aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2025-09-03 10:47:26 +0000
committerGitHub <[email protected]>2025-09-03 10:47:26 +0000
commita3d88ec0651518a3f8b7c8fb19cb816842de7750 (patch)
tree36eb66b23a396af2ca496f90681c83eb80956cab
parent2ef9dfb5122f602255eaa0b3cef440f6f84af33e (diff)
parent089b6722c6c58a023beccdd8f15695f1df0fe117 (diff)
Merge pull request #4635 from RyanCDE/complementary-pwm-polarity-fix
Add timer set polarity functions for main and complementary outputs in complementary_pwm
-rw-r--r--embassy-stm32/CHANGELOG.md1
-rw-r--r--embassy-stm32/src/timer/complementary_pwm.rs10
2 files changed, 11 insertions, 0 deletions
diff --git a/embassy-stm32/CHANGELOG.md b/embassy-stm32/CHANGELOG.md
index c9be259ea..4cc48ed97 100644
--- a/embassy-stm32/CHANGELOG.md
+++ b/embassy-stm32/CHANGELOG.md
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
11- fix: Fixed STM32H5 builds requiring time feature 11- fix: Fixed STM32H5 builds requiring time feature
12- feat: Derive Clone, Copy for QSPI Config 12- feat: Derive Clone, Copy for QSPI Config
13- fix: stm32/i2c in master mode (blocking): subsequent transmissions failed after a NACK was received 13- fix: stm32/i2c in master mode (blocking): subsequent transmissions failed after a NACK was received
14- feat: stm32/timer: add set_polarity functions for main and complementary outputs in complementary_pwm
14 15
15## 0.4.0 - 2025-08-26 16## 0.4.0 - 2025-08-26
16 17
diff --git a/embassy-stm32/src/timer/complementary_pwm.rs b/embassy-stm32/src/timer/complementary_pwm.rs
index b291fc155..7d6c2273e 100644
--- a/embassy-stm32/src/timer/complementary_pwm.rs
+++ b/embassy-stm32/src/timer/complementary_pwm.rs
@@ -185,6 +185,16 @@ impl<'d, T: AdvancedInstance4Channel> ComplementaryPwm<'d, T> {
185 self.inner.set_complementary_output_polarity(channel, polarity); 185 self.inner.set_complementary_output_polarity(channel, polarity);
186 } 186 }
187 187
188 /// Set the main output polarity for a given channel.
189 pub fn set_main_polarity(&mut self, channel: Channel, polarity: OutputPolarity) {
190 self.inner.set_output_polarity(channel, polarity);
191 }
192
193 /// Set the complementary output polarity for a given channel.
194 pub fn set_complementary_polarity(&mut self, channel: Channel, polarity: OutputPolarity) {
195 self.inner.set_complementary_output_polarity(channel, polarity);
196 }
197
188 /// Set the dead time as a proportion of max_duty 198 /// Set the dead time as a proportion of max_duty
189 pub fn set_dead_time(&mut self, value: u16) { 199 pub fn set_dead_time(&mut self, value: u16) {
190 let (ckd, value) = compute_dead_time_value(value); 200 let (ckd, value) = compute_dead_time_value(value);