summaryrefslogtreecommitdiff
path: root/ports
diff options
context:
space:
mode:
authorScott Shawcroft <scott@adafruit.com>2021-03-03 08:43:57 -0800
committerGitHub <noreply@github.com>2021-03-03 08:43:57 -0800
commit1d8933dd0587124e9243e4edca0117c6ff3e5dfc (patch)
tree386226c9714b268b6eb6957f428dcb6d0f31451b /ports
parent55e41d43eb5490e0687d177b72ab9a313b204bdb (diff)
parent8bf5dd93c1f54b0afb70d3ff529e45f373a2298a (diff)
Merge pull request #4265 from DavePutz/pio_soft_reset
Clear out PIOs and State Machines on RP2040 soft reset
Diffstat (limited to 'ports')
-rw-r--r--ports/raspberrypi/common-hal/rp2pio/StateMachine.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c
index 54c5220e7..e81d721c6 100644
--- a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c
+++ b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c
@@ -34,6 +34,7 @@
#include "src/rp2_common/hardware_dma/include/hardware/dma.h"
#include "src/rp2_common/hardware_pio/include/hardware/pio_instructions.h"
#include "src/rp2040/hardware_structs/include/hardware/structs/iobank0.h"
+#include "src/rp2_common/hardware_irq/include/hardware/irq.h"
#include "lib/utils/interrupt_char.h"
#include "py/obj.h"
@@ -101,6 +102,13 @@ void reset_rp2pio_statemachine(void) {
_reset_statemachine(pio, j, false);
}
}
+ for (uint8_t irq=PIO0_IRQ_0; irq <= PIO1_IRQ_1; irq++) {
+ irq_handler_t int_handler = irq_get_exclusive_handler(irq);
+ if (int_handler > 0) {
+ irq_set_enabled (irq, false);
+ irq_remove_handler(irq,int_handler);
+ }
+ }
}
STATIC uint32_t _check_pins_free(const mcu_pin_obj_t * first_pin, uint8_t pin_count, bool exclusive_pin_use) {