TB2026-YDS Firmware
Loading...
Searching...
No Matches
adc.h File Reference

Volume potentiometer: ADC1 sampling and mapping to PCM5242 digital volume. More...

#include <stdint.h>
#include "esp_err.h"
#include "esp_adc/adc_oneshot.h"

Go to the source code of this file.

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.

Detailed Description

Volume potentiometer: ADC1 sampling and mapping to PCM5242 digital volume.

Note
Développé avec l'assistance de Claude Opus 4.8 (Anthropic), sous la direction de Y. Dos Santos : spécification, revue et validation sur cible par l'auteur.