From 6b0ea14ec120e8c108745fea008555e24c10365f Mon Sep 17 00:00:00 2001 From: Jan Niehusmann Date: Thu, 25 Aug 2022 07:31:09 +0000 Subject: [PATCH] Temporarily disable out_sticky in set_pindirs Otherwise, it will change unrelated pindirs as well, if sticky is set --- rp2040-hal/src/pio.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rp2040-hal/src/pio.rs b/rp2040-hal/src/pio.rs index 3901ab7..dd94128 100644 --- a/rp2040-hal/src/pio.rs +++ b/rp2040-hal/src/pio.rs @@ -627,6 +627,11 @@ impl StateMachine { // `UninitStateMachine` byt adding a program. pub fn set_pindirs(&mut self, pindirs: impl IntoIterator) { let saved_ctrl = self.sm.sm().sm_pinctrl.read(); + let saved_execctrl = self.sm.sm().sm_execctrl.read(); + self.sm + .sm() + .sm_execctrl + .modify(|_, w| w.out_sticky().clear_bit()); for (pinnum, pin_dir) in pindirs { self.sm .sm() @@ -644,6 +649,10 @@ impl StateMachine { .sm() .sm_pinctrl .write(|w| unsafe { w.bits(saved_ctrl.bits()) }); + self.sm + .sm() + .sm_execctrl + .write(|w| unsafe { w.bits(saved_execctrl.bits()) }); } }