From 227468b5dbd78a566eb2eb9b160712dd8327613b Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Fri, 28 Sep 2018 19:27:45 +0200 Subject: [PATCH 01/17] Make InputPin trait methods fallible --- CHANGELOG.md | 6 ++++++ src/digital.rs | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d7abb561..9df050b50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +### Changed + +- [breaking-change] The unproven InputPin trait methods are now fallible, as reading an input + could potentially fail. + See [here](https://github.com/rust-embedded/embedded-hal/issues/95) for more info. + ## [v0.2.1] - 2018-05-14 ### Changed diff --git a/src/digital.rs b/src/digital.rs index 8f49da3d9..9a751ca9c 100644 --- a/src/digital.rs +++ b/src/digital.rs @@ -113,9 +113,11 @@ pub mod toggleable { /// *This trait is available if embedded-hal is built with the `"unproven"` feature.* #[cfg(feature = "unproven")] pub trait InputPin { + type Error; + /// Is the input pin high? - fn is_high(&self) -> bool; + fn is_high(&self) -> Result; /// Is the input pin low? - fn is_low(&self) -> bool; + fn is_low(&self) -> Result; } From 611ec43031d361f7c043f30a56d99c20b5d5c73a Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Fri, 28 Sep 2018 19:51:53 +0200 Subject: [PATCH 02/17] Add documentation for InputPin Error type --- src/digital.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/digital.rs b/src/digital.rs index 9a751ca9c..4237f1722 100644 --- a/src/digital.rs +++ b/src/digital.rs @@ -113,6 +113,7 @@ pub mod toggleable { /// *This trait is available if embedded-hal is built with the `"unproven"` feature.* #[cfg(feature = "unproven")] pub trait InputPin { + /// Error type type Error; /// Is the input pin high? From 2e90b036e2f7715e35ba510963bf4eeb8dce12f7 Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Fri, 28 Sep 2018 20:27:09 +0200 Subject: [PATCH 03/17] Add FallibleOutputPin trait --- CHANGELOG.md | 9 +++++++++ src/digital.rs | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9df050b50..258602d7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +### Added + +- A `FallibleOutputPin` trait has been added. It is a version of the `OutputPin` trait + where the methods return a `Result` type as setting an output pin could potentially fail. + The current `OutputPin` method signatures will become deprecated in a future version and + will be replaced by the ones defined in `FallibleOutputPin`. + After that, the `FallibleOutputPin` trait will be removed. + See [here](https://github.com/rust-embedded/embedded-hal/issues/95) for more info. + ### Changed - [breaking-change] The unproven InputPin trait methods are now fallible, as reading an input diff --git a/src/digital.rs b/src/digital.rs index 4237f1722..8982556bb 100644 --- a/src/digital.rs +++ b/src/digital.rs @@ -15,6 +15,25 @@ pub trait OutputPin { fn set_high(&mut self); } +/// Single digital push-pull output pin +/// (Fallible version. The OutputPin trait will adopt this interface in the future) +pub trait FallibleOutputPin { + /// Error type + type Error; + + /// Drives the pin low + /// + /// *NOTE* the actual electrical state of the pin may not actually be low, e.g. due to external + /// electrical sources + fn set_low(&mut self) -> Result<(), Self::Error>; + + /// Drives the pin high + /// + /// *NOTE* the actual electrical state of the pin may not actually be high, e.g. due to external + /// electrical sources + fn set_high(&mut self) -> Result<(), Self::Error>; +} + /// Push-pull output pin that can read its output state /// /// *This trait is available if embedded-hal is built with the `"unproven"` feature.* From 7c2167bc3aef7580e08a07a6e7d3cad7e33d9c68 Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Fri, 28 Sep 2018 21:29:12 +0200 Subject: [PATCH 04/17] Make ToggeableOutputPin fallible --- src/digital.rs | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/digital.rs b/src/digital.rs index 8982556bb..116829edb 100644 --- a/src/digital.rs +++ b/src/digital.rs @@ -60,15 +60,18 @@ pub trait StatefulOutputPin { /// implemented. Otherwise, implement this using hardware mechanisms. #[cfg(feature = "unproven")] pub trait ToggleableOutputPin { + /// Error type + type Error; + /// Toggle pin output. - fn toggle(&mut self); + fn toggle(&mut self) -> Result<(), Self::Error>; } /// If you can read **and** write the output state, a pin is /// toggleable by software. /// /// ``` -/// use embedded_hal::digital::{OutputPin, StatefulOutputPin, ToggleableOutputPin}; +/// use embedded_hal::digital::{FallibleOutputPin, StatefulOutputPin, ToggleableOutputPin}; /// use embedded_hal::digital::toggleable; /// /// /// A virtual output pin that exists purely in software @@ -76,12 +79,16 @@ pub trait ToggleableOutputPin { /// state: bool /// } /// -/// impl OutputPin for MyPin { -/// fn set_low(&mut self) { +/// impl FallibleOutputPin for MyPin { +/// type Error = void::Void; +/// +/// fn set_low(&mut self) -> Result<(), Self::Error>{ /// self.state = false; +/// Ok(()) /// } -/// fn set_high(&mut self) { +/// fn set_high(&mut self) -> Result<(), Self::Error>{ /// self.state = true; +/// Ok(()) /// } /// } /// @@ -98,30 +105,32 @@ pub trait ToggleableOutputPin { /// impl toggleable::Default for MyPin {} /// /// let mut pin = MyPin { state: false }; -/// pin.toggle(); +/// pin.toggle().unwrap(); /// assert!(pin.is_set_high()); /// pin.toggle(); /// assert!(pin.is_set_low()); /// ``` #[cfg(feature = "unproven")] pub mod toggleable { - use super::{OutputPin, StatefulOutputPin, ToggleableOutputPin}; + use super::{FallibleOutputPin, StatefulOutputPin, ToggleableOutputPin}; /// Software-driven `toggle()` implementation. /// /// *This trait is available if embedded-hal is built with the `"unproven"` feature.* - pub trait Default: OutputPin + StatefulOutputPin {} + pub trait Default: FallibleOutputPin + StatefulOutputPin {} impl

ToggleableOutputPin for P where P: Default, { + type Error = P::Error; + /// Toggle pin output - fn toggle(&mut self) { + fn toggle(&mut self) -> Result<(), Self::Error>{ if self.is_set_low() { - self.set_high(); + self.set_high() } else { - self.set_low(); + self.set_low() } } } From 156c8617b242620395bc78a1561c5299c2b257d7 Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Fri, 28 Sep 2018 21:30:02 +0200 Subject: [PATCH 05/17] Fix unwrapping toggle result in example --- src/digital.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/digital.rs b/src/digital.rs index 116829edb..ed925b74a 100644 --- a/src/digital.rs +++ b/src/digital.rs @@ -107,7 +107,7 @@ pub trait ToggleableOutputPin { /// let mut pin = MyPin { state: false }; /// pin.toggle().unwrap(); /// assert!(pin.is_set_high()); -/// pin.toggle(); +/// pin.toggle().unwrap(); /// assert!(pin.is_set_low()); /// ``` #[cfg(feature = "unproven")] From 34cd2b877b2768807c77235e3d86e54aa52e08d8 Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Fri, 28 Sep 2018 21:31:16 +0200 Subject: [PATCH 06/17] Fix spacing --- src/digital.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/digital.rs b/src/digital.rs index ed925b74a..45a72bc6e 100644 --- a/src/digital.rs +++ b/src/digital.rs @@ -82,11 +82,11 @@ pub trait ToggleableOutputPin { /// impl FallibleOutputPin for MyPin { /// type Error = void::Void; /// -/// fn set_low(&mut self) -> Result<(), Self::Error>{ +/// fn set_low(&mut self) -> Result<(), Self::Error> { /// self.state = false; /// Ok(()) /// } -/// fn set_high(&mut self) -> Result<(), Self::Error>{ +/// fn set_high(&mut self) -> Result<(), Self::Error> { /// self.state = true; /// Ok(()) /// } @@ -126,7 +126,7 @@ pub mod toggleable { type Error = P::Error; /// Toggle pin output - fn toggle(&mut self) -> Result<(), Self::Error>{ + fn toggle(&mut self) -> Result<(), Self::Error> { if self.is_set_low() { self.set_high() } else { From db447cecc2086fdc7397e9cb0fabf3cc1c969cc5 Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Fri, 28 Sep 2018 21:53:13 +0200 Subject: [PATCH 07/17] Add ToggleableOutputPin change to changelog --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 258602d7a..7e7cb4dd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,8 +18,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Changed -- [breaking-change] The unproven InputPin trait methods are now fallible, as reading an input - could potentially fail. +- [breaking-change] The unproven `InputPin` trait methods are now fallible, as reading an input + could potentially fail. Similarly, the methods in the unproven `ToggleableOutputPin` trait + are now also fallible. See [here](https://github.com/rust-embedded/embedded-hal/issues/95) for more info. ## [v0.2.1] - 2018-05-14 From e959f02bb89c97bdb91e6dcf3a78084928603650 Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Sat, 29 Sep 2018 07:46:00 +0200 Subject: [PATCH 08/17] Put fallible OutputPin behind use-fallible-digital-traits feature --- Cargo.toml | 1 + src/digital.rs | 46 ++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d558c2574..bfce98254 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,6 +26,7 @@ futures = "0.1.17" [features] unproven = ["nb/unstable"] +use-fallible-digital-traits = [] [package.metadata.docs.rs] features = ["unproven"] \ No newline at end of file diff --git a/src/digital.rs b/src/digital.rs index 45a72bc6e..23f91152a 100644 --- a/src/digital.rs +++ b/src/digital.rs @@ -1,6 +1,7 @@ //! Digital I/O /// Single digital push-pull output pin +#[cfg(not(feature = "use-fallible-digital-traits"))] pub trait OutputPin { /// Drives the pin low /// @@ -16,8 +17,11 @@ pub trait OutputPin { } /// Single digital push-pull output pin -/// (Fallible version. The OutputPin trait will adopt this interface in the future) -pub trait FallibleOutputPin { +/// (Fallible version. This will become the default after the next release) +/// +/// *This trait is available if embedded-hal is built with the `"use-fallible-digital-traits"` feature.* +#[cfg(feature = "use-fallible-digital-traits")] +pub trait OutputPin { /// Error type type Error; @@ -71,7 +75,7 @@ pub trait ToggleableOutputPin { /// toggleable by software. /// /// ``` -/// use embedded_hal::digital::{FallibleOutputPin, StatefulOutputPin, ToggleableOutputPin}; +/// use embedded_hal::digital::{OutputPin, StatefulOutputPin, ToggleableOutputPin}; /// use embedded_hal::digital::toggleable; /// /// /// A virtual output pin that exists purely in software @@ -79,7 +83,18 @@ pub trait ToggleableOutputPin { /// state: bool /// } /// -/// impl FallibleOutputPin for MyPin { +/// #[cfg(not(feature = "use-fallible-digital-traits"))] +/// impl OutputPin for MyPin { +/// fn set_low(&mut self){ +/// self.state = false; +/// } +/// fn set_high(&mut self){ +/// self.state = true; +/// } +/// } +/// +/// #[cfg(feature = "use-fallible-digital-traits")] +/// impl OutputPin for MyPin { /// type Error = void::Void; /// /// fn set_low(&mut self) -> Result<(), Self::Error> { @@ -112,13 +127,32 @@ pub trait ToggleableOutputPin { /// ``` #[cfg(feature = "unproven")] pub mod toggleable { - use super::{FallibleOutputPin, StatefulOutputPin, ToggleableOutputPin}; + use super::{OutputPin, StatefulOutputPin, ToggleableOutputPin}; /// Software-driven `toggle()` implementation. /// /// *This trait is available if embedded-hal is built with the `"unproven"` feature.* - pub trait Default: FallibleOutputPin + StatefulOutputPin {} + pub trait Default: OutputPin + StatefulOutputPin {} + + #[cfg(not(feature = "use-fallible-digital-traits"))] + impl

ToggleableOutputPin for P + where + P: Default, + { + type Error = void::Void; + + /// Toggle pin output + fn toggle(&mut self) -> Result<(), Self::Error> { + if self.is_set_low() { + self.set_high(); + } else { + self.set_low(); + } + Ok(()) + } + } + #[cfg(feature = "use-fallible-digital-traits")] impl

ToggleableOutputPin for P where P: Default, From f873a73aeafc770da4b7d281e4071e7e57e44d28 Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Sat, 29 Sep 2018 08:17:27 +0200 Subject: [PATCH 09/17] Make StatefulOutputPin inherit from OutputPin to inherit its error type This fallible version is only available if both "unproven" and "use-fallible-digital-traits" features are enabled. --- src/digital.rs | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/src/digital.rs b/src/digital.rs index 23f91152a..afd040958 100644 --- a/src/digital.rs +++ b/src/digital.rs @@ -41,7 +41,7 @@ pub trait OutputPin { /// Push-pull output pin that can read its output state /// /// *This trait is available if embedded-hal is built with the `"unproven"` feature.* -#[cfg(feature = "unproven")] +#[cfg(all(feature = "unproven", not(feature = "use-fallible-digital-traits")))] pub trait StatefulOutputPin { /// Is the pin in drive high mode? /// @@ -54,6 +54,24 @@ pub trait StatefulOutputPin { fn is_set_low(&self) -> bool; } +/// Push-pull output pin that can read its output state +/// (Fallible version. This will become the default after the next release) +/// +/// *This trait is available if embedded-hal is built with the `"unproven"` and +/// `"use-fallible-digital-traits"` features.* +#[cfg(all(feature = "unproven", feature = "use-fallible-digital-traits"))] +pub trait StatefulOutputPin : OutputPin { + /// Is the pin in drive high mode? + /// + /// *NOTE* this does *not* read the electrical state of the pin + fn is_set_high(&self) -> Result; + + /// Is the pin in drive low mode? + /// + /// *NOTE* this does *not* read the electrical state of the pin + fn is_set_low(&self) -> Result; +} + /// Output pin that can be toggled /// /// *This trait is available if embedded-hal is built with the `"unproven"` feature.* @@ -107,6 +125,7 @@ pub trait ToggleableOutputPin { /// } /// } /// +/// #[cfg(not(feature = "use-fallible-digital-traits"))] /// impl StatefulOutputPin for MyPin { /// fn is_set_low(&self) -> bool { /// !self.state @@ -116,14 +135,30 @@ pub trait ToggleableOutputPin { /// } /// } /// +/// #[cfg(feature = "use-fallible-digital-traits")] +/// impl StatefulOutputPin for MyPin { +/// fn is_set_low(&self) -> Result { +/// Ok(!self.state) +/// } +/// fn is_set_high(&self) -> Result { +/// Ok(self.state) +/// } +/// } +/// /// /// Opt-in to the software implementation. /// impl toggleable::Default for MyPin {} /// /// let mut pin = MyPin { state: false }; /// pin.toggle().unwrap(); +/// #[cfg(not(feature = "use-fallible-digital-traits"))] /// assert!(pin.is_set_high()); +/// #[cfg(feature = "use-fallible-digital-traits")] +/// assert!(pin.is_set_high().unwrap()); /// pin.toggle().unwrap(); +/// #[cfg(not(feature = "use-fallible-digital-traits"))] /// assert!(pin.is_set_low()); +/// #[cfg(feature = "use-fallible-digital-traits")] +/// assert!(pin.is_set_low().unwrap()); /// ``` #[cfg(feature = "unproven")] pub mod toggleable { @@ -161,7 +196,7 @@ pub mod toggleable { /// Toggle pin output fn toggle(&mut self) -> Result<(), Self::Error> { - if self.is_set_low() { + if self.is_set_low()? { self.set_high() } else { self.set_low() From 2a1d72ec46edce243531d5d33adda18bfdf1610a Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Sun, 30 Sep 2018 11:08:41 +0200 Subject: [PATCH 10/17] Mark infallible digital traits as deprecated --- CHANGELOG.md | 10 ++++++---- src/digital.rs | 14 +++++++++++++- src/prelude.rs | 1 + 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e7cb4dd9..53ac0b560 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,11 +9,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Added -- A `FallibleOutputPin` trait has been added. It is a version of the `OutputPin` trait +- A fallible version of the `OutputPin` trait has been added. It is a version where the methods return a `Result` type as setting an output pin could potentially fail. - The current `OutputPin` method signatures will become deprecated in a future version and - will be replaced by the ones defined in `FallibleOutputPin`. - After that, the `FallibleOutputPin` trait will be removed. + The current `OutputPin` trait version is now marked as deprecated. The fallible version + is available throught the `use-fallible-digital-traits` feature. After this release, + the fallible version of `OutputPin` will be made the default and the infallible one + will only be available if activating the `use-infallible-digital-traits` feature. + The infallible version of the trait will be removed in the relase after that one. See [here](https://github.com/rust-embedded/embedded-hal/issues/95) for more info. ### Changed diff --git a/src/digital.rs b/src/digital.rs index afd040958..a7fca47f9 100644 --- a/src/digital.rs +++ b/src/digital.rs @@ -1,6 +1,12 @@ //! Digital I/O -/// Single digital push-pull output pin +/// Single digital push-pull output pin. (Infallible version) +/// +/// *This version of the trait is now deprecated. Please enable the +/// `"use-fallible-digital-traits"` feature when building embedded-hal to use the new version. +/// In the release after next one, this version will only be available when activating the +/// `"use-infallible-digital-traits"` and it will be removed in the release after that one.* +#[deprecated] #[cfg(not(feature = "use-fallible-digital-traits"))] pub trait OutputPin { /// Drives the pin low @@ -41,6 +47,11 @@ pub trait OutputPin { /// Push-pull output pin that can read its output state /// /// *This trait is available if embedded-hal is built with the `"unproven"` feature.* +/// *This version of the trait is now deprecated. Please enable the +/// `"use-fallible-digital-traits"` feature when building embedded-hal to use the new version. +/// In the release after next one, this version will only be available when activating the +/// `"use-infallible-digital-traits"` and it will be removed in the release after that one.* +#[deprecated] #[cfg(all(feature = "unproven", not(feature = "use-fallible-digital-traits")))] pub trait StatefulOutputPin { /// Is the pin in drive high mode? @@ -161,6 +172,7 @@ pub trait ToggleableOutputPin { /// assert!(pin.is_set_low().unwrap()); /// ``` #[cfg(feature = "unproven")] +#[allow(deprecated)] pub mod toggleable { use super::{OutputPin, StatefulOutputPin, ToggleableOutputPin}; diff --git a/src/prelude.rs b/src/prelude.rs index ce1a5e18a..731870579 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -17,6 +17,7 @@ pub use blocking::spi::{ }; #[cfg(feature = "unproven")] pub use digital::InputPin as _embedded_hal_digital_InputPin; +#[allow(deprecated)] pub use digital::OutputPin as _embedded_hal_digital_OutputPin; #[cfg(feature = "unproven")] pub use digital::ToggleableOutputPin as _embedded_hal_digital_ToggleableOutputPin; From b6811629df3d223aa86479d657565fa3fbed5e06 Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Sun, 30 Sep 2018 11:11:18 +0200 Subject: [PATCH 11/17] Update changelog --- CHANGELOG.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53ac0b560..2ca210048 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,13 +9,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Added -- A fallible version of the `OutputPin` trait has been added. It is a version - where the methods return a `Result` type as setting an output pin could potentially fail. - The current `OutputPin` trait version is now marked as deprecated. The fallible version - is available throught the `use-fallible-digital-traits` feature. After this release, - the fallible version of `OutputPin` will be made the default and the infallible one +- Fallible versions of the `OutputPin` and `StatefulOutputPin` traits have been added. + These are versions where the methods return a `Result` type as setting an output pin + could potentially fail. + The current trait versions are now marked as deprecated. The fallible version + is available through the `use-fallible-digital-traits` feature. After this release, + the fallible version of the traits will be made the default and the infallible one will only be available if activating the `use-infallible-digital-traits` feature. The infallible version of the trait will be removed in the relase after that one. + Both versions of the traits are mutually-exclusive. See [here](https://github.com/rust-embedded/embedded-hal/issues/95) for more info. ### Changed From 2bad26e8a8128d9f25acf5c0be6982492fbc0d17 Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Sun, 30 Sep 2018 11:25:11 +0200 Subject: [PATCH 12/17] Add missing import --- src/digital.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/digital.rs b/src/digital.rs index a7fca47f9..2e70e8a57 100644 --- a/src/digital.rs +++ b/src/digital.rs @@ -181,12 +181,15 @@ pub mod toggleable { /// *This trait is available if embedded-hal is built with the `"unproven"` feature.* pub trait Default: OutputPin + StatefulOutputPin {} + #[cfg(not(feature = "use-fallible-digital-traits"))] + use void::Void; + #[cfg(not(feature = "use-fallible-digital-traits"))] impl

ToggleableOutputPin for P where P: Default, { - type Error = void::Void; + type Error = Void; /// Toggle pin output fn toggle(&mut self) -> Result<(), Self::Error> { From ea14b73c6fce1575a30e2df0fbc4112d59ccb323 Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Sun, 30 Sep 2018 11:28:51 +0200 Subject: [PATCH 13/17] Prioritize fallible version --- src/digital.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/digital.rs b/src/digital.rs index 2e70e8a57..0e4e1cb70 100644 --- a/src/digital.rs +++ b/src/digital.rs @@ -161,15 +161,15 @@ pub trait ToggleableOutputPin { /// /// let mut pin = MyPin { state: false }; /// pin.toggle().unwrap(); -/// #[cfg(not(feature = "use-fallible-digital-traits"))] -/// assert!(pin.is_set_high()); /// #[cfg(feature = "use-fallible-digital-traits")] /// assert!(pin.is_set_high().unwrap()); -/// pin.toggle().unwrap(); /// #[cfg(not(feature = "use-fallible-digital-traits"))] -/// assert!(pin.is_set_low()); +/// assert!(pin.is_set_high()); +/// pin.toggle().unwrap(); /// #[cfg(feature = "use-fallible-digital-traits")] /// assert!(pin.is_set_low().unwrap()); +/// #[cfg(not(feature = "use-fallible-digital-traits"))] +/// assert!(pin.is_set_low()); /// ``` #[cfg(feature = "unproven")] #[allow(deprecated)] From 623aaf833df92c49fc4b7e3e5f534d107b0c5a04 Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Fri, 12 Oct 2018 07:23:09 +0200 Subject: [PATCH 14/17] Split implementations to leave infallible traits untouched though deprecated - Add general documentation about transition process to digital module - Update CHANGELOG --- CHANGELOG.md | 23 ++++++----- src/digital.rs | 103 +++++++++++++++++++++++++++++++------------------ src/prelude.rs | 2 + 3 files changed, 81 insertions(+), 47 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ca210048..e65e5479a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,22 +9,25 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Added -- Fallible versions of the `OutputPin` and `StatefulOutputPin` traits have been added. +- Fallible versions of the digital `OutputPin`, `StatefulOutputPin`, + `ToggleableOutputPin` and `InputPin` traits have been added. These are versions where the methods return a `Result` type as setting an output pin - could potentially fail. - The current trait versions are now marked as deprecated. The fallible version - is available through the `use-fallible-digital-traits` feature. After this release, - the fallible version of the traits will be made the default and the infallible one - will only be available if activating the `use-infallible-digital-traits` feature. - The infallible version of the trait will be removed in the relase after that one. + and reading an input pin could potentially fail. + The fallible versions are available through the `use-fallible-digital-traits` feature. + After this release, the fallible versions of the traits will be made the default and + the infallible ones will only be available if activating the + `regress-infallible-digital-traits` feature. + These will be removed in the relase after that one. Both versions of the traits are mutually-exclusive. See [here](https://github.com/rust-embedded/embedded-hal/issues/95) for more info. ### Changed -- [breaking-change] The unproven `InputPin` trait methods are now fallible, as reading an input - could potentially fail. Similarly, the methods in the unproven `ToggleableOutputPin` trait - are now also fallible. +- The current infallible versions of the digital `OutputPin`, `StatefulOutputPin`, + `ToggleableOutputPin` and `InputPin` traits are now marked as deprecated. + In the next release, the infallible versions will only be available if activating the `regress-infallible-digital-traits` feature. + These will be removed in the relase after that one. + Both versions of the traits are mutually-exclusive. See [here](https://github.com/rust-embedded/embedded-hal/issues/95) for more info. ## [v0.2.1] - 2018-05-14 diff --git a/src/digital.rs b/src/digital.rs index 0e4e1cb70..241629d80 100644 --- a/src/digital.rs +++ b/src/digital.rs @@ -1,11 +1,11 @@ -//! Digital I/O +//! Digital I/O. +//! +//! The infallible versions of the traits below are now deprecated. Please enable the +//! `"use-fallible-digital-traits"` feature when building embedded-hal to use the new versions. +//! In the release after next one, the infallible versions will only be available when activating the +//! `"regress-infallible-digital-traits"` and they will be removed in the release after that one.* -/// Single digital push-pull output pin. (Infallible version) -/// -/// *This version of the trait is now deprecated. Please enable the -/// `"use-fallible-digital-traits"` feature when building embedded-hal to use the new version. -/// In the release after next one, this version will only be available when activating the -/// `"use-infallible-digital-traits"` and it will be removed in the release after that one.* +/// Single digital push-pull output pin. *(Infallible version)* #[deprecated] #[cfg(not(feature = "use-fallible-digital-traits"))] pub trait OutputPin { @@ -22,10 +22,9 @@ pub trait OutputPin { fn set_high(&mut self); } -/// Single digital push-pull output pin -/// (Fallible version. This will become the default after the next release) +/// Single digital push-pull output pin. /// -/// *This trait is available if embedded-hal is built with the `"use-fallible-digital-traits"` feature.* +/// *Fallible version. This will become the default after the next release.* #[cfg(feature = "use-fallible-digital-traits")] pub trait OutputPin { /// Error type @@ -44,13 +43,9 @@ pub trait OutputPin { fn set_high(&mut self) -> Result<(), Self::Error>; } -/// Push-pull output pin that can read its output state +/// Push-pull output pin that can read its output state. *(Infallible version)* /// /// *This trait is available if embedded-hal is built with the `"unproven"` feature.* -/// *This version of the trait is now deprecated. Please enable the -/// `"use-fallible-digital-traits"` feature when building embedded-hal to use the new version. -/// In the release after next one, this version will only be available when activating the -/// `"use-infallible-digital-traits"` and it will be removed in the release after that one.* #[deprecated] #[cfg(all(feature = "unproven", not(feature = "use-fallible-digital-traits")))] pub trait StatefulOutputPin { @@ -66,10 +61,10 @@ pub trait StatefulOutputPin { } /// Push-pull output pin that can read its output state -/// (Fallible version. This will become the default after the next release) /// -/// *This trait is available if embedded-hal is built with the `"unproven"` and -/// `"use-fallible-digital-traits"` features.* +/// *Fallible version. This will become the default after the next release.* +/// +/// *This trait is available if embedded-hal is built with the `"unproven"` feature.* #[cfg(all(feature = "unproven", feature = "use-fallible-digital-traits"))] pub trait StatefulOutputPin : OutputPin { /// Is the pin in drive high mode? @@ -83,7 +78,9 @@ pub trait StatefulOutputPin : OutputPin { fn is_set_low(&self) -> Result; } -/// Output pin that can be toggled +/// Output pin that can be toggled. +/// +/// *Fallible version. This will become the default after the next release.* /// /// *This trait is available if embedded-hal is built with the `"unproven"` feature.* /// @@ -91,7 +88,7 @@ pub trait StatefulOutputPin : OutputPin { /// both [OutputPin](trait.OutputPin.html) and /// [StatefulOutputPin](trait.StatefulOutputPin.html) are /// implemented. Otherwise, implement this using hardware mechanisms. -#[cfg(feature = "unproven")] +#[cfg(all(feature = "unproven", feature = "use-fallible-digital-traits"))] pub trait ToggleableOutputPin { /// Error type type Error; @@ -100,10 +97,26 @@ pub trait ToggleableOutputPin { fn toggle(&mut self) -> Result<(), Self::Error>; } +/// Output pin that can be toggled. *(Infallible version)* +/// +/// *This trait is available if embedded-hal is built with the `"unproven"` feature.* +/// +/// See [toggleable](toggleable) to use a software implementation if +/// both [OutputPin](trait.OutputPin.html) and +/// [StatefulOutputPin](trait.StatefulOutputPin.html) are +/// implemented. Otherwise, implement this using hardware mechanisms. +#[deprecated] +#[cfg(all(feature = "unproven", not(feature = "use-fallible-digital-traits")))] +pub trait ToggleableOutputPin { + /// Toggle pin output. + fn toggle(&mut self); +} + /// If you can read **and** write the output state, a pin is /// toggleable by software. /// /// ``` +/// #[allow(deprecated)] /// use embedded_hal::digital::{OutputPin, StatefulOutputPin, ToggleableOutputPin}; /// use embedded_hal::digital::toggleable; /// @@ -113,6 +126,7 @@ pub trait ToggleableOutputPin { /// } /// /// #[cfg(not(feature = "use-fallible-digital-traits"))] +/// #[allow(deprecated)] /// impl OutputPin for MyPin { /// fn set_low(&mut self){ /// self.state = false; @@ -137,6 +151,7 @@ pub trait ToggleableOutputPin { /// } /// /// #[cfg(not(feature = "use-fallible-digital-traits"))] +/// #[allow(deprecated)] /// impl StatefulOutputPin for MyPin { /// fn is_set_low(&self) -> bool { /// !self.state @@ -160,16 +175,21 @@ pub trait ToggleableOutputPin { /// impl toggleable::Default for MyPin {} /// /// let mut pin = MyPin { state: false }; -/// pin.toggle().unwrap(); /// #[cfg(feature = "use-fallible-digital-traits")] -/// assert!(pin.is_set_high().unwrap()); -/// #[cfg(not(feature = "use-fallible-digital-traits"))] -/// assert!(pin.is_set_high()); -/// pin.toggle().unwrap(); -/// #[cfg(feature = "use-fallible-digital-traits")] -/// assert!(pin.is_set_low().unwrap()); +/// { +/// pin.toggle().unwrap(); +/// assert!(pin.is_set_high().unwrap()); +/// pin.toggle().unwrap(); +/// assert!(pin.is_set_low().unwrap()); +/// } /// #[cfg(not(feature = "use-fallible-digital-traits"))] -/// assert!(pin.is_set_low()); +/// { +/// // deprecated +/// pin.toggle(); +/// assert!(pin.is_set_high()); +/// pin.toggle(); +/// assert!(pin.is_set_low()); +/// } /// ``` #[cfg(feature = "unproven")] #[allow(deprecated)] @@ -181,24 +201,18 @@ pub mod toggleable { /// *This trait is available if embedded-hal is built with the `"unproven"` feature.* pub trait Default: OutputPin + StatefulOutputPin {} - #[cfg(not(feature = "use-fallible-digital-traits"))] - use void::Void; - #[cfg(not(feature = "use-fallible-digital-traits"))] impl

ToggleableOutputPin for P where P: Default, { - type Error = Void; - /// Toggle pin output - fn toggle(&mut self) -> Result<(), Self::Error> { + fn toggle(&mut self) { if self.is_set_low() { self.set_high(); } else { self.set_low(); } - Ok(()) } } @@ -220,10 +234,12 @@ pub mod toggleable { } } -/// Single digital input pin +/// Single digital input pin. +/// +/// *Fallible version. This will become the default after the next release.* /// /// *This trait is available if embedded-hal is built with the `"unproven"` feature.* -#[cfg(feature = "unproven")] +#[cfg(all(feature = "unproven", feature = "use-fallible-digital-traits"))] pub trait InputPin { /// Error type type Error; @@ -234,3 +250,16 @@ pub trait InputPin { /// Is the input pin low? fn is_low(&self) -> Result; } + +/// Single digital input pin. *(Infallible version)* +/// +/// *This trait is available if embedded-hal is built with the `"unproven"` feature.* +#[deprecated] +#[cfg(all(feature = "unproven", not(feature = "use-fallible-digital-traits")))] +pub trait InputPin { + /// Is the input pin high? + fn is_high(&self) -> bool; + + /// Is the input pin low? + fn is_low(&self) -> bool; +} diff --git a/src/prelude.rs b/src/prelude.rs index 731870579..3f0d55a3a 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -16,10 +16,12 @@ pub use blocking::spi::{ Transfer as _embedded_hal_blocking_spi_Transfer, Write as _embedded_hal_blocking_spi_Write, }; #[cfg(feature = "unproven")] +#[allow(deprecated)] pub use digital::InputPin as _embedded_hal_digital_InputPin; #[allow(deprecated)] pub use digital::OutputPin as _embedded_hal_digital_OutputPin; #[cfg(feature = "unproven")] +#[allow(deprecated)] pub use digital::ToggleableOutputPin as _embedded_hal_digital_ToggleableOutputPin; pub use serial::Read as _embedded_hal_serial_Read; pub use serial::Write as _embedded_hal_serial_Write; From 2ab76fe7c8191e530ac44132b2f6eb758bab13f3 Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Fri, 12 Oct 2018 07:23:32 +0200 Subject: [PATCH 15/17] Add use-fallible-digital-traits to travis matrix --- .travis.yml | 24 ++++++++++++++++++++---- ci/script.sh | 4 ++-- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index a7cc51a5f..99430faa1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,21 +2,37 @@ language: rust matrix: include: - - env: TARGET=x86_64-unknown-linux-gnu + - env: TARGET=x86_64-unknown-linux-gnu FEATURES=unproven if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) - - env: TARGET=thumbv6m-none-eabi + - env: TARGET=thumbv6m-none-eabi FEATURES=unproven rust: beta if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) - - env: TARGET=thumbv7m-none-eabi + - env: TARGET=thumbv7m-none-eabi FEATURES=unproven rust: beta if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) - - env: TARGET=x86_64-unknown-linux-gnu + - env: TARGET=x86_64-unknown-linux-gnu FEATURES=unproven rust: nightly if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) + - env: TARGET=x86_64-unknown-linux-gnu FEATURES=unproven,use-fallible-digital-traits + if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) + + - env: TARGET=thumbv6m-none-eabi FEATURES=unproven,use-fallible-digital-traits + rust: beta + if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) + + - env: TARGET=thumbv7m-none-eabi FEATURES=unproven,use-fallible-digital-traits + rust: beta + if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) + + - env: TARGET=x86_64-unknown-linux-gnu FEATURES=unproven,use-fallible-digital-traits + rust: nightly + if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) + + before_install: set -e install: diff --git a/ci/script.sh b/ci/script.sh index 12c05e27b..982b90045 100644 --- a/ci/script.sh +++ b/ci/script.sh @@ -2,10 +2,10 @@ set -euxo pipefail main() { cargo check --target $TARGET - cargo check --target $TARGET --features unproven + cargo check --target $TARGET --features $FEATURES if [ $TRAVIS_RUST_VERSION = nightly ]; then - cargo test --target $TARGET --features unproven + cargo test --target $TARGET --features $FEATURES fi } From 6224d8823842ee15b0e1b226bb4a3c297accd33c Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Tue, 16 Oct 2018 19:27:13 +0200 Subject: [PATCH 16/17] Implement fallible digital traits as a clean break --- CHANGELOG.md | 23 ++------ Cargo.toml | 1 - src/digital.rs | 141 +++---------------------------------------------- src/prelude.rs | 3 -- 4 files changed, 11 insertions(+), 157 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e65e5479a..865e32f50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,27 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] -### Added - -- Fallible versions of the digital `OutputPin`, `StatefulOutputPin`, - `ToggleableOutputPin` and `InputPin` traits have been added. - These are versions where the methods return a `Result` type as setting an output pin - and reading an input pin could potentially fail. - The fallible versions are available through the `use-fallible-digital-traits` feature. - After this release, the fallible versions of the traits will be made the default and - the infallible ones will only be available if activating the - `regress-infallible-digital-traits` feature. - These will be removed in the relase after that one. - Both versions of the traits are mutually-exclusive. - See [here](https://github.com/rust-embedded/embedded-hal/issues/95) for more info. - ### Changed -- The current infallible versions of the digital `OutputPin`, `StatefulOutputPin`, - `ToggleableOutputPin` and `InputPin` traits are now marked as deprecated. - In the next release, the infallible versions will only be available if activating the `regress-infallible-digital-traits` feature. - These will be removed in the relase after that one. - Both versions of the traits are mutually-exclusive. +- [breaking-change] The digital `OutputPin`, `StatefulOutputPin`, `ToggleableOutputPin` + and `InputPin` traits have been replaced with fallible versions. + The methods now return a `Result` type as setting an output pin + and reading an input pin could potentially fail. See [here](https://github.com/rust-embedded/embedded-hal/issues/95) for more info. ## [v0.2.1] - 2018-05-14 diff --git a/Cargo.toml b/Cargo.toml index bfce98254..d558c2574 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,6 @@ futures = "0.1.17" [features] unproven = ["nb/unstable"] -use-fallible-digital-traits = [] [package.metadata.docs.rs] features = ["unproven"] \ No newline at end of file diff --git a/src/digital.rs b/src/digital.rs index 241629d80..37ff60ce0 100644 --- a/src/digital.rs +++ b/src/digital.rs @@ -1,31 +1,6 @@ //! Digital I/O. -//! -//! The infallible versions of the traits below are now deprecated. Please enable the -//! `"use-fallible-digital-traits"` feature when building embedded-hal to use the new versions. -//! In the release after next one, the infallible versions will only be available when activating the -//! `"regress-infallible-digital-traits"` and they will be removed in the release after that one.* - -/// Single digital push-pull output pin. *(Infallible version)* -#[deprecated] -#[cfg(not(feature = "use-fallible-digital-traits"))] -pub trait OutputPin { - /// Drives the pin low - /// - /// *NOTE* the actual electrical state of the pin may not actually be low, e.g. due to external - /// electrical sources - fn set_low(&mut self); - - /// Drives the pin high - /// - /// *NOTE* the actual electrical state of the pin may not actually be high, e.g. due to external - /// electrical sources - fn set_high(&mut self); -} /// Single digital push-pull output pin. -/// -/// *Fallible version. This will become the default after the next release.* -#[cfg(feature = "use-fallible-digital-traits")] pub trait OutputPin { /// Error type type Error; @@ -43,29 +18,10 @@ pub trait OutputPin { fn set_high(&mut self) -> Result<(), Self::Error>; } -/// Push-pull output pin that can read its output state. *(Infallible version)* -/// -/// *This trait is available if embedded-hal is built with the `"unproven"` feature.* -#[deprecated] -#[cfg(all(feature = "unproven", not(feature = "use-fallible-digital-traits")))] -pub trait StatefulOutputPin { - /// Is the pin in drive high mode? - /// - /// *NOTE* this does *not* read the electrical state of the pin - fn is_set_high(&self) -> bool; - - /// Is the pin in drive low mode? - /// - /// *NOTE* this does *not* read the electrical state of the pin - fn is_set_low(&self) -> bool; -} - /// Push-pull output pin that can read its output state /// -/// *Fallible version. This will become the default after the next release.* -/// /// *This trait is available if embedded-hal is built with the `"unproven"` feature.* -#[cfg(all(feature = "unproven", feature = "use-fallible-digital-traits"))] +#[cfg(feature = "unproven")] pub trait StatefulOutputPin : OutputPin { /// Is the pin in drive high mode? /// @@ -80,15 +36,13 @@ pub trait StatefulOutputPin : OutputPin { /// Output pin that can be toggled. /// -/// *Fallible version. This will become the default after the next release.* -/// /// *This trait is available if embedded-hal is built with the `"unproven"` feature.* /// /// See [toggleable](toggleable) to use a software implementation if /// both [OutputPin](trait.OutputPin.html) and /// [StatefulOutputPin](trait.StatefulOutputPin.html) are /// implemented. Otherwise, implement this using hardware mechanisms. -#[cfg(all(feature = "unproven", feature = "use-fallible-digital-traits"))] +#[cfg(feature = "unproven")] pub trait ToggleableOutputPin { /// Error type type Error; @@ -97,26 +51,10 @@ pub trait ToggleableOutputPin { fn toggle(&mut self) -> Result<(), Self::Error>; } -/// Output pin that can be toggled. *(Infallible version)* -/// -/// *This trait is available if embedded-hal is built with the `"unproven"` feature.* -/// -/// See [toggleable](toggleable) to use a software implementation if -/// both [OutputPin](trait.OutputPin.html) and -/// [StatefulOutputPin](trait.StatefulOutputPin.html) are -/// implemented. Otherwise, implement this using hardware mechanisms. -#[deprecated] -#[cfg(all(feature = "unproven", not(feature = "use-fallible-digital-traits")))] -pub trait ToggleableOutputPin { - /// Toggle pin output. - fn toggle(&mut self); -} - /// If you can read **and** write the output state, a pin is /// toggleable by software. /// /// ``` -/// #[allow(deprecated)] /// use embedded_hal::digital::{OutputPin, StatefulOutputPin, ToggleableOutputPin}; /// use embedded_hal::digital::toggleable; /// @@ -125,18 +63,6 @@ pub trait ToggleableOutputPin { /// state: bool /// } /// -/// #[cfg(not(feature = "use-fallible-digital-traits"))] -/// #[allow(deprecated)] -/// impl OutputPin for MyPin { -/// fn set_low(&mut self){ -/// self.state = false; -/// } -/// fn set_high(&mut self){ -/// self.state = true; -/// } -/// } -/// -/// #[cfg(feature = "use-fallible-digital-traits")] /// impl OutputPin for MyPin { /// type Error = void::Void; /// @@ -150,18 +76,6 @@ pub trait ToggleableOutputPin { /// } /// } /// -/// #[cfg(not(feature = "use-fallible-digital-traits"))] -/// #[allow(deprecated)] -/// impl StatefulOutputPin for MyPin { -/// fn is_set_low(&self) -> bool { -/// !self.state -/// } -/// fn is_set_high(&self) -> bool { -/// self.state -/// } -/// } -/// -/// #[cfg(feature = "use-fallible-digital-traits")] /// impl StatefulOutputPin for MyPin { /// fn is_set_low(&self) -> Result { /// Ok(!self.state) @@ -175,21 +89,10 @@ pub trait ToggleableOutputPin { /// impl toggleable::Default for MyPin {} /// /// let mut pin = MyPin { state: false }; -/// #[cfg(feature = "use-fallible-digital-traits")] -/// { -/// pin.toggle().unwrap(); -/// assert!(pin.is_set_high().unwrap()); -/// pin.toggle().unwrap(); -/// assert!(pin.is_set_low().unwrap()); -/// } -/// #[cfg(not(feature = "use-fallible-digital-traits"))] -/// { -/// // deprecated -/// pin.toggle(); -/// assert!(pin.is_set_high()); -/// pin.toggle(); -/// assert!(pin.is_set_low()); -/// } +/// pin.toggle().unwrap(); +/// assert!(pin.is_set_high().unwrap()); +/// pin.toggle().unwrap(); +/// assert!(pin.is_set_low().unwrap()); /// ``` #[cfg(feature = "unproven")] #[allow(deprecated)] @@ -201,22 +104,6 @@ pub mod toggleable { /// *This trait is available if embedded-hal is built with the `"unproven"` feature.* pub trait Default: OutputPin + StatefulOutputPin {} - #[cfg(not(feature = "use-fallible-digital-traits"))] - impl

ToggleableOutputPin for P - where - P: Default, - { - /// Toggle pin output - fn toggle(&mut self) { - if self.is_set_low() { - self.set_high(); - } else { - self.set_low(); - } - } - } - - #[cfg(feature = "use-fallible-digital-traits")] impl

ToggleableOutputPin for P where P: Default, @@ -236,10 +123,8 @@ pub mod toggleable { /// Single digital input pin. /// -/// *Fallible version. This will become the default after the next release.* -/// /// *This trait is available if embedded-hal is built with the `"unproven"` feature.* -#[cfg(all(feature = "unproven", feature = "use-fallible-digital-traits"))] +#[cfg(feature = "unproven")] pub trait InputPin { /// Error type type Error; @@ -251,15 +136,3 @@ pub trait InputPin { fn is_low(&self) -> Result; } -/// Single digital input pin. *(Infallible version)* -/// -/// *This trait is available if embedded-hal is built with the `"unproven"` feature.* -#[deprecated] -#[cfg(all(feature = "unproven", not(feature = "use-fallible-digital-traits")))] -pub trait InputPin { - /// Is the input pin high? - fn is_high(&self) -> bool; - - /// Is the input pin low? - fn is_low(&self) -> bool; -} diff --git a/src/prelude.rs b/src/prelude.rs index 3f0d55a3a..ce1a5e18a 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -16,12 +16,9 @@ pub use blocking::spi::{ Transfer as _embedded_hal_blocking_spi_Transfer, Write as _embedded_hal_blocking_spi_Write, }; #[cfg(feature = "unproven")] -#[allow(deprecated)] pub use digital::InputPin as _embedded_hal_digital_InputPin; -#[allow(deprecated)] pub use digital::OutputPin as _embedded_hal_digital_OutputPin; #[cfg(feature = "unproven")] -#[allow(deprecated)] pub use digital::ToggleableOutputPin as _embedded_hal_digital_ToggleableOutputPin; pub use serial::Read as _embedded_hal_serial_Read; pub use serial::Write as _embedded_hal_serial_Write; From 3422af28a9f7d4ca31bc003c732f55be54e58be0 Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Tue, 16 Oct 2018 19:29:22 +0200 Subject: [PATCH 17/17] Remove builds with use-fallible-digital-traits feature --- .travis.yml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 99430faa1..90b163985 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,22 +17,6 @@ matrix: rust: nightly if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) - - env: TARGET=x86_64-unknown-linux-gnu FEATURES=unproven,use-fallible-digital-traits - if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) - - - env: TARGET=thumbv6m-none-eabi FEATURES=unproven,use-fallible-digital-traits - rust: beta - if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) - - - env: TARGET=thumbv7m-none-eabi FEATURES=unproven,use-fallible-digital-traits - rust: beta - if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) - - - env: TARGET=x86_64-unknown-linux-gnu FEATURES=unproven,use-fallible-digital-traits - rust: nightly - if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) - - before_install: set -e install: