aboutsummaryrefslogtreecommitdiff
path: root/embassy-traits/src/uart.rs
blob: b40b9e9bd066835e9d284914e5a6ec2cad3dc328 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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>;
}