pub struct I2sCore<I, PART, MS, DIR, STD> { /* private fields */ }
Expand description

Main or extension part of a DualI2sDriver.

  • I: The DualI2sPeripheral controlled by the I2sCore.
  • PART: Main or Ext. The part of DualI2sPeripheral controlled by I2sCore.
  • MS: Master or Slave. The role of the I2sCore. Only a Main I2sCore can be Master.
  • DIR : Transmit or Receive. Communication direction.
  • STD: I2S standard, eg Philips

Implementations§

source§

impl<I: DualI2sPeripheral, PART, MS, DIR, STD> I2sCore<I, PART, MS, DIR, STD>
where Self: I2sCoreRegisters,

Methods available for any mode

source

pub fn enable(&mut self)

Enable the I2S peripheral.

source

pub fn disable(&mut self)

Immediately Disable the I2S peripheral.

Generated clocks aren’t reset, so a call to reset_clocks may required in master mode.

It’s up to the caller to not disable the peripheral in the middle of a frame.

source

pub fn data_register_address(&self) -> u32

Get address of the data register for DMA setup.

source

pub fn status(&mut self) -> Status<MS, DIR, STD>

Get the content of the status register. This operation may change the register content.

When reading the status register, the hardware may reset some error flags. The way each flag can be modified is documented on each Status flag getter.

source§

impl<I, PART, MS, STD> I2sCore<I, PART, MS, Transmit, STD>
where I: DualI2sPeripheral, Self: I2sCoreRegisters,

Transmit-only methods

source

pub fn write_data_register(&mut self, value: u16)

Write a raw half word to the Tx buffer and delete the TXE flag in status register.

It’s up to the caller to write the content when the buffer is empty.

source

pub fn set_tx_interrupt(&mut self, enabled: bool)

When set to true, an interrupt is generated each time the Tx buffer is empty.

source

pub fn set_tx_dma(&mut self, enabled: bool)

When set to true, a DMA request is generated each time the Tx buffer is empty.

source§

impl<I, PART, MS, STD> I2sCore<I, PART, MS, Receive, STD>
where I: DualI2sPeripheral, Self: I2sCoreRegisters,

Receive-only methods

source

pub fn read_data_register(&mut self) -> u16

Read a raw value from the Rx buffer and clear the RXNE flag in status register.

source

pub fn set_rx_interrupt(&mut self, enabled: bool)

When set to true, an interrupt is generated each time the Rx buffer contains a new data.

source

pub fn set_rx_dma(&mut self, enabled: bool)

When set to true, a DMA request is generated each time the Rx buffer contains a new data.

source§

impl<I, STD> I2sCore<I, Main, Master, Receive, STD>
where I: DualI2sPeripheral, Self: I2sCoreRegisters,

Error interrupt, Master Receive Mode.

source

pub fn set_error_interrupt(&mut self, enabled: bool)

When set to true, an interrupt is generated each time an error occurs.

This is not available for Master Transmit because no error can occur in this mode.

source§

impl<I, PART, DIR, STD> I2sCore<I, PART, Slave, DIR, STD>
where I: DualI2sPeripheral, Self: I2sCoreRegisters,

Error interrupt, Slave Mode.

source

pub fn set_error_interrupt(&mut self, enabled: bool)

When set to true, an interrupt is generated each time an error occurs.

This is not available for Master Transmit because no error can occur in this mode.

Auto Trait Implementations§

§

impl<I, PART, MS, DIR, STD> Freeze for I2sCore<I, PART, MS, DIR, STD>

§

impl<I, PART, MS, DIR, STD> RefUnwindSafe for I2sCore<I, PART, MS, DIR, STD>

§

impl<I, PART, MS, DIR, STD> Send for I2sCore<I, PART, MS, DIR, STD>
where DIR: Send, I: Send, MS: Send, PART: Send, STD: Send,

§

impl<I, PART, MS, DIR, STD> Sync for I2sCore<I, PART, MS, DIR, STD>
where DIR: Sync, I: Sync, MS: Sync, PART: Sync, STD: Sync,

§

impl<I, PART, MS, DIR, STD> Unpin for I2sCore<I, PART, MS, DIR, STD>
where DIR: Unpin, I: Unpin, MS: Unpin, PART: Unpin, STD: Unpin,

§

impl<I, PART, MS, DIR, STD> UnwindSafe for I2sCore<I, PART, MS, DIR, STD>
where DIR: UnwindSafe, I: UnwindSafe, MS: UnwindSafe, PART: UnwindSafe, STD: UnwindSafe,

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, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

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

Performs the conversion.
source§

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.
source§

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

Performs the conversion.