alif/machine_pin: Allow GPIO IRQs to work without a Python handler.

This allows the GPIO IRQ to be enabled even if a Python `Pin.irq()` is not
configured for that pin.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2026-05-11 23:41:32 +10:00
parent 78ff8d8d15
commit 2ce3fcdf2a
+5 -4
View File
@@ -52,11 +52,12 @@ typedef struct _machine_pin_irq_obj_t {
// Defines a single GPIO IRQ handler
#define DEFINE_GPIO_IRQ_HANDLER(pname, port, pin) \
void pname##_IRQ##pin##Handler(void) { \
gpio_interrupt_eoi((GPIO_Type *)pname##_BASE, pin); \
machine_pin_irq_obj_t *irq = MACHINE_PIN_IRQ_OBJECT(port, pin); \
machine_pin_obj_t *self = MP_OBJ_TO_PTR(irq->base.parent); \
gpio_interrupt_eoi(self->gpio, pin); \
irq->flags = irq->trigger; \
mp_irq_handler(&irq->base); \
if (irq != NULL) { \
irq->flags = irq->trigger; \
mp_irq_handler(&irq->base); \
} \
}
// Defines all 8 pin IRQ handlers for a port