aboutsummaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
authorErez Zukerman <ezuk@madmimi.com>2016-05-24 23:27:59 -0400
committerErez Zukerman <ezuk@madmimi.com>2016-05-24 23:43:58 -0400
commit1237025963484d70bbe5185a790bec6544653ccc (patch)
tree6c42a79c7fbd2f9d594ba5d9d69c75c0a70b7b82 /quantum
parentf4a426a0b1817dcf865cb5303184cd693074e9b3 (diff)
downloadqmk_firmware-1237025963484d70bbe5185a790bec6544653ccc.tar.gz
qmk_firmware-1237025963484d70bbe5185a790bec6544653ccc.zip
[Erez & Jack] Packages Space Cadet shifts into keycodes
Diffstat (limited to 'quantum')
-rw-r--r--quantum/keymap_common.h2
-rw-r--r--quantum/quantum.c44
2 files changed, 45 insertions, 1 deletions
diff --git a/quantum/keymap_common.h b/quantum/keymap_common.h
index 91d5c09c1..fafc93f7c 100644
--- a/quantum/keymap_common.h
+++ b/quantum/keymap_common.h
@@ -240,6 +240,8 @@ extern const uint16_t fn_actions[];
240#define BL_TOGG 0x5082 240#define BL_TOGG 0x5082
241#define BL_STEP 0x5083 241#define BL_STEP 0x5083
242 242
243#define KC_LSPO 0x5084 // Left shift, open parens when tapped
244#define KC_RSPC 0x5085 // Right shift, close parens when tapped
243// GOTO layer - 16 layers max 245// GOTO layer - 16 layers max
244// when: 246// when:
245// ON_PRESS = 1 247// ON_PRESS = 1
diff --git a/quantum/quantum.c b/quantum/quantum.c
index eb64a99a4..753dde5c6 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -21,6 +21,7 @@ void leader_end(void) {}
21uint8_t starting_note = 0x0C; 21uint8_t starting_note = 0x0C;
22int offset = 7; 22int offset = 7;
23 23
24
24#ifdef AUDIO_ENABLE 25#ifdef AUDIO_ENABLE
25 bool music_activated = false; 26 bool music_activated = false;
26 27
@@ -59,6 +60,8 @@ uint8_t chord_key_down = 0;
59 static uint8_t input_mode; 60 static uint8_t input_mode;
60#endif 61#endif
61 62
63static bool shift_interrupted[] = {0, 0, 0};
64
62bool keys_chord(uint8_t keys[]) { 65bool keys_chord(uint8_t keys[]) {
63 uint8_t keys_size = sizeof(keys)/sizeof(keys[0]); 66 uint8_t keys_size = sizeof(keys)/sizeof(keys[0]);
64 bool pass = true; 67 bool pass = true;
@@ -415,6 +418,45 @@ bool process_record_quantum(keyrecord_t *record) {
415 418
416#endif 419#endif
417 420
421 switch(keycode) {
422 case KC_LSPO: {
423 if (record->event.pressed) {
424 shift_interrupted[0] = false;
425 register_mods(MOD_BIT(KC_LSFT));
426 }
427 else {
428 if (!shift_interrupted[0]) {
429 register_code(KC_9);
430 unregister_code(KC_9);
431 }
432 unregister_mods(MOD_BIT(KC_LSFT));
433 }
434 return false;
435 break;
436 }
437
438 case KC_RSPC: {
439 if (record->event.pressed) {
440 shift_interrupted[1] = false;
441 register_mods(MOD_BIT(KC_RSFT));
442 }
443 else {
444 if (!shift_interrupted[1]) {
445 register_code(KC_0);
446 unregister_code(KC_0);
447 }
448 unregister_mods(MOD_BIT(KC_RSFT));
449 }
450 return false;
451 break;
452 }
453 default: {
454 shift_interrupted[0] = true;
455 shift_interrupted[1] = true;
456 break;
457 }
458 }
459
418 return process_action_kb(record); 460 return process_action_kb(record);
419} 461}
420 462
@@ -481,4 +523,4 @@ void audio_on_user() {}
481__attribute__ ((weak)) 523__attribute__ ((weak))
482void music_scale_user() {} 524void music_scale_user() {}
483 525
484//------------------------------------------------------------------------------ \ No newline at end of file 526//------------------------------------------------------------------------------