From 983cfd62a5f597a74de6d9e2ad72985ec083f70f Mon Sep 17 00:00:00 2001 From: graham sanderson Date: Sun, 16 Feb 2025 12:42:13 -0600 Subject: [PATCH] Add irq_has_handler() and use it to fix GPIO IRQ assert --- src/rp2_common/hardware_gpio/gpio.c | 7 ++----- .../hardware_irq/include/hardware/irq.h | 16 +++++++++++++++- src/rp2_common/hardware_irq/irq.c | 8 +++++++- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/rp2_common/hardware_gpio/gpio.c b/src/rp2_common/hardware_gpio/gpio.c index 44c39e9c4..2c4e91d40 100644 --- a/src/rp2_common/hardware_gpio/gpio.c +++ b/src/rp2_common/hardware_gpio/gpio.c @@ -184,12 +184,9 @@ static void _gpio_set_irq_enabled(uint gpio, uint32_t events, bool enabled, io_b } void gpio_set_irq_enabled(uint gpio, uint32_t events, bool enabled) { - // either this call disables the interrupt - // or callback should already be set (raw or using gpio_set_irq_callback) + // either this call disables the interrupt or callback should already be set. // this protects against enabling the interrupt without callback set - assert(!enabled - || (raw_irq_mask[get_core_num()] & (1ull<