summaryrefslogtreecommitdiff
path: root/tmk_core/common
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2020-05-03 00:39:37 +0100
committerFlorian Didron <fdidron@users.noreply.github.com>2020-06-12 17:00:27 +0900
commit528f7d27d9c9a7d8a9a327f6c9afe20f60b4d41a (patch)
tree2f7f700d4e1c5e99265278031b550583a1f8ee45 /tmk_core/common
parent1aa5d2d6d090516d3653e0c875a8aace6461e0b4 (diff)
Provide a mechanism for split keyboards to process key press on both halves (#9001)
Diffstat (limited to 'tmk_core/common')
-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 d576d565d1..c030da8130 100644
--- a/tmk_core/common/keyboard.c
+++ b/tmk_core/common/keyboard.c
@@ -208,6 +208,13 @@ void keyboard_setup(void) {
*/
__attribute__((weak)) bool is_keyboard_master(void) { return true; }
+/** \brief should_process_keypress
+ *
+ * Override this function if you have a condition where keypresses processing should change:
+ * - splits where the slave side needs to process for rgb/oled functionality
+ */
+__attribute__((weak)) bool should_process_keypress(void) { return is_keyboard_master(); }
+
/** \brief keyboard_init
*
* FIXME: needs doc
@@ -287,7 +294,7 @@ void keyboard_task(void) {
matrix_scan();
#endif
- if (is_keyboard_master()) {
+ if (should_process_keypress()) {
for (uint8_t r = 0; r < MATRIX_ROWS; r++) {
matrix_row = matrix_get_row(r);
matrix_change = matrix_row ^ matrix_prev[r];