This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Zephyr GPIO Interrupt masking

I have a question related to nRF52840-DK and Zephyr / NCS -

I have a device on an arduino shield that generates an interrupt - the driver provided uses gpio_* functions as follows:

gpio_pin_configure(gpio_dev, IRQ_GPIO_PIN, (GPIO_INPUT | IRQ_GPIO_FLAGS));

gpio_init_callback(&gpio_cb, (gpio_callback_handler_t)(device_isr_callback), BIT(IRQ_GPIO_PIN));

gpio_add_callback(gpio_dev, &gpio_cb);

gpio_pin_interrupt_configure(gpio_dev, IRQ_GPIO_PIN, GPIO_INT_EDGE_RISING);

How do I temporarily enable/disable this interrupt for a critical section of code? I don't understand how to. The zephyr interrupt documentation section talks about configuring using ISR_CONNECT macros, dynamic interrupts, and such. None of that seems to relate to the gpio abstraction used. How does one map between the two? I am not even sure how to figure out what 'IRQ' number is ultimately used behind the scenes.

The IRQ_GPIO_PIN is determined from the dts overlay as such:

 device-irq-gpios = <&arduino_header 14 GPIO_ACTIVE_LOW>; /* D8 */

Does does one mask / enable / disable that interrupt? The gpio abstraction hides all these details.

Related