pub trait Api: Support<usize> + Send {
    // Required methods
    fn set_baudrate(uart: Id<Self>, baudrate: usize) -> Result<(), Error>;
    fn start(uart: Id<Self>) -> Result<(), Error>;
    fn stop(uart: Id<Self>) -> Result<(), Error>;
    fn read(uart: Id<Self>, output: &mut [u8]) -> Result<usize, Error>;
    fn write(uart: Id<Self>, input: &[u8]) -> Result<usize, Error>;
    fn enable(uart: Id<Self>, direction: Direction) -> Result<(), Error>;
    fn disable(uart: Id<Self>, direction: Direction) -> Result<(), Error>;
}
Available on crate feature api-uart only.
Expand description

UART interface.

Required Methods§

source

fn set_baudrate(uart: Id<Self>, baudrate: usize) -> Result<(), Error>

Sets the baudrate of a stopped UART.

source

fn start(uart: Id<Self>) -> Result<(), Error>

Starts a UART.

source

fn stop(uart: Id<Self>) -> Result<(), Error>

Stops a UART.

source

fn read(uart: Id<Self>, output: &mut [u8]) -> Result<usize, Error>

Reads from a UART into a buffer.

Returns the number of bytes read. It could be zero if there’s nothing to read.

source

fn write(uart: Id<Self>, input: &[u8]) -> Result<usize, Error>

Writes from a buffer to a UART.

Returns the number of bytes written. It could be zero if the other side is not ready.

source

fn enable(uart: Id<Self>, direction: Direction) -> Result<(), Error>

Enables a given event to be triggered.

source

fn disable(uart: Id<Self>, direction: Direction) -> Result<(), Error>

Disables a given event from being triggered.

Object Safety§

This trait is not object safe.

Implementors§