diff options
| author | Drashna Jaelre <drashna@live.com> | 2018-07-16 18:04:32 -0700 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2018-07-16 21:04:32 -0400 |
| commit | b2877470ced1deb9651ecb39f6a82f5ef380b399 (patch) | |
| tree | ba4c9e0a9c86526cf4bc002b732be0dce37acd5b /users/drashna/drashna.c | |
| parent | e0c9cfad86a7c17863db08574472e866aa3d37b7 (diff) | |
| download | qmk_firmware-b2877470ced1deb9651ecb39f6a82f5ef380b399.tar.gz qmk_firmware-b2877470ced1deb9651ecb39f6a82f5ef380b399.zip | |
Update to drashna userspace and keymaps (#3172)
* Use string with delay
* Add skipped region to ergodox
* Add send string config
* Use default_layer_state instead of function
* Fully generalize keyboards
* old iris cleanup
* Fix Drashna keymap compile issues
By checking to see if secret.c exists before actually trying to add it
* Remove unnecessary references
* Add 4x12 ortho board
* Update userspace readme for secrets
* Make RGB more modular
* Fix iris keymap, since we don't need the lower left (Function keys)
* Fix includes
* Add Blanks
* Fix Ergodox lower layer
* Add suspend commands
* Add Maltron Layout
* Add additional layouts
* Finish adding gamepad to Iris
* Tweaks to iris gamepag layer
* make gaming layers more friendly
* minor gaming layer tweak
* Add Carplax
* Add modded key timer function
* Cleanup and macro documentation
* Add QMK DFU info
* Add 'old' keymap for 12 LED spare
* Update Pro Micro documentation
* Disable twinkling so it fits in firmware space
* Switch to QMK DFU bootloader, since it's better anyhow
* Write default layer state colors to EEPROM
Since we are writing to EEPROM anyways, and this way, it sticks on reboot
* Fix QMK DFU bootloader options
* More updates for QMK DFU support
* Use matrix scanning hack for startup_user until #3113 gets merged
* Fix indicator light consistency issue
* Add/readd ifdefs to indicators
* Add/readd alt indicator
* Remove RGB Twinkling from Viterbi macro pad
* Fix default layer color detection
* Fix rebase and detection issues
* Cleanup code so it will compile if RGBLIGHT is disabled
* Revert vsode settings
* Use Pragma Once instead of boilerplate code
Diffstat (limited to 'users/drashna/drashna.c')
| -rw-r--r-- | users/drashna/drashna.c | 96 |
1 files changed, 89 insertions, 7 deletions
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index 8efd99f80..f72902f0b 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c | |||
| @@ -38,7 +38,7 @@ bool send_game_macro(const char *str, keyrecord_t *record, bool override) { | |||
| 38 | clear_keyboard(); | 38 | clear_keyboard(); |
| 39 | tap(userspace_config.is_overwatch ? KC_BSPC : KC_ENTER); | 39 | tap(userspace_config.is_overwatch ? KC_BSPC : KC_ENTER); |
| 40 | wait_ms(50); | 40 | wait_ms(50); |
| 41 | send_string(str); | 41 | send_string_with_delay(str, MACRO_TIMER); |
| 42 | wait_ms(50); | 42 | wait_ms(50); |
| 43 | tap(KC_ENTER); | 43 | tap(KC_ENTER); |
| 44 | } | 44 | } |
| @@ -48,6 +48,40 @@ bool send_game_macro(const char *str, keyrecord_t *record, bool override) { | |||
| 48 | 48 | ||
| 49 | void tap(uint16_t keycode){ register_code(keycode); unregister_code(keycode); }; | 49 | void tap(uint16_t keycode){ register_code(keycode); unregister_code(keycode); }; |
| 50 | 50 | ||
| 51 | bool mod_key_press_timer (uint16_t code, uint16_t mod_code, bool pressed) { | ||
| 52 | static uint16_t this_timer; | ||
| 53 | if(pressed) { | ||
| 54 | this_timer= timer_read(); | ||
| 55 | } else { | ||
| 56 | if (timer_elapsed(this_timer) < TAPPING_TERM){ | ||
| 57 | register_code(code); | ||
| 58 | unregister_code(code); | ||
| 59 | } else { | ||
| 60 | register_code(mod_code); | ||
| 61 | register_code(code); | ||
| 62 | unregister_code(code); | ||
| 63 | unregister_code(mod_code); | ||
| 64 | } | ||
| 65 | } | ||
| 66 | return false; | ||
| 67 | } | ||
| 68 | |||
| 69 | bool mod_key_press (uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer) { | ||
| 70 | if(pressed) { | ||
| 71 | this_timer= timer_read(); | ||
| 72 | } else { | ||
| 73 | if (timer_elapsed(this_timer) < TAPPING_TERM){ | ||
| 74 | register_code(code); | ||
| 75 | unregister_code(code); | ||
| 76 | } else { | ||
| 77 | register_code(mod_code); | ||
| 78 | register_code(code); | ||
| 79 | unregister_code(code); | ||
| 80 | unregister_code(mod_code); | ||
| 81 | } | ||
| 82 | } | ||
| 83 | return false; | ||
| 84 | } | ||
| 51 | 85 | ||
| 52 | // Add reconfigurable functions here, for keymap customization | 86 | // Add reconfigurable functions here, for keymap customization |
| 53 | // This allows for a global, userspace functions, and continued | 87 | // This allows for a global, userspace functions, and continued |
| @@ -57,6 +91,15 @@ __attribute__ ((weak)) | |||
| 57 | void matrix_init_keymap(void) {} | 91 | void matrix_init_keymap(void) {} |
| 58 | 92 | ||
| 59 | __attribute__ ((weak)) | 93 | __attribute__ ((weak)) |
| 94 | void startup_keymap(void) {} | ||
| 95 | |||
| 96 | __attribute__ ((weak)) | ||
| 97 | void suspend_power_down_keymap(void) {} | ||
| 98 | |||
| 99 | __attribute__ ((weak)) | ||
| 100 | void suspend_wakeup_init_keymap(void) {} | ||
| 101 | |||
| 102 | __attribute__ ((weak)) | ||
| 60 | void matrix_scan_keymap(void) {} | 103 | void matrix_scan_keymap(void) {} |
| 61 | 104 | ||
| 62 | __attribute__ ((weak)) | 105 | __attribute__ ((weak)) |
| @@ -69,12 +112,18 @@ bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { | |||
| 69 | return true; | 112 | return true; |
| 70 | } | 113 | } |
| 71 | 114 | ||
| 115 | |||
| 72 | __attribute__ ((weak)) | 116 | __attribute__ ((weak)) |
| 73 | uint32_t layer_state_set_keymap (uint32_t state) { | 117 | uint32_t layer_state_set_keymap (uint32_t state) { |
| 74 | return state; | 118 | return state; |
| 75 | } | 119 | } |
| 76 | 120 | ||
| 77 | __attribute__ ((weak)) | 121 | __attribute__ ((weak)) |
| 122 | uint32_t default_layer_state_set_keymap (uint32_t state) { | ||
| 123 | return state; | ||
| 124 | } | ||
| 125 | |||
| 126 | __attribute__ ((weak)) | ||
| 78 | void led_set_keymap(uint8_t usb_led) {} | 127 | void led_set_keymap(uint8_t usb_led) {} |
| 79 | 128 | ||
| 80 | 129 | ||
| @@ -99,14 +148,38 @@ void matrix_init_user(void) { | |||
| 99 | #if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE)) | 148 | #if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE)) |
| 100 | set_unicode_input_mode(UC_WINC); | 149 | set_unicode_input_mode(UC_WINC); |
| 101 | #endif //UNICODE_ENABLE | 150 | #endif //UNICODE_ENABLE |
| 102 | matrix_init_rgb(); | ||
| 103 | matrix_init_keymap(); | 151 | matrix_init_keymap(); |
| 104 | } | 152 | } |
| 105 | 153 | ||
| 154 | void startup_user (void) { | ||
| 155 | #ifdef RGBLIGHT_ENABLE | ||
| 156 | matrix_init_rgb(); | ||
| 157 | #endif //RGBLIGHT_ENABLE | ||
| 158 | startup_keymap(); | ||
| 159 | } | ||
| 160 | |||
| 161 | void suspend_power_down_user(void) | ||
| 162 | { | ||
| 163 | suspend_power_down_keymap(); | ||
| 164 | } | ||
| 165 | |||
| 166 | void suspend_wakeup_init_user(void) | ||
| 167 | { | ||
| 168 | suspend_wakeup_init_keymap(); | ||
| 169 | #ifdef KEYBOARD_ergodox_ez | ||
| 170 | wait_ms(10); | ||
| 171 | #endif | ||
| 172 | } | ||
| 173 | |||
| 106 | 174 | ||
| 107 | // No global matrix scan code, so just run keymap's matrix | 175 | // No global matrix scan code, so just run keymap's matrix |
| 108 | // scan function | 176 | // scan function |
| 109 | void matrix_scan_user(void) { | 177 | void matrix_scan_user(void) { |
| 178 | static bool has_ran_yet; | ||
| 179 | if (!has_ran_yet) { | ||
| 180 | has_ran_yet = true; | ||
| 181 | startup_user(); | ||
| 182 | } | ||
| 110 | 183 | ||
| 111 | #ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code. | 184 | #ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code. |
| 112 | run_diablo_macro_check(); | 185 | run_diablo_macro_check(); |
| @@ -160,7 +233,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 160 | 233 | ||
| 161 | case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader | 234 | case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader |
| 162 | if (!record->event.pressed) { | 235 | if (!record->event.pressed) { |
| 163 | SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP | 236 | send_string_with_delay_P(PSTR("make " QMK_KEYBOARD ":" QMK_KEYMAP |
| 164 | #if (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU)) | 237 | #if (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU)) |
| 165 | ":dfu" | 238 | ":dfu" |
| 166 | #elif defined(BOOTLOADER_HALFKAY) | 239 | #elif defined(BOOTLOADER_HALFKAY) |
| @@ -168,7 +241,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 168 | #elif defined(BOOTLOADER_CATERINA) | 241 | #elif defined(BOOTLOADER_CATERINA) |
| 169 | ":avrdude" | 242 | ":avrdude" |
| 170 | #endif // bootloader options | 243 | #endif // bootloader options |
| 171 | SS_TAP(X_ENTER)); | 244 | SS_TAP(X_ENTER)), 10); |
| 172 | } | 245 | } |
| 173 | return false; | 246 | return false; |
| 174 | break; | 247 | break; |
| @@ -197,7 +270,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 197 | break; | 270 | break; |
| 198 | case VRSN: // Prints firmware version | 271 | case VRSN: // Prints firmware version |
| 199 | if (record->event.pressed) { | 272 | if (record->event.pressed) { |
| 200 | SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE); | 273 | send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE), MACRO_TIMER); |
| 201 | } | 274 | } |
| 202 | return false; | 275 | return false; |
| 203 | break; | 276 | break; |
| @@ -256,7 +329,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 256 | diablo_key_time[dtime] = diablo_times[0]; | 329 | diablo_key_time[dtime] = diablo_times[0]; |
| 257 | } | 330 | } |
| 258 | } | 331 | } |
| 259 | #endif // TAP_DANCE_ENABLE#endif | 332 | #endif // TAP_DANCE_ENABLE |
| 260 | return false; break; | 333 | return false; break; |
| 261 | 334 | ||
| 262 | 335 | ||
| @@ -314,7 +387,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 314 | #endif // UNICODE_ENABLE | 387 | #endif // UNICODE_ENABLE |
| 315 | 388 | ||
| 316 | } | 389 | } |
| 317 | return process_record_keymap(keycode, record) && process_record_secrets(keycode, record) && process_record_user_rgb(keycode, record); | 390 | return process_record_keymap(keycode, record) && |
| 391 | #ifdef RGBLIGHT_ENABLE | ||
| 392 | process_record_user_rgb(keycode, record) && | ||
| 393 | #endif // RGBLIGHT_ENABLE | ||
| 394 | process_record_secrets(keycode, record); | ||
| 318 | } | 395 | } |
| 319 | 396 | ||
| 320 | 397 | ||
| @@ -331,6 +408,11 @@ uint32_t layer_state_set_user(uint32_t state) { | |||
| 331 | } | 408 | } |
| 332 | 409 | ||
| 333 | 410 | ||
| 411 | uint32_t default_layer_state_set_kb(uint32_t state) { | ||
| 412 | return default_layer_state_set_keymap (state); | ||
| 413 | } | ||
| 414 | |||
| 415 | |||
| 334 | // Any custom LED code goes here. | 416 | // Any custom LED code goes here. |
| 335 | // So far, I only have keyboard specific code, | 417 | // So far, I only have keyboard specific code, |
| 336 | // So nothing goes here. | 418 | // So nothing goes here. |
