diff options
| author | Jakob <[email protected]> | 2025-06-11 11:48:39 +0200 |
|---|---|---|
| committer | Jakob <[email protected]> | 2025-06-11 11:48:39 +0200 |
| commit | 09967b71f509bdebaf23ab11e3c362e447722240 (patch) | |
| tree | fa1bb5e36016e58211b6fc7f9bb294ff60e5c780 /embassy-stm32 | |
| parent | 0ee77f50aacdc39aabae1881304a7c744adc24c5 (diff) | |
Also update the AdvancedInstace4Channel version
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 1a840650a..fa6164bdd 100644 --- a/embassy-stm32/src/timer/complementary_pwm.rs +++ b/embassy-stm32/src/timer/complementary_pwm.rs | |||
| @@ -175,7 +175,11 @@ impl<'d, T: AdvancedInstance4Channel> embedded_hal_02::Pwm for ComplementaryPwm< | |||
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | fn get_max_duty(&self) -> Self::Duty { | 177 | fn get_max_duty(&self) -> Self::Duty { |
| 178 | self.inner.get_max_compare_value() as u16 + 1 | 178 | if self.inner.get_counting_mode().is_center_aligned() { |
| 179 | self.inner.get_max_compare_value() as u16 | ||
| 180 | } else { | ||
| 181 | self.inner.get_max_compare_value() as u16 + 1 | ||
| 182 | } | ||
| 179 | } | 183 | } |
| 180 | 184 | ||
| 181 | fn set_duty(&mut self, channel: Self::Channel, duty: Self::Duty) { | 185 | fn set_duty(&mut self, channel: Self::Channel, duty: Self::Duty) { |
