diff options
| author | Drashna Jaelre <drashna@live.com> | 2018-03-25 13:01:15 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-03-25 13:01:15 -0700 |
| commit | 0c665696d7b498bd278d05eed3b52c1fac89ff29 (patch) | |
| tree | a14f3ca315d4e9d044163b219d78d34e48f3eb7f /users/drashna/drashna.c | |
| parent | a09a042b8fe6a0369a7c479168492125efa24e59 (diff) | |
| download | qmk_firmware-0c665696d7b498bd278d05eed3b52c1fac89ff29.tar.gz qmk_firmware-0c665696d7b498bd278d05eed3b52c1fac89ff29.zip | |
Update to drashna files (#2587)
* Add Colemak Mod-DH vars
* Add Norman Layot vars
* Set Shift Indicator to include CAPS Lock as well
* Change MEH to GUI
* Add Enter to Macro layer
* Switch raise and lower layers to make more sense (to me)
* Replace unused quote on Ergodox
* Add One Shot defines
* Dim indicator LEDs
* Add short codes for KC_SECRET
* Fix typos
* Update OLKB code in userspace
* Add global userspace config.h
* add compile fix
* Automatically include from userspace
* update readme
* Re-add QMK Scan loop
* Add EEPROM reset code to all keymaps
* Shorten fauxclick sound
* Use layouts instead of keymap, when possible
* Add OSM detection to ergodox
* Convert Viterbi to LAYOUT macro
* Clean up game macros
* Because I accidently removed the C6 AUDIO define from my viterbi... Whoops
* Minor formatting
* Fix Woodpad because it's still there
* Move Ergodox keymap into layouts folder
* Add build date to version macro
* Remove PREVENT_STUCK_MODIFIERS from config
Diffstat (limited to 'users/drashna/drashna.c')
| -rw-r--r-- | users/drashna/drashna.c | 125 |
1 files changed, 48 insertions, 77 deletions
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index 678570958..09b3891dd 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c | |||
| @@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 22 | #include "secrets.h" | 22 | #include "secrets.h" |
| 23 | #else | 23 | #else |
| 24 | // `PROGMEM const char secret[][x]` may work better, but it takes up more space in the firmware | 24 | // `PROGMEM const char secret[][x]` may work better, but it takes up more space in the firmware |
| 25 | // And I'm not familar enough to know which is better or why... | 25 | // And I'm not familiar enough to know which is better or why... |
| 26 | PROGMEM const char secret[][64] = { | 26 | PROGMEM const char secret[][64] = { |
| 27 | "test1", | 27 | "test1", |
| 28 | "test2", | 28 | "test2", |
| @@ -32,20 +32,13 @@ PROGMEM const char secret[][64] = { | |||
| 32 | }; | 32 | }; |
| 33 | #endif | 33 | #endif |
| 34 | 34 | ||
| 35 | #ifdef AUDIO_ENABLE | ||
| 36 | float tone_qwerty[][2] = SONG(QWERTY_SOUND); | ||
| 37 | float tone_dvorak[][2] = SONG(DVORAK_SOUND); | ||
| 38 | float tone_colemak[][2] = SONG(COLEMAK_SOUND); | ||
| 39 | float tone_workman[][2] = SONG(PLOVER_SOUND); | ||
| 40 | float tone_hackstartup[][2] = SONG(ONE_UP_SOUND); | ||
| 41 | #endif | ||
| 42 | 35 | ||
| 43 | #ifdef FAUXCLICKY_ENABLE | 36 | #ifdef FAUXCLICKY_ENABLE |
| 44 | float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_A6, 2); // (_D4, 0.25); | 37 | float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_A6, 2); // (_D4, 0.25); |
| 45 | float fauxclicky_released_note[2] = MUSICAL_NOTE(_A6, 2); // (_C4, 0.125); | 38 | float fauxclicky_released_note[2] = MUSICAL_NOTE(_A6, 2); // (_C4, 0.125); |
| 46 | #else | 39 | #else |
| 47 | float fauxclicky_pressed[][2] = SONG(E__NOTE(_A6)); // change to your tastes | 40 | float fauxclicky_pressed[][2] = SONG(S__NOTE(_A6)); // change to your tastes |
| 48 | float fauxclicky_released[][2] = SONG(E__NOTE(_A6)); // change to your tastes | 41 | float fauxclicky_released[][2] = SONG(S__NOTE(_A6)); // change to your tastes |
| 49 | #endif | 42 | #endif |
| 50 | 43 | ||
| 51 | bool faux_click_enabled = false; | 44 | bool faux_click_enabled = false; |
| @@ -191,7 +184,7 @@ void matrix_init_user(void) { | |||
| 191 | #endif | 184 | #endif |
| 192 | matrix_init_keymap(); | 185 | matrix_init_keymap(); |
| 193 | } | 186 | } |
| 194 | // No global matrix scan code, so just run keymap's matix | 187 | // No global matrix scan code, so just run keymap's matrix |
| 195 | // scan function | 188 | // scan function |
| 196 | void matrix_scan_user(void) { | 189 | void matrix_scan_user(void) { |
| 197 | #ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code. | 190 | #ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code. |
| @@ -202,17 +195,20 @@ void matrix_scan_user(void) { | |||
| 202 | 195 | ||
| 203 | // This block is for all of the gaming macros, as they were all doing | 196 | // This block is for all of the gaming macros, as they were all doing |
| 204 | // the same thing, but with differring text sent. | 197 | // the same thing, but with differring text sent. |
| 205 | void send_game_macro(const char *str) { | 198 | bool send_game_macro(const char *str, keyrecord_t *record, bool override) { |
| 206 | clear_keyboard(); | 199 | if (!record->event.pressed || override) { |
| 207 | register_code(is_overwatch ? KC_BSPC : KC_ENTER); | 200 | clear_keyboard(); |
| 208 | unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); | 201 | register_code(is_overwatch ? KC_BSPC : KC_ENTER); |
| 209 | wait_ms(50); | 202 | unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); |
| 210 | send_string(str); | 203 | wait_ms(50); |
| 211 | register_code(KC_ENTER); | 204 | send_string(str); |
| 212 | unregister_code(KC_ENTER); | 205 | register_code(KC_ENTER); |
| 206 | unregister_code(KC_ENTER); | ||
| 207 | } | ||
| 208 | if (override) wait_ms(3000); | ||
| 209 | return false; | ||
| 213 | } | 210 | } |
| 214 | 211 | ||
| 215 | |||
| 216 | // Sent the default layer | 212 | // Sent the default layer |
| 217 | void persistent_default_layer_set(uint16_t default_layer) { | 213 | void persistent_default_layer_set(uint16_t default_layer) { |
| 218 | eeconfig_update_default_layer(default_layer); | 214 | eeconfig_update_default_layer(default_layer); |
| @@ -221,7 +217,7 @@ void persistent_default_layer_set(uint16_t default_layer) { | |||
| 221 | 217 | ||
| 222 | 218 | ||
| 223 | // Defines actions tor my global custom keycodes. Defined in drashna.h file | 219 | // Defines actions tor my global custom keycodes. Defined in drashna.h file |
| 224 | // Then runs the _keymap's recod handier if not processed here | 220 | // Then runs the _keymap's record handier if not processed here |
| 225 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | 221 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { |
| 226 | 222 | ||
| 227 | // If console is enabled, it will print the matrix position and status of each key pressed | 223 | // If console is enabled, it will print the matrix position and status of each key pressed |
| @@ -230,7 +226,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 230 | #endif //CONSOLE_ENABLE | 226 | #endif //CONSOLE_ENABLE |
| 231 | 227 | ||
| 232 | // Run custom faux click code, but only if faux clicky is enabled | 228 | // Run custom faux click code, but only if faux clicky is enabled |
| 233 | #ifdef AUDIO_ENABLE | 229 | #ifdef AUDIO_ENABLE |
| 234 | if ( (faux_click_enabled && keycode != KC_FXCL) || (!faux_click_enabled && keycode == KC_FXCL) ) { | 230 | if ( (faux_click_enabled && keycode != KC_FXCL) || (!faux_click_enabled && keycode == KC_FXCL) ) { |
| 235 | if (record->event.pressed) { | 231 | if (record->event.pressed) { |
| 236 | PLAY_SONG(fauxclicky_pressed); | 232 | PLAY_SONG(fauxclicky_pressed); |
| @@ -245,37 +241,25 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 245 | switch (keycode) { | 241 | switch (keycode) { |
| 246 | case KC_QWERTY: | 242 | case KC_QWERTY: |
| 247 | if (record->event.pressed) { | 243 | if (record->event.pressed) { |
| 248 | #ifdef AUDIO_ENABLE | 244 | set_single_persistent_default_layer(_QWERTY); |
| 249 | PLAY_SONG(tone_qwerty); | ||
| 250 | #endif //AUDIO_ENABLE | ||
| 251 | persistent_default_layer_set(1UL << _QWERTY); | ||
| 252 | } | 245 | } |
| 253 | return false; | 246 | return false; |
| 254 | break; | 247 | break; |
| 255 | case KC_COLEMAK: | 248 | case KC_COLEMAK: |
| 256 | if (record->event.pressed) { | 249 | if (record->event.pressed) { |
| 257 | #ifdef AUDIO_ENABLE | 250 | set_single_persistent_default_layer(_COLEMAK); |
| 258 | PLAY_SONG(tone_colemak); | ||
| 259 | #endif //AUDIO_ENABLE | ||
| 260 | persistent_default_layer_set(1UL << _COLEMAK); | ||
| 261 | } | 251 | } |
| 262 | return false; | 252 | return false; |
| 263 | break; | 253 | break; |
| 264 | case KC_DVORAK: | 254 | case KC_DVORAK: |
| 265 | if (record->event.pressed) { | 255 | if (record->event.pressed) { |
| 266 | #ifdef AUDIO_ENABLE | 256 | set_single_persistent_default_layer(_DVORAK); |
| 267 | PLAY_SONG(tone_dvorak); | ||
| 268 | #endif //AUDIO_ENABLE | ||
| 269 | persistent_default_layer_set(1UL << _DVORAK); | ||
| 270 | } | 257 | } |
| 271 | return false; | 258 | return false; |
| 272 | break; | 259 | break; |
| 273 | case KC_WORKMAN: | 260 | case KC_WORKMAN: |
| 274 | if (record->event.pressed) { | 261 | if (record->event.pressed) { |
| 275 | #ifdef AUDIO_ENABLE | 262 | set_single_persistent_default_layer(_WORKMAN); |
| 276 | PLAY_SONG(tone_workman); | ||
| 277 | #endif //AUDIO_ENABLE | ||
| 278 | persistent_default_layer_set(1UL << _WORKMAN); | ||
| 279 | } | 263 | } |
| 280 | return false; | 264 | return false; |
| 281 | break; | 265 | break; |
| @@ -328,7 +312,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 328 | } | 312 | } |
| 329 | return false; | 313 | return false; |
| 330 | break; | 314 | break; |
| 331 | case KC_RESET: // Custom RESET code that setr RGBLights to RED | 315 | |
| 316 | |||
| 317 | case KC_RESET: // Custom RESET code that sets RGBLights to RED | ||
| 332 | if (!record->event.pressed) { | 318 | if (!record->event.pressed) { |
| 333 | #ifdef RGBLIGHT_ENABLE | 319 | #ifdef RGBLIGHT_ENABLE |
| 334 | rgblight_enable(); | 320 | rgblight_enable(); |
| @@ -339,6 +325,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 339 | } | 325 | } |
| 340 | return false; | 326 | return false; |
| 341 | break; | 327 | break; |
| 328 | |||
| 329 | |||
| 342 | case EPRM: // Resets EEPROM | 330 | case EPRM: // Resets EEPROM |
| 343 | if (record->event.pressed) { | 331 | if (record->event.pressed) { |
| 344 | eeconfig_init(); | 332 | eeconfig_init(); |
| @@ -347,11 +335,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 347 | break; | 335 | break; |
| 348 | case VRSN: // Prints firmware version | 336 | case VRSN: // Prints firmware version |
| 349 | if (record->event.pressed) { | 337 | if (record->event.pressed) { |
| 350 | SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); | 338 | SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE); |
| 351 | } | 339 | } |
| 352 | return false; | 340 | return false; |
| 353 | break; | 341 | break; |
| 354 | case KC_SECRET_1 ... KC_SECRET_5: // Custom | 342 | |
| 343 | |||
| 344 | case KC_SECRET_1 ... KC_SECRET_5: // Secrets! Externally defined strings, not stored in repo | ||
| 355 | if (!record->event.pressed) { | 345 | if (!record->event.pressed) { |
| 356 | clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED); | 346 | clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED); |
| 357 | send_string_P(secret[keycode - KC_SECRET_1]); | 347 | send_string_P(secret[keycode - KC_SECRET_1]); |
| @@ -364,61 +354,42 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 364 | // Only enables for the viterbi, basically, | 354 | // Only enables for the viterbi, basically, |
| 365 | // to save on firmware space, since it's limited. | 355 | // to save on firmware space, since it's limited. |
| 366 | #if !(defined(KEYBOARD_orthodox_rev1) || defined(KEYBOARD_orthodox_rev3) || defined(KEYBOARD_ergodox_ez)) | 356 | #if !(defined(KEYBOARD_orthodox_rev1) || defined(KEYBOARD_orthodox_rev3) || defined(KEYBOARD_ergodox_ez)) |
| 367 | |||
| 368 | |||
| 369 | case KC_OVERWATCH: // Toggle's if we hit "ENTER" or "BACKSPACE" to input macros | 357 | case KC_OVERWATCH: // Toggle's if we hit "ENTER" or "BACKSPACE" to input macros |
| 370 | if (record->event.pressed) { is_overwatch = !is_overwatch; } | 358 | if (record->event.pressed) { is_overwatch = !is_overwatch; } |
| 371 | #ifdef RGBLIGHT_ENABLE | 359 | #ifdef RGBLIGHT_ENABLE |
| 372 | is_overwatch ? rgblight_mode(17) : rgblight_mode(18); | 360 | is_overwatch ? rgblight_mode(17) : rgblight_mode(18); |
| 373 | #endif //RGBLIGHT_ENABLE | 361 | #endif //RGBLIGHT_ENABLE |
| 374 | return false; | ||
| 375 | break; | ||
| 376 | |||
| 377 | case KC_SALT: | ||
| 378 | if (!record->event.pressed) { send_game_macro("Salt, salt, salt..."); } | ||
| 379 | return false; break; | 362 | return false; break; |
| 363 | case KC_SALT: | ||
| 364 | return send_game_macro("Salt, salt, salt...", record, false); | ||
| 380 | case KC_MORESALT: | 365 | case KC_MORESALT: |
| 381 | if (!record->event.pressed) { send_game_macro("Please sir, can I have some more salt?!"); } | 366 | return send_game_macro("Please sir, can I have some more salt?!", record, false); |
| 382 | return false; break; | ||
| 383 | case KC_SALTHARD: | 367 | case KC_SALTHARD: |
| 384 | if (!record->event.pressed) { send_game_macro("Your salt only makes me harder, and even more aggressive!"); } | 368 | return send_game_macro("Your salt only makes me harder, and even more aggressive!", record, false); |
| 385 | return false; break; | ||
| 386 | case KC_GOODGAME: | 369 | case KC_GOODGAME: |
| 387 | if (!record->event.pressed) { send_game_macro("Good game, everyone!"); } | 370 | return send_game_macro("Good game, everyone!", record, false); |
| 388 | return false; break; | ||
| 389 | case KC_GLHF: | 371 | case KC_GLHF: |
| 390 | if (!record->event.pressed) { send_game_macro("Good luck, have fun!!!"); } | 372 | return send_game_macro("Good luck, have fun!!!", record, false); |
| 391 | return false; break; | ||
| 392 | case KC_SYMM: | 373 | case KC_SYMM: |
| 393 | if (!record->event.pressed) { send_game_macro("Left click to win!"); } | 374 | return send_game_macro("Left click to win!", record, false); |
| 394 | return false; break; | ||
| 395 | case KC_JUSTGAME: | 375 | case KC_JUSTGAME: |
| 396 | if (!record->event.pressed) { send_game_macro("It may be a game, but if you don't want to actually try, please go play AI, so that people that actually want to take the game seriously and \"get good\" have a place to do so without trolls like you throwing games."); } | 376 | return send_game_macro("It may be a game, but if you don't want to actually try, please go play AI, so that people that actually want to take the game seriously and \"get good\" have a place to do so without trolls like you throwing games.", record, false); |
| 397 | return false; break; | ||
| 398 | case KC_TORB: | 377 | case KC_TORB: |
| 399 | if (!record->event.pressed) { send_game_macro("That was positively riveting!"); } | 378 | return send_game_macro("That was positively riveting!", record, false); |
| 400 | return false; break; | ||
| 401 | case KC_AIM: | 379 | case KC_AIM: |
| 402 | if (!record->event.pressed) { | 380 | send_game_macro("That aim is absolutely amazing. It's almost like you're a machine!", record, true); |
| 403 | send_game_macro("That aim is absolutely amazing. It's almost like you're a machine!"); | 381 | return send_game_macro("Wait! That aim is TOO good! You're clearly using an aim hack! CHEATER!", record, false); |
| 404 | wait_ms(3000); | ||
| 405 | send_game_macro("Wait! That aim is TOO good! You're clearly using an aim hack! CHEATER!"); | ||
| 406 | } | ||
| 407 | return false; break; | ||
| 408 | case KC_C9: | 382 | case KC_C9: |
| 409 | if (!record->event.pressed) { send_game_macro("OMG!!! C9!!!"); } | 383 | return send_game_macro("OMG!!! C9!!!", record, false); |
| 410 | return false; break; | ||
| 411 | case KC_GGEZ: | 384 | case KC_GGEZ: |
| 412 | if (!record->event.pressed) { send_game_macro("That was a fantastic game, though it was a bit easy. Try harder next time!"); } | 385 | return send_game_macro("That was a fantastic game, though it was a bit easy. Try harder next time!", record, false); |
| 413 | return false; break; | ||
| 414 | #endif // !(defined(KEYBOARD_orthodox_rev1) || defined(KEYBOARD_orthodox_rev3) || defined(KEYBOARD_ergodox_ez)) | 386 | #endif // !(defined(KEYBOARD_orthodox_rev1) || defined(KEYBOARD_orthodox_rev3) || defined(KEYBOARD_ergodox_ez)) |
| 415 | 387 | ||
| 416 | 388 | ||
| 417 | #ifdef TAP_DANCE_ENABLE | 389 | #ifdef TAP_DANCE_ENABLE |
| 418 | case KC_DIABLO_CLEAR: // reset all Diable timers, disabling them | 390 | case KC_DIABLO_CLEAR: // reset all Diablo timers, disabling them |
| 419 | if (record->event.pressed) { | 391 | if (record->event.pressed) { |
| 420 | uint8_t dtime; | 392 | uint8_t dtime; |
| 421 | |||
| 422 | for (dtime = 0; dtime < 4; dtime++) { | 393 | for (dtime = 0; dtime < 4; dtime++) { |
| 423 | diablo_key_time[dtime] = diablo_times[0]; | 394 | diablo_key_time[dtime] = diablo_times[0]; |
| 424 | } | 395 | } |
| @@ -437,14 +408,14 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 437 | if (record->event.pressed) { | 408 | if (record->event.pressed) { |
| 438 | rgb_layer_change = !rgb_layer_change; | 409 | rgb_layer_change = !rgb_layer_change; |
| 439 | if (rgb_layer_change) { | 410 | if (rgb_layer_change) { |
| 440 | layer_state_set(layer_state); // This is needed to immediately set the layer color (looks beetter) | 411 | layer_state_set(layer_state); // This is needed to immediately set the layer color (looks better) |
| 441 | } | 412 | } |
| 442 | } | 413 | } |
| 443 | #endif // RGBLIGHT_ENABLE | 414 | #endif // RGBLIGHT_ENABLE |
| 444 | return false; break; | 415 | return false; break; |
| 445 | #ifdef RGBLIGHT_ENABLE | 416 | #ifdef RGBLIGHT_ENABLE |
| 446 | case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions | 417 | case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions |
| 447 | if (record->event.pressed) { //This disrables layer indication, as it's assumed that if you're changing this ... you want that disabled | 418 | if (record->event.pressed) { //This disables layer indication, as it's assumed that if you're changing this ... you want that disabled |
| 448 | rgb_layer_change = false; | 419 | rgb_layer_change = false; |
| 449 | } | 420 | } |
| 450 | return true; break; | 421 | return true; break; |
| @@ -534,7 +505,7 @@ uint32_t layer_state_set_user(uint32_t state) { | |||
| 534 | 505 | ||
| 535 | // Any custom LED code goes here. | 506 | // Any custom LED code goes here. |
| 536 | // So far, I only have keyboard specific code, | 507 | // So far, I only have keyboard specific code, |
| 537 | // So nothing goes here. | 508 | // So nothing goes here. |
| 538 | void led_set_user(uint8_t usb_led) { | 509 | void led_set_user(uint8_t usb_led) { |
| 539 | led_set_keymap(usb_led); | 510 | led_set_keymap(usb_led); |
| 540 | } | 511 | } |
