aboutsummaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2016-11-21 20:17:45 -0500
committerJack Humbert <jack.humb@gmail.com>2016-11-21 20:17:45 -0500
commit450a8fb5b61de8166fe21eb4f57e1c00514afe32 (patch)
treec7d363a244115eb3736401cc6670f1967ddf9a5d /quantum
parent06a2677b7eedbf58532fa1a673ba1277e756174d (diff)
parentaf119baf710c0b19cfe3351e3f3e89ddeeaacdf6 (diff)
downloadqmk_firmware-450a8fb5b61de8166fe21eb4f57e1c00514afe32.tar.gz
qmk_firmware-450a8fb5b61de8166fe21eb4f57e1c00514afe32.zip
Merge branch 'master' of github.com:jackhumbert/qmk_firmware into wu5y7
Diffstat (limited to 'quantum')
-rw-r--r--quantum/quantum.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 8b2fefef6..f9f1ef22d 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -1,5 +1,9 @@
1#include "quantum.h" 1#include "quantum.h"
2 2
3#ifndef TAPPING_TERM
4#define TAPPING_TERM 200
5#endif
6
3static void do_code16 (uint16_t code, void (*f) (uint8_t)) { 7static void do_code16 (uint16_t code, void (*f) (uint8_t)) {
4 switch (code) { 8 switch (code) {
5 case QK_MODS ... QK_MODS_MAX: 9 case QK_MODS ... QK_MODS_MAX:
@@ -75,6 +79,7 @@ void reset_keyboard(void) {
75#endif 79#endif
76 80
77static bool shift_interrupted[2] = {0, 0}; 81static bool shift_interrupted[2] = {0, 0};
82static uint16_t scs_timer = 0;
78 83
79bool process_record_quantum(keyrecord_t *record) { 84bool process_record_quantum(keyrecord_t *record) {
80 85
@@ -286,6 +291,7 @@ bool process_record_quantum(keyrecord_t *record) {
286 case KC_LSPO: { 291 case KC_LSPO: {
287 if (record->event.pressed) { 292 if (record->event.pressed) {
288 shift_interrupted[0] = false; 293 shift_interrupted[0] = false;
294 scs_timer = timer_read ();
289 register_mods(MOD_BIT(KC_LSFT)); 295 register_mods(MOD_BIT(KC_LSFT));
290 } 296 }
291 else { 297 else {
@@ -295,7 +301,7 @@ bool process_record_quantum(keyrecord_t *record) {
295 shift_interrupted[1] = true; 301 shift_interrupted[1] = true;
296 } 302 }
297 #endif 303 #endif
298 if (!shift_interrupted[0]) { 304 if (!shift_interrupted[0] && timer_elapsed(scs_timer) < TAPPING_TERM) {
299 register_code(LSPO_KEY); 305 register_code(LSPO_KEY);
300 unregister_code(LSPO_KEY); 306 unregister_code(LSPO_KEY);
301 } 307 }
@@ -308,6 +314,7 @@ bool process_record_quantum(keyrecord_t *record) {
308 case KC_RSPC: { 314 case KC_RSPC: {
309 if (record->event.pressed) { 315 if (record->event.pressed) {
310 shift_interrupted[1] = false; 316 shift_interrupted[1] = false;
317 scs_timer = timer_read ();
311 register_mods(MOD_BIT(KC_RSFT)); 318 register_mods(MOD_BIT(KC_RSFT));
312 } 319 }
313 else { 320 else {
@@ -317,7 +324,7 @@ bool process_record_quantum(keyrecord_t *record) {
317 shift_interrupted[1] = true; 324 shift_interrupted[1] = true;
318 } 325 }
319 #endif 326 #endif
320 if (!shift_interrupted[1]) { 327 if (!shift_interrupted[1] && timer_elapsed(scs_timer) < TAPPING_TERM) {
321 register_code(RSPC_KEY); 328 register_code(RSPC_KEY);
322 unregister_code(RSPC_KEY); 329 unregister_code(RSPC_KEY);
323 } 330 }