]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Allow multiple process_record() calls per scan
authorSeebs <seebs@seebs.net>
Sat, 18 Nov 2017 21:39:50 +0000 (15:39 -0600)
committerJack Humbert <jack.humb@gmail.com>
Tue, 21 Nov 2017 05:20:52 +0000 (00:20 -0500)
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>
docs/config_options.md
keyboards/ergodox_ez/readme.md
tmk_core/common/keyboard.c

index faa9c6481411edc15491c56cc77240670f9566e3..a3a918be7f472674e8240e5448000d0c3cac400f 100644 (file)
@@ -123,6 +123,15 @@ If you define these options you will enable the associated feature, which may in
   * how many taps before oneshot toggle is triggered
 * `#define IGNORE_MOD_TAP_INTERRUPT`
   * makes it possible to do rolling combos (zx) with keys that convert to other keys on hold
+* `#define QMK_KEYS_PER_SCAN 4`
+  * Allows sending more than one key per scan. By default, only one key event gets
+    sent via `process_record()` per scan. This has little impact on most typing, but
+    if you're doing a lot of chords, or your scan rate is slow to begin with, you can
+    have some delay in processing key events. Each press and release is a separate
+    event. For a keyboard with 1ms or so scan times, even a very fast typist isn't
+    going to produce the 500 keystrokes a second needed to actually get more than a
+    few ms of delay from this. But if you're doing chording on something with 3-4ms
+    scan times? You probably want this.
 
 ### RGB Light Configuration
 
index f025c5991d641f6842a626f70b3f5088d2c3b2d4..ffde65c88b7b0df90ae60a1d96b21a9974187bc2 100644 (file)
@@ -31,3 +31,8 @@ To flash with ´teensy-loader-cli´:
 
   - Press the Reset button by inserting a paperclip gently into the reset hole
     in the top right corder.
+
+## Settings
+
+You may want to enable QMK_KEYS_PER_SCAN because the Ergodox has a relatively
+slow scan rate.
index fd2cf74f57b0a6502e874f0dee7fcea1e116ddc1..c962a721cb93f8a9a6a1fc11a7e796f45f16c59a 100644 (file)
@@ -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: