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

gpiote handler - disable momentarily to run critical section

With calls to these functions: nrf_drv_gpiote_init() nrf_drv_gpiote_in_init() nrf_drv_gpiote_in_event_enable() I have a handler (interrupt) routine that services a CAN bus chip on SPI bus. The handler runs when the chip's interrupt output, connected to a nRF52 GPIO input, goes from high to low. The handler receives data ok and now looking to add transmit.

How can momentarily disable the handler in nrf_drv_gpiote_in_init() so I can run critical section of code? There are pointers/indexes that are accessed inside and outside the event handler so looking momentarily disable the handler whilst the pointers are updated: disable handler, do read/modify/write operation of pointers, enable handler.

Don't want to miss any interrupts from the CAN chip so if the GPIO pin goes high to low whilst the handler is disabled was looking for the handler to run immediately once it's enabled again.

Maybe there's another way this is normally done on nRF52. Looked, can't find the answer.

Related