Add Uart trait, implement it for nrf.
This commit is contained in:
@ -12,4 +12,5 @@ pub mod interrupt;
|
||||
pub mod io;
|
||||
pub mod rand;
|
||||
pub mod time;
|
||||
pub mod uart;
|
||||
pub mod util;
|
||||
|
15
embassy/src/uart.rs
Normal file
15
embassy/src/uart.rs
Normal file
@ -0,0 +1,15 @@
|
||||
use core::future::Future;
|
||||
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
#[non_exhaustive]
|
||||
pub enum Error {
|
||||
Other,
|
||||
}
|
||||
|
||||
pub trait Uart {
|
||||
type ReceiveFuture<'a>: Future<Output = Result<(), Error>>;
|
||||
type SendFuture<'a>: Future<Output = Result<(), Error>>;
|
||||
fn receive<'a>(&'a mut self, buf: &'a mut [u8]) -> Self::ReceiveFuture<'a>;
|
||||
fn send<'a>(&'a mut self, buf: &'a [u8]) -> Self::SendFuture<'a>;
|
||||
}
|
Reference in New Issue
Block a user