|
TB2026-YDS Firmware
|
#include "adc.h"#include "board_pins.h"#include "esp_adc/adc_cali.h"#include "esp_adc/adc_cali_scheme.h"#include <math.h>Macros | |
| #define | POT_MV_MIN (147) |
| #define | POT_MV_MAX (2518) |
| #define | POT_INVERTED (0) |
| #define | POT_SAMPLES (16) |
| #define | POT_ATTEN ADC_ATTEN_DB_12 |
| #define | POT_BITWIDTH ADC_BITWIDTH_DEFAULT |
| #define | DAC_REG0_DB (24.0f) |
| #define | DAC_DB_PER_STEP (0.5f) |
| #define | DAC_MAX_DB (0.0f) |
| #define | POT_FLOOR_DB (-60.0f) |
Functions | |
| 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. | |
| esp_err_t | adc_pot_read (adc_oneshot_unit_handle_t handle, int *out_mv) |
| Read the averaged, calibrated wiper voltage. | |
| uint8_t | adc_pot_to_volume (int mv) |
| Map a wiper voltage to a PCM5242 digital-volume register byte. | |
| 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. | |
| uint8_t | adc_frac_to_volume (float frac) |
| Map a 0..1 volume fraction directly to a PCM5242 register byte, bypassing the pot. | |
| 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. | |
| #define DAC_DB_PER_STEP (0.5f) |
| #define DAC_MAX_DB (0.0f) |
| #define DAC_REG0_DB (24.0f) |
| #define POT_ATTEN ADC_ATTEN_DB_12 |
| #define POT_BITWIDTH ADC_BITWIDTH_DEFAULT |
| #define POT_FLOOR_DB (-60.0f) |
| #define POT_INVERTED (0) |
| #define POT_MV_MAX (2518) |
| #define POT_MV_MIN (147) |
| #define POT_SAMPLES (16) |