summaryrefslogtreecommitdiffstats
path: root/quantum/quantum.c
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/quantum.c
parentf4a426a0b1817dcf865cb5303184cd693074e9b3 (diff)
[Erez & Jack] Packages Space Cadet shifts into keycodes
Diffstat (limited to 'quantum/quantum.c')
-rw-r--r--quantum/quantum.c44
1 files changed, 43 insertions, 1 deletions
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
+//------------------------------------------------------------------------------