Skip to content

Commit

Permalink
refactor: Upgrade to Zephyr 2.5.0.
Browse files Browse the repository at this point in the history
* Core move to new version.
* Updated power API.

See: zephyrproject-rtos/zephyr#29410
  • Loading branch information
petejohanson committed Jun 18, 2021
1 parent 576ce76 commit 246e56b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
5 changes: 1 addition & 4 deletions app/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,8 @@ config ZMK_SLEEP

if ZMK_SLEEP

config SYS_POWER_DEEP_SLEEP_STATES
default y

choice SYS_PM_POLICY
default SYS_PM_POLICY_APP
default PM_POLICY_APP
endchoice

config DEVICE_POWER_MANAGEMENT
Expand Down
14 changes: 4 additions & 10 deletions app/src/power.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
__weak bool pm_policy_low_power_devices(enum pm_state state) { return pm_is_sleep_state(state); }
5 changes: 2 additions & 3 deletions app/west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ manifest:
url-base: https://github.com/microsoft
projects:
- name: zephyr
remote: zmkfirmware
revision: v2.4.0+zmk-fixes
clone-depth: 1
url: https://github.com/petejohanson/zephyr
revision: v2.5.0+zmk-fixes
import:
# TODO: Rename once upstream offers option like `exclude` or `denylist`
name-blacklist:
Expand Down

0 comments on commit 246e56b

Please sign in to comment.