4 Replies Latest reply on Sep 1, 2017 2:25 AM by Lockdog

    Which GPIO pin caused interrupt?


      Hello everybody,


      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?
      void main()
      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;
      QM_IRQ_REQUEST(QM_IRQ_GPIO_0_INT, qm_gpio_0_isr);
      qm_gpio_set_config(QM_GPIO_0, &cfg);


      Thank you very much.