Expand description
§Everest Semiconductor ES8311 audio codec driver
A platform-agnostic driver to configure the Everest Semiconductor ES8311 mono audio codec over I²C.
This driver was built using embedded-hal 1.0 and es8311-registers. Enable the
async feature for an equivalent driver on embedded-hal-async in the asynch module.
The driver only configures the codec. Audio data flows over I²S, which the host drives:
the codec runs in slave mode, with MCLK, SCLK and LRCK supplied by the host.
§Safe defaults
After Es8311::init, the DAC is muted at minimum volume and all analog blocks are
powered down. Nothing reaches the output until Es8311::dac_power_up and
set_mute(false). Boards with an always-on speaker amplifier play sound as soon as
the DAC is unmuted.
§Volume limit
Es8311::set_volume never writes a value above Es8311::max_volume. The limit
defaults to the chip’s full scale, DAC_VOLUME_MAX (+32 dB). Lower it with
Es8311::set_max_volume when an amplifier after the codec adds gain, so the speaker
or the amplifier cannot be overdriven. On the Kode Dot, with an NS4150B class-D
amplifier, the limit is 0xA9 (-11 dB).
The raw register access (Es8311::write_register) bypasses the limit.
Re-exports§
pub use es8311_registers as registers;
Modules§
- asynch
async - Async driver on
embedded-hal-async.
Structs§
Enums§
- Error
- A driver error.
- Serial
Format - The serial audio data format, as set in
SdpInandSdpOut. - Word
Length - The serial audio data word length, as set in
SdpInandSdpOut.
Constants§
- ALTERNATE_
DEVICE_ ADDRESS - The 7-bit I²C address with the
CEpin high. - DAC_
VOLUME_ 0DB - The
DacVolumevalue for 0 dB. Each step is 0.5 dB. - DAC_
VOLUME_ MAX - The highest
DacVolumevalue: +32 dB. - DEFAULT_
DEVICE_ ADDRESS - The 7-bit I²C address with the
CEpin low. - ES8311_
CHIP_ ID - The ID read from
ChipId1andChipId2(0xFD,0xFE) of an ES8311. - RESET_
DELAY_ MS - How long
Es8311::initholds the digital blocks in reset, in milliseconds.