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>, }
Available on crate feature unstable only.
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<Dm> I2s<'_, Dm>
where Dm: DriverMode,

Source

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

Registers an interrupt handler for the peripheral.

Note that this will replace any previously registered interrupt handlers.

You can restore the default/unhandled interrupt handler by using 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>>)

Listen 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>>)

Unlisten 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>

Gets 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>>)

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 new<CH>( i2s: impl Peripheral<P = impl RegisterAccess> + 'd, standard: Standard, data_format: DataFormat, sample_rate: Rate, channel: impl Peripheral<P = CH> + 'd, rx_descriptors: &'static mut [DmaDescriptor], tx_descriptors: &'static mut [DmaDescriptor], ) -> Self
where CH: DmaChannelFor<AnyI2s>,

Construct a new I2S peripheral driver instance for the first I2S peripheral

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<P: PeripheralOutput>( self, pin: impl Peripheral<P = P> + '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,

Source§

fn set_interrupt_handler(&mut self, handler: InterruptHandler)

Registers an interrupt handler for the peripheral. Read more

Auto Trait Implementations§

§

impl<'d, Dm> Freeze for I2s<'d, Dm>

§

impl<'d, Dm> RefUnwindSafe for I2s<'d, Dm>
where Dm: RefUnwindSafe,

§

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

§

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

§

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

§

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

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, 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.