HI, I want use some GPIO to detect "pin_high_to_low" or " pin_low_to_high". and I think the "app_gpiote.c" might be helpful. but I have been confused by function " sense_level_toggle(*p_user, pins) " , What's the purpose of toggling sense level for specified pin ?
static void sense_level_toggle(gpiote_user_t * p_user, uint32_t pins)
{
uint32_t pin_no;
for (pin_no = 0; pin_no < NO_OF_PINS; pin_no++)
{
uint32_t pin_mask = (1 << pin_no);
if ((pins & pin_mask) != 0)
{
uint32_t sense;
// Invert sensing.
if ((p_user->sense_high_pins & pin_mask) == 0)
{
sense = GPIO_PIN_CNF_SENSE_High << GPIO_PIN_CNF_SENSE_Pos;
p_user->sense_high_pins |= pin_mask;
}
else
{
sense = GPIO_PIN_CNF_SENSE_Low << GPIO_PIN_CNF_SENSE_Pos;
p_user->sense_high_pins &= ~pin_mask;
}
NRF_GPIO->PIN_CNF[pin_no] &= ~GPIO_PIN_CNF_SENSE_Msk;
NRF_GPIO->PIN_CNF[pin_no] |= sense;
}
}
}
Does that mean if I press a button and then release it , will enter the GPIOTE_IRQHandler() twice . and the same gpiote_event_handler() will be called twice too ?