diff --git a/src/rp2_common/hardware_gpio/gpio.c b/src/rp2_common/hardware_gpio/gpio.c index 4945738d..c16e3cdc 100644 --- a/src/rp2_common/hardware_gpio/gpio.c +++ b/src/rp2_common/hardware_gpio/gpio.c @@ -174,6 +174,13 @@ static void _gpio_set_irq_enabled(uint gpio, uint32_t events, bool enabled, io_i } 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) + // this protects against enabling the interrupt without callback set + assert(!enabled + || (raw_irq_mask[get_core_num()] & (1u<