Struct esp_idf_svc::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) -> PdmTxSlotConfig
pub fn from_slot_mode(slot_mode: SlotMode) -> PdmTxSlotConfig
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) -> PdmTxSlotConfig
pub fn slot_mode(self, slot_mode: SlotMode) -> PdmTxSlotConfig
Sets the slot mode on this PDM transmit slot configuration.
sourcepub fn sd_prescale(self, sd_prescale: u32) -> PdmTxSlotConfig
pub fn sd_prescale(self, sd_prescale: u32) -> PdmTxSlotConfig
Sets the sigma-delta filter prescale on this PDM transmit slot configuration.
sourcepub fn sd_scale(self, sd_scale: PdmSignalScale) -> PdmTxSlotConfig
pub fn sd_scale(self, sd_scale: PdmSignalScale) -> PdmTxSlotConfig
Sets the sigma-delta filter scaling on this PDM transmit slot configuration.
sourcepub fn hp_scale(self, hp_scale: PdmSignalScale) -> PdmTxSlotConfig
pub fn hp_scale(self, hp_scale: PdmSignalScale) -> PdmTxSlotConfig
Sets the high-pass filter scaling on this PDM transmit slot configuration.
sourcepub fn lp_scale(self, lp_scale: PdmSignalScale) -> PdmTxSlotConfig
pub fn lp_scale(self, lp_scale: PdmSignalScale) -> PdmTxSlotConfig
Sets the low-pass filter scaling on this PDM transmit slot configuration.
sourcepub fn sinc_scale(self, sinc_scale: PdmSignalScale) -> PdmTxSlotConfig
pub fn sinc_scale(self, sinc_scale: PdmSignalScale) -> PdmTxSlotConfig
Sets the sinc filter scaling on this PDM transmit slot configuration.
sourcepub fn line_mode(self, line_mode: PdmTxLineMode) -> PdmTxSlotConfig
pub fn line_mode(self, line_mode: PdmTxLineMode) -> PdmTxSlotConfig
Sets the PDM transmit line mode on this PDM transmit slot configuration.
sourcepub fn hp_enable(self, hp_enable: bool) -> PdmTxSlotConfig
pub fn hp_enable(self, hp_enable: bool) -> PdmTxSlotConfig
Sets the high-pass filter enable on this PDM transmit slot configuration.
sourcepub fn hp_cutoff_freq(self, hp_cutoff_freq: f32) -> PdmTxSlotConfig
pub fn hp_cutoff_freq(self, hp_cutoff_freq: f32) -> PdmTxSlotConfig
Sets the high-pass filter cutoff frequency on this PDM transmit slot configuration.
sourcepub fn sd_dither(self, sd_dither: u32, sd_dither2: u32) -> PdmTxSlotConfig
pub fn sd_dither(self, sd_dither: u32, sd_dither2: u32) -> PdmTxSlotConfig
Sets the sigma-delta filter dither 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§fn default() -> PdmTxSlotConfig
fn default() -> 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 ==
.impl Copy for PdmTxSlotConfig
impl Eq for PdmTxSlotConfig
impl StructuralPartialEq for PdmTxSlotConfig
Auto Trait Implementations§
impl Freeze for PdmTxSlotConfig
impl RefUnwindSafe for PdmTxSlotConfig
impl Send for PdmTxSlotConfig
impl Sync for PdmTxSlotConfig
impl Unpin for PdmTxSlotConfig
impl UnwindSafe for PdmTxSlotConfig
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)