aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2020-05-03 00:39:37 +0100
committerGitHub <noreply@github.com>2020-05-03 00:39:37 +0100
commitc482a2944bf5b025fd70fa9ee53fc2e12369d327 (patch)
treec6415345ec3bf6c2fe97593f8a4cb66067edf7d0
parente182a38e7c63179f11c94cd7d59f9bac829b85a8 (diff)
downloadqmk_firmware-c482a2944bf5b025fd70fa9ee53fc2e12369d327.tar.gz
qmk_firmware-c482a2944bf5b025fd70fa9ee53fc2e12369d327.zip
Provide a mechanism for split keyboards to process key press on both halves (#9001)
-rw-r--r--tmk_core/common/keyboard.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c
index a767d9c87..53d08959e 100644
--- a/tmk_core/common/keyboard.c
+++ b/tmk_core/common/keyboard.c
@@ -213,6 +213,13 @@ void keyboard_setup(void) {
213 */ 213 */
214__attribute__((weak)) bool is_keyboard_master(void) { return true; } 214__attribute__((weak)) bool is_keyboard_master(void) { return true; }
215 215
216/** \brief should_process_keypress
217 *
218 * Override this function if you have a condition where keypresses processing should change:
219 * - splits where the slave side needs to process for rgb/oled functionality
220 */
221__attribute__((weak)) bool should_process_keypress(void) { return is_keyboard_master(); }
222
216/** \brief keyboard_init 223/** \brief keyboard_init
217 * 224 *
218 * FIXME: needs doc 225 * FIXME: needs doc
@@ -292,7 +299,7 @@ void keyboard_task(void) {
292 matrix_scan(); 299 matrix_scan();
293#endif 300#endif
294 301
295 if (is_keyboard_master()) { 302 if (should_process_keypress()) {
296 for (uint8_t r = 0; r < MATRIX_ROWS; r++) { 303 for (uint8_t r = 0; r < MATRIX_ROWS; r++) {
297 matrix_row = matrix_get_row(r); 304 matrix_row = matrix_get_row(r);
298 matrix_change = matrix_row ^ matrix_prev[r]; 305 matrix_change = matrix_row ^ matrix_prev[r];