Skip to main content

PdmTxSlotConfig

Struct 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]
1112131415161718

The actual data on the line will be:

§All microcontrollers except ESP32

line_modeslot_modeLineTransmitted Data
WS LowWS HighWS LowWS HighWS LowWS HighWS LowWS High
OneLineCodecMono dout110120130140
Stereodout1112131415161718
OneLineDac Mono dout1111121213131414
TwoLineDac Monodout1212141416161818
dout200000000
Stereodout1212141416161818
dout21111131315151717

§ESP32

slot_modeslot_maskTransmitted Data
WS LowWS HighWS LowWS HighWS LowWS HighWS LowWS High
Mono Left 110120130140
Right011012013014
Both1112131415161718
Mono Left1111131315151717
Right1212141416161818
Both 1112131415161718

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

Source

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.

Source

pub fn slot_mode(self, slot_mode: SlotMode) -> Self

Sets the slot mode on this PDM transmit slot configuration.

Source

pub fn sd_prescale(self, sd_prescale: u32) -> Self

Sets the sigma-delta filter prescale on this PDM transmit slot configuration.

Source

pub fn sd_scale(self, sd_scale: PdmSignalScale) -> Self

Sets the sigma-delta filter scaling on this PDM transmit slot configuration.

Source

pub fn hp_scale(self, hp_scale: PdmSignalScale) -> Self

Sets the high-pass filter scaling on this PDM transmit slot configuration.

Source

pub fn lp_scale(self, lp_scale: PdmSignalScale) -> Self

Sets the low-pass filter scaling on this PDM transmit slot configuration.

Source

pub fn sinc_scale(self, sinc_scale: PdmSignalScale) -> Self

Sets the sinc filter scaling on this PDM transmit slot configuration.

Source

pub fn line_mode(self, line_mode: PdmTxLineMode) -> Self

Sets the PDM transmit line mode on this PDM transmit slot configuration.

Source

pub fn hp_enable(self, hp_enable: bool) -> Self

Sets the high-pass filter enable on this PDM transmit slot configuration.

Source

pub fn hp_cutoff_freq(self, hp_cutoff_freq: f32) -> Self

Sets the high-pass filter cutoff frequency on this PDM transmit slot configuration.

Source

pub fn sd_dither(self, sd_dither: u32, sd_dither2: u32) -> Self

Sets the sigma-delta filter dither on this PDM transmit slot configuration.

Trait Implementations§

Source§

impl Clone for PdmTxSlotConfig

Source§

fn clone(&self) -> PdmTxSlotConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable)§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for PdmTxSlotConfig

Source§

impl Debug for PdmTxSlotConfig

Source§

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

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

impl Default for PdmTxSlotConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for PdmTxSlotConfig

Source§

impl PartialEq for PdmTxSlotConfig

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable)§

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

Inequality operator !=. Read more
Source§

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 UnsafeUnpin for PdmTxSlotConfig

§

impl UnwindSafe for PdmTxSlotConfig

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> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.