summaryrefslogtreecommitdiff
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)
[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 91d5c09c1c..fafc93f7cd 100644
--- a/quantum/keymap_common.h
+++ b/quantum/keymap_common.h
@@ -240,6 +240,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..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
+//------------------------------------------------------------------------------