From 3a166db2800c2b4a141d955d035bb3120a2ac757 Mon Sep 17 00:00:00 2001 From: Jacob Rosenthal Date: Sat, 13 Nov 2021 16:41:44 -0700 Subject: [PATCH] nrf: pwm use register reset --- embassy-nrf/src/pwm.rs | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/embassy-nrf/src/pwm.rs b/embassy-nrf/src/pwm.rs index 206be5af..48a826e9 100644 --- a/embassy-nrf/src/pwm.rs +++ b/embassy-nrf/src/pwm.rs @@ -336,23 +336,23 @@ impl<'a, T: Instance> Drop for SequencePwm<'a, T> { if let Some(pin) = &self.ch0 { pin.set_low(); - pin.conf().write(|w| w); - r.psel.out[0].write(|w| unsafe { w.bits(0x80000000) }); + pin.conf().reset(); + r.psel.out[0].reset(); } if let Some(pin) = &self.ch1 { pin.set_low(); - pin.conf().write(|w| w); - r.psel.out[1].write(|w| unsafe { w.bits(0x80000000) }); + pin.conf().reset(); + r.psel.out[1].reset(); } if let Some(pin) = &self.ch2 { pin.set_low(); - pin.conf().write(|w| w); - r.psel.out[2].write(|w| unsafe { w.bits(0x80000000) }); + pin.conf().reset(); + r.psel.out[2].reset(); } if let Some(pin) = &self.ch3 { pin.set_low(); - pin.conf().write(|w| w); - r.psel.out[3].write(|w| unsafe { w.bits(0x80000000) }); + pin.conf().reset(); + r.psel.out[3].reset(); } } } @@ -616,23 +616,23 @@ impl<'a, T: Instance> Drop for SimplePwm<'a, T> { if let Some(pin) = &self.ch0 { pin.set_low(); - pin.conf().write(|w| w); - r.psel.out[0].write(|w| unsafe { w.bits(0x80000000) }); + pin.conf().reset(); + r.psel.out[0].reset(); } if let Some(pin) = &self.ch1 { pin.set_low(); - pin.conf().write(|w| w); - r.psel.out[1].write(|w| unsafe { w.bits(0x80000000) }); + pin.conf().reset(); + r.psel.out[1].reset(); } if let Some(pin) = &self.ch2 { pin.set_low(); - pin.conf().write(|w| w); - r.psel.out[2].write(|w| unsafe { w.bits(0x80000000) }); + pin.conf().reset(); + r.psel.out[2].reset(); } if let Some(pin) = &self.ch3 { pin.set_low(); - pin.conf().write(|w| w); - r.psel.out[3].write(|w| unsafe { w.bits(0x80000000) }); + pin.conf().reset(); + r.psel.out[3].reset(); } } }