Struct esp_idf_hal::i2s::config::PdmTxSlotConfig
source · pub struct PdmTxSlotConfig { /* private fields */ }
Expand description
PDM mode channel transmit slot configuration.
§Note
The slot_mode
and line_mode
(microcontrollers new than ESP32) or slot_mask
(ESP32) cause data to be
interpreted in different ways, as noted below.
Assuming the buffered data contains the following samples (where a sample may be 1, 2, 3, or 4 bytes, depending
on data_bit_width
):
d[0] | d[1] | d[2] | d[3] | d[4] | d[5] | d[6] | d[7] |
---|---|---|---|---|---|---|---|
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
The actual data on the line will be:
§All microcontrollers except ESP32
line_mode | slot_mode | Line | Transmitted Data | |||||||
---|---|---|---|---|---|---|---|---|---|---|
WS Low | WS High | WS Low | WS High | WS Low | WS High | WS Low | WS High | |||
OneLineCodec | Mono | dout | 11 | 0 | 12 | 0 | 13 | 0 | 14 | 0 |
Stereo | dout | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | |
OneLineDac | Mono | dout | 11 | 11 | 12 | 12 | 13 | 13 | 14 | 14 |
TwoLineDac | Mono | dout | 12 | 12 | 14 | 14 | 16 | 16 | 18 | 18 |
dout2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ||
Stereo | dout | 12 | 12 | 14 | 14 | 16 | 16 | 18 | 18 | |
dout2 | 11 | 11 | 13 | 13 | 15 | 15 | 17 | 17 |
§ESP32
slot_mode | slot_mask | Transmitted Data | |||||||
---|---|---|---|---|---|---|---|---|---|
WS Low | WS High | WS Low | WS High | WS Low | WS High | WS Low | WS High | ||
Mono | Left | 11 | 0 | 12 | 0 | 13 | 0 | 14 | 0 |
Right | 0 | 11 | 0 | 12 | 0 | 13 | 0 | 14 | |
Both | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | |
Mono | Left | 11 | 11 | 13 | 13 | 15 | 15 | 17 | 17 |
Right | 12 | 12 | 14 | 14 | 16 | 16 | 18 | 18 | |
Both | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
Modes combinations other than SlotMode::Mono
/PdmSlotMask::Both
,
SlotMode::Stereo
/PdmSlotMask::Left
, and SlotMode::Stereo
/PdmSlotMask::Right
are unlikely to be
useful since it requires precise demutiplexing on the bit stream based on the WS clock.
For details, refer to the ESP-IDF Programming Guide PDM Tx Usage details for your specific microcontroller:
Implementations§
source§impl PdmTxSlotConfig
impl PdmTxSlotConfig
sourcepub fn from_slot_mode(slot_mode: SlotMode) -> Self
pub fn from_slot_mode(slot_mode: SlotMode) -> Self
Configure the PDM mode channel transmit slot configuration for the specified slot mode in 2 slots.
This sets the sigma-delta, low-pass, and sinc scaling to None.
For hardware version 1, the high-pass filter scaling is set to None.
For hardware version 2, the high-pass filter is enabled, scaled to dividing by 2 and set to 35.5 Hz.
sourcepub fn slot_mode(self, slot_mode: SlotMode) -> Self
pub fn slot_mode(self, slot_mode: SlotMode) -> Self
Sets the slot mode on this PDM transmit slot configuration.
sourcepub fn sd_prescale(self, sd_prescale: u32) -> Self
pub fn sd_prescale(self, sd_prescale: u32) -> Self
Sets the sigma-delta filter prescale on this PDM transmit slot configuration.
sourcepub fn sd_scale(self, sd_scale: PdmSignalScale) -> Self
pub fn sd_scale(self, sd_scale: PdmSignalScale) -> Self
Sets the sigma-delta filter scaling on this PDM transmit slot configuration.
sourcepub fn hp_scale(self, hp_scale: PdmSignalScale) -> Self
pub fn hp_scale(self, hp_scale: PdmSignalScale) -> Self
Sets the high-pass filter scaling on this PDM transmit slot configuration.
sourcepub fn lp_scale(self, lp_scale: PdmSignalScale) -> Self
pub fn lp_scale(self, lp_scale: PdmSignalScale) -> Self
Sets the low-pass filter scaling on this PDM transmit slot configuration.
sourcepub fn sinc_scale(self, sinc_scale: PdmSignalScale) -> Self
pub fn sinc_scale(self, sinc_scale: PdmSignalScale) -> Self
Sets the sinc filter scaling on this PDM transmit slot configuration.
sourcepub fn line_mode(self, line_mode: PdmTxLineMode) -> Self
pub fn line_mode(self, line_mode: PdmTxLineMode) -> Self
Sets the PDM transmit line mode on this PDM transmit slot configuration.
sourcepub fn hp_enable(self, hp_enable: bool) -> Self
pub fn hp_enable(self, hp_enable: bool) -> Self
Sets the high-pass filter enable on this PDM transmit slot configuration.
sourcepub fn hp_cutoff_freq(self, hp_cutoff_freq: f32) -> Self
pub fn hp_cutoff_freq(self, hp_cutoff_freq: f32) -> Self
Sets the high-pass filter cutoff frequency on this PDM transmit slot configuration.
Trait Implementations§
source§impl Clone for PdmTxSlotConfig
impl Clone for PdmTxSlotConfig
source§fn clone(&self) -> PdmTxSlotConfig
fn clone(&self) -> PdmTxSlotConfig
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for PdmTxSlotConfig
impl Debug for PdmTxSlotConfig
source§impl Default for PdmTxSlotConfig
impl Default for PdmTxSlotConfig
source§impl PartialEq for PdmTxSlotConfig
impl PartialEq for PdmTxSlotConfig
source§fn eq(&self, other: &PdmTxSlotConfig) -> bool
fn eq(&self, other: &PdmTxSlotConfig) -> bool
self
and other
values to be equal, and is used
by ==
.