Skip to content

Commit edb14f8

Browse files
committed
stm32/timer: enable channels for waveform_up multi
1 parent 790940a commit edb14f8

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

embassy-stm32/src/timer/complementary_pwm.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,11 @@ impl<'d, T: AdvancedInstance4Channel> ComplementaryPwm<'d, T> {
263263
ending_channel: Channel,
264264
duty: &[T::Word],
265265
) {
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));
266271
self.inner.enable_update_dma(true);
267272
self.inner
268273
.setup_update_dma_burst(dma, starting_channel, ending_channel, duty)

embassy-stm32/src/timer/simple_pwm.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,11 @@ impl<'d, T: GeneralInstance4Channel> SimplePwm<'d, T> {
387387
ending_channel: Channel,
388388
duty: &[T::Word],
389389
) {
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));
390395
self.inner.enable_update_dma(true);
391396
self.inner
392397
.setup_update_dma_burst(dma, starting_channel, ending_channel, duty)

0 commit comments

Comments
 (0)