Struct DualI2s

Source
pub struct DualI2s<I: DualInstance> { /* private fields */ }
Expand description

A wrapper around a SPI and a I2SEXT object and pins for full duplex I2S operation

Implementations§

Source§

impl<SPI: DualInstance> DualI2s<SPI>

Source

pub fn new( spi: SPI, i2s_ext: SPI::I2sExtPeripheral, pins: (impl Into<SPI::Ws>, impl Into<SPI::Ck>, impl Into<SPI::Mck>, impl Into<SPI::Sd>, impl Into<SPI::ExtSd>), clocks: &Clocks, ) -> Self

Creates an DualI2s object around a SPI peripheral, it’s I2SEXT extension, and pins

This function enables and resets the SPI and I2SEXT peripheral, but does not configure it.

The returned DualI2s object implements stm32_i2s_v12x::DualI2sPeripheral, so it can be used to configure the peripheral and communicate.

§Panics

This function panics if the I2S clock input (from the I2S PLL or similar) is not configured.

Source

pub fn release( self, ) -> (SPI, SPI::I2sExtPeripheral, (SPI::Ws, SPI::Ck, SPI::Mck, SPI::Sd, SPI::ExtSd))

Source§

impl<SPI: DualInstance> DualI2s<SPI>

Source

pub fn ws_pin(&self) -> &SPI::Ws

Source

pub fn ws_pin_mut(&mut self) -> &mut SPI::Ws

Source§

impl<I: DualInstance> DualI2s<I>

Source

pub fn input_clock(&self) -> Hertz

Returns the frequency of the clock signal that the SPI peripheral is receiving from the I2S PLL or similar source

Trait Implementations§

Source§

impl DualI2sPeripheral for DualI2s<SPI2>
where SPI2: Reset,

Source§

const MAIN_REGISTERS: *const () = {0x40003800 as *const ()}

Pointer to the SPI register block
Source§

const EXT_REGISTERS: *const () = {0x40003400 as *const ()}

Pointer to the I2SEXT register block
Source§

type WsPin = Ws

Source§

fn i2s_freq(&self) -> u32

Get I2s clock source frequency from the I2s device. Read more
Source§

fn ws_pin(&self) -> &Self::WsPin

Get a reference to WS pin.
Source§

fn ws_pin_mut(&mut self) -> &mut Self::WsPin

Get mutable reference to WS pin;
Source§

fn rcc_reset(&mut self)

Reset the peripheral through the rcc register. This must be implemented with atomic operation through write to bit band region.
Source§

impl DualI2sPeripheral for DualI2s<SPI3>
where SPI3: Reset,

Source§

const MAIN_REGISTERS: *const () = {0x40003c00 as *const ()}

Pointer to the SPI register block
Source§

const EXT_REGISTERS: *const () = {0x40004000 as *const ()}

Pointer to the I2SEXT register block
Source§

type WsPin = Ws

Source§

fn i2s_freq(&self) -> u32

Get I2s clock source frequency from the I2s device. Read more
Source§

fn ws_pin(&self) -> &Self::WsPin

Get a reference to WS pin.
Source§

fn ws_pin_mut(&mut self) -> &mut Self::WsPin

Get mutable reference to WS pin;
Source§

fn rcc_reset(&mut self)

Reset the peripheral through the rcc register. This must be implemented with atomic operation through write to bit band region.

Auto Trait Implementations§

§

impl<I> Freeze for DualI2s<I>
where I: Freeze, <I as DualInstance>::I2sExtPeripheral: Freeze, <I as I2sCommon>::Ws: Freeze, <I as I2sCommon>::Ck: Freeze, <I as I2sMaster>::Mck: Freeze, <I as I2sCommon>::Sd: Freeze, <I as I2sExtPin>::ExtSd: Freeze,

§

impl<I> RefUnwindSafe for DualI2s<I>

§

impl<I> Send for DualI2s<I>
where I: Send, <I as DualInstance>::I2sExtPeripheral: Send, <I as I2sCommon>::Ws: Send, <I as I2sCommon>::Ck: Send, <I as I2sMaster>::Mck: Send, <I as I2sCommon>::Sd: Send, <I as I2sExtPin>::ExtSd: Send,

§

impl<I> Sync for DualI2s<I>
where I: Sync, <I as DualInstance>::I2sExtPeripheral: Sync, <I as I2sCommon>::Ws: Sync, <I as I2sCommon>::Ck: Sync, <I as I2sMaster>::Mck: Sync, <I as I2sCommon>::Sd: Sync, <I as I2sExtPin>::ExtSd: Sync,

§

impl<I> Unpin for DualI2s<I>
where I: Unpin, <I as DualInstance>::I2sExtPeripheral: Unpin, <I as I2sCommon>::Ws: Unpin, <I as I2sCommon>::Ck: Unpin, <I as I2sMaster>::Mck: Unpin, <I as I2sCommon>::Sd: Unpin, <I as I2sExtPin>::ExtSd: Unpin,

§

impl<I> UnwindSafe for DualI2s<I>

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

Source§

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

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.