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

Clearing GPIO Driver Interrupt Event

Hi there,

I'm using an input GPIOTE based on SDK11. The interrupt is consistently being fired. On the other hand, if I use "if(Pin_6)" to check the trigger, it does not get fired continuously. Is there a command in the nrf_drv to clear the gpio interrupt flag, the current command i'm using isnt working? I'm using 'globalflag' to turn on certain segments of my main loop. Below is a segment of the code:

void gpiote_event_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action) 
{
	// Event not clearing
        nrf_gpiote_event_clear(NRF_GPIOTE_EVENTS_IN_0);
        globalflag = true;
}

   static void gpiote_init(void) 
   {
    	// Initialize GPIO Interrupt Driver
    	nrf_drv_gpiote_init();
    
    	// Initialize PIN_6 as GPIOTE Input Pin
    	nrf_drv_gpiote_in_config_t config = GPIOTE_CONFIG_IN_SENSE_LOTOHI(true);
    	nrf_drv_gpiote_in_init(PIN_6, &config, gpiote_event_handler);
    
            nrf_gpiote_event_clear(NRF_GPIOTE_EVENTS_IN_0);
    	// Enable GPIO event and it's corresponding interrupt
    	nrf_drv_gpiote_in_event_enable(PIN_6, true);
    	return; 
    }
Related