diff options
| author | Jakob <[email protected]> | 2025-06-11 09:24:00 +0200 |
|---|---|---|
| committer | Jakob <[email protected]> | 2025-06-11 09:24:00 +0200 |
| commit | 0ee77f50aacdc39aabae1881304a7c744adc24c5 (patch) | |
| tree | 734e975aebb77707aaa9e860d51ea2e511cf096e /embassy-stm32 | |
| parent | 56d76aeb7bccfebf07f0ad5ad9da8d9d36b0865d (diff) | |
Add separate case for center aligned mode
Diffstat (limited to 'embassy-stm32')
| -rw-r--r-- | embassy-stm32/src/timer/complementary_pwm.rs | 6 |
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. |
