I can read the button and see if it is being held. I would like to know which GPIO pin caused the wake without having to hold the button down to signify the button that woke the device.
I don't see a way to do that. Is that possible?
reas = nrf_reset_resetreas_get(NRF_RESET);
nrf_reset_resetreas_clear(NRF_RESET, reas);
if (reas & NRF_RESET_RESETREAS_NFC_MASK) {
LOG_DBG("Wake up by NFC field detect\n");
} else if (reas & NRF_RESET_RESETREAS_RESETPIN_MASK) {
LOG_DBG("Reset by pin-reset\n");
} else if (reas & NRF_RESET_RESETREAS_SREQ_MASK) {
LOG_DBG("Reset by soft-reset\n");
} else if (reas) {
LOG_DBG("Reset by a different source (0x%08X)\n", reas);
int val=0;
#ifdef CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP
val = gpio_pin_get_dt(&button2);
if (val > 0) {
LOG_DBG("button2 %d was held.",val);
} else {
LOG_DBG("button2 was NOT held.\n");
}
val = gpio_pin_get_dt(&button3);
if (val > 0) {
LOG_DBG("button3 %d was held.",val);
}
} else {
LOG_DBG("button3 was NOT held.\n");
}
#endif
