aboutsummaryrefslogtreecommitdiff
path: root/embassy-traits/src
diff options
context:
space:
mode:
authorxoviat <[email protected]>2021-03-11 16:25:38 -0600
committerxoviat <[email protected]>2021-03-11 16:25:38 -0600
commitfa807d2f08b69e3fe3bdf2fde3611e5292ba32bb (patch)
tree3bc9a2167ec69087f6cec2af401b29428c58235e /embassy-traits/src
parent16e00669aeae310451adbd1773db29cc70c9dc5f (diff)
add qei trait and implementation
Diffstat (limited to 'embassy-traits/src')
-rw-r--r--embassy-traits/src/lib.rs1
-rw-r--r--embassy-traits/src/qei.rs14
2 files changed, 15 insertions, 0 deletions
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 @@
9pub mod delay; 9pub mod delay;
10pub mod flash; 10pub mod flash;
11pub mod gpio; 11pub mod gpio;
12pub mod qei;
12pub mod i2c; 13pub mod i2c;
13pub mod uart; 14pub 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 @@
1use core::future::Future;
2use core::pin::Pin;
3use embedded_hal::Direction;
4
5// Wait for a specified number of rotations either up or down
6pub trait WaitForRotate {
7 type RotateFuture<'a>: Future<Output = Direction> + 'a;
8
9 fn wait_for_rotate<'a>(
10 self: Pin<&'a mut Self>,
11 count_down: u16,
12 count_up: u16,
13 ) -> Self::RotateFuture<'a>;
14}