-
-
Notifications
You must be signed in to change notification settings - Fork 40.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial migration of suspend callbacks (#16067)
* Initial migration of suspend logic * Add header
- Loading branch information
Showing
6 changed files
with
61 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters