8000 rp2/machine_pin: Generalise gpio_irq handler for pins >32. · holdenweb/micropython@57f4cab · GitHub
[go: up one dir, main page]

Skip to content

Commit 57f4cab

Browse files
Gadgetoiddpgeorge
authored andcommitted
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>
1 parent 733052f commit 57f4cab

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ports/rp2/machine_pin.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ typedef struct _machine_pin_irq_obj_t {
8686
} machine_pin_irq_obj_t;
8787

8888
static const mp_irq_methods_t machine_pin_irq_methods;
89+
static const int num_intr_regs = sizeof(iobank0_hw->intr) / sizeof(iobank0_hw->intr[0]);
8990

9091
// Mask with "1" indicating that the corresponding pin is in simulated open-drain mode.
9192
uint64_t machine_pin_open_drain_mask;
@@ -99,7 +100,7 @@ static inline bool is_ext_pin(__unused const machine_pin_obj_t *self) {
99100
#endif
100101

101102
static void gpio_irq(void) {
102-
for (int i = 0; i < 4; ++i) {
103+
for (int i = 0; i < num_intr_regs; ++i) {
103104
uint32_t intr = iobank0_hw->intr[i];
104105
if (intr) {
105106
for (int j = 0; j < 8; ++j) {

0 commit comments

Comments
 (0)
0