This sounds like very n00bie question and I'm a bit embarrassed to ask this, but I'm not getting anywhere so I have to ask it anyway. Why my GPIOTE events are not working? I must be missing some simple initialization or configuration setting but what the heck is it? I've gone through all possible examples with no luck
Here's my ultimately simple program, which reads and prints out the pin state change correctly with polling, but never calls the handler() function.
#define DR0 DT_GPIO_PIN(DT_ALIAS(dr0), gpios)
void handler(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
printf("pin %d\n", pin);
}
void main()
{
nrfx_err_t err;
nrfx_gpiote_in_config_t const in_config =
{
.sense = NRF_GPIOTE_POLARITY_LOTOHI,
.pull = NRF_GPIO_PIN_PULLDOWN,
.is_watcher = false,
.hi_accuracy = true,
.skip_gpio_setup = false,
};
err = nrfx_gpiote_in_init(DR0, &in_config, handler);
if (err != NRFX_SUCCESS) {
LOG_ERR("nrfx_gpiote_in_init error: %08x", err);
return err;
}
nrfx_gpiote_in_event_enable(DR0,true);
while(1)
{
printf("%d\n", nrf_gpio_pin_read(DR0));
k_msleep(1000);
}
}