diff options
| author | xoviat <[email protected]> | 2021-03-02 00:32:23 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-03-02 00:32:23 +0100 |
| commit | 9626aee7dbe5fe454a014beee82383bc3f102a91 (patch) | |
| tree | 6d155c12dd0563056874ecc97d57c6ac521bcf5c /embassy-traits/src/uart.rs | |
| parent | 084b64053a562797fa3d88bb7dde9ddd8db792f1 (diff) | |
Move traits to separate crate.
Diffstat (limited to 'embassy-traits/src/uart.rs')
| -rw-r--r-- | embassy-traits/src/uart.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/embassy-traits/src/uart.rs b/embassy-traits/src/uart.rs new file mode 100644 index 000000000..b40b9e9bd --- /dev/null +++ b/embassy-traits/src/uart.rs | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | use core::future::Future; | ||
| 2 | |||
| 3 | #[derive(Copy, Clone, Debug, Eq, PartialEq)] | ||
| 4 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 5 | #[non_exhaustive] | ||
| 6 | pub enum Error { | ||
| 7 | Other, | ||
| 8 | } | ||
| 9 | |||
| 10 | pub trait Uart { | ||
| 11 | type ReceiveFuture<'a>: Future<Output = Result<(), Error>>; | ||
| 12 | type SendFuture<'a>: Future<Output = Result<(), Error>>; | ||
| 13 | fn receive<'a>(&'a mut self, buf: &'a mut [u8]) -> Self::ReceiveFuture<'a>; | ||
| 14 | fn send<'a>(&'a mut self, buf: &'a [u8]) -> Self::SendFuture<'a>; | ||
| 15 | } | ||
