aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32
diff options
context:
space:
mode:
authorJakob <[email protected]>2025-06-11 09:24:00 +0200
committerJakob <[email protected]>2025-06-11 09:24:00 +0200
commit0ee77f50aacdc39aabae1881304a7c744adc24c5 (patch)
tree734e975aebb77707aaa9e860d51ea2e511cf096e /embassy-stm32
parent56d76aeb7bccfebf07f0ad5ad9da8d9d36b0865d (diff)
Add separate case for center aligned mode
Diffstat (limited to 'embassy-stm32')
-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.