Skip to main content

I2s

Struct I2s 

Source
#[non_exhaustive]
pub struct I2s<'d, Dm>
where Dm: DriverMode,
{ pub i2s_rx: RxCreator<'d, Dm>, pub i2s_tx: TxCreator<'d, Dm>, }
Expand description

Instance of the I2S peripheral driver.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§i2s_rx: RxCreator<'d, Dm>

Handles the reception (RX) side of the I2S peripheral.

§i2s_tx: TxCreator<'d, Dm>

Handles the transmission (TX) side of the I2S peripheral.

Implementations§

Source§

impl<'d> I2s<'d, Blocking>

Source

pub fn new<I: Instance + 'd>( i2s: I, channel: impl I2sMasterDmaChannel<'d, I>, config: TdmConfig, ) -> Result<Self, ConfigError>

Creates a new I2S instance in TDM mode.

Source

pub fn new_pdm<I: Instance + PdmInstance + 'd>( i2s: I, channel: impl I2sMasterDmaChannel<'d, I>, config: PdmConfig, ) -> Result<Self, ConfigError>

Creates a new I2S instance in PDM mode.

Source§

impl<Dm> I2s<'_, Dm>
where Dm: DriverMode,

Source

pub fn set_interrupt_handler(&mut self, handler: InterruptHandler)

Available on crate feature unstable only.

Registers an interrupt handler for the peripheral.

Replaces any previously registered interrupt handlers.

The default/unhandled interrupt handler can be restored with crate::interrupt::DEFAULT_INTERRUPT_HANDLER

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source

pub fn listen(&mut self, interrupts: impl Into<EnumSet<I2sInterrupt>>)

Available on crate feature unstable only.

Listens for the given interrupts.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source

pub fn unlisten(&mut self, interrupts: impl Into<EnumSet<I2sInterrupt>>)

Available on crate feature unstable only.

Unlistens from the given interrupts.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source

pub fn interrupts(&mut self) -> EnumSet<I2sInterrupt>

Available on crate feature unstable only.

Returns the asserted interrupts.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source

pub fn clear_interrupts(&mut self, interrupts: impl Into<EnumSet<I2sInterrupt>>)

Available on crate feature unstable only.

Resets asserted interrupts.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source§

impl<'d> I2s<'d, Blocking>

Source

pub fn into_async(self) -> I2s<'d, Async>

Converts the I2S instance into async mode.

Source§

impl<'d, Dm> I2s<'d, Dm>
where Dm: DriverMode,

Source

pub fn with_mclk(self, mclk: impl PeripheralOutput<'d>) -> Self

Configures the I2S peripheral to use a master clock (MCLK) output pin.

Trait Implementations§

Source§

impl<Dm> InterruptConfigurable for I2s<'_, Dm>
where Dm: DriverMode,

Available on crate feature unstable only.
Source§

fn set_interrupt_handler(&mut self, handler: InterruptHandler)

Registers an interrupt handler for the peripheral. Read more

Auto Trait Implementations§

§

impl<'d, Dm> !RefUnwindSafe for I2s<'d, Dm>

§

impl<'d, Dm> !UnwindSafe for I2s<'d, Dm>

§

impl<'d, Dm> Freeze for I2s<'d, Dm>
where RxCreator<'d, Dm>: Freeze, TxCreator<'d, Dm>: Freeze,

§

impl<'d, Dm> Send for I2s<'d, Dm>
where RxCreator<'d, Dm>: Send, TxCreator<'d, Dm>: Send,

§

impl<'d, Dm> Sync for I2s<'d, Dm>
where RxCreator<'d, Dm>: Sync, TxCreator<'d, Dm>: Sync,

§

impl<'d, Dm> Unpin for I2s<'d, Dm>
where RxCreator<'d, Dm>: Unpin, TxCreator<'d, Dm>: Unpin,

§

impl<'d, Dm> UnsafeUnpin for I2s<'d, Dm>
where RxCreator<'d, Dm>: UnsafeUnpin, TxCreator<'d, Dm>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.