summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Howard <phil@gadgetoid.com>2024-07-08 16:22:56 +0100
committerDamien George <damien@micropython.org>2024-10-15 12:14:59 +1100
commit57f4cabff93a11e27c61ecb181664e0d70c7ced1 (patch)
treed913d0fa1a2104fa8b74b263ff866587c49bc479
parent733052f6b9a5d3e470ede99c04a4f440e789ebac (diff)
rp2/machine_pin: Generalise gpio_irq handler for pins >32.
Fix the gpio_irq function so that it looks at all six iobank0_hw->intr[n] registers, for up to 48 IOs. Signed-off-by: Phil Howard <phil@gadgetoid.com>
-rw-r--r--ports/rp2/machine_pin.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ports/rp2/machine_pin.c b/ports/rp2/machine_pin.c
index 8fdde114b..8ba0b44a6 100644
--- a/ports/rp2/machine_pin.c
+++ b/ports/rp2/machine_pin.c
@@ -86,6 +86,7 @@ typedef struct _machine_pin_irq_obj_t {
} machine_pin_irq_obj_t;
static const mp_irq_methods_t machine_pin_irq_methods;
+static const int num_intr_regs = sizeof(iobank0_hw->intr) / sizeof(iobank0_hw->intr[0]);
// Mask with "1" indicating that the corresponding pin is in simulated open-drain mode.
uint64_t machine_pin_open_drain_mask;
@@ -99,7 +100,7 @@ static inline bool is_ext_pin(__unused const machine_pin_obj_t *self) {
#endif
static void gpio_irq(void) {
- for (int i = 0; i < 4; ++i) {
+ for (int i = 0; i < num_intr_regs; ++i) {
uint32_t intr = iobank0_hw->intr[i];
if (intr) {
for (int j = 0; j < 8; ++j) {