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 LowWS HighWS LowWS HighWS LowWS HighWS LowWS High
1112131415161718

The actual data in the buffer will be (1-4 bytes, depending on data_bit_width):

slot_modeslot_maskBuffer Contents
d[0]d[1]d[2]d[3]d[4]d[5]d[6]d[7]
Mono Left 1113151719212325
Right1214161820222426
Both Unspecified behavior
Stereo (ESP32) Any 1112131415161718
Stereo (ESP32-S3)Any 1211141316151817

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

source

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.

source

pub fn data_bit_width(self, data_bit_width: DataBitWidth) -> Self

Update the data bit width on this PDM receive slot configuration.

source

pub fn slot_bit_width(self, slot_bit_width: SlotBitWidth) -> Self

Update the slot bit width on this PDM receive slot configuration.

source

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

source§

fn clone(&self) -> PdmRxSlotConfig

Returns a copy of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for PdmRxSlotConfig

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for PdmRxSlotConfig

source§

fn eq(&self, other: &PdmRxSlotConfig) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for PdmRxSlotConfig

source§

impl Eq for PdmRxSlotConfig

source§

impl StructuralPartialEq for PdmRxSlotConfig

Auto Trait Implementations§

§

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 T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.