diff --git a/CHANGELOG.md b/CHANGELOG.md index 324c55907..c05922753 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] -## [v0.2.0] - 2018-05-11 +## [v0.2.0] - 2018-05-12 + +### Added + +- A `ToggeableOutputPin` trait has been added. This trait contains a single method: `toggle` that + can be used to toggle the state of a push-pull pin. ### Changed @@ -19,6 +24,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/). [`Void`]: https://docs.rs/void/1.0.2/void/enum.Void.html [`void`]: https://crates.io/crates/void +- [breaking-change] the `OutputPin.is_{low,high}` methods have been moved into its own trait + `StatefulOutputPin` and renamed to `is_set_{low,high}`. + +- It has been clarified in the documentation that `OutputPin` must be implemented for push-pull + output pins (and e.g. not for open drain output pins). + ## [v0.1.2] - 2018-02-14 ### Added diff --git a/Cargo.toml b/Cargo.toml index 225fce0c7..e4ae4d711 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "embedded-hal" readme = "README.md" repository = "https://github.com/japaric/embedded-hal" -version = "0.1.2" +version = "0.2.0" [dependencies.void] default-features = false diff --git a/src/digital.rs b/src/digital.rs index 897c1525d..077375036 100644 --- a/src/digital.rs +++ b/src/digital.rs @@ -1,21 +1,31 @@ //! Digital I/O -/// Single digital output pin +/// Single digital push-pull output pin pub trait OutputPin { - /// Sets the pin low + /// 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); - /// Sets the pin high + /// 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); } -/// Output pin that can read its output state +/// Push-pull output pin that can read its output state #[cfg(feature = "unproven")] pub trait StatefulOutputPin { - /// Is the pin set to high? + /// 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 set to low? + /// Is the pin in drive low mode? + /// + /// *NOTE* this does *not* read the electrical state of the pin fn is_set_low(&self) -> bool; }