summaryrefslogtreecommitdiff
path: root/tmk_core/common
diff options
context:
space:
mode:
authorSeebs <seebs@seebs.net>2017-11-18 15:39:50 -0600
committerJack Humbert <jack.humb@gmail.com>2017-11-21 00:20:52 -0500
commit39d3d92364039b278f8e4db0b1c63eb057ab8016 (patch)
tree101db1ebcc9ea863cf4dc445d44abe42cbc1750c /tmk_core/common
parentb669d115c2969a58f0ae00f6ae5c2290dba44c03 (diff)
Allow multiple process_record() calls per scan
This is particularly relevant for, e.g., the ergodox EZ and other keyboards with slow scan rates. Without changing the API or behavior of individual process_record() calls, we allow a configuration flag to make multiple calls in a single scan. This will probably have miniscule effects on non-steno users, and it's not enabled by default for any keyboards. Added note about it to ergodox README. Signed-off-by: seebs <seebs@seebs.net>
Diffstat (limited to 'tmk_core/common')
-rw-r--r--tmk_core/common/keyboard.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c
index fd2cf74f57..c962a721cb 100644
--- a/tmk_core/common/keyboard.c
+++ b/tmk_core/common/keyboard.c
@@ -177,6 +177,9 @@ void keyboard_task(void)
static uint8_t led_status = 0;
matrix_row_t matrix_row = 0;
matrix_row_t matrix_change = 0;
+#ifdef QMK_KEYS_PER_SCAN
+ uint8_t keys_processed = 0;
+#endif
matrix_scan();
if (is_keyboard_master()) {
@@ -208,6 +211,10 @@ void keyboard_task(void)
});
// record a processed key
matrix_prev[r] ^= ((matrix_row_t)1<<c);
+#ifdef QMK_KEYS_PER_SCAN
+ // only jump out if we have processed "enough" keys.
+ if (++keys_processed >= QMK_KEYS_PER_SCAN)
+#endif
// process a key per task call
goto MATRIX_LOOP_END;
}
@@ -216,6 +223,10 @@ void keyboard_task(void)
}
}
// call with pseudo tick event when no real key event.
+#ifdef QMK_KEYS_PER_SCAN
+ // we can get here with some keys processed now.
+ if (!keys_processed)
+#endif
action_exec(TICK);
MATRIX_LOOP_END: