Struct esp_idf_hal::i2s::config::PdmRxSlotConfig
source · pub struct PdmRxSlotConfig { /* private fields */ }
Expand description
PDM mode channel receive slot configuration.
§Note
The slot_mode
and slot_mask
cause data to be interpreted in different ways, as noted below.
WS is the “word select” signal, sometimes called LRCLK (left/right clock).
Assuming the received data contains the following samples (when converted from PDM to PCM), where a sample may be 8, 16, 24, or 32 bits, depending on data_bit_width
:
WS Low | WS High | WS Low | WS High | WS Low | WS High | WS Low | WS High | |
---|---|---|---|---|---|---|---|---|
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | … |
The actual data in the buffer will be (1-4 bytes, depending on data_bit_width
):
slot_mode | slot_mask | Buffer Contents | |||||||
---|---|---|---|---|---|---|---|---|---|
d[0] | d[1] | d[2] | d[3] | d[4] | d[5] | d[6] | d[7] | ||
Mono | Left | 11 | 13 | 15 | 17 | 19 | 21 | 23 | 25 |
Right | 12 | 14 | 16 | 18 | 20 | 22 | 24 | 26 | |
Both | Unspecified behavior | ||||||||
Stereo (ESP32) | Any | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
Stereo (ESP32-S3) | Any | 12 | 11 | 14 | 13 | 16 | 15 | 18 | 17 |
Note that, on the ESP32-S3, the right channel is received first. This can be switched by setting
PdmRxGpioConfig::clk_invert
to true
in the merged PdmRxConfig
.
For details, refer to the ESP-IDF Programming Guide PDM Rx Usage details for your specific microcontroller:
Other microcontrollers do not support PDM receive mode, or do not have a PDM-to-PCM peripheral that allows for decoding the PDM data as required by ESP-IDF.
Implementations§
source§impl PdmRxSlotConfig
impl PdmRxSlotConfig
sourcepub fn from_bits_per_sample_and_slot_mode(
bits_per_sample: DataBitWidth,
slot_mode: SlotMode,
) -> Self
pub fn from_bits_per_sample_and_slot_mode( bits_per_sample: DataBitWidth, slot_mode: SlotMode, ) -> Self
Configure the PDM mode channel receive slot configuration for the specified bits per sample and slot mode in 2 slots.
sourcepub fn data_bit_width(self, data_bit_width: DataBitWidth) -> Self
pub fn data_bit_width(self, data_bit_width: DataBitWidth) -> Self
Update the data bit width on this PDM receive slot configuration.
sourcepub fn slot_bit_width(self, slot_bit_width: SlotBitWidth) -> Self
pub fn slot_bit_width(self, slot_bit_width: SlotBitWidth) -> Self
Update the slot bit width on this PDM receive slot configuration.
sourcepub fn slot_mode_mask(self, slot_mode: SlotMode, slot_mask: PdmSlotMask) -> Self
pub fn slot_mode_mask(self, slot_mode: SlotMode, slot_mask: PdmSlotMask) -> Self
Update the slot mode and mask on this PDM receive slot configuration.
Trait Implementations§
source§impl Clone for PdmRxSlotConfig
impl Clone for PdmRxSlotConfig
source§fn clone(&self) -> PdmRxSlotConfig
fn clone(&self) -> PdmRxSlotConfig
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for PdmRxSlotConfig
impl Debug for PdmRxSlotConfig
source§impl PartialEq for PdmRxSlotConfig
impl PartialEq for PdmRxSlotConfig
source§fn eq(&self, other: &PdmRxSlotConfig) -> bool
fn eq(&self, other: &PdmRxSlotConfig) -> bool
self
and other
values to be equal, and is used
by ==
.impl Copy for PdmRxSlotConfig
impl Eq for PdmRxSlotConfig
impl StructuralPartialEq for PdmRxSlotConfig
Auto Trait Implementations§
impl Freeze for PdmRxSlotConfig
impl RefUnwindSafe for PdmRxSlotConfig
impl Send for PdmRxSlotConfig
impl Sync for PdmRxSlotConfig
impl Unpin for PdmRxSlotConfig
impl UnwindSafe for PdmRxSlotConfig
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
)