From e4f4ceaf3f2e3d25fb282273a81f9b58790fc427 Mon Sep 17 00:00:00 2001 From: lokher Date: Wed, 26 Apr 2023 16:32:15 +0800 Subject: merge upstream 713427c --- quantum/keyboard.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'quantum/keyboard.c') 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 . #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 -- cgit v1.2.3