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>
impl<'a> AudioPeripherals<'a>
Sourcepub async fn prepare_interface(
self,
audio_config: AudioConfig,
) -> Interface<'a, Idle>
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 useAudioConfig::default()orDefault::default()for default settings.
§Notes
- This method is async because
seed_1_1requires 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> 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