pub unsafe trait DualI2sPeripheral {
    type WsPin: WsPin;

    const MAIN_REGISTERS: *const ();
    const EXT_REGISTERS: *const ();

    // Required methods
    fn i2s_freq(&self) -> u32;
    fn ws_pin(&self) -> &Self::WsPin;
    fn ws_pin_mut(&mut self) -> &mut Self::WsPin;
    fn rcc_reset(&mut self);
}
Expand description

An object that can be used for full duplex I2S communication.

This trait is meant to be implemented on a type that represent a device supporting full duplex I2S operation. This object should be composed of

  • A SPI peripheral with I2S support
  • The corresponding I2SEXT peripheral
  • Pins that the peripherals use
  • Eventually a clock object (or reference)

§Safety

It is only safe to implement this trait when:

  • The implementing type has ownership of the peripherals, preventing any other accesses to the register blocks.
  • MAIN_REGISTERS and EXT_REGISTERS are pointers to that peripheral’s register blocks and can be safely accessed as long as ownership or a borrow of the implementing type is present.

Required Associated Types§

Required Associated Constants§

source

const MAIN_REGISTERS: *const ()

Pointer to the SPI register block

source

const EXT_REGISTERS: *const ()

Pointer to the I2SEXT register block

Required Methods§

source

fn i2s_freq(&self) -> u32

Get I2s clock source frequency from the I2s device.

Implementers are allowed to panic in case i2s source frequency is unavailable.

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.

Object Safety§

This trait is not object safe.

Implementors§