diff options
| author | Drashna Jaelre <drashna@live.com> | 2018-05-15 19:34:34 -0700 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2018-05-15 22:34:34 -0400 |
| commit | 53a6501d71cabbe4c5c41652cf24fdc059609e5d (patch) | |
| tree | 4662908d245fe7176307f99a994d1f8d8ef12158 /users/drashna/drashna.c | |
| parent | a572323f94b533582edab4402867dc994cc8c75f (diff) | |
| download | qmk_firmware-53a6501d71cabbe4c5c41652cf24fdc059609e5d.tar.gz qmk_firmware-53a6501d71cabbe4c5c41652cf24fdc059609e5d.zip | |
Yet another update to drashna keymaps and userspace (EEPROM, RGB indicators) (#2959)
* More Iris Tweaks
* Mess with iris arrow keys
* Massive layout overhaul to make everything more OLKB
* Additional tweaks
* Cleanup Userspace
Remove unused layer code, and properly set userspace eeprom structure.
* EEPROM stuff
* Only use indicators if layer indication is enabled
* Iris and Orthodox Tweaks (Status Indicators)
* Additional tweaks to finish tri layer conversion
* Disable ProMicro ligths globally
* Add Pro Micro hacking info
* Successfully get mod indication working on thumb clusters
* Enable printing when console is enabled
* Make Modifier Indicator lights more modular
* Keymap cleanup
* Tapping test changes
* Cleanup and minor tweaks
Diffstat (limited to 'users/drashna/drashna.c')
| -rw-r--r-- | users/drashna/drashna.c | 132 |
1 files changed, 62 insertions, 70 deletions
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index 86c16b826..6ce541bfb 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c | |||
| @@ -38,10 +38,6 @@ float tone_paste[][2] = SONG(SCROLL_LOCK_OFF_SOUND); | |||
| 38 | 38 | ||
| 39 | 39 | ||
| 40 | static uint16_t copy_paste_timer; | 40 | static uint16_t copy_paste_timer; |
| 41 | #ifdef RGBLIGHT_ENABLE | ||
| 42 | bool rgb_layer_change = true; | ||
| 43 | #endif | ||
| 44 | |||
| 45 | userspace_config_t userspace_config; | 41 | userspace_config_t userspace_config; |
| 46 | 42 | ||
| 47 | // Helper Functions | 43 | // Helper Functions |
| @@ -164,31 +160,42 @@ void led_set_keymap(uint8_t usb_led) {} | |||
| 164 | // call the keymap's init function | 160 | // call the keymap's init function |
| 165 | void matrix_init_user(void) { | 161 | void matrix_init_user(void) { |
| 166 | uint8_t default_layer = eeconfig_read_default_layer(); | 162 | uint8_t default_layer = eeconfig_read_default_layer(); |
| 163 | userspace_config.raw = eeprom_read_byte(EECONFIG_USERSPACE); | ||
| 167 | 164 | ||
| 168 | #ifdef RGBLIGHT_ENABLE | 165 | #ifdef BOOTLOADER_CATERINA |
| 169 | rgblight_enable(); | 166 | DDRD &= ~(1<<5); |
| 170 | #endif // RGBLIGHT_ENABLE | 167 | PORTD &= ~(1<<5); |
| 171 | 168 | ||
| 172 | if (default_layer & (1UL << _COLEMAK)) { | 169 | DDRB &= ~(1<<0); |
| 173 | #ifdef RGBLIGHT_ENABLE | 170 | PORTB &= ~(1<<0); |
| 174 | rgblight_sethsv_magenta(); | 171 | #endif |
| 175 | #endif // RGBLIGHT_ENABLE | 172 | |
| 176 | } else if (default_layer & (1UL << _DVORAK)) { | 173 | if (userspace_config.rgb_layer_change) { |
| 177 | #ifdef RGBLIGHT_ENABLE | ||
| 178 | rgblight_sethsv_green(); | ||
| 179 | #endif // RGBLIGHT_ENABLE | ||
| 180 | } else if (default_layer & (1UL << _WORKMAN)) { | ||
| 181 | #ifdef RGBLIGHT_ENABLE | ||
| 182 | rgblight_sethsv_goldenrod(); | ||
| 183 | #endif // RGBLIGHT_ENABLE | ||
| 184 | } else { | ||
| 185 | #ifdef RGBLIGHT_ENABLE | 174 | #ifdef RGBLIGHT_ENABLE |
| 186 | rgblight_sethsv_teal(); | 175 | rgblight_enable(); |
| 187 | #endif // RGBLIGHT_ENABLE | 176 | #endif // RGBLIGHT_ENABLE |
| 177 | if (default_layer & (1UL << _COLEMAK)) { | ||
| 178 | #ifdef RGBLIGHT_ENABLE | ||
| 179 | rgblight_sethsv_magenta(); | ||
| 180 | #endif // RGBLIGHT_ENABLE | ||
| 181 | } else if (default_layer & (1UL << _DVORAK)) { | ||
| 182 | #ifdef RGBLIGHT_ENABLE | ||
| 183 | rgblight_sethsv_green(); | ||
| 184 | #endif // RGBLIGHT_ENABLE | ||
| 185 | } else if (default_layer & (1UL << _WORKMAN)) { | ||
| 186 | #ifdef RGBLIGHT_ENABLE | ||
| 187 | rgblight_sethsv_goldenrod(); | ||
| 188 | #endif // RGBLIGHT_ENABLE | ||
| 189 | } else { | ||
| 190 | #ifdef RGBLIGHT_ENABLE | ||
| 191 | rgblight_sethsv_teal(); | ||
| 192 | #endif // RGBLIGHT_ENABLE | ||
| 193 | } | ||
| 188 | } | 194 | } |
| 189 | 195 | ||
| 190 | userspace_config.raw = eeprom_read_byte(EECONFIG_USERSPACE); | 196 | #ifdef AUDIO_CLICKY |
| 191 | clicky_enable = userspace_config.clicky_enable; | 197 | clicky_enable = userspace_config.clicky_enable; |
| 198 | #endif | ||
| 192 | 199 | ||
| 193 | #if ( defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE) ) | 200 | #if ( defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE) ) |
| 194 | set_unicode_input_mode(UC_WINC); | 201 | set_unicode_input_mode(UC_WINC); |
| @@ -364,8 +371,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 364 | case KC_RGB_T: // This allows me to use underglow as layer indication, or as normal | 371 | case KC_RGB_T: // This allows me to use underglow as layer indication, or as normal |
| 365 | #ifdef RGBLIGHT_ENABLE | 372 | #ifdef RGBLIGHT_ENABLE |
| 366 | if (record->event.pressed) { | 373 | if (record->event.pressed) { |
| 367 | rgb_layer_change = !rgb_layer_change; | 374 | userspace_config.rgb_layer_change ^= 1; |
| 368 | if (rgb_layer_change) { | 375 | eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw); |
| 376 | if (userspace_config.rgb_layer_change) { | ||
| 369 | layer_state_set(layer_state); // This is needed to immediately set the layer color (looks better) | 377 | layer_state_set(layer_state); // This is needed to immediately set the layer color (looks better) |
| 370 | } | 378 | } |
| 371 | } | 379 | } |
| @@ -374,7 +382,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 374 | #ifdef RGBLIGHT_ENABLE | 382 | #ifdef RGBLIGHT_ENABLE |
| 375 | case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions | 383 | case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions |
| 376 | if (record->event.pressed) { //This disables layer indication, as it's assumed that if you're changing this ... you want that disabled | 384 | if (record->event.pressed) { //This disables layer indication, as it's assumed that if you're changing this ... you want that disabled |
| 377 | rgb_layer_change = false; | 385 | userspace_config.rgb_layer_change = false; |
| 386 | eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw); | ||
| 378 | } | 387 | } |
| 379 | return true; break; | 388 | return true; break; |
| 380 | #endif // RGBLIGHT_ENABLE | 389 | #endif // RGBLIGHT_ENABLE |
| @@ -403,8 +412,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 403 | return false; | 412 | return false; |
| 404 | break; | 413 | break; |
| 405 | case CLICKY_TOGGLE: | 414 | case CLICKY_TOGGLE: |
| 415 | #ifdef AUDIO_CLICKY | ||
| 406 | userspace_config.clicky_enable = clicky_enable; | 416 | userspace_config.clicky_enable = clicky_enable; |
| 407 | eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw); | 417 | eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw); |
| 418 | #endif | ||
| 408 | break; | 419 | break; |
| 409 | #ifdef UNICODE_ENABLE | 420 | #ifdef UNICODE_ENABLE |
| 410 | case UC_FLIP: // (╯°□°)╯ ︵ ┻━┻ | 421 | case UC_FLIP: // (╯°□°)╯ ︵ ┻━┻ |
| @@ -445,123 +456,104 @@ uint32_t layer_state_set_user(uint32_t state) { | |||
| 445 | state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); | 456 | state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); |
| 446 | 457 | ||
| 447 | switch (biton32(state)) { | 458 | switch (biton32(state)) { |
| 448 | case _NAV: | ||
| 449 | #ifdef RGBLIGHT_ENABLE | ||
| 450 | if (rgb_layer_change) { | ||
| 451 | rgblight_sethsv_blue(); | ||
| 452 | rgblight_mode(1); | ||
| 453 | } | ||
| 454 | #endif // RGBLIGHT_ENABLE | ||
| 455 | break; | ||
| 456 | case _SYMB: | ||
| 457 | #ifdef RGBLIGHT_ENABLE | ||
| 458 | if (rgb_layer_change) { | ||
| 459 | rgblight_sethsv_blue(); | ||
| 460 | rgblight_mode(2); | ||
| 461 | } | ||
| 462 | #endif // RGBLIGHT_ENABLE | ||
| 463 | break; | ||
| 464 | case _MOUS: | ||
| 465 | #ifdef RGBLIGHT_ENABLE | ||
| 466 | if (rgb_layer_change) { | ||
| 467 | rgblight_sethsv_yellow(); | ||
| 468 | rgblight_mode(1); | ||
| 469 | } | ||
| 470 | #endif // RGBLIGHT_ENABLE | ||
| 471 | break; | ||
| 472 | case _MACROS: | 459 | case _MACROS: |
| 473 | #ifdef RGBLIGHT_ENABLE | 460 | #ifdef RGBLIGHT_ENABLE |
| 474 | if (rgb_layer_change) { | 461 | if (userspace_config.rgb_layer_change) { |
| 475 | rgblight_sethsv_orange(); | 462 | rgblight_sethsv_orange(); |
| 476 | userspace_config.is_overwatch ? rgblight_mode(17) : rgblight_mode(18); | 463 | userspace_config.is_overwatch ? rgblight_mode(17) : rgblight_mode(18); |
| 477 | } | 464 | } |
| 478 | #endif // RGBLIGHT_ENABLE | 465 | #endif // RGBLIGHT_ENABLE |
| 466 | |||
| 479 | break; | 467 | break; |
| 480 | case _MEDIA: | 468 | case _MEDIA: |
| 481 | #ifdef RGBLIGHT_ENABLE | 469 | #ifdef RGBLIGHT_ENABLE |
| 482 | if (rgb_layer_change) { | 470 | if (userspace_config.rgb_layer_change) { |
| 483 | rgblight_sethsv_chartreuse(); | 471 | rgblight_sethsv_chartreuse(); |
| 484 | rgblight_mode(22); | 472 | rgblight_mode(22); |
| 485 | } | 473 | } |
| 486 | #endif // RGBLIGHT_ENABLE | 474 | #endif // RGBLIGHT_ENABLE |
| 475 | |||
| 487 | break; | 476 | break; |
| 488 | case _GAMEPAD: | 477 | case _GAMEPAD: |
| 489 | #ifdef RGBLIGHT_ENABLE | 478 | #ifdef RGBLIGHT_ENABLE |
| 490 | if (rgb_layer_change) { | 479 | if (userspace_config.rgb_layer_change) { |
| 491 | rgblight_sethsv_orange(); | 480 | rgblight_sethsv_orange(); |
| 492 | rgblight_mode(17); | 481 | rgblight_mode(17); |
| 493 | } | 482 | } |
| 494 | #endif // RGBLIGHT_ENABLE | 483 | #endif // RGBLIGHT_ENABLE |
| 484 | |||
| 495 | break; | 485 | break; |
| 496 | case _DIABLO: | 486 | case _DIABLO: |
| 497 | #ifdef RGBLIGHT_ENABLE | 487 | #ifdef RGBLIGHT_ENABLE |
| 498 | if (rgb_layer_change) { | 488 | if (userspace_config.rgb_layer_change) { |
| 499 | rgblight_sethsv_red(); | 489 | rgblight_sethsv_red(); |
| 500 | rgblight_mode(5); | 490 | rgblight_mode(5); |
| 501 | } | 491 | } |
| 502 | #endif // RGBLIGHT_ENABLE | 492 | #endif // RGBLIGHT_ENABLE |
| 493 | |||
| 503 | break; | 494 | break; |
| 504 | case _RAISE: | 495 | case _RAISE: |
| 505 | #ifdef RGBLIGHT_ENABLE | 496 | #ifdef RGBLIGHT_ENABLE |
| 506 | if (rgb_layer_change) { | 497 | if (userspace_config.rgb_layer_change) { |
| 507 | rgblight_sethsv_yellow(); | 498 | rgblight_sethsv_yellow(); |
| 508 | rgblight_mode(5); | 499 | rgblight_mode(5); |
| 509 | } | 500 | } |
| 510 | #endif // RGBLIGHT_ENABLE | 501 | #endif // RGBLIGHT_ENABLE |
| 502 | |||
| 511 | break; | 503 | break; |
| 512 | case _LOWER: | 504 | case _LOWER: |
| 513 | #ifdef RGBLIGHT_ENABLE | 505 | #ifdef RGBLIGHT_ENABLE |
| 514 | if (rgb_layer_change) { | 506 | if (userspace_config.rgb_layer_change) { |
| 515 | rgblight_sethsv_orange(); | 507 | rgblight_sethsv_orange(); |
| 516 | rgblight_mode(5); | 508 | rgblight_mode(5); |
| 517 | } | 509 | } |
| 518 | #endif // RGBLIGHT_ENABLE | 510 | #endif // RGBLIGHT_ENABLE |
| 511 | |||
| 519 | break; | 512 | break; |
| 520 | case _ADJUST: | 513 | case _ADJUST: |
| 521 | #ifdef RGBLIGHT_ENABLE | 514 | #ifdef RGBLIGHT_ENABLE |
| 522 | if (rgb_layer_change) { | 515 | if (userspace_config.rgb_layer_change) { |
| 523 | rgblight_sethsv_red(); | 516 | rgblight_sethsv_red(); |
| 524 | rgblight_mode(23); | 517 | rgblight_mode(23); |
| 525 | } | 518 | } |
| 526 | #endif // RGBLIGHT_ENABLE | 519 | #endif // RGBLIGHT_ENABLE |
| 527 | break; | 520 | |
| 528 | case _COVECUBE: | ||
| 529 | #ifdef RGBLIGHT_ENABLE | ||
| 530 | if (rgb_layer_change) { | ||
| 531 | rgblight_sethsv_green(); | ||
| 532 | rgblight_mode(2); | ||
| 533 | } | ||
| 534 | #endif // RGBLIGHT_ENABLE | ||
| 535 | break; | 521 | break; |
| 536 | default: // for any other layers, or the default layer | 522 | default: // for any other layers, or the default layer |
| 537 | if (default_layer & (1UL << _COLEMAK)) { | 523 | if (default_layer & (1UL << _COLEMAK)) { |
| 538 | #ifdef RGBLIGHT_ENABLE | 524 | #ifdef RGBLIGHT_ENABLE |
| 539 | if (rgb_layer_change) { rgblight_sethsv_magenta(); } | 525 | if (userspace_config.rgb_layer_change) { rgblight_sethsv_magenta(); } |
| 540 | #endif // RGBLIGHT_ENABLE | 526 | #endif // RGBLIGHT_ENABLE |
| 527 | |||
| 541 | } | 528 | } |
| 542 | else if (default_layer & (1UL << _DVORAK)) { | 529 | else if (default_layer & (1UL << _DVORAK)) { |
| 543 | #ifdef RGBLIGHT_ENABLE | 530 | #ifdef RGBLIGHT_ENABLE |
| 544 | if (rgb_layer_change) { rgblight_sethsv_green(); } | 531 | if (userspace_config.rgb_layer_change) { rgblight_sethsv_green(); } |
| 545 | #endif // RGBLIGHT_ENABLE | 532 | #endif // RGBLIGHT_ENABLE |
| 533 | |||
| 546 | } | 534 | } |
| 547 | else if (default_layer & (1UL << _WORKMAN)) { | 535 | else if (default_layer & (1UL << _WORKMAN)) { |
| 548 | #ifdef RGBLIGHT_ENABLE | 536 | #ifdef RGBLIGHT_ENABLE |
| 549 | if (rgb_layer_change) { rgblight_sethsv_goldenrod(); } | 537 | if (userspace_config.rgb_layer_change) { rgblight_sethsv_goldenrod(); } |
| 550 | #endif // RGBLIGHT_ENABLE | 538 | #endif // RGBLIGHT_ENABLE |
| 539 | |||
| 551 | } | 540 | } |
| 552 | else { | 541 | else { |
| 553 | #ifdef RGBLIGHT_ENABLE | 542 | #ifdef RGBLIGHT_ENABLE |
| 554 | if (rgb_layer_change) { rgblight_sethsv_teal(); } | 543 | if (userspace_config.rgb_layer_change) { rgblight_sethsv_teal(); } |
| 555 | #endif // RGBLIGHT_ENABLE | 544 | #endif // RGBLIGHT_ENABLE |
| 545 | |||
| 556 | } | 546 | } |
| 557 | if (biton32(state) == _MODS) { // If the non-OSM layer is enabled, then breathe | 547 | if (biton32(state) == _MODS) { // If the non-OSM layer is enabled, then breathe |
| 558 | #ifdef RGBLIGHT_ENABLE | 548 | #ifdef RGBLIGHT_ENABLE |
| 559 | if (rgb_layer_change) { rgblight_mode(2); } | 549 | if (userspace_config.rgb_layer_change) { rgblight_mode(2); } |
| 560 | #endif // RGBLIGHT_ENABLE | 550 | #endif // RGBLIGHT_ENABLE |
| 551 | |||
| 561 | } else { // otherwise, stay solid | 552 | } else { // otherwise, stay solid |
| 562 | #ifdef RGBLIGHT_ENABLE | 553 | #ifdef RGBLIGHT_ENABLE |
| 563 | if (rgb_layer_change) { rgblight_mode(1); } | 554 | if (userspace_config.rgb_layer_change) { rgblight_mode(1); } |
| 564 | #endif // RGBLIGHT_ENABLE | 555 | #endif // RGBLIGHT_ENABLE |
| 556 | |||
| 565 | } | 557 | } |
| 566 | break; | 558 | break; |
| 567 | } | 559 | } |
