wasm_embedded_spec/uart.rs
1//! Platform UART API abstraction (and wrappers).
2//!
3//! Provides a platform UART trait with wiggle and c wrappers
4
5use super::Error;
6
7/// UART context abstraction.
8///
9/// This hides runtime implementation details to simplify implementing UART contexts.
10/// Hopefully one day generation is improved so we don't _need_ this any more
11pub trait Uart {
12 fn init(&mut self, dev: u32, baud: u32, tx: i32, rx: i32) -> Result<i32, Error>;
13
14 fn deinit(&mut self, handle: i32) -> Result<(), Error>;
15
16 fn write(&mut self, handle: i32, flags: u32, data: &[u8]) -> Result<(), Error>;
17
18 fn read(&mut self, handle: i32, flags: u32, buff: &mut [u8]) -> Result<(), Error>;
19}