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

Wired output path control: PCM5242 analog mute (XSMT) and MAX97220 amp shutdown. More...

#include "esp_err.h"
#include <stdbool.h>
#include "audio_sink.h"

Go to the source code of this file.

Functions

esp_err_t sink_i2s_dac_init (void)
 Bring up the wired path's I2S bus; the sink owns the channel handle.
const audio_sink_tsink_i2s_dac_get (void)
 Get the wired-DAC sink (I2S → PCM5242 → MAX97220 → jack).
esp_err_t sink_i2s_dac_output_enable (bool enable)
 Enable or mute the DAC analog output via the PCM5242 XSMT pin.
esp_err_t sink_i2s_dac_amp_enable (bool enable)
 Enable or shut down the MAX97220 headphone amplifier via its SHDN pin.

Detailed Description

Wired output path control: PCM5242 analog mute (XSMT) and MAX97220 amp shutdown.

Both lines are GPIO-expander pins, not chip data interfaces, so this routing lives in the audio service rather than in the drivers: the DAC driver stays I2C-only and the amp has no driver of its own. Power sequencing between the two is this service's concern.

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.

Function Documentation

◆ sink_i2s_dac_amp_enable()

esp_err_t sink_i2s_dac_amp_enable ( bool enable)

Enable or shut down the MAX97220 headphone amplifier via its SHDN pin.

SHDN is expander IO1, active-low. Requires gpio_expander_init() to have run first.

Parameters
enabletrue = drive SHDN high (amp on), false = SHDN low (shutdown).
Returns
ESP_OK on success, or the expander I2C error.

◆ sink_i2s_dac_get()

const audio_sink_t * sink_i2s_dac_get ( void )

Get the wired-DAC sink (I2S → PCM5242 → MAX97220 → jack).

Returns
Pointer to the static sink vtable (never NULL). Requires sink_i2s_dac_init().

◆ sink_i2s_dac_init()

esp_err_t sink_i2s_dac_init ( void )

Bring up the wired path's I2S bus; the sink owns the channel handle.

Mounts I2S0 (BCK/WS/DOUT, no MCLK) and keeps the TX handle inside the sink, so upper layers never touch it. Call once at startup. The PCM5242 I2C control port and the expander mute/amp lines are initialised by their own drivers (audio_dac_init, gpio_expander_init), not here.

Returns
ESP_OK on success, or the I2S driver error.

◆ sink_i2s_dac_output_enable()

esp_err_t sink_i2s_dac_output_enable ( bool enable)

Enable or mute the DAC analog output via the PCM5242 XSMT pin.

XSMT is expander IO0, active-low. Requires gpio_expander_init() to have run first.

Parameters
enabletrue = drive XSMT high (output on), false = XSMT low (muted).
Returns
ESP_OK on success, or the expander I2C error.