RIOT
RIOT copied to clipboard
Interrupt callback function is instantly called on samd51 after setting it from within interrupt callback function
Description
I'm setting a new interrupt callback function for a GPIO pin from within the previous callback function for the same GPIO pin.
Steps to reproduce the issue
static void _interrupt_on_gpio_cb_2(void *arg)
{
// do something different
}
static void _interrupt_on_gpio_cb(void *arg)
{
(void) arg;
// do something
// gpio_irq_disable(MY_GPIO_PIN);
gpio_init_int(MY_GPIO_PIN, GPIO_IN_PD, GPIO_RISING, _interrupt_on_gpio_cb_2, NULL);
// gpio_irq_enable(MY_GPIO_PIN);
}
int main(void)
{
gpio_init(MY_GPIO_PIN, GPIO_IN);
gpio_init_int(MY_GPIO_PIN, GPIO_IN_PD, GPIO_RISING, _interrupt_on_gpio_cb, NULL);
}
Expected results
I would expect nothing to happen except that the next time an interrupt is triggered the new callback function will be called.
Actual results
Unless disabling interrupts for this pin while setting the new callback, the new handler will be called instantly on samd51, but not on saml21.
Versions
Based on RIOT 2023.04
Might be worth getting back to #12082 or #13925, but only with a single function this time.