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 404331f8df..f7048869ed 100644 --- a/users/spacebarracecar/spacebarracecar.c +++ b/users/spacebarracecar/spacebarracecar.c @@ -1,18 +1,29 @@ #include "spacebarracecar.h" #ifdef GERMAN_ENABLE +// These indicate if left and right shift are physically pressed bool lshift = false; bool rshift = false; + +// Interrupt and times for space cadet shift bool lshiftp = false; bool rshiftp = false; uint16_t lshift_timer = 0; uint16_t rshift_timer = 0; +// Number of items that are saved in prev_kcs uint8_t prev_indx = 0; +// Used to save the last 6 actual keycodes activated by frankenkeycodes uint16_t prev_kcs[6] = {0, 0, 0, 0, 0, 0}; +// If true the deadkey characters grave and circonflexe are not automatically escaped bool esct = false; +/* +Used to add a keycode to a prev_kcs to remember it. +When full the last code gets discarded and replaced by +the new one. +*/ void add_to_prev(uint16_t kc){ for (int i=0; i<prev_indx; i++){ if (kc == prev_kcs[i]) @@ -29,6 +40,13 @@ void add_to_prev(uint16_t kc){ } } +/* +Unregisters all codes saved in prev_kcs and resets prev_indx. +gets called on multiple occasions mainly when shift is released +and when frankenkeycodes are pressed. Prevents output of +wrong characters when really specific key combinations +that would never occur during normal usage are pressed. +*/ void unreg_prev(void){ if (prev_indx == 0) return; @@ -39,11 +57,14 @@ void unreg_prev(void){ } #endif -// stuff for nav esc +// Interrupt and times for Nav/Esc bool navesc = false; uint16_t navesc_timer = 0; + +// If true Gui keys and Space Cadet Shift get disabled bool game = false; +// Interrupts all timers void timer_timeout(void){ #ifdef GERMAN_ENABLE lshiftp = false; @@ -52,15 +73,19 @@ void timer_timeout(void){ navesc = false; } -bool process_record_userspace(uint16_t keycode, keyrecord_t *record) { +bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case CU_GAME: if(record->event.pressed) { + timer_timeout(); game = !game; } - return false; + // allows keymap to execute further commands when CU_GAME is pressed, for example enabling a macro layer + return process_record_keymap(keycode, record) && false; case KC_LGUI: case KC_RGUI: + if (record->event.pressed) + timer_timeout(); if (game) return false; else @@ -77,11 +102,21 @@ bool process_record_userspace(uint16_t keycode, keyrecord_t *record) { } layer_off(_NAV); } - return false; + return false; + case KC_P00: + if(record->event.pressed) { + timer_timeout(); + register_code(KC_P0); + unregister_code(KC_P0); + register_code(KC_P0); + unregister_code(KC_P0); + } + return false; #ifdef RGBLIGHT_ENABLE case CU_RGBV: if(record->event.pressed) { + timer_timeout(); if (rgblight_get_val()+32>255) rgblight_sethsv(rgblight_get_hue(), rgblight_get_sat(), 31); else @@ -133,6 +168,7 @@ bool process_record_userspace(uint16_t keycode, keyrecord_t *record) { return false; case CU_ESCT: if(record->event.pressed) { + timer_timeout(); esct = !esct; } return false; @@ -282,6 +318,7 @@ bool process_record_userspace(uint16_t keycode, keyrecord_t *record) { case KC_LCTL: case KC_RCTL: if(!record->event.pressed) { + timer_timeout(); unregister_code(KC_Z); unregister_code(KC_Y); } @@ -300,6 +337,6 @@ bool process_record_userspace(uint16_t keycode, keyrecord_t *record) { #endif } - return true; + return process_record_keymap(keycode, record); } } diff --git a/users/spacebarracecar/spacebarracecar.h b/users/spacebarracecar/spacebarracecar.h index 42879d2efb..1e18253510 100644 --- a/users/spacebarracecar/spacebarracecar.h +++ b/users/spacebarracecar/spacebarracecar.h @@ -4,13 +4,14 @@ #include "keymap_german.h" enum userspace_layers { - _DEADKEY = 14, //change if more than 16 layers are required + _DEADKEY = 14, // Change if more than 16 layers are required _NAV }; enum userspace_custom_keycodes { CU_GAME = SAFE_RANGE, // Toggle game mode on/off CU_NAV, // NAV | ESC + KC_P00, // Numpad double zero #ifdef GERMAN_ENABLE CU_LSFT, // LSFT | ( @@ -52,10 +53,8 @@ enum userspace_custom_keycodes { }; #ifdef GERMAN_ENABLE -// these save the current shift status extern bool lshift; extern bool rshift; -// stuff for custom space cadet shift extern bool lshiftp; extern bool rshiftp; extern uint16_t lshift_timer; @@ -63,14 +62,12 @@ extern uint16_t rshift_timer; extern uint8_t prev_indx; extern uint16_t prev_kcs[6]; - void add_to_prev(uint16_t kc); void unreg_prev(void); extern bool esct; #endif -// stuff for nav esc extern bool navesc; extern uint16_t navesc_timer; @@ -78,7 +75,7 @@ extern bool game; void timer_timeout(void); -bool process_record_userspace(uint16_t keycode, keyrecord_t *record); +bool process_record_keymap(uint16_t keycode, keyrecord_t *record); #define CTRLX LCTL(KC_X) #define CTRLC LCTL(KC_C) @@ -89,9 +86,9 @@ bool process_record_userspace(uint16_t keycode, keyrecord_t *record); #define GUIL LGUI(KC_LEFT) #define GUIR RGUI(KC_RIGHT) -// -// Templates for Keys, with custom shifted and non shifted Characters -// +/* +Templates for Keys, with custom shifted and non shifted Characters +*/ // Normal shift status #define SHIFT_NORM(kc1, kc2) \ @@ -139,7 +136,7 @@ if (record->event.pressed) { \ } \ return false; -// All shift +// Always shifted #define SHIFT_ALL(kc1, kc2) \ if (record->event.pressed) { \ timer_timeout(); \ @@ -164,7 +161,7 @@ if (record->event.pressed) { \ } \ return false; -// All no shift +// Never shifted #define SHIFT_NO(kc1, kc2) \ if (record->event.pressed) { \ timer_timeout(); \ @@ -188,7 +185,7 @@ if (record->event.pressed) { \ } \ return false; -// All algr +// Always AltGr #define SHIFT_ALGR(kc1, kc2) \ if (record->event.pressed) { \ timer_timeout(); \ @@ -208,7 +205,7 @@ if (record->event.pressed) { \ } \ return false; -// Different keycode for ctrl +// Different keycode when Ctrl is pressed #define CTRL(kc1, kc2) \ if(record->event.pressed) { \ timer_timeout(); \ @@ -227,7 +224,7 @@ if(record->event.pressed) { \ } \ return false; -// Umlaute for deadkey layer +// Template for keys on deadkey layer (mostly Umlaute) #define UML(kc) \ if(record->event.pressed) { \ timer_timeout(); \ |