Skip to main content

AudioPeripherals

Struct AudioPeripherals 

Source
pub struct AudioPeripherals<'a> {
    pub codec_pins: Pins<'a>,
    pub sai1: Peri<'a, SAI1>,
    pub i2c2: Peri<'a, I2C2>,
    pub dma1_ch0: Peri<'a, DMA1_CH0>,
    pub dma1_ch1: Peri<'a, DMA1_CH1>,
    pub dma1_ch2: Peri<'a, DMA1_CH2>,
}
Expand description

AudioPeripherals is a builder to make Interface safely. It ensures the correct pin mappings and DMA regions for SAI on every supported Seed revision, preventing invalid peripheral configurations at compile time. Use prepare_interface() to apply board‐rev-specific SAI setup and transition into the Interface<'_, Idle>. From there you can call start_interface() to move to Interface<'_, Running> and begin audio callbacks.

Fields§

§codec_pins: Pins<'a>§sai1: Peri<'a, SAI1>§i2c2: Peri<'a, I2C2>§dma1_ch0: Peri<'a, DMA1_CH0>§dma1_ch1: Peri<'a, DMA1_CH1>§dma1_ch2: Peri<'a, DMA1_CH2>

Implementations§

Source§

impl<'a> AudioPeripherals<'a>

Source

pub async fn prepare_interface( self, audio_config: AudioConfig, ) -> Interface<'a, Idle>

Prepares the audio interface.

This method sets up the SAI transmitter and receiver, configures the codec (if necessary), allocates DMA buffers, and applies board-specific SAI settings. It returns an Interface<'a, Idle> in the Idle state, allowing the runtime to decide when to start audio callbacks using start_interface().

§Arguments
  • audio_config - Audio configuration parameters such as the sample rate.
    You can use AudioConfig::default() or Default::default() for default settings.
§Notes
  • This method is async because seed_1_1 requires I2C communication with the WM8731 codec.
  • The board revision is selected via Cargo features (seed_1_1, seed_1_2).

Auto Trait Implementations§

§

impl<'a> !UnwindSafe for AudioPeripherals<'a>

§

impl<'a> Freeze for AudioPeripherals<'a>

§

impl<'a> RefUnwindSafe for AudioPeripherals<'a>

§

impl<'a> Send for AudioPeripherals<'a>

§

impl<'a> Sync for AudioPeripherals<'a>

§

impl<'a> Unpin for AudioPeripherals<'a>

§

impl<'a> UnsafeUnpin for AudioPeripherals<'a>

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.