From fa807d2f08b69e3fe3bdf2fde3611e5292ba32bb Mon Sep 17 00:00:00 2001 From: xoviat Date: Thu, 11 Mar 2021 16:25:38 -0600 Subject: add qei trait and implementation --- embassy-traits/src/lib.rs | 1 + embassy-traits/src/qei.rs | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 embassy-traits/src/qei.rs (limited to 'embassy-traits/src') diff --git a/embassy-traits/src/lib.rs b/embassy-traits/src/lib.rs index 10d44d9de..d8b06a091 100644 --- a/embassy-traits/src/lib.rs +++ b/embassy-traits/src/lib.rs @@ -9,5 +9,6 @@ pub mod delay; pub mod flash; pub mod gpio; +pub mod qei; pub mod i2c; pub mod uart; diff --git a/embassy-traits/src/qei.rs b/embassy-traits/src/qei.rs new file mode 100644 index 000000000..7e0a8961f --- /dev/null +++ b/embassy-traits/src/qei.rs @@ -0,0 +1,14 @@ +use core::future::Future; +use core::pin::Pin; +use embedded_hal::Direction; + +// Wait for a specified number of rotations either up or down +pub trait WaitForRotate { + type RotateFuture<'a>: Future + 'a; + + fn wait_for_rotate<'a>( + self: Pin<&'a mut Self>, + count_down: u16, + count_up: u16, + ) -> Self::RotateFuture<'a>; +} -- cgit