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>
impl<SPI: DualInstance> DualI2s<SPI>
Sourcepub 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
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.
pub fn release( self, ) -> (SPI, SPI::I2sExtPeripheral, (SPI::Ws, SPI::Ck, SPI::Mck, SPI::Sd, SPI::ExtSd))
Source§impl<SPI: DualInstance> DualI2s<SPI>
impl<SPI: DualInstance> DualI2s<SPI>
Source§impl<I: DualInstance> DualI2s<I>
impl<I: DualInstance> DualI2s<I>
Sourcepub fn input_clock(&self) -> Hertz
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>
impl DualI2sPeripheral for DualI2s<SPI2>
Source§const MAIN_REGISTERS: *const () = {0x40003800 as *const ()}
const MAIN_REGISTERS: *const () = {0x40003800 as *const ()}
Pointer to the SPI register block
Source§const EXT_REGISTERS: *const () = {0x40003400 as *const ()}
const EXT_REGISTERS: *const () = {0x40003400 as *const ()}
Pointer to the I2SEXT register block
type WsPin = Ws
Source§fn ws_pin_mut(&mut self) -> &mut Self::WsPin
fn ws_pin_mut(&mut self) -> &mut Self::WsPin
Get mutable reference to WS pin;
Source§impl DualI2sPeripheral for DualI2s<SPI3>
impl DualI2sPeripheral for DualI2s<SPI3>
Source§const MAIN_REGISTERS: *const () = {0x40003c00 as *const ()}
const MAIN_REGISTERS: *const () = {0x40003c00 as *const ()}
Pointer to the SPI register block
Source§const EXT_REGISTERS: *const () = {0x40004000 as *const ()}
const EXT_REGISTERS: *const () = {0x40004000 as *const ()}
Pointer to the I2SEXT register block
type WsPin = Ws
Source§fn ws_pin_mut(&mut self) -> &mut Self::WsPin
fn ws_pin_mut(&mut self) -> &mut Self::WsPin
Get mutable reference to WS pin;
Auto Trait Implementations§
impl<I> Freeze for DualI2s<I>
impl<I> RefUnwindSafe for DualI2s<I>where
I: RefUnwindSafe,
<I as DualInstance>::I2sExtPeripheral: RefUnwindSafe,
<I as I2sCommon>::Ws: RefUnwindSafe,
<I as I2sCommon>::Ck: RefUnwindSafe,
<I as I2sMaster>::Mck: RefUnwindSafe,
<I as I2sCommon>::Sd: RefUnwindSafe,
<I as I2sExtPin>::ExtSd: RefUnwindSafe,
impl<I> Send for DualI2s<I>
impl<I> Sync for DualI2s<I>
impl<I> Unpin for DualI2s<I>
impl<I> UnwindSafe for DualI2s<I>where
I: UnwindSafe,
<I as DualInstance>::I2sExtPeripheral: UnwindSafe,
<I as I2sCommon>::Ws: UnwindSafe,
<I as I2sCommon>::Ck: UnwindSafe,
<I as I2sMaster>::Mck: UnwindSafe,
<I as I2sCommon>::Sd: UnwindSafe,
<I as I2sExtPin>::ExtSd: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more