pub unsafe trait I2sPeripheral {
    type WsPin: WsPin;

    const 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 composed of a SPI device that can be used for I2S communication.

This trait is meant to be implemented on a type that represent a full SPI device. That means an object composed of a SPI peripheral, pins that it uses, and eventually a clock object (which can be a reference).

§Safety

It is only safe to implement this trait when:

  • The implementing type has ownership of the peripheral, preventing any other accesses to the register block.
  • REGISTERS is a pointer to that peripheral’s register block 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 REGISTERS: *const ()

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

Object Safety§

This trait is not object safe.

Implementors§