From dbc691fb09b994ad855d4c9f0285026be846ba18 Mon Sep 17 00:00:00 2001 From: Wilfried Chauveau Date: Thu, 25 Aug 2022 18:19:01 +0100 Subject: [PATCH] Temporary disable sticky-bit in set_pins too (#433) --- rp2040-hal/src/pio.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/rp2040-hal/src/pio.rs b/rp2040-hal/src/pio.rs index 37e6559..a8f04f4 100644 --- a/rp2040-hal/src/pio.rs +++ b/rp2040-hal/src/pio.rs @@ -598,6 +598,7 @@ impl StateMachine { // `UninitStateMachine` byt adding a program. pub fn set_pins(&mut self, pins: impl IntoIterator) { let saved_ctrl = self.sm.sm().sm_pinctrl.read(); + let saved_execctrl = self.sm.sm().sm_execctrl.read(); for (pin_num, pin_state) in pins { self.sm .sm() @@ -611,10 +612,11 @@ impl StateMachine { .encode(), ); } - self.sm - .sm() - .sm_pinctrl + let sm = self.sm.sm(); + sm.sm_pinctrl .write(|w| unsafe { w.bits(saved_ctrl.bits()) }); + sm.sm_execctrl + .write(|w| unsafe { w.bits(saved_execctrl.bits()) }) } /// Set pin directions. @@ -645,13 +647,10 @@ impl StateMachine { .encode(), ); } - self.sm - .sm() - .sm_pinctrl + let sm = self.sm.sm(); + sm.sm_pinctrl .write(|w| unsafe { w.bits(saved_ctrl.bits()) }); - self.sm - .sm() - .sm_execctrl + sm.sm_execctrl .write(|w| unsafe { w.bits(saved_execctrl.bits()) }); } }