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

PCM5242 DAC control over I2C (volume, mute). More...

#include "esp_err.h"
#include "driver/i2c_master.h"

Go to the source code of this file.

Functions

esp_err_t audio_dac_init (i2c_master_bus_handle_t bus)
 Attach the PCM5242 to the shared I2C bus and select independent L/R volume.
esp_err_t audio_dac_set_sample_rate (uint32_t rate_hz)
 Retune the PLL and clock dividers for a new sample rate.
esp_err_t audio_dac_set_volume (uint8_t left, uint8_t right)
 Set the left and right digital volumes independently (see audio_dac_init()).
esp_err_t audio_dac_get_volume (uint8_t *level)
 Read the left-channel digital volume byte back, for verification.
esp_err_t audio_dac_mute (bool mute)
 Soft-mute or un-mute both channels (ramped, pop-free).
esp_err_t audio_dac_standby (bool standby)
 Request or release software standby (DAC and line driver powered down).
esp_err_t audio_dac_get_clock_status (uint8_t *status)
 Read the clock/PLL status register (0x5E) for bring-up diagnostics.
bool audio_dac_ready (void)
 Whether the DAC's I2C device is registered (audio_dac_init() has run).

Detailed Description

PCM5242 DAC control over I2C (volume, mute).

SCK is grounded on this board, so the DAC cannot auto-clock; this driver programs the PLL and clock dividers off BCK by hand (see audio_dac_set_sample_rate()). It otherwise only handles the I2C control port at address 0x4C. Mute also depends on the XSMT pin on the GPIO expander, which this driver does not touch.

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.