I'm playing with D2000 MCU and got an issue that need your help, I'm trying to connect buttons to GPIO pins, when one button is pressed, an interrupt is triggered, but how can I know which pin caused the interrupt?
static void gpio_example_callback(void *data, uint32_t status)
// How can I know which pin caused the interrupt here?
cfg.int_en = BIT(PIN_1) | BIT(PIN_2) | BIT(PIN_3);
cfg.int_type = BIT(PIN_1) | BIT(PIN_2) | BIT(PIN_3);
cfg.callback = gpio_callback;
cfg.callback_data = NULL;
Thank you very much.
In the simplest way you can read a pin state in the interrupt routine:
Also your interrupt callback function has an argument:
Try to read this variable in the callback function for check the required triggered pin