Hello,
Is there any methods to implement the "long press wake-up"? Pressing the button for 3 seconds to let device enter sleep mode and pressing the same button for 3 seconds to wake it up.
Already defined the wake-up gpio in "sleep_mode_enter()" function as below. The question is that how to measure the time when the device wake-up from the sleep mode?
[SDK12, nRF52]
static void sleep_mode_enter(void)
{
uint32_t err_code;
//
LEDS_OFF(LEDS_MASK);
// init wakeup gpio
nrf_drv_gpiote_in_uninit(5);
nrf_drv_gpiote_in_config_t power_btn_config = GPIOTE_CONFIG_IN_SENSE_HITOLO(false);
power_btn_config.pull = NRF_GPIO_PIN_PULLUP;
err_code = nrf_drv_gpiote_in_init(5, &power_btn_config, NULL);
APP_ERROR_CHECK(err_code);
nrf_drv_gpiote_in_event_enable(5, true);
nrf_delay_ms(500);
// Go to system-off mode (this function will not return; wakeup will cause a reset).
err_code = sd_power_system_off();
APP_ERROR_CHECK(err_code);
}
Thanks.