From 0b0547874d5280659fd8cafab752d6a4245712be Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Wed, 22 Jul 2020 09:33:52 +0200 Subject: [PATCH] Pwm: 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 825272d51..203feafd5 100644 --- a/src/pwm.rs +++ b/src/pwm.rs @@ -79,6 +79,9 @@ pub trait Pwm { fn try_get_period(&self) -> Result; /// 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, channel: Self::Channel) -> Result; /// Returns the maximum duty cycle value