From 1237025963484d70bbe5185a790bec6544653ccc Mon Sep 17 00:00:00 2001 From: Erez Zukerman Date: Tue, 24 May 2016 23:27:59 -0400 Subject: [Erez & Jack] Packages Space Cadet shifts into keycodes --- quantum/quantum.c | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) (limited to 'quantum/quantum.c') diff --git a/quantum/quantum.c b/quantum/quantum.c index eb64a99a4d..753dde5c66 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[] = {0, 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 +//------------------------------------------------------------------------------ -- cgit v1.2.3