traits: add delay trait

delay allows downstream libraries
to use async delay without depending
on a specific delay implementation
This commit is contained in:
xoviat
2021-03-02 08:45:22 -06:00
parent 3e4abe9e9d
commit 7ef81c75e7
5 changed files with 37 additions and 2 deletions

View File

@ -0,0 +1,9 @@
use core::future::Future;
use core::pin::Pin;
pub trait Delay {
type DelayFuture<'a>: Future<Output = ()> + 'a;
fn delay_ms<'a>(self: Pin<&'a mut Self>, millis: u64) -> Self::DelayFuture<'a>;
fn delay_us<'a>(self: Pin<&'a mut Self>, micros: u64) -> Self::DelayFuture<'a>;
}

View File

@ -5,6 +5,7 @@
#![feature(const_option)]
#![allow(incomplete_features)]
pub mod delay;
pub mod flash;
pub mod gpio;
pub mod uart;