diff --git a/CHANGELOG.md b/CHANGELOG.md index 7262aed74..3aef1c78d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,23 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - `i2c`: traits now enforce all impls on the same struct have the same `Error` type. - `i2c`: unify all traits into a single `I2c` trait. +### Removed +- Traits with unconstrained associated types and their modules (See: [#324], [#354]): + - `capture::Capture` + - `pwm::Pwm` + - `pwm::PwmPin` + - `qei::Qei` + - `timer::Cancel` + - `timer::CountDown` + - `timer::Periodic` + - `watchdog::Disable` + - `watchdog::Enable` + - `watchdog::Watchdog` + + +[#324]: https://github.com/rust-embedded/embedded-hal/pull/324/ +[#354]: https://github.com/rust-embedded/embedded-hal/pull/354 + ## [v1.0.0-alpha.6] - 2021-11-19 *** This is (also) an alpha release with breaking changes (sorry) *** diff --git a/src/lib.rs b/src/lib.rs index 95c2ce63d..56f61c0a6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -360,7 +360,6 @@ pub mod can; pub mod delay; pub mod digital; pub mod i2c; -pub mod qei; pub mod serial; pub mod spi; diff --git a/src/qei.rs b/src/qei.rs deleted file mode 100644 index 83d5210ea..000000000 --- a/src/qei.rs +++ /dev/null @@ -1,82 +0,0 @@ -//! Quadrature encoder interface traits - -/// Count direction -#[derive(Clone, Copy, Debug, Eq, PartialEq)] -pub enum Direction { - /// 3, 2, 1 - Downcounting, - /// 1, 2, 3 - Upcounting, -} - -/// Blocking quadrature encoder interface traits -pub mod blocking { - use super::Direction; - - /// Quadrature encoder interface - /// - /// # Examples - /// - /// You can use this interface to measure the speed of a motor - /// - /// ``` - /// extern crate embedded_hal as hal; - /// #[macro_use(block)] - /// extern crate nb; - /// - /// use hal::qei::blocking::Qei; - /// - /// fn main() { - /// let mut qei: Qei1 = { - /// // .. - /// # Qei1 - /// }; - /// - /// - /// let before = qei.count().unwrap(); - /// // wait some time - /// let after = qei.count().unwrap(); - /// - /// let speed = after.wrapping_sub(before); - /// println!("Speed: {} pulses per second", speed); - /// } - /// - /// # use core::convert::Infallible; - /// # struct Qei1; - /// # impl hal::qei::blocking::Qei for Qei1 { - /// # type Error = Infallible; - /// # type Count = u16; - /// # fn count(&self) -> Result { Ok(0) } - /// # fn direction(&self) -> Result<::hal::qei::Direction, Self::Error> { unimplemented!() } - /// # } - /// ``` - // unproven reason: needs to be re-evaluated in the new singletons world. At the very least this needs a - // reference implementation - pub trait Qei { - /// Enumeration of `Qei` errors - type Error: core::fmt::Debug; - - /// The type of the value returned by `count` - type Count; - - /// Returns the current pulse count of the encoder - fn count(&self) -> Result; - - /// Returns the count direction - fn direction(&self) -> Result; - } - - impl Qei for &T { - type Error = T::Error; - - type Count = T::Count; - - fn count(&self) -> Result { - T::count(self) - } - - fn direction(&self) -> Result { - T::direction(self) - } - } -}