From 613e88f1d2dad3c8f5ea2471bb5b714e180a5ede Mon Sep 17 00:00:00 2001 From: Jacob Rosenthal Date: Wed, 10 Nov 2021 18:53:21 -0700 Subject: [PATCH] fix bug with config.counter_mode --- embassy-nrf/src/pwm.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/embassy-nrf/src/pwm.rs b/embassy-nrf/src/pwm.rs index 5f31b772..8c4a5dae 100644 --- a/embassy-nrf/src/pwm.rs +++ b/embassy-nrf/src/pwm.rs @@ -129,8 +129,10 @@ impl<'d, T: Instance> SequencePwm<'d, T> { w.mode().refresh_count() }); - r.mode - .write(|w| unsafe { w.bits(config.counter_mode as u32) }); + r.mode.write(|w| match config.counter_mode { + CounterMode::UpAndDown => w.updown().up_and_down(), + CounterMode::Up => w.updown().up(), + }); r.prescaler .write(|w| w.prescaler().bits(config.prescaler as u8)); r.countertop