diff options
Diffstat (limited to 'quantum')
| -rw-r--r-- | quantum/keymap_common.h | 2 | ||||
| -rw-r--r-- | quantum/quantum.c | 44 |
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) {} | |||
| 21 | uint8_t starting_note = 0x0C; | 21 | uint8_t starting_note = 0x0C; |
| 22 | int offset = 7; | 22 | int 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 | ||
| 63 | static bool shift_interrupted[] = {0, 0, 0}; | ||
| 64 | |||
| 62 | bool keys_chord(uint8_t keys[]) { | 65 | bool 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)) |
| 482 | void music_scale_user() {} | 524 | void music_scale_user() {} |
| 483 | 525 | ||
| 484 | //------------------------------------------------------------------------------ \ No newline at end of file | 526 | //------------------------------------------------------------------------------ |
