Skip to content

Commit 55a1058

Browse files
MarekPietakapi-no
authored andcommitted
caf: buttons: Document handling power off event
Change introduces documentation for power_off_event handling. Jira: NCSDK-31742 Signed-off-by: Marek Pieta <[email protected]> Signed-off-by: Divya Pillai <[email protected]>
1 parent 03f769e commit 55a1058

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

doc/nrf/libraries/caf/buttons.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ You can change this with :kconfig:option:`CONFIG_CAF_BUTTONS_POLARITY_INVERSED`,
6565
Power management configuration
6666
==============================
6767

68-
If the :kconfig:option:`CONFIG_CAF_BUTTONS_PM_EVENTS` Kconfig option is enabled, the module interacts with power management events (:c:struct:`power_down_event` and :c:struct:`wake_up_event`).
68+
If the :kconfig:option:`CONFIG_CAF_BUTTONS_PM_EVENTS` Kconfig option is enabled, the module interacts with power management events (:c:struct:`power_down_event`, :c:struct:`power_off_event`, and :c:struct:`wake_up_event`).
6969

7070
The module can be used to trigger an application wakeup event.
7171
By default, pressing any button wakes up the application.
@@ -159,6 +159,7 @@ In that case, the following additional states are available:
159159
The power management events that module can react to are the following:
160160

161161
* :c:struct:`power_down_event`
162+
* :c:struct:`power_off_event`
162163
* :c:struct:`wake_up_event`
163164

164165
If :c:struct:`power_down_event` comes while the module is in the ``STATE_SCANNING`` state, the module switches to ``STATE_SUSPENDING`` and remains in this state until no button is pressed.
@@ -168,3 +169,8 @@ If :c:struct:`power_down_event` comes while the module is in the ``STATE_ACTIVE`
168169
Similarly, as in ``STATE_ACTIVE``, in ``STATE_IDLE`` the module enables the GPIO interrupts and waits for the pin state to change.
169170
However, in ``STATE_IDLE`` the interrupts are enabled only for the subset of buttons that are configured to wake up the application.
170171
Pressing any of these buttons also invokes :c:struct:`wake_up_event` and sends it to all subscribing modules.
172+
173+
.. note::
174+
If the system enters the off state (indicated by :c:struct:`power_off_event`), a button press triggers an instant system reboot (:c:func:`sys_reboot`).
175+
This is done to prevent entering the system off state with GPIO interrupts disabled (:c:func:`sys_poweroff` call may prevent the CAF Buttons module from scanning buttons and reenabling GPIO interrupts).
176+
System reboot is anyway necessary to wake up from the system off state.

0 commit comments

Comments
 (0)