On nRF52 interrupts for GPIOTE, I need to perform one event when a button is pushed, and perform another different event when the button is released.
I've checked these links already, buy they are quit old.
The question is, do I need to set up two events or toggle? Any other idea?
nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(true);
in_config.pull = NRF_GPIO_PIN_PULLUP;
err_code = nrf_drv_gpiote_in_init(PIN_IN, &in_config, in_pin_handler);
APP_ERROR_CHECK(err_code);
I wonder if I need separate handlers for two functionality?
void in_pin_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action){
nrf_drv_gpiote_out_toggle(PIN_OUT);
// IF BUTTON IS PUSHED
if (action == NRF_GPIOTE_POLARITY_HITOLO){
// DO SOMETHING
}
// IF BUTTON IS RELEASED
if (action == NRF_GPIOTE_POLARITY_LOTOHI){
// DO SOMETHING
}