summaryrefslogtreecommitdiffstats
path: root/quantum/keyboard.c
diff options
context:
space:
mode:
authorlokher <lokher@gmail.com>2023-04-26 16:32:15 +0800
committerlokher <lokher@gmail.com>2023-04-26 16:32:15 +0800
commite4f4ceaf3f2e3d25fb282273a81f9b58790fc427 (patch)
treec0a257eab0ffe5238fdf2c04882e8ee1fe8fc46e /quantum/keyboard.c
parent103badc87cb50db1ff3851c84331e86ba78fb681 (diff)
merge upstream 713427c
Diffstat (limited to 'quantum/keyboard.c')
-rw-r--r--quantum/keyboard.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/quantum/keyboard.c b/quantum/keyboard.c
index 749ebb559c..82b5096c7f 100644
--- a/quantum/keyboard.c
+++ b/quantum/keyboard.c
@@ -105,6 +105,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifdef CAPS_WORD_ENABLE
# include "caps_word.h"
#endif
+#ifdef LEADER_ENABLE
+# include "leader.h"
+#endif
static uint32_t last_input_modification_time = 0;
uint32_t last_input_activity_time(void) {
@@ -238,7 +241,7 @@ __attribute__((weak)) void keyboard_pre_init_kb(void) {
* FIXME: needs doc
*/
-__attribute__((weak)) void keyboard_post_init_user() {}
+__attribute__((weak)) void keyboard_post_init_user(void) {}
/** \brief keyboard_post_init_kb
*
@@ -249,6 +252,14 @@ __attribute__((weak)) void keyboard_post_init_kb(void) {
keyboard_post_init_user();
}
+/** \brief matrix_can_read
+ *
+ * Allows overriding when matrix scanning operations should be executed.
+ */
+__attribute__((weak)) bool matrix_can_read(void) {
+ return true;
+}
+
/** \brief keyboard_setup
*
* FIXME: needs doc
@@ -449,10 +460,14 @@ static inline void generate_tick_event(void) {
* @return false Matrix didn't change
*/
static bool matrix_task(void) {
+ if (!matrix_can_read()) {
+ generate_tick_event();
+ return false;
+ }
+
static matrix_row_t matrix_previous[MATRIX_ROWS];
matrix_scan();
-
bool matrix_changed = false;
for (uint8_t row = 0; row < MATRIX_ROWS && !matrix_changed; row++) {
matrix_changed |= matrix_previous[row] ^ matrix_get_row(row);
@@ -549,6 +564,10 @@ void quantum_task(void) {
combo_task();
#endif
+#ifdef LEADER_ENABLE
+ leader_task();
+#endif
+
#ifdef WPM_ENABLE
decay_wpm();
#endif