aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/stm32f4/src/bin/ws2812_pwm_dma.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/examples/stm32f4/src/bin/ws2812_pwm_dma.rs b/examples/stm32f4/src/bin/ws2812_pwm_dma.rs
index c4181d024..cdce36f2e 100644
--- a/examples/stm32f4/src/bin/ws2812_pwm_dma.rs
+++ b/examples/stm32f4/src/bin/ws2812_pwm_dma.rs
@@ -21,6 +21,7 @@
21use embassy_executor::Spawner; 21use embassy_executor::Spawner;
22use embassy_stm32::gpio::OutputType; 22use embassy_stm32::gpio::OutputType;
23use embassy_stm32::pac; 23use embassy_stm32::pac;
24use embassy_stm32::pac::timer::vals::Ocpe;
24use embassy_stm32::time::khz; 25use embassy_stm32::time::khz;
25use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm}; 26use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm};
26use embassy_stm32::timer::{Channel, CountingMode}; 27use embassy_stm32::timer::{Channel, CountingMode};
@@ -89,6 +90,12 @@ async fn main(_spawner: Spawner) {
89 90
90 let pwm_channel = Channel::Ch1; 91 let pwm_channel = Channel::Ch1;
91 92
93 // PAC level hacking, enable output compare preload
94 // keep output waveform integrity
95 pac::TIM3
96 .ccmr_output(pwm_channel.index())
97 .modify(|v| v.set_ocpe(0, Ocpe::ENABLED));
98
92 // make sure PWM output keep low on first start 99 // make sure PWM output keep low on first start
93 ws2812_pwm.set_duty(pwm_channel, 0); 100 ws2812_pwm.set_duty(pwm_channel, 0);
94 101