diff options
author | Christopher Browne <cbbrowne@ca.afilias.info> | 2016-05-26 15:17:00 -0400 |
---|---|---|
committer | Christopher Browne <cbbrowne@ca.afilias.info> | 2016-05-26 15:17:00 -0400 |
commit | d649ab34334ff568448c47a04fcf40f1aa960135 (patch) | |
tree | 4cc848e8892b21839da14d7b9ac628f6cfbefadf /quantum | |
parent | 48871b9b6b99201abc381ee27cfd94e211ca131a (diff) | |
parent | 89f0472b9e1c751034a745898fd495bbd49f2b66 (diff) |
Merge branch 'master' of https://github.com/jackhumbert/qmk_firmware
Diffstat (limited to 'quantum')
-rw-r--r-- | quantum/keymap_common.h | 4 | ||||
-rw-r--r-- | quantum/quantum.c | 44 |
2 files changed, 47 insertions, 1 deletions
diff --git a/quantum/keymap_common.h b/quantum/keymap_common.h index 91d5c09c1c..db14e7d8ac 100644 --- a/quantum/keymap_common.h +++ b/quantum/keymap_common.h @@ -119,6 +119,8 @@ extern const uint16_t fn_actions[]; #define KC_PLUS LSFT(KC_EQL) // + +#define KC_DQUO LSFT(KC_QUOT) // " +#define KC_DOUBLE_QUOTE KC_DQUO #define KC_LCBR LSFT(KC_LBRC) // { #define KC_LEFT_CURLY_BRACE KC_LCBR @@ -240,6 +242,8 @@ extern const uint16_t fn_actions[]; #define BL_TOGG 0x5082 #define BL_STEP 0x5083 +#define KC_LSPO 0x5084 // Left shift, open parens when tapped +#define KC_RSPC 0x5085 // Right shift, close parens when tapped // GOTO layer - 16 layers max // when: // ON_PRESS = 1 diff --git a/quantum/quantum.c b/quantum/quantum.c index eb64a99a4d..c53fb19b4b 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -21,6 +21,7 @@ void leader_end(void) {} uint8_t starting_note = 0x0C; int offset = 7; + #ifdef AUDIO_ENABLE bool music_activated = false; @@ -59,6 +60,8 @@ uint8_t chord_key_down = 0; static uint8_t input_mode; #endif +static bool shift_interrupted[2] = {0, 0}; + bool keys_chord(uint8_t keys[]) { uint8_t keys_size = sizeof(keys)/sizeof(keys[0]); bool pass = true; @@ -415,6 +418,45 @@ bool process_record_quantum(keyrecord_t *record) { #endif + switch(keycode) { + case KC_LSPO: { + if (record->event.pressed) { + shift_interrupted[0] = false; + register_mods(MOD_BIT(KC_LSFT)); + } + else { + if (!shift_interrupted[0]) { + register_code(KC_9); + unregister_code(KC_9); + } + unregister_mods(MOD_BIT(KC_LSFT)); + } + return false; + break; + } + + case KC_RSPC: { + if (record->event.pressed) { + shift_interrupted[1] = false; + register_mods(MOD_BIT(KC_RSFT)); + } + else { + if (!shift_interrupted[1]) { + register_code(KC_0); + unregister_code(KC_0); + } + unregister_mods(MOD_BIT(KC_RSFT)); + } + return false; + break; + } + default: { + shift_interrupted[0] = true; + shift_interrupted[1] = true; + break; + } + } + return process_action_kb(record); } @@ -481,4 +523,4 @@ void audio_on_user() {} __attribute__ ((weak)) void music_scale_user() {} -//------------------------------------------------------------------------------
\ No newline at end of file +//------------------------------------------------------------------------------ |