diff --git a/CHANGELOG.md b/CHANGELOG.md index d5b14d86b..ab8ce5e52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Added - A nonblocking trait for interfacing with random number generation hardware. +- Methods to enable or disable all channels for a PWM object ### Changed - All traits have been marked as proven (`unproven` feature has been removed). @@ -26,6 +27,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - A new [process](https://github.com/rust-embedded/embedded-hal#how-to-add-a-new-trait) has been adopted for the addition of traits to the embedded-hal. - The minimum supported Rust version is 1.35 due to [this issue](https://github.com/rust-lang/rust/issues/54973). +- Renamed the existing PWM try_enable/try_disable methods to try_enable_channel/try_disable_channel to make room for new try_enable/try_disable methods ## [v0.2.3] - 2019-05-09 diff --git a/src/pwm.rs b/src/pwm.rs index eaa6a92d6..3bb67d76b 100644 --- a/src/pwm.rs +++ b/src/pwm.rs @@ -39,8 +39,10 @@ /// # type Channel = Channel; /// # type Time = KiloHertz; /// # type Duty = u16; -/// # fn try_disable(&mut self, _: Channel) -> Result<(), Self::Error> { unimplemented!() } -/// # fn try_enable(&mut self, _: Channel) -> Result<(), Self::Error> { unimplemented!() } +/// # fn try_disable(&mut self) -> Result<(), Self::Error> { unimplemented!() } +/// # fn try_enable(&mut self) -> Result<(), Self::Error> { unimplemented!() } +/// # fn try_disable_channel(&mut self, _: Channel) -> Result<(), Self::Error> { unimplemented!() } +/// # fn try_enable_channel(&mut self, _: Channel) -> Result<(), Self::Error> { unimplemented!() } /// # fn try_get_duty(&self, _: Channel) -> Result { unimplemented!() } /// # fn try_get_max_duty(&self) -> Result { Ok(0) } /// # fn try_set_duty(&mut self, _: Channel, _: u16) -> Result<(), Self::Error> { Ok(()) } @@ -69,11 +71,17 @@ pub trait Pwm { /// (e.g. `0.0 .. 1.0`) or an integer representation (e.g. `0 .. 65535`) type Duty; + /// Disables all channels on the timer + fn try_disable(&mut self) -> Result<(), Self::Error>; + + /// Enables all channels on the timer + fn try_enable(&mut self) -> Result<(), Self::Error>; + /// Disables a PWM `channel` - fn try_disable(&mut self, channel: Self::Channel) -> Result<(), Self::Error>; + fn try_disable_channel(&mut self, channel: Self::Channel) -> Result<(), Self::Error>; /// Enables a PWM `channel` - fn try_enable(&mut self, channel: Self::Channel) -> Result<(), Self::Error>; + fn try_enable_channel(&mut self, channel: Self::Channel) -> Result<(), Self::Error>; /// Returns the current PWM period fn try_get_period(&self) -> Result;