diff options
| author | xoviat <[email protected]> | 2023-10-14 04:09:57 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-10-14 04:09:57 +0000 |
| commit | 575db172643a6fe5b853c331a3ac640f11f92984 (patch) | |
| tree | 259bd0f84eb94cb0f1541eba639776ee5510addb | |
| parent | 0aa99e66f7173b35e263cb1bb8919aa513a08204 (diff) | |
| parent | 9a7fda87b0335471e2944a57af684cf4b184ce07 (diff) | |
Merge pull request #2053 from jr-oss/fix_stm32_advanced_timer_enable_output
STM32: Fix regression in advanced timer to enable output of PWM signa…
| -rw-r--r-- | embassy-stm32/src/timer/complementary_pwm.rs | 2 | ||||
| -rw-r--r-- | embassy-stm32/src/timer/mod.rs | 14 | ||||
| -rw-r--r-- | embassy-stm32/src/timer/simple_pwm.rs | 2 |
3 files changed, 13 insertions, 5 deletions
diff --git a/embassy-stm32/src/timer/complementary_pwm.rs b/embassy-stm32/src/timer/complementary_pwm.rs index 9349a6fad..e1baf6b2e 100644 --- a/embassy-stm32/src/timer/complementary_pwm.rs +++ b/embassy-stm32/src/timer/complementary_pwm.rs | |||
| @@ -71,7 +71,7 @@ impl<'d, T: ComplementaryCaptureCompare16bitInstance> ComplementaryPwm<'d, T> { | |||
| 71 | this.inner.set_frequency(freq); | 71 | this.inner.set_frequency(freq); |
| 72 | this.inner.start(); | 72 | this.inner.start(); |
| 73 | 73 | ||
| 74 | this.inner.enable_outputs(true); | 74 | this.inner.enable_outputs(); |
| 75 | 75 | ||
| 76 | this.inner | 76 | this.inner |
| 77 | .set_output_compare_mode(Channel::Ch1, OutputCompareMode::PwmMode1); | 77 | .set_output_compare_mode(Channel::Ch1, OutputCompareMode::PwmMode1); |
diff --git a/embassy-stm32/src/timer/mod.rs b/embassy-stm32/src/timer/mod.rs index 1e0999ed3..4b88834cb 100644 --- a/embassy-stm32/src/timer/mod.rs +++ b/embassy-stm32/src/timer/mod.rs | |||
| @@ -173,7 +173,7 @@ pub(crate) mod sealed { | |||
| 173 | } | 173 | } |
| 174 | }); | 174 | }); |
| 175 | } | 175 | } |
| 176 | fn enable_outputs(&mut self, _enable: bool) {} | 176 | fn enable_outputs(&mut self); |
| 177 | 177 | ||
| 178 | fn set_output_compare_mode(&mut self, channel: Channel, mode: OutputCompareMode) { | 178 | fn set_output_compare_mode(&mut self, channel: Channel, mode: OutputCompareMode) { |
| 179 | let r = Self::regs_gp16(); | 179 | let r = Self::regs_gp16(); |
| @@ -401,7 +401,9 @@ macro_rules! impl_32bit_timer { | |||
| 401 | #[allow(unused)] | 401 | #[allow(unused)] |
| 402 | macro_rules! impl_compare_capable_16bit { | 402 | macro_rules! impl_compare_capable_16bit { |
| 403 | ($inst:ident) => { | 403 | ($inst:ident) => { |
| 404 | impl sealed::CaptureCompare16bitInstance for crate::peripherals::$inst {} | 404 | impl sealed::CaptureCompare16bitInstance for crate::peripherals::$inst { |
| 405 | fn enable_outputs(&mut self) {} | ||
| 406 | } | ||
| 405 | }; | 407 | }; |
| 406 | } | 408 | } |
| 407 | 409 | ||
| @@ -450,7 +452,13 @@ foreach_interrupt! { | |||
| 450 | impl CaptureCompare16bitInstance for crate::peripherals::$inst {} | 452 | impl CaptureCompare16bitInstance for crate::peripherals::$inst {} |
| 451 | impl ComplementaryCaptureCompare16bitInstance for crate::peripherals::$inst {} | 453 | impl ComplementaryCaptureCompare16bitInstance for crate::peripherals::$inst {} |
| 452 | impl AdvancedControlInstance for crate::peripherals::$inst {} | 454 | impl AdvancedControlInstance for crate::peripherals::$inst {} |
| 453 | impl sealed::CaptureCompare16bitInstance for crate::peripherals::$inst {} | 455 | impl sealed::CaptureCompare16bitInstance for crate::peripherals::$inst { |
| 456 | fn enable_outputs(&mut self) { | ||
| 457 | use crate::timer::sealed::AdvancedControlInstance; | ||
| 458 | let r = Self::regs_advanced(); | ||
| 459 | r.bdtr().modify(|w| w.set_moe(true)); | ||
| 460 | } | ||
| 461 | } | ||
| 454 | impl sealed::ComplementaryCaptureCompare16bitInstance for crate::peripherals::$inst {} | 462 | impl sealed::ComplementaryCaptureCompare16bitInstance for crate::peripherals::$inst {} |
| 455 | impl sealed::GeneralPurpose16bitInstance for crate::peripherals::$inst { | 463 | impl sealed::GeneralPurpose16bitInstance for crate::peripherals::$inst { |
| 456 | fn regs_gp16() -> crate::pac::timer::TimGp16 { | 464 | fn regs_gp16() -> crate::pac::timer::TimGp16 { |
diff --git a/embassy-stm32/src/timer/simple_pwm.rs b/embassy-stm32/src/timer/simple_pwm.rs index 18ecc1964..01773ff3a 100644 --- a/embassy-stm32/src/timer/simple_pwm.rs +++ b/embassy-stm32/src/timer/simple_pwm.rs | |||
| @@ -70,7 +70,7 @@ impl<'d, T: CaptureCompare16bitInstance> SimplePwm<'d, T> { | |||
| 70 | this.inner.set_frequency(freq); | 70 | this.inner.set_frequency(freq); |
| 71 | this.inner.start(); | 71 | this.inner.start(); |
| 72 | 72 | ||
| 73 | this.inner.enable_outputs(true); | 73 | this.inner.enable_outputs(); |
| 74 | 74 | ||
| 75 | this.inner | 75 | this.inner |
| 76 | .set_output_compare_mode(Channel::Ch1, OutputCompareMode::PwmMode1); | 76 | .set_output_compare_mode(Channel::Ch1, OutputCompareMode::PwmMode1); |
