Trait wasefire_board_api::uart::Api
source · 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§
sourcefn set_baudrate(uart: Id<Self>, baudrate: usize) -> Result<(), Error>
fn set_baudrate(uart: Id<Self>, baudrate: usize) -> Result<(), Error>
Sets the baudrate of a stopped UART.
sourcefn read(uart: Id<Self>, output: &mut [u8]) -> Result<usize, Error>
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.
sourcefn write(uart: Id<Self>, input: &[u8]) -> Result<usize, Error>
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.
Object Safety§
This trait is not object safe.