diff options
-rw-r--r-- | docs/feature_space_cadet.md | 6 | ||||
-rw-r--r-- | quantum/process_keycode/process_space_cadet.c | 39 | ||||
-rw-r--r-- | quantum/process_keycode/process_space_cadet.h | 2 | ||||
-rw-r--r-- | users/xulkal/config.h | 2 |
4 files changed, 27 insertions, 22 deletions
diff --git a/docs/feature_space_cadet.md b/docs/feature_space_cadet.md index 3e4665cde..5c375c518 100644 --- a/docs/feature_space_cadet.md +++ b/docs/feature_space_cadet.md | |||
@@ -39,15 +39,15 @@ By default Space Cadet assumes a US ANSI layout, but if your layout uses differe | |||
39 | |`LSPO_KEYS` |`KC_LSFT, LSPO_MOD, LSPO_KEY` |Send `KC_LSFT` when held, the mod and key defined by `LSPO_MOD` and `LSPO_KEY`. | | 39 | |`LSPO_KEYS` |`KC_LSFT, LSPO_MOD, LSPO_KEY` |Send `KC_LSFT` when held, the mod and key defined by `LSPO_MOD` and `LSPO_KEY`. | |
40 | |`RSPC_KEYS` |`KC_RSFT, RSPC_MOD, RSPC_KEY` |Send `KC_RSFT` when held, the mod and key defined by `RSPC_MOD` and `RSPC_KEY`. | | 40 | |`RSPC_KEYS` |`KC_RSFT, RSPC_MOD, RSPC_KEY` |Send `KC_RSFT` when held, the mod and key defined by `RSPC_MOD` and `RSPC_KEY`. | |
41 | |`LCPO_KEYS` |`KC_LCTL, KC_LCTL, KC_9` |Send `KC_LCTL` when held, the mod `KC_LCTL` with the key `KC_9` when tapped. | | 41 | |`LCPO_KEYS` |`KC_LCTL, KC_LCTL, KC_9` |Send `KC_LCTL` when held, the mod `KC_LCTL` with the key `KC_9` when tapped. | |
42 | |`RCPO_KEYS` |`KC_RCTL, KC_RCTL, KC_0` |Send `KC_RCTL` when held, the mod `KC_RCTL` with the key `KC_0` when tapped. | | 42 | |`RCPC_KEYS` |`KC_RCTL, KC_RCTL, KC_0` |Send `KC_RCTL` when held, the mod `KC_RCTL` with the key `KC_0` when tapped. | |
43 | |`LAPO_KEYS` |`KC_LALT, KC_LALT, KC_9` |Send `KC_LALT` when held, the mod `KC_LALT` with the key `KC_9` when tapped. | | 43 | |`LAPO_KEYS` |`KC_LALT, KC_LALT, KC_9` |Send `KC_LALT` when held, the mod `KC_LALT` with the key `KC_9` when tapped. | |
44 | |`RAPO_KEYS` |`KC_RALT, KC_RALT, KC_0` |Send `KC_RALT` when held, the mod `KC_RALT` with the key `KC_0` when tapped. | | 44 | |`RAPC_KEYS` |`KC_RALT, KC_RALT, KC_0` |Send `KC_RALT` when held, the mod `KC_RALT` with the key `KC_0` when tapped. | |
45 | |`SFTENT_KEYS` |`KC_RSFT, KC_TRNS, SFTENT_KEY` |Send `KC_RSFT` when held, no mod with the key `SFTENT_KEY` when tapped. | | 45 | |`SFTENT_KEYS` |`KC_RSFT, KC_TRNS, SFTENT_KEY` |Send `KC_RSFT` when held, no mod with the key `SFTENT_KEY` when tapped. | |
46 | 46 | ||
47 | 47 | ||
48 | ## Obsolete Configuration | 48 | ## Obsolete Configuration |
49 | 49 | ||
50 | These defines are used in the above defines internally to support backwards compatibility, so you may continue to use them, however the above defines open up a larger range of flexibility than before. As an example, say you want to not send any modifier when you tap just `KC_LSPO`, with the old defines you had an all or nothing choice of using the `DISABLE_SPACE_CADET_MODIFIER` define. Now you can define that key as: `#define KC_LSPO_KEYS KC_LSFT, KC_TRNS, KC_9`. This tells the system to set Left Shift if held or used with other keys, then on tap send no modifier (transparent) with the `KC_9` | 50 | These defines are used in the above defines internally to support backwards compatibility, so you may continue to use them, however the above defines open up a larger range of flexibility than before. As an example, say you want to not send any modifier when you tap just `KC_LSPO`, with the old defines you had an all or nothing choice of using the `DISABLE_SPACE_CADET_MODIFIER` define. Now you can define that key as: `#define LSPO_KEYS KC_LSFT, KC_TRNS, KC_9`. This tells the system to set Left Shift if held or used with other keys, then on tap send no modifier (transparent) with the `KC_9`. |
51 | 51 | ||
52 | |Define |Default |Description | | 52 | |Define |Default |Description | |
53 | |------------------------------|-------------|------------------------------------------------------------------| | 53 | |------------------------------|-------------|------------------------------------------------------------------| |
diff --git a/quantum/process_keycode/process_space_cadet.c b/quantum/process_keycode/process_space_cadet.c index a9c506168..ac39df808 100644 --- a/quantum/process_keycode/process_space_cadet.c +++ b/quantum/process_keycode/process_space_cadet.c | |||
@@ -62,16 +62,16 @@ | |||
62 | #ifndef LCPO_KEYS | 62 | #ifndef LCPO_KEYS |
63 | #define LCPO_KEYS KC_LCTL, KC_LCTL, KC_9 | 63 | #define LCPO_KEYS KC_LCTL, KC_LCTL, KC_9 |
64 | #endif | 64 | #endif |
65 | #ifndef RCPO_KEYS | 65 | #ifndef RCPC_KEYS |
66 | #define RCPO_KEYS KC_RCTL, KC_RCTL, KC_0 | 66 | #define RCPC_KEYS KC_RCTL, KC_RCTL, KC_0 |
67 | #endif | 67 | #endif |
68 | 68 | ||
69 | // Alt / paren setup | 69 | // Alt / paren setup |
70 | #ifndef LAPO_KEYS | 70 | #ifndef LAPO_KEYS |
71 | #define LAPO_KEYS KC_LALT, KC_LALT, KC_9 | 71 | #define LAPO_KEYS KC_LALT, KC_LALT, KC_9 |
72 | #endif | 72 | #endif |
73 | #ifndef RAPO_KEYS | 73 | #ifndef RAPC_KEYS |
74 | #define RAPO_KEYS KC_RALT, KC_RALT, KC_0 | 74 | #define RAPC_KEYS KC_RALT, KC_RALT, KC_0 |
75 | #endif | 75 | #endif |
76 | 76 | ||
77 | // Shift / Enter setup | 77 | // Shift / Enter setup |
@@ -82,27 +82,32 @@ | |||
82 | static uint8_t sc_last = 0; | 82 | static uint8_t sc_last = 0; |
83 | static uint16_t sc_timer = 0; | 83 | static uint16_t sc_timer = 0; |
84 | 84 | ||
85 | void perform_space_cadet(keyrecord_t *record, uint8_t normalMod, uint8_t tapMod, uint8_t keycode) { | 85 | void perform_space_cadet(keyrecord_t *record, uint8_t holdMod, uint8_t tapMod, uint8_t keycode) { |
86 | if (record->event.pressed) { | 86 | if (record->event.pressed) { |
87 | sc_last = normalMod; | 87 | sc_last = holdMod; |
88 | sc_timer = timer_read (); | 88 | sc_timer = timer_read (); |
89 | if (IS_MOD(normalMod)) { | 89 | if (IS_MOD(holdMod)) { |
90 | register_mods(MOD_BIT(normalMod)); | 90 | register_mods(MOD_BIT(holdMod)); |
91 | } | 91 | } |
92 | } | 92 | } |
93 | else { | 93 | else { |
94 | if (IS_MOD(normalMod)) { | 94 | if (sc_last == holdMod && timer_elapsed(sc_timer) < TAPPING_TERM) { |
95 | unregister_mods(MOD_BIT(normalMod)); | 95 | if (holdMod != tapMod) { |
96 | } | 96 | if (IS_MOD(holdMod)) { |
97 | 97 | unregister_mods(MOD_BIT(holdMod)); | |
98 | if (sc_last == normalMod && timer_elapsed(sc_timer) < TAPPING_TERM) { | 98 | } |
99 | if (IS_MOD(tapMod)) { | 99 | if (IS_MOD(tapMod)) { |
100 | register_mods(MOD_BIT(tapMod)); | 100 | register_mods(MOD_BIT(tapMod)); |
101 | } | ||
101 | } | 102 | } |
102 | tap_code(keycode); | 103 | tap_code(keycode); |
103 | if (IS_MOD(tapMod)) { | 104 | if (IS_MOD(tapMod)) { |
104 | unregister_mods(MOD_BIT(tapMod)); | 105 | unregister_mods(MOD_BIT(tapMod)); |
105 | } | 106 | } |
107 | } else { | ||
108 | if (IS_MOD(holdMod)) { | ||
109 | unregister_mods(MOD_BIT(holdMod)); | ||
110 | } | ||
106 | } | 111 | } |
107 | } | 112 | } |
108 | } | 113 | } |
@@ -122,7 +127,7 @@ bool process_space_cadet(uint16_t keycode, keyrecord_t *record) { | |||
122 | return false; | 127 | return false; |
123 | } | 128 | } |
124 | case KC_RCPC: { | 129 | case KC_RCPC: { |
125 | perform_space_cadet(record, RCPO_KEYS); | 130 | perform_space_cadet(record, RCPC_KEYS); |
126 | return false; | 131 | return false; |
127 | } | 132 | } |
128 | case KC_LAPO: { | 133 | case KC_LAPO: { |
@@ -130,7 +135,7 @@ bool process_space_cadet(uint16_t keycode, keyrecord_t *record) { | |||
130 | return false; | 135 | return false; |
131 | } | 136 | } |
132 | case KC_RAPC: { | 137 | case KC_RAPC: { |
133 | perform_space_cadet(record, RAPO_KEYS); | 138 | perform_space_cadet(record, RAPC_KEYS); |
134 | return false; | 139 | return false; |
135 | } | 140 | } |
136 | case KC_SFTENT: { | 141 | case KC_SFTENT: { |
diff --git a/quantum/process_keycode/process_space_cadet.h b/quantum/process_keycode/process_space_cadet.h index 3f08b8002..c82314350 100644 --- a/quantum/process_keycode/process_space_cadet.h +++ b/quantum/process_keycode/process_space_cadet.h | |||
@@ -17,5 +17,5 @@ | |||
17 | 17 | ||
18 | #include "quantum.h" | 18 | #include "quantum.h" |
19 | 19 | ||
20 | void perform_space_cadet(keyrecord_t *record, uint8_t normalMod, uint8_t tapMod, uint8_t keycode); | 20 | void perform_space_cadet(keyrecord_t *record, uint8_t holdMod, uint8_t tapMod, uint8_t keycode); |
21 | bool process_space_cadet(uint16_t keycode, keyrecord_t *record); | 21 | bool process_space_cadet(uint16_t keycode, keyrecord_t *record); |
diff --git a/users/xulkal/config.h b/users/xulkal/config.h index 6ff4ca49d..2899017b0 100644 --- a/users/xulkal/config.h +++ b/users/xulkal/config.h | |||
@@ -10,7 +10,7 @@ | |||
10 | #define LSPO_KEYS KC_LSFT, KC_TRNS, KC_LBRC | 10 | #define LSPO_KEYS KC_LSFT, KC_TRNS, KC_LBRC |
11 | #define RSPC_KEYS KC_RSFT, KC_TRNS, KC_RBRC | 11 | #define RSPC_KEYS KC_RSFT, KC_TRNS, KC_RBRC |
12 | #define LCPO_KEYS KC_LCTL, KC_TRNS, KC_MINS | 12 | #define LCPO_KEYS KC_LCTL, KC_TRNS, KC_MINS |
13 | #define RCPO_KEYS KC_RCTL, KC_TRNS, KC_EQL | 13 | #define RCPC_KEYS KC_RCTL, KC_TRNS, KC_EQL |
14 | 14 | ||
15 | // No need for the single versions when multi performance isn't a problem =D | 15 | // No need for the single versions when multi performance isn't a problem =D |
16 | #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE | 16 | #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE |