diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-12-19 17:35:38 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2023-12-19 17:35:38 +0100 |
| commit | 189b15c426a3a9ef7d4024ba7e5de6a255f88ee7 (patch) | |
| tree | 50a5c64c14cd2b920bc99ebcbd7fdf276ebe0ae0 /examples | |
| parent | 41c3c26beb5d9ef683073c257c1269307be6ad43 (diff) | |
stm32/timer: docs.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/stm32f4/src/bin/ws2812_pwm_dma.rs | 2 | ||||
| -rw-r--r-- | examples/stm32h7/src/bin/low_level_timer_api.rs | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/examples/stm32f4/src/bin/ws2812_pwm_dma.rs b/examples/stm32f4/src/bin/ws2812_pwm_dma.rs index 52cc665c7..39f5d3421 100644 --- a/examples/stm32f4/src/bin/ws2812_pwm_dma.rs +++ b/examples/stm32f4/src/bin/ws2812_pwm_dma.rs | |||
| @@ -110,7 +110,7 @@ async fn main(_spawner: Spawner) { | |||
| 110 | &mut dp.DMA1_CH2, | 110 | &mut dp.DMA1_CH2, |
| 111 | 5, | 111 | 5, |
| 112 | color_list[color_list_index], | 112 | color_list[color_list_index], |
| 113 | pac::TIM3.ccr(pwm_channel.raw()).as_ptr() as *mut _, | 113 | pac::TIM3.ccr(pwm_channel.index()).as_ptr() as *mut _, |
| 114 | dma_transfer_option, | 114 | dma_transfer_option, |
| 115 | ) | 115 | ) |
| 116 | .await; | 116 | .await; |
diff --git a/examples/stm32h7/src/bin/low_level_timer_api.rs b/examples/stm32h7/src/bin/low_level_timer_api.rs index e0be495d1..394ed3281 100644 --- a/examples/stm32h7/src/bin/low_level_timer_api.rs +++ b/examples/stm32h7/src/bin/low_level_timer_api.rs | |||
| @@ -85,7 +85,7 @@ impl<'d, T: CaptureCompare32bitInstance> SimplePwm32<'d, T> { | |||
| 85 | 85 | ||
| 86 | let mut this = Self { inner: tim }; | 86 | let mut this = Self { inner: tim }; |
| 87 | 87 | ||
| 88 | this.set_freq(freq); | 88 | this.set_frequency(freq); |
| 89 | this.inner.start(); | 89 | this.inner.start(); |
| 90 | 90 | ||
| 91 | let r = T::regs_gp32(); | 91 | let r = T::regs_gp32(); |
| @@ -102,14 +102,14 @@ impl<'d, T: CaptureCompare32bitInstance> SimplePwm32<'d, T> { | |||
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | pub fn enable(&mut self, channel: Channel) { | 104 | pub fn enable(&mut self, channel: Channel) { |
| 105 | T::regs_gp32().ccer().modify(|w| w.set_cce(channel.raw(), true)); | 105 | T::regs_gp32().ccer().modify(|w| w.set_cce(channel.index(), true)); |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | pub fn disable(&mut self, channel: Channel) { | 108 | pub fn disable(&mut self, channel: Channel) { |
| 109 | T::regs_gp32().ccer().modify(|w| w.set_cce(channel.raw(), false)); | 109 | T::regs_gp32().ccer().modify(|w| w.set_cce(channel.index(), false)); |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | pub fn set_freq(&mut self, freq: Hertz) { | 112 | pub fn set_frequency(&mut self, freq: Hertz) { |
| 113 | <T as embassy_stm32::timer::low_level::GeneralPurpose32bitInstance>::set_frequency(&mut self.inner, freq); | 113 | <T as embassy_stm32::timer::low_level::GeneralPurpose32bitInstance>::set_frequency(&mut self.inner, freq); |
| 114 | } | 114 | } |
| 115 | 115 | ||
| @@ -119,6 +119,6 @@ impl<'d, T: CaptureCompare32bitInstance> SimplePwm32<'d, T> { | |||
| 119 | 119 | ||
| 120 | pub fn set_duty(&mut self, channel: Channel, duty: u32) { | 120 | pub fn set_duty(&mut self, channel: Channel, duty: u32) { |
| 121 | defmt::assert!(duty < self.get_max_duty()); | 121 | defmt::assert!(duty < self.get_max_duty()); |
| 122 | T::regs_gp32().ccr(channel.raw()).modify(|w| w.set_ccr(duty)) | 122 | T::regs_gp32().ccr(channel.index()).modify(|w| w.set_ccr(duty)) |
| 123 | } | 123 | } |
| 124 | } | 124 | } |
