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§
Sourcefn initialize(&mut self, callback: impl FnMut(Event) + 'a) -> Result<(), i32>
fn initialize(&mut self, callback: impl FnMut(Event) + 'a) -> Result<(), i32>
Initializes the SAI peripheral with a callback for event signaling.
Sourcefn uninitialize(&mut self) -> Result<(), i32>
fn uninitialize(&mut self) -> Result<(), i32>
De-initializes the SAI peripheral.
Sourcefn power_control(&mut self, state: PowerState) -> Result<(), i32>
fn power_control(&mut self, state: PowerState) -> Result<(), i32>
Controls the power state of the SAI block.
Sourcefn get_tx_count(&self) -> u32
fn get_tx_count(&self) -> u32
Gets the number of bytes sent so far.
Sourcefn get_rx_count(&self) -> u32
fn get_rx_count(&self) -> u32
Gets the number of bytes received so far.
Sourcefn control(&mut self, control: u32, arg1: u32, arg2: u32) -> Result<(), i32>
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.).
Sourcefn get_status(&self) -> Status
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.