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

GPIOTE manual clear

Hello,

I am working with the GPIOTE library to get a GPIOTE_IRQ from a peripheral.

I have several questions regarding the library and how IRQ works.

1.How do I clear the event for the gpiote input. I know that void GPIOTE_IRQHandler(void) does the clearing for you but I am wondering if there is a way I can clear it when I need to. This needs to happen because I need to do something while I am in my GPIOTE_IRQHandler when there is another GPIOTE_IRQ signal coming from the peripheral.

I know that I can use nrf_drv_gpiote_in_is_set(GPIOPE_IRQ_Pin) to check if the pin is set. However, the only function that actually clears the event needs an event input

__STATIC_INLINE void nrf_gpiote_event_clear	(	nrf_gpiote_events_t 	event	)

So I though of using

uint32_t nrf_drv_gpiote_in_event_addr_get	(	nrf_drv_gpiote_pin_t 	pin	)	

and manually subtracting NRF_GPIOTE to get the event and use

__STATIC_INLINE void nrf_gpiote_event_clear	(	nrf_gpiote_events_t 	event	)	

Is there a better way of clearing the event?

2 Also, I was wondering about the behavior of the IRQ when I manually clear it. Will clearing the event cause the void GPIOTE_IRQHandler(void) not be called or will it be called anyway.

Thank you, John Lee

Related