diff options
| author | xoviat <[email protected]> | 2025-11-25 08:54:11 -0600 |
|---|---|---|
| committer | xoviat <[email protected]> | 2025-11-25 08:54:11 -0600 |
| commit | 2612f07f549fa0b9d8565ef760814d5f7ebea785 (patch) | |
| tree | e2227fbac5f2c404130c444cd1b31a4c53b3b31e /embassy-stm32/src/timer/simple_pwm.rs | |
| parent | 424d9d3aa961d4170be96ac23331aa5a3cba3e5b (diff) | |
cleanup low-level timer methods
Diffstat (limited to 'embassy-stm32/src/timer/simple_pwm.rs')
| -rw-r--r-- | embassy-stm32/src/timer/simple_pwm.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/embassy-stm32/src/timer/simple_pwm.rs b/embassy-stm32/src/timer/simple_pwm.rs index 15399b108..eb1b66358 100644 --- a/embassy-stm32/src/timer/simple_pwm.rs +++ b/embassy-stm32/src/timer/simple_pwm.rs | |||
| @@ -316,9 +316,11 @@ impl<'d, T: GeneralInstance4Channel> SimplePwm<'d, T> { | |||
| 316 | /// You will need to provide corresponding `TIMx_UP` DMA channel to use this method. | 316 | /// You will need to provide corresponding `TIMx_UP` DMA channel to use this method. |
| 317 | /// Also be aware that embassy timers use one of timers internally. It is possible to | 317 | /// Also be aware that embassy timers use one of timers internally. It is possible to |
| 318 | /// switch this timer by using `time-driver-timX` feature. | 318 | /// switch this timer by using `time-driver-timX` feature. |
| 319 | #[inline(always)] | ||
| 320 | pub async fn waveform_up(&mut self, dma: Peri<'_, impl super::UpDma<T>>, channel: Channel, duty: &[u16]) { | 319 | pub async fn waveform_up(&mut self, dma: Peri<'_, impl super::UpDma<T>>, channel: Channel, duty: &[u16]) { |
| 321 | self.inner.waveform_up(dma, channel, duty).await; | 320 | self.inner.enable_channel(channel, true); |
| 321 | self.inner.enable_update_dma(true); | ||
| 322 | self.inner.setup_update_dma(dma, channel, duty).await; | ||
| 323 | self.inner.enable_update_dma(false); | ||
| 322 | } | 324 | } |
| 323 | 325 | ||
| 324 | /// Generate a multichannel sequence of PWM waveforms using DMA triggered by timer update events. | 326 | /// Generate a multichannel sequence of PWM waveforms using DMA triggered by timer update events. |
| @@ -350,7 +352,6 @@ impl<'d, T: GeneralInstance4Channel> SimplePwm<'d, T> { | |||
| 350 | /// Also be aware that embassy timers use one of timers internally. It is possible to | 352 | /// Also be aware that embassy timers use one of timers internally. It is possible to |
| 351 | /// switch this timer by using `time-driver-timX` feature. | 353 | /// switch this timer by using `time-driver-timX` feature. |
| 352 | /// | 354 | /// |
| 353 | #[inline(always)] | ||
| 354 | pub async fn waveform_up_multi_channel( | 355 | pub async fn waveform_up_multi_channel( |
| 355 | &mut self, | 356 | &mut self, |
| 356 | dma: Peri<'_, impl super::UpDma<T>>, | 357 | dma: Peri<'_, impl super::UpDma<T>>, |
| @@ -358,9 +359,11 @@ impl<'d, T: GeneralInstance4Channel> SimplePwm<'d, T> { | |||
| 358 | ending_channel: Channel, | 359 | ending_channel: Channel, |
| 359 | duty: &[u16], | 360 | duty: &[u16], |
| 360 | ) { | 361 | ) { |
| 362 | self.inner.enable_update_dma(true); | ||
| 361 | self.inner | 363 | self.inner |
| 362 | .waveform_up_multi_channel(dma, starting_channel, ending_channel, duty) | 364 | .setup_update_dma_burst(dma, starting_channel, ending_channel, duty) |
| 363 | .await; | 365 | .await; |
| 366 | self.inner.enable_update_dma(false); | ||
| 364 | } | 367 | } |
| 365 | } | 368 | } |
| 366 | 369 | ||
