Struct esp_idf_hal::i2s::config::StdSlotConfig

source ·
pub struct StdSlotConfig { /* private fields */ }
Expand description

Standard mode channel slot configuration.

To create a slot configuration, use StdSlotConfig::philips_slot_default, StdSlotConfig::pcm_slot_default, or StdSlotConfig::msb_slot_default, then customize it as needed.

§Note

The slot_mode and slot_mask cause the data to be interpreted in different ways, as noted below. WS is the “word select” signal, sometimes called LRCLK (left/right clock).

§Transmit

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:

slot_modeslot_maskTransmitted Data
WS LowWS HighWS LowWS HighWS LowWS HighWS LowWS High
MonoLeft 110120130140
Right011012013014
Both 1111121213131414
StereoLeft 110130150170
Right012014016018
Both 1112131415161718

§Receive

Assuming the received data contains the following samples (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
StereoAny 1112131415161718

For details, refer to the ESP-IDF Programming Guide details for your specific microcontroller:

Implementations§

source§

impl StdSlotConfig

source

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

Update the data bit width on this standard slot configuration.

source

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

Update the slot bit width on this standard slot configuration.

source

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

Update the slot mode and mask on this standard slot configuration.

source

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

Update the word select signal width on this standard slot configuration.

source

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

Update the word select signal polarity on this standard slot configuration.

source

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

Update the bit shift flag on this standard slot configuration.

source

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

Update the left-alignment flag on this standard slot configuration.

source

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

Update the big-endian flag on this standard slot configuration.

source

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

Update the LSB-first flag on this standard slot configuration.

source

pub fn philips_slot_default( bits_per_sample: DataBitWidth, slot_mode: SlotMode, ) -> Self

Configure in Philips format in 2 slots.

source

pub fn pcm_slot_default( bits_per_sample: DataBitWidth, slot_mode: SlotMode, ) -> Self

Configure in PCM (short) format in 2 slots.

source

pub fn msb_slot_default( bits_per_sample: DataBitWidth, slot_mode: SlotMode, ) -> Self

Configure in MSB format in 2 slots.

Trait Implementations§

source§

impl Clone for StdSlotConfig

source§

fn clone(&self) -> StdSlotConfig

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 StdSlotConfig

source§

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

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

impl PartialEq for StdSlotConfig

source§

fn eq(&self, other: &StdSlotConfig) -> 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 StdSlotConfig

source§

impl Eq for StdSlotConfig

source§

impl StructuralPartialEq for StdSlotConfig

Auto Trait Implementations§

§

impl Freeze for StdSlotConfig

§

impl RefUnwindSafe for StdSlotConfig

§

impl Send for StdSlotConfig

§

impl Sync for StdSlotConfig

§

impl Unpin for StdSlotConfig

§

impl UnwindSafe for StdSlotConfig

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,

§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T> CloneToUninit for T
where T: Copy,

§

unsafe fn clone_to_uninit(&self, dst: *mut T)

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