Hello,
I need to handle 2 buttons so I configured GPIOTE. The issue I'm facing is that this IRQ occurs only once, when I press both buttons for the first time.
void main( void ) {
ret_code_t err_code;
nrf_drv_gpiote_in_config_t in_config = {
.sense = NRF_GPIOTE_POLARITY_HITOLO, // Transition that triggers the interrupt. */
.pull = NRF_GPIO_PIN_NOPULL, // Pulling mode. */
.is_watcher = false, // True when the input pin is tracking an output pin.
.hi_accuracy = false, // True when high accuracy (IN_EVENT) is used.
.skip_gpio_setup = false // Change GPIO configuration
};
// Hardware init
nrf_gpio_cfg( PUSH_A, // pin_number
NRF_GPIO_PIN_DIR_INPUT, // Input.
NRF_GPIO_PIN_INPUT_CONNECT, // Connect input buffer.
NRF_GPIO_PIN_NOPULL, // Pin pull-up resistor disabled.
NRF_GPIO_PIN_S0S1, // Standard '0', standard '1'.
NRF_GPIO_PIN_SENSE_LOW // Pin sense low level.
);
nrf_gpio_cfg( PUSH_B, // pin_number
NRF_GPIO_PIN_DIR_INPUT, // Input.
NRF_GPIO_PIN_INPUT_CONNECT, // Connect input buffer.
NRF_GPIO_PIN_NOPULL, // Pin pull-up resistor disabled.
NRF_GPIO_PIN_S0S1, // Standard '0', standard '1'.
NRF_GPIO_PIN_SENSE_LOW // Pin sense low level.
);
err_code = nrf_drv_gpiote_init();
APP_ERROR_CHECK( err_code );
err_code = nrf_drv_gpiote_in_init( PUSH_A, &in_config, vISR_Push_A );
APP_ERROR_CHECK( err_code );
err_code = nrf_drv_gpiote_in_init( PUSH_B, &in_config, vISR_Push_B );
APP_ERROR_CHECK( err_code );
// IRQ enable
nrf_drv_gpiote_in_event_enable( PUSH_A, true );
nrf_drv_gpiote_in_event_enable( PUSH_B, true );
// main LOOP
while(1);
return;
}
/* ISR PushButton */
static void vISR_Push_A( nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action ) {
// some code here
SEGGER_RTT_printf( 0, "push A\n");
return;
}
/* ISR PushButton */
static void vISR_Push_B( nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action ) {
// some code here
SEGGER_RTT_printf( 0, "push B\n");
return;
}
The ISR is called only at the first pushbutton pression. I'm sure that there is something missing, please can you help me?