File tree 3 files changed +35
-0
lines changed
3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,27 @@ struct power_down_event {
57
57
bool error ;
58
58
};
59
59
60
+ /** @brief Power off event.
61
+ *
62
+ * The power off event is submitted by the module that controls the power management in the
63
+ * application to inform other application modules that system power off (sys_poweroff) is about to
64
+ * happen. This happens when system is already suspended by @ref power_down_event and entering power
65
+ * off state is not restricted.
66
+ *
67
+ * The module that controls the power management in the application registers itself as the final
68
+ * subscriber for the event. When it receives the power off event, it instantly calls the
69
+ * sys_poweroff API. Because of that, after handling the power off event, an application module can
70
+ * no longer trigger system wakeup using a @ref wake_up_event. An application module could trigger
71
+ * system reboot (sys_reboot) to wakeup the system (leaving the power off state goes through the
72
+ * system reboot anyway).
73
+ */
74
+ struct power_off_event {
75
+ /** Event header. */
76
+ struct app_event_header header ;
77
+
78
+ /** Information if the power off was result of a fatal error. */
79
+ bool error ;
80
+ };
60
81
61
82
/** @brief Wake up event.
62
83
*
@@ -94,6 +115,7 @@ extern "C" {
94
115
#endif
95
116
96
117
APP_EVENT_TYPE_DECLARE (power_down_event );
118
+ APP_EVENT_TYPE_DECLARE (power_off_event );
97
119
APP_EVENT_TYPE_DECLARE (wake_up_event );
98
120
99
121
#ifdef __cplusplus
Original file line number Diff line number Diff line change @@ -18,6 +18,12 @@ config CAF_INIT_LOG_POWER_DOWN_EVENTS
18
18
depends on LOG
19
19
default y
20
20
21
+ config CAF_INIT_LOG_POWER_OFF_EVENTS
22
+ bool "Log power off events"
23
+ depends on CAF_PM_EVENTS
24
+ depends on LOG
25
+ default y
26
+
21
27
config CAF_INIT_LOG_WAKE_UP_EVENTS
22
28
bool "Log wake up events"
23
29
depends on CAF_PM_EVENTS
Original file line number Diff line number Diff line change @@ -13,6 +13,13 @@ APP_EVENT_TYPE_DEFINE(power_down_event,
13
13
IF_ENABLED (CONFIG_CAF_INIT_LOG_POWER_DOWN_EVENTS ,
14
14
(APP_EVENT_TYPE_FLAGS_INIT_LOG_ENABLE ))));
15
15
16
+ APP_EVENT_TYPE_DEFINE (power_off_event ,
17
+ NULL ,
18
+ NULL ,
19
+ APP_EVENT_FLAGS_CREATE (
20
+ IF_ENABLED (CONFIG_CAF_INIT_LOG_POWER_OFF_EVENTS ,
21
+ (APP_EVENT_TYPE_FLAGS_INIT_LOG_ENABLE ))));
22
+
16
23
APP_EVENT_TYPE_DEFINE (wake_up_event ,
17
24
NULL ,
18
25
NULL ,
You can’t perform that action at this time.
0 commit comments