Configure Interrupt for GPIO Header Pins on nRF52840 DK

Hello, this is probably a very beginner question but I don't know how to configure interrupt for the GPIO headers on the nRF52840 dev kit. I tried to search in this forum and the nRF Connect SDK Fundamentals course. So far, all I come across is how to configure it on buttons. Here is one of the exercise solution:

/* SW0_NODE is the devicetree node identifier for the node with alias "sw0" */
#define SW0_NODE DT_ALIAS(sw0)
static const struct gpio_dt_spec button = GPIO_DT_SPEC_GET(SW0_NODE, gpios);

/* STEP 3 - Configure the interrupt on the button's pin */
ret = gpio_pin_interrupt_configure_dt(&button, GPIO_INT_EDGE_TO_ACTIVE);

/* STEP 6 - Initialize the static struct gpio_callback variable */
gpio_init_callback(&button_cb_data, button_pressed, BIT(button.pin));

/* STEP 7 - Add the callback function by calling gpio_add_callback() */
gpio_add_callback(button.port, &button_cb_data);

My use case is I have a peripheral that generates an interrupt when it has new data or when it needs the main MCU attention. I believe that is a very generic use case. I want to wire that pin to the nRF52840 DK header pins so that it can detect when that interrupt happens and do something with it. I came from the Arduino background where only certain pins have interrupt capabilities, and I can't seem to find this information anywhere in the nRF52840 DK user guide. I don't really know how to retrieve the pin because the arduino header is defined differently in the dts compared to the button.

My application is also time-constrained, so I've been looking at "direct" ISR to avoid the overhead from zephyr, reference from this document: https://docs.nordicsemi.com/bundle/ncs-2.5.2/page/zephyr/kernel/services/interrupts.html#concepts

But I couldn't find a sample on how to use this.

Any help is appreciated. Thank you.

Related