Merge branch 'master' into spi-trait
This commit is contained in:
@ -91,8 +91,7 @@ impl AddressMode for SevenBitAddress {}
|
||||
|
||||
impl AddressMode for TenBitAddress {}
|
||||
|
||||
/// Blocking read
|
||||
pub trait Read<A: AddressMode = SevenBitAddress> {
|
||||
pub trait I2c<A: AddressMode = SevenBitAddress> {
|
||||
/// Error type
|
||||
type Error;
|
||||
|
||||
|
@ -4,11 +4,14 @@
|
||||
#![feature(const_fn_fn_ptr_basics)]
|
||||
#![feature(const_option)]
|
||||
#![allow(incomplete_features)]
|
||||
#![feature(min_type_alias_impl_trait)]
|
||||
#![feature(impl_trait_in_bindings)]
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
pub mod delay;
|
||||
pub mod flash;
|
||||
pub mod gpio;
|
||||
pub mod i2c;
|
||||
pub mod qei;
|
||||
pub mod spi;
|
||||
pub mod uart;
|
||||
|
22
embassy-traits/src/qei.rs
Normal file
22
embassy-traits/src/qei.rs
Normal file
@ -0,0 +1,22 @@
|
||||
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<Output = Direction> + 'a;
|
||||
|
||||
/// Wait for a specified number of rotations, in ticks, either up or down.
|
||||
///
|
||||
/// Return Direction::Upcounting if the high bound is reached.
|
||||
/// Return Direction::Downcounting if the low bound is reached.
|
||||
///
|
||||
/// Number of ticks is encoder dependent. As an example, if we connect
|
||||
/// the Bourns PEC11H-4120F-S0020, we have 20 ticks per full rotation.
|
||||
/// Other encoders may vary.
|
||||
fn wait_for_rotate<'a>(
|
||||
self: Pin<&'a mut Self>,
|
||||
count_down: u16,
|
||||
count_up: u16,
|
||||
) -> Self::RotateFuture<'a>;
|
||||
}
|
Reference in New Issue
Block a user