TB2026-YDS Firmware
Loading...
Searching...
No Matches
adc.h
Go to the documentation of this file.
1
9#pragma once
10
11#include <stdint.h>
12#include "esp_err.h"
13#include "esp_adc/adc_oneshot.h"
14
21
28esp_err_t adc_pot_init(adc_oneshot_unit_handle_t *out_handle);
29
37esp_err_t adc_pot_read(adc_oneshot_unit_handle_t handle, int *out_mv);
38
47uint8_t adc_pot_to_volume(int mv);
48
59uint8_t adc_pot_to_avrcp_volume(int mv);
60
71uint8_t adc_frac_to_volume(float frac);
72
78uint8_t adc_frac_to_avrcp_volume(float frac);
79
uint8_t adc_frac_to_volume(float frac)
Map a 0..1 volume fraction directly to a PCM5242 register byte, bypassing the pot.
Definition adc.c:113
esp_err_t adc_pot_read(adc_oneshot_unit_handle_t handle, int *out_mv)
Read the averaged, calibrated wiper voltage.
Definition adc.c:66
uint8_t adc_pot_to_avrcp_volume(int mv)
Map a wiper voltage to an AVRCP absolute-volume value (0..0x7F) for a Bluetooth sink.
Definition adc.c:92
uint8_t adc_pot_to_volume(int mv)
Map a wiper voltage to a PCM5242 digital-volume register byte.
Definition adc.c:78
uint8_t adc_frac_to_avrcp_volume(float frac)
Map a 0..1 volume fraction directly to an AVRCP absolute-volume value, bypassing the pot.
Definition adc.c:118
esp_err_t adc_pot_init(adc_oneshot_unit_handle_t *out_handle)
Bring up ADC1 for the volume potentiometer (GPIO36) with line-fitting calibration.
Definition adc.c:42