mirror of
https://github.com/micropython/micropython.git
synced 2026-06-12 01:25:15 +02:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user