How can I return from k_sleep (or any other "sleep" method) when an interrupt occurs?
I would like my device to sleep (low power) until a GPIO pin toggles, then wakeup to process the event.
How can I return from k_sleep (or any other "sleep" method) when an interrupt occurs?
I would like my device to sleep (low power) until a GPIO pin toggles, then wakeup to process the event.
I'm currently busy looking at the "zephyr\samples\boards\nrf\system_off" sample (https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/boards/nordic/system_off/src/main.c), which looks like it may be the correct solution for my case.
Hi Dane,
To wake up your device from a low power mode when a GPIO pin toggles, you can use the GPIO pin as an interrupt. Just set the GPIO pin that you wish to use, in order to trigger an interrupt when it is toggled.
https://docs.nordicsemi.com/bundle/zephyr-apis-latest/page/group_gpio_interface.html#:~:text=GPIO%20interrupt%20configuration%20flags
Regards,
Priyanka
The system off sample is a good start for the use case. Hope it helps. Do let us know in case of further queries regarding the issue.
-Priyanka