diff options
| author | SpacebarRacecar <42380065+SpacebarRacecar@users.noreply.github.com> | 2018-10-22 22:23:22 +0200 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2018-10-22 13:23:22 -0700 |
| commit | 704a2e8d3c0bd15f6c8accd5a39fb88ca6c9e2d5 (patch) | |
| tree | e3ed96d6cc1d4a78c65db1dc571956feeaef83e6 /users/spacebarracecar | |
| parent | e7451448361b0d1490f74aae6dfe4f80e86ea1ca (diff) | |
| download | qmk_firmware-704a2e8d3c0bd15f6c8accd5a39fb88ca6c9e2d5.tar.gz qmk_firmware-704a2e8d3c0bd15f6c8accd5a39fb88ca6c9e2d5.zip | |
Keymap: Updates to personal userspace and keymaps (#4206)
* - updated personal userspace
- updated fc660c, niu mini and planck keymaps
- added prime_o keymap
* Rename README.md to readme.md
Diffstat (limited to 'users/spacebarracecar')
| -rw-r--r-- | users/spacebarracecar/spacebarracecar.c | 47 | ||||
| -rw-r--r-- | users/spacebarracecar/spacebarracecar.h | 25 |
2 files changed, 53 insertions, 19 deletions
diff --git a/users/spacebarracecar/spacebarracecar.c b/users/spacebarracecar/spacebarracecar.c index 404331f8d..f7048869e 100644 --- a/users/spacebarracecar/spacebarracecar.c +++ b/users/spacebarracecar/spacebarracecar.c | |||
| @@ -1,18 +1,29 @@ | |||
| 1 | #include "spacebarracecar.h" | 1 | #include "spacebarracecar.h" |
| 2 | 2 | ||
| 3 | #ifdef GERMAN_ENABLE | 3 | #ifdef GERMAN_ENABLE |
| 4 | // These indicate if left and right shift are physically pressed | ||
| 4 | bool lshift = false; | 5 | bool lshift = false; |
| 5 | bool rshift = false; | 6 | bool rshift = false; |
| 7 | |||
| 8 | // Interrupt and times for space cadet shift | ||
| 6 | bool lshiftp = false; | 9 | bool lshiftp = false; |
| 7 | bool rshiftp = false; | 10 | bool rshiftp = false; |
| 8 | uint16_t lshift_timer = 0; | 11 | uint16_t lshift_timer = 0; |
| 9 | uint16_t rshift_timer = 0; | 12 | uint16_t rshift_timer = 0; |
| 10 | 13 | ||
| 14 | // Number of items that are saved in prev_kcs | ||
| 11 | uint8_t prev_indx = 0; | 15 | uint8_t prev_indx = 0; |
| 16 | // Used to save the last 6 actual keycodes activated by frankenkeycodes | ||
| 12 | uint16_t prev_kcs[6] = {0, 0, 0, 0, 0, 0}; | 17 | uint16_t prev_kcs[6] = {0, 0, 0, 0, 0, 0}; |
| 13 | 18 | ||
| 19 | // If true the deadkey characters grave and circonflexe are not automatically escaped | ||
| 14 | bool esct = false; | 20 | bool esct = false; |
| 15 | 21 | ||
| 22 | /* | ||
| 23 | Used to add a keycode to a prev_kcs to remember it. | ||
| 24 | When full the last code gets discarded and replaced by | ||
| 25 | the new one. | ||
| 26 | */ | ||
| 16 | void add_to_prev(uint16_t kc){ | 27 | void add_to_prev(uint16_t kc){ |
| 17 | for (int i=0; i<prev_indx; i++){ | 28 | for (int i=0; i<prev_indx; i++){ |
| 18 | if (kc == prev_kcs[i]) | 29 | if (kc == prev_kcs[i]) |
| @@ -29,6 +40,13 @@ void add_to_prev(uint16_t kc){ | |||
| 29 | } | 40 | } |
| 30 | } | 41 | } |
| 31 | 42 | ||
| 43 | /* | ||
| 44 | Unregisters all codes saved in prev_kcs and resets prev_indx. | ||
| 45 | gets called on multiple occasions mainly when shift is released | ||
| 46 | and when frankenkeycodes are pressed. Prevents output of | ||
| 47 | wrong characters when really specific key combinations | ||
| 48 | that would never occur during normal usage are pressed. | ||
| 49 | */ | ||
| 32 | void unreg_prev(void){ | 50 | void unreg_prev(void){ |
| 33 | if (prev_indx == 0) | 51 | if (prev_indx == 0) |
| 34 | return; | 52 | return; |
| @@ -39,11 +57,14 @@ void unreg_prev(void){ | |||
| 39 | } | 57 | } |
| 40 | #endif | 58 | #endif |
| 41 | 59 | ||
| 42 | // stuff for nav esc | 60 | // Interrupt and times for Nav/Esc |
| 43 | bool navesc = false; | 61 | bool navesc = false; |
| 44 | uint16_t navesc_timer = 0; | 62 | uint16_t navesc_timer = 0; |
| 63 | |||
| 64 | // If true Gui keys and Space Cadet Shift get disabled | ||
| 45 | bool game = false; | 65 | bool game = false; |
| 46 | 66 | ||
| 67 | // Interrupts all timers | ||
| 47 | void timer_timeout(void){ | 68 | void timer_timeout(void){ |
| 48 | #ifdef GERMAN_ENABLE | 69 | #ifdef GERMAN_ENABLE |
| 49 | lshiftp = false; | 70 | lshiftp = false; |
| @@ -52,15 +73,19 @@ void timer_timeout(void){ | |||
| 52 | navesc = false; | 73 | navesc = false; |
| 53 | } | 74 | } |
| 54 | 75 | ||
| 55 | bool process_record_userspace(uint16_t keycode, keyrecord_t *record) { | 76 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { |
| 56 | switch (keycode) { | 77 | switch (keycode) { |
| 57 | case CU_GAME: | 78 | case CU_GAME: |
| 58 | if(record->event.pressed) { | 79 | if(record->event.pressed) { |
| 80 | timer_timeout(); | ||
| 59 | game = !game; | 81 | game = !game; |
| 60 | } | 82 | } |
| 61 | return false; | 83 | // allows keymap to execute further commands when CU_GAME is pressed, for example enabling a macro layer |
| 84 | return process_record_keymap(keycode, record) && false; | ||
| 62 | case KC_LGUI: | 85 | case KC_LGUI: |
| 63 | case KC_RGUI: | 86 | case KC_RGUI: |
| 87 | if (record->event.pressed) | ||
| 88 | timer_timeout(); | ||
| 64 | if (game) | 89 | if (game) |
| 65 | return false; | 90 | return false; |
| 66 | else | 91 | else |
| @@ -77,11 +102,21 @@ bool process_record_userspace(uint16_t keycode, keyrecord_t *record) { | |||
| 77 | } | 102 | } |
| 78 | layer_off(_NAV); | 103 | layer_off(_NAV); |
| 79 | } | 104 | } |
| 80 | return false; | 105 | return false; |
| 106 | case KC_P00: | ||
| 107 | if(record->event.pressed) { | ||
| 108 | timer_timeout(); | ||
| 109 | register_code(KC_P0); | ||
| 110 | unregister_code(KC_P0); | ||
| 111 | register_code(KC_P0); | ||
| 112 | unregister_code(KC_P0); | ||
| 113 | } | ||
| 114 | return false; | ||
| 81 | 115 | ||
| 82 | #ifdef RGBLIGHT_ENABLE | 116 | #ifdef RGBLIGHT_ENABLE |
| 83 | case CU_RGBV: | 117 | case CU_RGBV: |
| 84 | if(record->event.pressed) { | 118 | if(record->event.pressed) { |
| 119 | timer_timeout(); | ||
| 85 | if (rgblight_get_val()+32>255) | 120 | if (rgblight_get_val()+32>255) |
| 86 | rgblight_sethsv(rgblight_get_hue(), rgblight_get_sat(), 31); | 121 | rgblight_sethsv(rgblight_get_hue(), rgblight_get_sat(), 31); |
| 87 | else | 122 | else |
| @@ -133,6 +168,7 @@ bool process_record_userspace(uint16_t keycode, keyrecord_t *record) { | |||
| 133 | return false; | 168 | return false; |
| 134 | case CU_ESCT: | 169 | case CU_ESCT: |
| 135 | if(record->event.pressed) { | 170 | if(record->event.pressed) { |
| 171 | timer_timeout(); | ||
| 136 | esct = !esct; | 172 | esct = !esct; |
| 137 | } | 173 | } |
| 138 | return false; | 174 | return false; |
| @@ -282,6 +318,7 @@ bool process_record_userspace(uint16_t keycode, keyrecord_t *record) { | |||
| 282 | case KC_LCTL: | 318 | case KC_LCTL: |
| 283 | case KC_RCTL: | 319 | case KC_RCTL: |
| 284 | if(!record->event.pressed) { | 320 | if(!record->event.pressed) { |
| 321 | timer_timeout(); | ||
| 285 | unregister_code(KC_Z); | 322 | unregister_code(KC_Z); |
| 286 | unregister_code(KC_Y); | 323 | unregister_code(KC_Y); |
| 287 | } | 324 | } |
| @@ -300,6 +337,6 @@ bool process_record_userspace(uint16_t keycode, keyrecord_t *record) { | |||
| 300 | #endif | 337 | #endif |
| 301 | 338 | ||
| 302 | } | 339 | } |
| 303 | return true; | 340 | return process_record_keymap(keycode, record); |
| 304 | } | 341 | } |
| 305 | } | 342 | } |
diff --git a/users/spacebarracecar/spacebarracecar.h b/users/spacebarracecar/spacebarracecar.h index 42879d2ef..1e1825351 100644 --- a/users/spacebarracecar/spacebarracecar.h +++ b/users/spacebarracecar/spacebarracecar.h | |||
| @@ -4,13 +4,14 @@ | |||
| 4 | #include "keymap_german.h" | 4 | #include "keymap_german.h" |
| 5 | 5 | ||
| 6 | enum userspace_layers { | 6 | enum userspace_layers { |
| 7 | _DEADKEY = 14, //change if more than 16 layers are required | 7 | _DEADKEY = 14, // Change if more than 16 layers are required |
| 8 | _NAV | 8 | _NAV |
| 9 | }; | 9 | }; |
| 10 | 10 | ||
| 11 | enum userspace_custom_keycodes { | 11 | enum userspace_custom_keycodes { |
| 12 | CU_GAME = SAFE_RANGE, // Toggle game mode on/off | 12 | CU_GAME = SAFE_RANGE, // Toggle game mode on/off |
| 13 | CU_NAV, // NAV | ESC | 13 | CU_NAV, // NAV | ESC |
| 14 | KC_P00, // Numpad double zero | ||
| 14 | 15 | ||
| 15 | #ifdef GERMAN_ENABLE | 16 | #ifdef GERMAN_ENABLE |
| 16 | CU_LSFT, // LSFT | ( | 17 | CU_LSFT, // LSFT | ( |
| @@ -52,10 +53,8 @@ enum userspace_custom_keycodes { | |||
| 52 | }; | 53 | }; |
| 53 | 54 | ||
| 54 | #ifdef GERMAN_ENABLE | 55 | #ifdef GERMAN_ENABLE |
| 55 | // these save the current shift status | ||
| 56 | extern bool lshift; | 56 | extern bool lshift; |
| 57 | extern bool rshift; | 57 | extern bool rshift; |
| 58 | // stuff for custom space cadet shift | ||
| 59 | extern bool lshiftp; | 58 | extern bool lshiftp; |
| 60 | extern bool rshiftp; | 59 | extern bool rshiftp; |
| 61 | extern uint16_t lshift_timer; | 60 | extern uint16_t lshift_timer; |
| @@ -63,14 +62,12 @@ extern uint16_t rshift_timer; | |||
| 63 | 62 | ||
| 64 | extern uint8_t prev_indx; | 63 | extern uint8_t prev_indx; |
| 65 | extern uint16_t prev_kcs[6]; | 64 | extern uint16_t prev_kcs[6]; |
| 66 | |||
| 67 | void add_to_prev(uint16_t kc); | 65 | void add_to_prev(uint16_t kc); |
| 68 | void unreg_prev(void); | 66 | void unreg_prev(void); |
| 69 | 67 | ||
| 70 | extern bool esct; | 68 | extern bool esct; |
| 71 | #endif | 69 | #endif |
| 72 | 70 | ||
| 73 | // stuff for nav esc | ||
| 74 | extern bool navesc; | 71 | extern bool navesc; |
| 75 | extern uint16_t navesc_timer; | 72 | extern uint16_t navesc_timer; |
| 76 | 73 | ||
| @@ -78,7 +75,7 @@ extern bool game; | |||
| 78 | 75 | ||
| 79 | void timer_timeout(void); | 76 | void timer_timeout(void); |
| 80 | 77 | ||
| 81 | bool process_record_userspace(uint16_t keycode, keyrecord_t *record); | 78 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record); |
| 82 | 79 | ||
| 83 | #define CTRLX LCTL(KC_X) | 80 | #define CTRLX LCTL(KC_X) |
| 84 | #define CTRLC LCTL(KC_C) | 81 | #define CTRLC LCTL(KC_C) |
| @@ -89,9 +86,9 @@ bool process_record_userspace(uint16_t keycode, keyrecord_t *record); | |||
| 89 | #define GUIL LGUI(KC_LEFT) | 86 | #define GUIL LGUI(KC_LEFT) |
| 90 | #define GUIR RGUI(KC_RIGHT) | 87 | #define GUIR RGUI(KC_RIGHT) |
| 91 | 88 | ||
| 92 | // | 89 | /* |
| 93 | // Templates for Keys, with custom shifted and non shifted Characters | 90 | Templates for Keys, with custom shifted and non shifted Characters |
| 94 | // | 91 | */ |
| 95 | 92 | ||
| 96 | // Normal shift status | 93 | // Normal shift status |
| 97 | #define SHIFT_NORM(kc1, kc2) \ | 94 | #define SHIFT_NORM(kc1, kc2) \ |
| @@ -139,7 +136,7 @@ if (record->event.pressed) { \ | |||
| 139 | } \ | 136 | } \ |
| 140 | return false; | 137 | return false; |
| 141 | 138 | ||
| 142 | // All shift | 139 | // Always shifted |
| 143 | #define SHIFT_ALL(kc1, kc2) \ | 140 | #define SHIFT_ALL(kc1, kc2) \ |
| 144 | if (record->event.pressed) { \ | 141 | if (record->event.pressed) { \ |
| 145 | timer_timeout(); \ | 142 | timer_timeout(); \ |
| @@ -164,7 +161,7 @@ if (record->event.pressed) { \ | |||
| 164 | } \ | 161 | } \ |
| 165 | return false; | 162 | return false; |
| 166 | 163 | ||
| 167 | // All no shift | 164 | // Never shifted |
| 168 | #define SHIFT_NO(kc1, kc2) \ | 165 | #define SHIFT_NO(kc1, kc2) \ |
| 169 | if (record->event.pressed) { \ | 166 | if (record->event.pressed) { \ |
| 170 | timer_timeout(); \ | 167 | timer_timeout(); \ |
| @@ -188,7 +185,7 @@ if (record->event.pressed) { \ | |||
| 188 | } \ | 185 | } \ |
| 189 | return false; | 186 | return false; |
| 190 | 187 | ||
| 191 | // All algr | 188 | // Always AltGr |
| 192 | #define SHIFT_ALGR(kc1, kc2) \ | 189 | #define SHIFT_ALGR(kc1, kc2) \ |
| 193 | if (record->event.pressed) { \ | 190 | if (record->event.pressed) { \ |
| 194 | timer_timeout(); \ | 191 | timer_timeout(); \ |
| @@ -208,7 +205,7 @@ if (record->event.pressed) { \ | |||
| 208 | } \ | 205 | } \ |
| 209 | return false; | 206 | return false; |
| 210 | 207 | ||
| 211 | // Different keycode for ctrl | 208 | // Different keycode when Ctrl is pressed |
| 212 | #define CTRL(kc1, kc2) \ | 209 | #define CTRL(kc1, kc2) \ |
| 213 | if(record->event.pressed) { \ | 210 | if(record->event.pressed) { \ |
| 214 | timer_timeout(); \ | 211 | timer_timeout(); \ |
| @@ -227,7 +224,7 @@ if(record->event.pressed) { \ | |||
| 227 | } \ | 224 | } \ |
| 228 | return false; | 225 | return false; |
| 229 | 226 | ||
| 230 | // Umlaute for deadkey layer | 227 | // Template for keys on deadkey layer (mostly Umlaute) |
| 231 | #define UML(kc) \ | 228 | #define UML(kc) \ |
| 232 | if(record->event.pressed) { \ | 229 | if(record->event.pressed) { \ |
| 233 | timer_timeout(); \ | 230 | timer_timeout(); \ |
