Trait Usart

Source
pub trait Usart<'a> {
Show 17 methods // Required methods fn initialize( &mut self, callback: impl FnMut(Event) + 'a, ) -> Result<(), i32>; fn uninitialize(&mut self) -> Result<(), i32>; fn configure(&mut self, config: &Config) -> Result<(), i32>; fn send(&mut self, data: &[u8]) -> Result<(), i32>; fn receive(&mut self, data: &mut [u8]) -> Result<(), i32>; fn transfer( &mut self, data_out: &[u8], data_in: &mut [u8], ) -> Result<(), i32>; fn get_tx_count(&self) -> u32; fn get_rx_count(&self) -> u32; fn get_status(&self) -> Status; fn set_modem_control(&mut self, control: ModemControl) -> Result<(), i32>; fn get_modem_status(&self) -> ModemStatus; fn tx_enable(&mut self, enable: bool) -> Result<(), i32>; fn rx_enable(&mut self, enable: bool) -> Result<(), i32>; fn control_break(&mut self, enable: bool) -> Result<(), i32>; fn abort_send(&mut self) -> Result<(), i32>; fn abort_receive(&mut self) -> Result<(), i32>; fn abort_transfer(&mut self) -> Result<(), i32>;
}
Expand description

A trait that defines a standard interface for a USART driver.

Required Methods§

Source

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

Initializes the USART peripheral.

The provided callback will be invoked to signal communication events.

Source

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

De-initializes the USART peripheral.

Source

fn configure(&mut self, config: &Config) -> Result<(), i32>

Configures the USART peripheral.

Source

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

Transmits data over the USART bus.

Source

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

Receives data from the USART bus.

Source

fn transfer(&mut self, data_out: &[u8], data_in: &mut [u8]) -> Result<(), i32>

Simultaneously sends and receives data.

Source

fn get_tx_count(&self) -> u32

Gets the number of bytes transmitted.

Source

fn get_rx_count(&self) -> u32

Gets the number of bytes received.

Source

fn get_status(&self) -> Status

Gets the current status of the USART peripheral.

Source

fn set_modem_control(&mut self, control: ModemControl) -> Result<(), i32>

Controls the modem lines.

Source

fn get_modem_status(&self) -> ModemStatus

Gets the status of the modem lines.

Source

fn tx_enable(&mut self, enable: bool) -> Result<(), i32>

Enables or disables the transmitter.

Source

fn rx_enable(&mut self, enable: bool) -> Result<(), i32>

Enables or disables the receiver.

Source

fn control_break(&mut self, enable: bool) -> Result<(), i32>

Controls the generation of a break condition.

Source

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

Aborts an ongoing send operation.

Source

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

Aborts an ongoing receive operation.

Source

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

Aborts an ongoing transfer operation.

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§

Source§

impl<'a> Usart<'a> for UsartDriver<'a>