Struct I2s

Source
pub struct I2s<I: Instance> { /* private fields */ }
Expand description

An I2s wrapper around an SPI object and pins

Implementations§

Source§

impl<SPI: Instance> I2s<SPI>

Source

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

Creates an I2s object around an SPI peripheral and pins

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

The returned I2s object implements stm32_i2s_v12x::I2sPeripheral, 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::Ws, SPI::Ck, SPI::Mck, SPI::Sd))

Source§

impl<SPI: Instance> I2s<SPI>

Source

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

Source

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

Source§

impl<I: Instance> I2s<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 I2sPeripheral for I2s<SPI2>
where SPI2: Reset,

Source§

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

Pointer to the SPI 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 operations through writes to the bit band region.
Source§

impl I2sPeripheral for I2s<SPI3>
where SPI3: Reset,

Source§

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

Pointer to the SPI 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 operations through writes to the bit band region.
Source§

impl I2sPeripheral for I2s<SPI4>
where SPI4: Reset,

Source§

const REGISTERS: *const () = {0x40013400 as *const ()}

Pointer to the SPI 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 operations through writes to the bit band region.
Source§

impl I2sPeripheral for I2s<SPI5>
where SPI5: Reset,

Source§

const REGISTERS: *const () = {0x40015000 as *const ()}

Pointer to the SPI 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 operations through writes to the bit band region.

Auto Trait Implementations§

§

impl<I> Freeze for I2s<I>
where I: Freeze, <I as I2sCommon>::Ws: Freeze, <I as I2sCommon>::Ck: Freeze, <I as I2sMaster>::Mck: Freeze, <I as I2sCommon>::Sd: Freeze,

§

impl<I> RefUnwindSafe for I2s<I>

§

impl<I> Send for I2s<I>
where I: Send, <I as I2sCommon>::Ws: Send, <I as I2sCommon>::Ck: Send, <I as I2sMaster>::Mck: Send, <I as I2sCommon>::Sd: Send,

§

impl<I> Sync for I2s<I>
where I: Sync, <I as I2sCommon>::Ws: Sync, <I as I2sCommon>::Ck: Sync, <I as I2sMaster>::Mck: Sync, <I as I2sCommon>::Sd: Sync,

§

impl<I> Unpin for I2s<I>
where I: Unpin, <I as I2sCommon>::Ws: Unpin, <I as I2sCommon>::Ck: Unpin, <I as I2sMaster>::Mck: Unpin, <I as I2sCommon>::Sd: Unpin,

§

impl<I> UnwindSafe for I2s<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.