aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxoviat <[email protected]>2025-11-27 20:19:06 -0600
committerxoviat <[email protected]>2025-11-27 20:19:06 -0600
commitedb14f8c0966e1d22f396cbd631e5835a9a5104b (patch)
tree17c7d5c1f37008cd87731538e80c06a54f6763d9
parent790940a18c093fb7c7f94585be81d7d02892b4fb (diff)
stm32/timer: enable channels for waveform_up multi
-rw-r--r--embassy-stm32/src/timer/complementary_pwm.rs5
-rw-r--r--embassy-stm32/src/timer/simple_pwm.rs5
2 files changed, 10 insertions, 0 deletions
diff --git a/embassy-stm32/src/timer/complementary_pwm.rs b/embassy-stm32/src/timer/complementary_pwm.rs
index d194899c6..996759060 100644
--- a/embassy-stm32/src/timer/complementary_pwm.rs
+++ b/embassy-stm32/src/timer/complementary_pwm.rs
@@ -263,6 +263,11 @@ impl<'d, T: AdvancedInstance4Channel> ComplementaryPwm<'d, T> {
263 ending_channel: Channel, 263 ending_channel: Channel,
264 duty: &[T::Word], 264 duty: &[T::Word],
265 ) { 265 ) {
266 [Channel::Ch1, Channel::Ch2, Channel::Ch3, Channel::Ch4]
267 .iter()
268 .filter(|ch| ch.index() >= starting_channel.index())
269 .filter(|ch| ch.index() <= ending_channel.index())
270 .for_each(|ch| self.inner.enable_channel(*ch, true));
266 self.inner.enable_update_dma(true); 271 self.inner.enable_update_dma(true);
267 self.inner 272 self.inner
268 .setup_update_dma_burst(dma, starting_channel, ending_channel, duty) 273 .setup_update_dma_burst(dma, starting_channel, ending_channel, duty)
diff --git a/embassy-stm32/src/timer/simple_pwm.rs b/embassy-stm32/src/timer/simple_pwm.rs
index 8dc84cdfa..466c56db2 100644
--- a/embassy-stm32/src/timer/simple_pwm.rs
+++ b/embassy-stm32/src/timer/simple_pwm.rs
@@ -387,6 +387,11 @@ impl<'d, T: GeneralInstance4Channel> SimplePwm<'d, T> {
387 ending_channel: Channel, 387 ending_channel: Channel,
388 duty: &[T::Word], 388 duty: &[T::Word],
389 ) { 389 ) {
390 [Channel::Ch1, Channel::Ch2, Channel::Ch3, Channel::Ch4]
391 .iter()
392 .filter(|ch| ch.index() >= starting_channel.index())
393 .filter(|ch| ch.index() <= ending_channel.index())
394 .for_each(|ch| self.inner.enable_channel(*ch, true));
390 self.inner.enable_update_dma(true); 395 self.inner.enable_update_dma(true);
391 self.inner 396 self.inner
392 .setup_update_dma_burst(dma, starting_channel, ending_channel, duty) 397 .setup_update_dma_burst(dma, starting_channel, ending_channel, duty)