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

nrf_drv_gpiote_in_event_enable function doesn't re-enable event

Hello,

I am writing an application using SDK version 8.1 where I have a pin using the PORT event in nrf_drv_gpiote library. I have a need to disable the event temporarily and then re-enable it at a later time. I tried to do this using the nrf_drv_gpiote_in_event_disable() and nrf_drv_gpiote_in_event_enable() functions. This didn't seem to work properly and after looking into it more, it appears that the event disable function disconnects the input and the event enable function does not reconnect. Also, when the event is re-enabled, the GPIOTE handler function is called repeatedly.

Is this the appropriate way to accomplish this goal? Should I be using some other functions such ones that directly manipulate the sense function, or is this a issue with the SDK?

Thanks.

UPDATE:

I wanted to post an alternative solution that I found in addition to Aryan's answer. I was able to enable and disable the event and still leave it attached to the PORT event. I did this with the following steps.

To initialize I called: nrf_drv_gpiote_in_init() followed by nrf_drv_gpiote_in_event_enable().

Then my disable and enable routine called nrf_gpio_cfg_sense_set() and set the sense parameter to NRF_GPIO_PIN_NOSENSEor NRF_GPIO_PIN_SENSE_LOW and this seems to have worked as well.

Related