summaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorinnovaker <66737976+innovaker@users.noreply.github.com>2021-06-19 10:57:33 +0100
committerPete Johanson <peter@peterjohanson.com>2021-07-17 17:04:25 -0400
commitad981c3bbda0c2f047b6387c41d4b02dd30508e7 (patch)
tree871461c7b314b09f00a4e5eb0516b0661797df83 /app/src
parent71a85a0c8eeef8d5482ee06f7e06bf35cabbbf9b (diff)
refactor(core): update power API to Zephyr v2.5.0
See: https://github.com/zephyrproject-rtos/zephyr/pull/29410 PR: https://github.com/zmkfirmware/zmk/pull/736
Diffstat (limited to 'app/src')
-rw-r--r--app/src/power.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/app/src/power.c b/app/src/power.c
index 4af18cf..47ef3a3 100644
--- a/app/src/power.c
+++ b/app/src/power.c
@@ -23,18 +23,12 @@ bool is_usb_power_present() {
#endif /* CONFIG_USB */
}
-enum power_states sys_pm_policy_next_state(int32_t ticks) {
-#ifdef CONFIG_SYS_POWER_DEEP_SLEEP_STATES
-#ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_1
+struct pm_state_info pm_policy_next_state(int32_t ticks) {
if (zmk_activity_get_state() == ZMK_ACTIVITY_SLEEP && !is_usb_power_present()) {
- return SYS_POWER_STATE_DEEP_SLEEP_1;
+ return (struct pm_state_info){PM_STATE_SOFT_OFF, 0, 0};
}
-#endif /* CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_1 */
-#endif /* CONFIG_SYS_POWER_DEEP_SLEEP_STATES */
- return SYS_POWER_STATE_ACTIVE;
+ return (struct pm_state_info){PM_STATE_ACTIVE, 0, 0};
}
-bool sys_pm_policy_low_power_devices(enum power_states pm_state) {
- return sys_pm_is_sleep_state(pm_state);
-} \ No newline at end of file
+__weak bool pm_policy_low_power_devices(enum pm_state state) { return pm_is_sleep_state(state); }