From d26ccb9c884b50520dd7c52a69c3381c342c8e28 Mon Sep 17 00:00:00 2001 From: chrysn Date: Tue, 28 May 2019 12:44:07 +0200 Subject: [PATCH] PwmPin: allow get_duty to return the old value for some time PWM is often implemented in a buffered way to allow glitch-free operation; as a result, implementing a strict "you get what you last set" is not feasible for some implementations. --- src/pwm.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pwm.rs b/src/pwm.rs index eaa6a92d6..825272d51 100644 --- a/src/pwm.rs +++ b/src/pwm.rs @@ -114,6 +114,9 @@ pub trait PwmPin { fn try_enable(&mut self) -> Result<(), Self::Error>; /// Returns the current duty cycle + /// + /// While the pin is transitioning to the new duty cycle after a `try_set_duty` call, this may + /// return the old or the new duty cycle depending on the implementation. fn try_get_duty(&self) -> Result; /// Returns the maximum duty cycle value