diff options
| author | RaulIQ <[email protected]> | 2025-05-21 16:39:41 +0300 |
|---|---|---|
| committer | RaulIQ <[email protected]> | 2025-05-21 16:39:41 +0300 |
| commit | 62ffc995f179de25d3fc41b420dd0194c94df737 (patch) | |
| tree | 0e5bd8dc519660cf55b8e2e8b0746f361b253a79 | |
| parent | 05c511355638c3a55ab509ef9b2e30f5564b6282 (diff) | |
improve waveform_up_multi_channel documentation
| -rw-r--r-- | embassy-stm32/src/timer/simple_pwm.rs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/embassy-stm32/src/timer/simple_pwm.rs b/embassy-stm32/src/timer/simple_pwm.rs index c6fd169fc..972a3852c 100644 --- a/embassy-stm32/src/timer/simple_pwm.rs +++ b/embassy-stm32/src/timer/simple_pwm.rs | |||
| @@ -388,9 +388,27 @@ impl<'d, T: GeneralInstance4Channel> SimplePwm<'d, T> { | |||
| 388 | /// in sequence on each update event (UEV). The data is written via the DMAR register using the | 388 | /// in sequence on each update event (UEV). The data is written via the DMAR register using the |
| 389 | /// DMA base address (DBA) and burst length (DBL) configured in the DCR register. | 389 | /// DMA base address (DBA) and burst length (DBL) configured in the DCR register. |
| 390 | /// | 390 | /// |
| 391 | /// The `duty` buffer must be structured as a flattened 2D array in row-major order, where each row | ||
| 392 | /// represents a single update event and each column corresponds to a specific timer channel (starting | ||
| 393 | /// from `starting_channel` up to and including `ending_channel`). | ||
| 394 | /// | ||
| 395 | /// For example, if using channels 1 through 4, a buffer of 4 update steps might look like: | ||
| 396 | /// | ||
| 397 | /// ```rust | ||
| 398 | /// let dma_buf: [u16; 16] = [ | ||
| 399 | /// ch1_duty_1, ch2_duty_1, ch3_duty_1, ch4_duty_1, // update 1 | ||
| 400 | /// ch1_duty_2, ch2_duty_2, ch3_duty_2, ch4_duty_2, // update 2 | ||
| 401 | /// ch1_duty_3, ch2_duty_3, ch3_duty_3, ch4_duty_3, // update 3 | ||
| 402 | /// ch1_duty_4, ch2_duty_4, ch3_duty_4, ch4_duty_4, // update 4 | ||
| 403 | /// ]; | ||
| 404 | /// ``` | ||
| 405 | /// | ||
| 406 | /// Each group of N values (where N = number of channels) is transferred on one update event, | ||
| 407 | /// updating the duty cycles of all selected channels simultaneously. | ||
| 408 | /// | ||
| 391 | /// Note: | 409 | /// Note: |
| 392 | /// you will need to provide corresponding TIMx_UP DMA channel to use this method. | 410 | /// you will need to provide corresponding TIMx_UP DMA channel to use this method. |
| 393 | pub async fn waveform_up_multichannel( | 411 | pub async fn waveform_up_multi_channel( |
| 394 | &mut self, | 412 | &mut self, |
| 395 | dma: Peri<'_, impl super::UpDma<T>>, | 413 | dma: Peri<'_, impl super::UpDma<T>>, |
| 396 | starting_channel: Channel, | 414 | starting_channel: Channel, |
