diff options
author | Joel Challis <git@zvecr.com> | 2022-02-04 18:10:00 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-05 05:10:00 +1100 |
commit | 135c93599036bbe646a69b568eef9219823a4be9 (patch) | |
tree | 2fca5c980cc7bbc2f2db4c54f5fa76006bf741d4 /platforms/suspend.c | |
parent | 580ef6d88f22478112417c4ab3c1ee50211167d2 (diff) |
Initial migration of suspend callbacks (#16067)
* Initial migration of suspend logic
* Add header
Diffstat (limited to 'platforms/suspend.c')
-rw-r--r-- | platforms/suspend.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/platforms/suspend.c b/platforms/suspend.c new file mode 100644 index 0000000000..cd773764fa --- /dev/null +++ b/platforms/suspend.c @@ -0,0 +1,47 @@ +// Copyright 2022 QMK +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "suspend.h" +#include "matrix.h" + +// TODO: Move to more correct location +__attribute__((weak)) void matrix_power_up(void) {} +__attribute__((weak)) void matrix_power_down(void) {} + +/** \brief Run user level Power down + * + * FIXME: needs doc + */ +__attribute__((weak)) void suspend_power_down_user(void) {} + +/** \brief Run keyboard level Power down + * + * FIXME: needs doc + */ +__attribute__((weak)) void suspend_power_down_kb(void) { suspend_power_down_user(); } + +/** \brief run user level code immediately after wakeup + * + * FIXME: needs doc + */ +__attribute__((weak)) void suspend_wakeup_init_user(void) {} + +/** \brief run keyboard level code immediately after wakeup + * + * FIXME: needs doc + */ +__attribute__((weak)) void suspend_wakeup_init_kb(void) { suspend_wakeup_init_user(); } + +/** \brief suspend wakeup condition + * + * FIXME: needs doc + */ +bool suspend_wakeup_condition(void) { + matrix_power_up(); + matrix_scan(); + matrix_power_down(); + for (uint8_t r = 0; r < MATRIX_ROWS; r++) { + if (matrix_get_row(r)) return true; + } + return false; +} |