I want to generate an interrupt event use pin30 when it goes from low->high or high->low. First I register a gpiote user by
app_gpiote_user_params_t app_gpiote_params =
{
.pins_low_to_high_mask = (1 << CONFIG_IO_BATDETECT),
.pins_high_to_low_mask = (0 << CONFIG_IO_BATDETECT),
.config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(true),
};
//app_gpiote_params.config.pull = NRF_GPIO_PIN_PULLDOWN;
retval = app_gpiote_user_register_param(&m_batdetect_user_id,
&app_gpiote_params,
batterydetect_gpiote_event_handler);
CONFIG_IO_BATDETECT represent pin30,batterydetect_gpiote_event_handler is the handle function when interrupt generated.Then I use
APP_ERROR_CHECK(app_gpiote_user_enable(m_batdetect_user_id));
to enable GPIOTE.I also change the APP_GPIOTE_MAX_USERS from 2 to 3:
#define APP_GPIOTE_MAX_USERS 3
in the main.c.The event handle function as follow:
APP_ERROR_CHECK(app_gpiote_user_disable(m_batdetect_user_id));
DBG0_EVT0("jack:m_keyboard: Disabled");
if (event_pins_low_to_high & TEST_PIN_L2H)
{
DBG0_EVT0("jack:event_pins_low_to_high");
}
if (event_pins_high_to_low & TEST_PIN_H2L)
{
DBG0_EVT0("jack:event_pins_high_to_low");
}
DBG0_EVT0("jack:m_keyboard: enabled");
APP_ERROR_CHECK(app_gpiote_user_enable(m_batdetect_user_id));
While the function has never been triggered. Have I miss something ? The SDK is v11.0.0 by the way.