Trait Sai

Source
pub trait Sai<'a> {
    // Required methods
    fn initialize(
        &mut self,
        callback: impl FnMut(Event) + 'a,
    ) -> Result<(), i32>;
    fn uninitialize(&mut self) -> Result<(), i32>;
    fn power_control(&mut self, state: PowerState) -> Result<(), i32>;
    fn send(&mut self, data: &[u8]) -> Result<(), i32>;
    fn receive(&mut self, buffer: &mut [u8]) -> Result<(), i32>;
    fn get_tx_count(&self) -> u32;
    fn get_rx_count(&self) -> u32;
    fn control(&mut self, control: u32, arg1: u32, arg2: u32) -> Result<(), i32>;
    fn get_status(&self) -> Status;
}
Expand description

Trait defining the standard interface for a SAI driver.

Required Methods§

Source

fn initialize(&mut self, callback: impl FnMut(Event) + 'a) -> Result<(), i32>

Initializes the SAI peripheral with a callback for event signaling.

Source

fn uninitialize(&mut self) -> Result<(), i32>

De-initializes the SAI peripheral.

Source

fn power_control(&mut self, state: PowerState) -> Result<(), i32>

Controls the power state of the SAI block.

Source

fn send(&mut self, data: &[u8]) -> Result<(), i32>

Sends audio data over SAI.

Source

fn receive(&mut self, buffer: &mut [u8]) -> Result<(), i32>

Receives audio data over SAI.

Source

fn get_tx_count(&self) -> u32

Gets the number of bytes sent so far.

Source

fn get_rx_count(&self) -> u32

Gets the number of bytes received so far.

Source

fn control(&mut self, control: u32, arg1: u32, arg2: u32) -> Result<(), i32>

Configures the SAI peripheral with user-defined parameters.

Arguments are typically encoded bitfields (frame length, slot count, etc.).

Source

fn get_status(&self) -> Status

Returns the current status of the SAI block.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§