diff options
| author | xoviat <[email protected]> | 2025-11-14 16:29:49 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-11-14 16:29:49 +0000 |
| commit | 709b157620dd1f2f270ae9b874f62ac8b810da22 (patch) | |
| tree | 80d9b3e6af71e4d4969b92935bac17a2102c7e64 /embassy-stm32/src/timer | |
| parent | a6d392b24c5f010a8b5b2a00326c04b05a4ab0f0 (diff) | |
| parent | f440a3e19584aa8c1c5df742b964ae417cf705a1 (diff) | |
Merge pull request #4833 from plaes/stm32-pwm-docs-misc
stm32/timer/simplepwm: Fix docs formatting and clarify timer usage
Diffstat (limited to 'embassy-stm32/src/timer')
| -rw-r--r-- | embassy-stm32/src/timer/simple_pwm.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/embassy-stm32/src/timer/simple_pwm.rs b/embassy-stm32/src/timer/simple_pwm.rs index 36303aeb4..c338b0fd4 100644 --- a/embassy-stm32/src/timer/simple_pwm.rs +++ b/embassy-stm32/src/timer/simple_pwm.rs | |||
| @@ -309,7 +309,9 @@ impl<'d, T: GeneralInstance4Channel> SimplePwm<'d, T> { | |||
| 309 | /// Generate a sequence of PWM waveform | 309 | /// Generate a sequence of PWM waveform |
| 310 | /// | 310 | /// |
| 311 | /// Note: | 311 | /// Note: |
| 312 | /// you will need to provide corresponding TIMx_UP DMA channel to use this method. | 312 | /// You will need to provide corresponding `TIMx_UP` DMA channel to use this method. |
| 313 | /// Also be aware that embassy timers use one of timers internally. It is possible to | ||
| 314 | /// switch this timer by using `time-driver-timX` feature. | ||
| 313 | pub async fn waveform_up(&mut self, dma: Peri<'_, impl super::UpDma<T>>, channel: Channel, duty: &[u16]) { | 315 | pub async fn waveform_up(&mut self, dma: Peri<'_, impl super::UpDma<T>>, channel: Channel, duty: &[u16]) { |
| 314 | #[allow(clippy::let_unit_value)] // eg. stm32f334 | 316 | #[allow(clippy::let_unit_value)] // eg. stm32f334 |
| 315 | let req = dma.request(); | 317 | let req = dma.request(); |
| @@ -397,18 +399,23 @@ impl<'d, T: GeneralInstance4Channel> SimplePwm<'d, T> { | |||
| 397 | /// | 399 | /// |
| 398 | /// For example, if using channels 1 through 4, a buffer of 4 update steps might look like: | 400 | /// For example, if using channels 1 through 4, a buffer of 4 update steps might look like: |
| 399 | /// | 401 | /// |
| 402 | /// ```rust,ignore | ||
| 400 | /// let dma_buf: [u16; 16] = [ | 403 | /// let dma_buf: [u16; 16] = [ |
| 401 | /// ch1_duty_1, ch2_duty_1, ch3_duty_1, ch4_duty_1, // update 1 | 404 | /// ch1_duty_1, ch2_duty_1, ch3_duty_1, ch4_duty_1, // update 1 |
| 402 | /// ch1_duty_2, ch2_duty_2, ch3_duty_2, ch4_duty_2, // update 2 | 405 | /// ch1_duty_2, ch2_duty_2, ch3_duty_2, ch4_duty_2, // update 2 |
| 403 | /// ch1_duty_3, ch2_duty_3, ch3_duty_3, ch4_duty_3, // update 3 | 406 | /// ch1_duty_3, ch2_duty_3, ch3_duty_3, ch4_duty_3, // update 3 |
| 404 | /// ch1_duty_4, ch2_duty_4, ch3_duty_4, ch4_duty_4, // update 4 | 407 | /// ch1_duty_4, ch2_duty_4, ch3_duty_4, ch4_duty_4, // update 4 |
| 405 | /// ]; | 408 | /// ]; |
| 409 | /// ``` | ||
| 406 | /// | 410 | /// |
| 407 | /// Each group of N values (where N = number of channels) is transferred on one update event, | 411 | /// Each group of `N` values (where `N` is number of channels) is transferred on one update event, |
| 408 | /// updating the duty cycles of all selected channels simultaneously. | 412 | /// updating the duty cycles of all selected channels simultaneously. |
| 409 | /// | 413 | /// |
| 410 | /// Note: | 414 | /// Note: |
| 411 | /// you will need to provide corresponding TIMx_UP DMA channel to use this method. | 415 | /// You will need to provide corresponding `TIMx_UP` DMA channel to use this method. |
| 416 | /// Also be aware that embassy timers use one of timers internally. It is possible to | ||
| 417 | /// switch this timer by using `time-driver-timX` feature. | ||
| 418 | /// | ||
| 412 | pub async fn waveform_up_multi_channel( | 419 | pub async fn waveform_up_multi_channel( |
| 413 | &mut self, | 420 | &mut self, |
| 414 | dma: Peri<'_, impl super::UpDma<T>>, | 421 | dma: Peri<'_, impl super::UpDma<T>>, |
