aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-stm32/src/timer/complementary_pwm.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/embassy-stm32/src/timer/complementary_pwm.rs b/embassy-stm32/src/timer/complementary_pwm.rs
index d51b5a8fc..1a840650a 100644
--- a/embassy-stm32/src/timer/complementary_pwm.rs
+++ b/embassy-stm32/src/timer/complementary_pwm.rs
@@ -121,7 +121,11 @@ impl<'d, T: AdvancedInstance4Channel> ComplementaryPwm<'d, T> {
121 /// 121 ///
122 /// This value depends on the configured frequency and the timer's clock rate from RCC. 122 /// This value depends on the configured frequency and the timer's clock rate from RCC.
123 pub fn get_max_duty(&self) -> u16 { 123 pub fn get_max_duty(&self) -> u16 {
124 self.inner.get_max_compare_value() as u16 124 if self.inner.get_counting_mode().is_center_aligned() {
125 self.inner.get_max_compare_value() as u16
126 } else {
127 self.inner.get_max_compare_value() as u16 + 1
128 }
125 } 129 }
126 130
127 /// Set the duty for a given channel. 131 /// Set the duty for a given channel.