diff options
Diffstat (limited to 'users/drashna/drashna.c')
| -rw-r--r-- | users/drashna/drashna.c | 318 |
1 files changed, 171 insertions, 147 deletions
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index d9d412b08..86c16b826 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c | |||
| @@ -33,35 +33,52 @@ PROGMEM const char secret[][64] = { | |||
| 33 | #endif | 33 | #endif |
| 34 | 34 | ||
| 35 | 35 | ||
| 36 | #ifdef FAUXCLICKY_ENABLE | ||
| 37 | float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_A6, 2); // (_D4, 0.25); | ||
| 38 | float fauxclicky_released_note[2] = MUSICAL_NOTE(_A6, 2); // (_C4, 0.125); | ||
| 39 | #else // FAUXCLICKY_ENABLE | ||
| 40 | float fauxclicky_pressed[][2] = SONG(S__NOTE(_A6)); // change to your tastes | ||
| 41 | float fauxclicky_released[][2] = SONG(S__NOTE(_A6)); // change to your tastes | ||
| 42 | #endif // FAUXCLICKY_ENABLE | ||
| 43 | |||
| 44 | float tone_copy[][2] = SONG(SCROLL_LOCK_ON_SOUND); | 36 | float tone_copy[][2] = SONG(SCROLL_LOCK_ON_SOUND); |
| 45 | float tone_paste[][2] = SONG(SCROLL_LOCK_OFF_SOUND); | 37 | float tone_paste[][2] = SONG(SCROLL_LOCK_OFF_SOUND); |
| 46 | 38 | ||
| 47 | 39 | ||
| 48 | bool faux_click_enabled = false; | ||
| 49 | bool is_overwatch = false; | ||
| 50 | static uint16_t copy_paste_timer; | 40 | static uint16_t copy_paste_timer; |
| 51 | #ifdef RGBLIGHT_ENABLE | 41 | #ifdef RGBLIGHT_ENABLE |
| 52 | bool rgb_layer_change = true; | 42 | bool rgb_layer_change = true; |
| 53 | #endif | 43 | #endif |
| 54 | 44 | ||
| 45 | userspace_config_t userspace_config; | ||
| 46 | |||
| 47 | // Helper Functions | ||
| 48 | void tap(uint16_t keycode){ register_code(keycode); unregister_code(keycode); }; | ||
| 49 | |||
| 50 | #ifdef RGBLIGHT_ENABLE | ||
| 51 | void rgblight_sethsv_default_helper(uint8_t index) { | ||
| 52 | uint8_t default_layer = eeconfig_read_default_layer(); | ||
| 53 | if (default_layer & (1UL << _COLEMAK)) { | ||
| 54 | rgblight_sethsv_at(300, 255, 255, index); | ||
| 55 | rgblight_sethsv_at(300, 255, 255, index); | ||
| 56 | } | ||
| 57 | else if (default_layer & (1UL << _DVORAK)) { | ||
| 58 | rgblight_sethsv_at(120, 255, 255, index); | ||
| 59 | rgblight_sethsv_at(120, 255, 255, index); | ||
| 60 | } | ||
| 61 | else if (default_layer & (1UL << _WORKMAN)) { | ||
| 62 | rgblight_sethsv_at(43, 255, 255, index); | ||
| 63 | rgblight_sethsv_at(43, 255, 255, index); | ||
| 64 | } | ||
| 65 | else { | ||
| 66 | rgblight_sethsv_at(180, 255, 255, index); | ||
| 67 | rgblight_sethsv_at(180, 255, 255, index); | ||
| 68 | } | ||
| 69 | } | ||
| 70 | #endif // RGBLIGHT_ENABLE | ||
| 71 | |||
| 72 | |||
| 73 | // ========================================= TAP DANCE ========================================= | ||
| 55 | #ifdef TAP_DANCE_ENABLE | 74 | #ifdef TAP_DANCE_ENABLE |
| 56 | //define diablo macro timer variables | 75 | //define diablo macro timer variables |
| 57 | static uint16_t diablo_timer[4]; | 76 | static uint16_t diablo_timer[4]; |
| 58 | static uint8_t diablo_times[] = { 0, 1, 3, 5, 10, 30 }; | 77 | static uint8_t diablo_times[] = { 0, 1, 3, 5, 10, 30 }; |
| 59 | static uint8_t diablo_key_time[4]; | 78 | static uint8_t diablo_key_time[4]; |
| 60 | 79 | ||
| 61 | bool check_dtimer(uint8_t dtimer) { | 80 | // has the correct number of seconds elapsed (as defined by diablo_times) |
| 62 | // has the correct number of seconds elapsed (as defined by diablo_times) | 81 | bool check_dtimer(uint8_t dtimer) { return (timer_elapsed(diablo_timer[dtimer]) < (diablo_key_time[dtimer] * 1000)) ? false : true; }; |
| 63 | return (timer_elapsed(diablo_timer[dtimer]) < (diablo_key_time[dtimer] * 1000)) ? false : true; | ||
| 64 | }; | ||
| 65 | 82 | ||
| 66 | // Cycle through the times for the macro, starting at 0, for disabled. | 83 | // Cycle through the times for the macro, starting at 0, for disabled. |
| 67 | // Max of six values, so don't exceed | 84 | // Max of six values, so don't exceed |
| @@ -69,25 +86,16 @@ void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data, uint8_ | |||
| 69 | if (state->count >= 7) { | 86 | if (state->count >= 7) { |
| 70 | diablo_key_time[diablo_key] = diablo_times[0]; | 87 | diablo_key_time[diablo_key] = diablo_times[0]; |
| 71 | reset_tap_dance(state); | 88 | reset_tap_dance(state); |
| 72 | } | 89 | } else { |
| 73 | else { | ||
| 74 | diablo_key_time[diablo_key] = diablo_times[state->count - 1]; | 90 | diablo_key_time[diablo_key] = diablo_times[state->count - 1]; |
| 75 | } | 91 | } |
| 76 | } | 92 | } |
| 77 | 93 | ||
| 78 | // Would rather have one function for all of this, but no idea how to do that... | 94 | // Would rather have one function for all of this, but no idea how to do that... |
| 79 | void diablo_tapdance1(qk_tap_dance_state_t *state, void *user_data) { | 95 | void diablo_tapdance1(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 0); } |
| 80 | diablo_tapdance_master(state, user_data, 0); | 96 | void diablo_tapdance2(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 1); } |
| 81 | } | 97 | void diablo_tapdance3(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 2); } |
| 82 | void diablo_tapdance2(qk_tap_dance_state_t *state, void *user_data) { | 98 | void diablo_tapdance4(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 3); } |
| 83 | diablo_tapdance_master(state, user_data, 1); | ||
| 84 | } | ||
| 85 | void diablo_tapdance3(qk_tap_dance_state_t *state, void *user_data) { | ||
| 86 | diablo_tapdance_master(state, user_data, 2); | ||
| 87 | } | ||
| 88 | void diablo_tapdance4(qk_tap_dance_state_t *state, void *user_data) { | ||
| 89 | diablo_tapdance_master(state, user_data, 3); | ||
| 90 | } | ||
| 91 | 99 | ||
| 92 | //Tap Dance Definitions | 100 | //Tap Dance Definitions |
| 93 | qk_tap_dance_action_t tap_dance_actions[] = { | 101 | qk_tap_dance_action_t tap_dance_actions[] = { |
| @@ -96,7 +104,6 @@ qk_tap_dance_action_t tap_dance_actions[] = { | |||
| 96 | [TD_D3_2] = ACTION_TAP_DANCE_FN(diablo_tapdance2), | 104 | [TD_D3_2] = ACTION_TAP_DANCE_FN(diablo_tapdance2), |
| 97 | [TD_D3_3] = ACTION_TAP_DANCE_FN(diablo_tapdance3), | 105 | [TD_D3_3] = ACTION_TAP_DANCE_FN(diablo_tapdance3), |
| 98 | [TD_D3_4] = ACTION_TAP_DANCE_FN(diablo_tapdance4), | 106 | [TD_D3_4] = ACTION_TAP_DANCE_FN(diablo_tapdance4), |
| 99 | |||
| 100 | }; | 107 | }; |
| 101 | 108 | ||
| 102 | // Sends the key press to system, but only if on the Diablo layer | 109 | // Sends the key press to system, but only if on the Diablo layer |
| @@ -104,17 +111,13 @@ void send_diablo_keystroke(uint8_t diablo_key) { | |||
| 104 | if (biton32(layer_state) == _DIABLO) { | 111 | if (biton32(layer_state) == _DIABLO) { |
| 105 | switch (diablo_key) { | 112 | switch (diablo_key) { |
| 106 | case 0: | 113 | case 0: |
| 107 | SEND_STRING("1"); | 114 | tap(KC_1); break; |
| 108 | break; | ||
| 109 | case 1: | 115 | case 1: |
| 110 | SEND_STRING("2"); | 116 | tap(KC_2); break; |
| 111 | break; | ||
| 112 | case 2: | 117 | case 2: |
| 113 | SEND_STRING("3"); | 118 | tap(KC_3); break; |
| 114 | break; | ||
| 115 | case 3: | 119 | case 3: |
| 116 | SEND_STRING("4"); | 120 | tap(KC_4); break; |
| 117 | break; | ||
| 118 | } | 121 | } |
| 119 | } | 122 | } |
| 120 | } | 123 | } |
| @@ -123,7 +126,6 @@ void send_diablo_keystroke(uint8_t diablo_key) { | |||
| 123 | // Runs the "send string" command if enough time has passed, and resets the timer. | 126 | // Runs the "send string" command if enough time has passed, and resets the timer. |
| 124 | void run_diablo_macro_check(void) { | 127 | void run_diablo_macro_check(void) { |
| 125 | uint8_t dtime; | 128 | uint8_t dtime; |
| 126 | |||
| 127 | for (dtime = 0; dtime < 4; dtime++) { | 129 | for (dtime = 0; dtime < 4; dtime++) { |
| 128 | if (check_dtimer(dtime) && diablo_key_time[dtime]) { | 130 | if (check_dtimer(dtime) && diablo_key_time[dtime]) { |
| 129 | diablo_timer[dtime] = timer_read(); | 131 | diablo_timer[dtime] = timer_read(); |
| @@ -131,7 +133,6 @@ void run_diablo_macro_check(void) { | |||
| 131 | } | 133 | } |
| 132 | } | 134 | } |
| 133 | } | 135 | } |
| 134 | |||
| 135 | #endif // TAP_DANCE_ENABLE | 136 | #endif // TAP_DANCE_ENABLE |
| 136 | 137 | ||
| 137 | 138 | ||
| @@ -162,31 +163,32 @@ void led_set_keymap(uint8_t usb_led) {} | |||
| 162 | // Call user matrix init, set default RGB colors and then | 163 | // Call user matrix init, set default RGB colors and then |
| 163 | // call the keymap's init function | 164 | // call the keymap's init function |
| 164 | void matrix_init_user(void) { | 165 | void matrix_init_user(void) { |
| 165 | #ifdef RGBLIGHT_ENABLE | ||
| 166 | uint8_t default_layer = eeconfig_read_default_layer(); | 166 | uint8_t default_layer = eeconfig_read_default_layer(); |
| 167 | 167 | ||
| 168 | #ifdef RGBLIGHT_ENABLE | ||
| 168 | rgblight_enable(); | 169 | rgblight_enable(); |
| 170 | #endif // RGBLIGHT_ENABLE | ||
| 169 | 171 | ||
| 170 | if (true) { | 172 | if (default_layer & (1UL << _COLEMAK)) { |
| 171 | if (default_layer & (1UL << _COLEMAK)) { | 173 | #ifdef RGBLIGHT_ENABLE |
| 172 | rgblight_sethsv_magenta(); | 174 | rgblight_sethsv_magenta(); |
| 173 | } | ||
| 174 | else if (default_layer & (1UL << _DVORAK)) { | ||
| 175 | rgblight_sethsv_green(); | ||
| 176 | } | ||
| 177 | else if (default_layer & (1UL << _WORKMAN)) { | ||
| 178 | rgblight_sethsv_goldenrod(); | ||
| 179 | } | ||
| 180 | else { | ||
| 181 | rgblight_sethsv_teal(); | ||
| 182 | } | ||
| 183 | } | ||
| 184 | else | ||
| 185 | { | ||
| 186 | rgblight_setrgb_red(); | ||
| 187 | rgblight_mode(5); | ||
| 188 | } | ||
| 189 | #endif // RGBLIGHT_ENABLE | 175 | #endif // RGBLIGHT_ENABLE |
| 176 | } else if (default_layer & (1UL << _DVORAK)) { | ||
| 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 | ||
| 186 | rgblight_sethsv_teal(); | ||
| 187 | #endif // RGBLIGHT_ENABLE | ||
| 188 | } | ||
| 189 | |||
| 190 | userspace_config.raw = eeprom_read_byte(EECONFIG_USERSPACE); | ||
| 191 | clicky_enable = userspace_config.clicky_enable; | ||
| 190 | 192 | ||
| 191 | #if ( defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE) ) | 193 | #if ( defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE) ) |
| 192 | set_unicode_input_mode(UC_WINC); | 194 | set_unicode_input_mode(UC_WINC); |
| @@ -197,23 +199,21 @@ void matrix_init_user(void) { | |||
| 197 | // No global matrix scan code, so just run keymap's matrix | 199 | // No global matrix scan code, so just run keymap's matrix |
| 198 | // scan function | 200 | // scan function |
| 199 | void matrix_scan_user(void) { | 201 | void matrix_scan_user(void) { |
| 202 | |||
| 200 | #ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code. | 203 | #ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code. |
| 201 | run_diablo_macro_check(); | 204 | run_diablo_macro_check(); |
| 202 | #endif // TAP_DANCE_ENABLE | 205 | #endif // TAP_DANCE_ENABLE |
| 206 | |||
| 203 | matrix_scan_keymap(); | 207 | matrix_scan_keymap(); |
| 204 | } | 208 | } |
| 205 | 209 | ||
| 206 | void tap(uint16_t keycode){ | ||
| 207 | register_code(keycode); | ||
| 208 | unregister_code(keycode); | ||
| 209 | }; | ||
| 210 | 210 | ||
| 211 | // This block is for all of the gaming macros, as they were all doing | 211 | // This block is for all of the gaming macros, as they were all doing |
| 212 | // the same thing, but with differring text sent. | 212 | // the same thing, but with differring text sent. |
| 213 | bool send_game_macro(const char *str, keyrecord_t *record, bool override) { | 213 | bool send_game_macro(const char *str, keyrecord_t *record, bool override) { |
| 214 | if (!record->event.pressed || override) { | 214 | if (!record->event.pressed || override) { |
| 215 | clear_keyboard(); | 215 | clear_keyboard(); |
| 216 | tap(is_overwatch ? KC_BSPC : KC_ENTER); | 216 | tap(userspace_config.is_overwatch ? KC_BSPC : KC_ENTER); |
| 217 | wait_ms(50); | 217 | wait_ms(50); |
| 218 | send_string(str); | 218 | send_string(str); |
| 219 | wait_ms(50); | 219 | wait_ms(50); |
| @@ -261,39 +261,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 261 | break; | 261 | break; |
| 262 | 262 | ||
| 263 | 263 | ||
| 264 | case LOWER: | ||
| 265 | if (record->event.pressed) { | ||
| 266 | layer_on(_LOWER); | ||
| 267 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 268 | } | ||
| 269 | else { | ||
| 270 | layer_off(_LOWER); | ||
| 271 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 272 | } | ||
| 273 | return false; | ||
| 274 | break; | ||
| 275 | case RAISE: | ||
| 276 | if (record->event.pressed) { | ||
| 277 | layer_on(_RAISE); | ||
| 278 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 279 | } | ||
| 280 | else { | ||
| 281 | layer_off(_RAISE); | ||
| 282 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 283 | } | ||
| 284 | return false; | ||
| 285 | break; | ||
| 286 | case ADJUST: | ||
| 287 | if (record->event.pressed) { | ||
| 288 | layer_on(_ADJUST); | ||
| 289 | } | ||
| 290 | else { | ||
| 291 | layer_off(_ADJUST); | ||
| 292 | } | ||
| 293 | return false; | ||
| 294 | break; | ||
| 295 | |||
| 296 | |||
| 297 | case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader | 264 | case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader |
| 298 | if (!record->event.pressed) { | 265 | if (!record->event.pressed) { |
| 299 | SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP | 266 | SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP |
| @@ -349,11 +316,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 349 | // These are a serious of gaming macros. | 316 | // These are a serious of gaming macros. |
| 350 | // Only enables for the viterbi, basically, | 317 | // Only enables for the viterbi, basically, |
| 351 | // to save on firmware space, since it's limited. | 318 | // to save on firmware space, since it's limited. |
| 352 | #if !(defined(KEYBOARD_orthodox_rev1) || defined(KEYBOARD_orthodox_rev3) || defined(KEYBOARD_ergodox_ez)) | 319 | #if !(defined(KEYBOARD_orthodox_rev1) || defined(KEYBOARD_orthodox_rev3) || defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_iris_rev2)) |
| 353 | case KC_OVERWATCH: // Toggle's if we hit "ENTER" or "BACKSPACE" to input macros | 320 | case KC_OVERWATCH: // Toggle's if we hit "ENTER" or "BACKSPACE" to input macros |
| 354 | if (record->event.pressed) { is_overwatch = !is_overwatch; } | 321 | if (record->event.pressed) { userspace_config.is_overwatch ^= 1; eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw); } |
| 355 | #ifdef RGBLIGHT_ENABLE | 322 | #ifdef RGBLIGHT_ENABLE |
| 356 | is_overwatch ? rgblight_mode(17) : rgblight_mode(18); | 323 | userspace_config.is_overwatch ? rgblight_mode(17) : rgblight_mode(18); |
| 357 | #endif //RGBLIGHT_ENABLE | 324 | #endif //RGBLIGHT_ENABLE |
| 358 | return false; break; | 325 | return false; break; |
| 359 | case KC_SALT: | 326 | case KC_SALT: |
| @@ -435,7 +402,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 435 | } | 402 | } |
| 436 | return false; | 403 | return false; |
| 437 | break; | 404 | break; |
| 438 | 405 | case CLICKY_TOGGLE: | |
| 406 | userspace_config.clicky_enable = clicky_enable; | ||
| 407 | eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw); | ||
| 408 | break; | ||
| 439 | #ifdef UNICODE_ENABLE | 409 | #ifdef UNICODE_ENABLE |
| 440 | case UC_FLIP: // (╯°□°)╯ ︵ ┻━┻ | 410 | case UC_FLIP: // (╯°□°)╯ ︵ ┻━┻ |
| 441 | if (record->event.pressed) { | 411 | if (record->event.pressed) { |
| @@ -466,81 +436,135 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 466 | } | 436 | } |
| 467 | 437 | ||
| 468 | 438 | ||
| 439 | |||
| 469 | // Runs state check and changes underglow color and animation | 440 | // Runs state check and changes underglow color and animation |
| 470 | // on layer change, no matter where the change was initiated | 441 | // on layer change, no matter where the change was initiated |
| 471 | // Then runs keymap's layer change check | 442 | // Then runs keymap's layer change check |
| 472 | uint32_t layer_state_set_user(uint32_t state) { | 443 | uint32_t layer_state_set_user(uint32_t state) { |
| 473 | #ifdef RGBLIGHT_ENABLE | ||
| 474 | uint8_t default_layer = eeconfig_read_default_layer(); | 444 | uint8_t default_layer = eeconfig_read_default_layer(); |
| 445 | state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); | ||
| 475 | 446 | ||
| 476 | if (rgb_layer_change) { | 447 | switch (biton32(state)) { |
| 477 | switch (biton32(state)) { | 448 | case _NAV: |
| 478 | case _NAV: | 449 | #ifdef RGBLIGHT_ENABLE |
| 450 | if (rgb_layer_change) { | ||
| 479 | rgblight_sethsv_blue(); | 451 | rgblight_sethsv_blue(); |
| 480 | rgblight_mode(1); | 452 | rgblight_mode(1); |
| 481 | break; | 453 | } |
| 482 | case _SYMB: | 454 | #endif // RGBLIGHT_ENABLE |
| 455 | break; | ||
| 456 | case _SYMB: | ||
| 457 | #ifdef RGBLIGHT_ENABLE | ||
| 458 | if (rgb_layer_change) { | ||
| 483 | rgblight_sethsv_blue(); | 459 | rgblight_sethsv_blue(); |
| 484 | rgblight_mode(2); | 460 | rgblight_mode(2); |
| 485 | break; | 461 | } |
| 486 | case _MOUS: | 462 | #endif // RGBLIGHT_ENABLE |
| 463 | break; | ||
| 464 | case _MOUS: | ||
| 465 | #ifdef RGBLIGHT_ENABLE | ||
| 466 | if (rgb_layer_change) { | ||
| 487 | rgblight_sethsv_yellow(); | 467 | rgblight_sethsv_yellow(); |
| 488 | rgblight_mode(1); | 468 | rgblight_mode(1); |
| 489 | break; | 469 | } |
| 490 | case _MACROS: | 470 | #endif // RGBLIGHT_ENABLE |
| 471 | break; | ||
| 472 | case _MACROS: | ||
| 473 | #ifdef RGBLIGHT_ENABLE | ||
| 474 | if (rgb_layer_change) { | ||
| 491 | rgblight_sethsv_orange(); | 475 | rgblight_sethsv_orange(); |
| 492 | is_overwatch ? rgblight_mode(17) : rgblight_mode(18); | 476 | userspace_config.is_overwatch ? rgblight_mode(17) : rgblight_mode(18); |
| 493 | break; | 477 | } |
| 494 | case _MEDIA: | 478 | #endif // RGBLIGHT_ENABLE |
| 479 | break; | ||
| 480 | case _MEDIA: | ||
| 481 | #ifdef RGBLIGHT_ENABLE | ||
| 482 | if (rgb_layer_change) { | ||
| 495 | rgblight_sethsv_chartreuse(); | 483 | rgblight_sethsv_chartreuse(); |
| 496 | rgblight_mode(22); | 484 | rgblight_mode(22); |
| 497 | break; | 485 | } |
| 498 | case _GAMEPAD: | 486 | #endif // RGBLIGHT_ENABLE |
| 487 | break; | ||
| 488 | case _GAMEPAD: | ||
| 489 | #ifdef RGBLIGHT_ENABLE | ||
| 490 | if (rgb_layer_change) { | ||
| 499 | rgblight_sethsv_orange(); | 491 | rgblight_sethsv_orange(); |
| 500 | rgblight_mode(17); | 492 | rgblight_mode(17); |
| 501 | break; | 493 | } |
| 502 | case _DIABLO: | 494 | #endif // RGBLIGHT_ENABLE |
| 495 | break; | ||
| 496 | case _DIABLO: | ||
| 497 | #ifdef RGBLIGHT_ENABLE | ||
| 498 | if (rgb_layer_change) { | ||
| 503 | rgblight_sethsv_red(); | 499 | rgblight_sethsv_red(); |
| 504 | rgblight_mode(5); | 500 | rgblight_mode(5); |
| 505 | break; | 501 | } |
| 506 | case _RAISE: | 502 | #endif // RGBLIGHT_ENABLE |
| 503 | break; | ||
| 504 | case _RAISE: | ||
| 505 | #ifdef RGBLIGHT_ENABLE | ||
| 506 | if (rgb_layer_change) { | ||
| 507 | rgblight_sethsv_yellow(); | 507 | rgblight_sethsv_yellow(); |
| 508 | rgblight_mode(5); | 508 | rgblight_mode(5); |
| 509 | break; | 509 | } |
| 510 | case _LOWER: | 510 | #endif // RGBLIGHT_ENABLE |
| 511 | break; | ||
| 512 | case _LOWER: | ||
| 513 | #ifdef RGBLIGHT_ENABLE | ||
| 514 | if (rgb_layer_change) { | ||
| 511 | rgblight_sethsv_orange(); | 515 | rgblight_sethsv_orange(); |
| 512 | rgblight_mode(5); | 516 | rgblight_mode(5); |
| 513 | break; | 517 | } |
| 514 | case _ADJUST: | 518 | #endif // RGBLIGHT_ENABLE |
| 519 | break; | ||
| 520 | case _ADJUST: | ||
| 521 | #ifdef RGBLIGHT_ENABLE | ||
| 522 | if (rgb_layer_change) { | ||
| 515 | rgblight_sethsv_red(); | 523 | rgblight_sethsv_red(); |
| 516 | rgblight_mode(23); | 524 | rgblight_mode(23); |
| 517 | break; | 525 | } |
| 518 | case _COVECUBE: | 526 | #endif // RGBLIGHT_ENABLE |
| 527 | break; | ||
| 528 | case _COVECUBE: | ||
| 529 | #ifdef RGBLIGHT_ENABLE | ||
| 530 | if (rgb_layer_change) { | ||
| 519 | rgblight_sethsv_green(); | 531 | rgblight_sethsv_green(); |
| 520 | rgblight_mode(2); | 532 | rgblight_mode(2); |
| 521 | break; | ||
| 522 | default: // for any other layers, or the default layer | ||
| 523 | if (default_layer & (1UL << _COLEMAK)) { | ||
| 524 | rgblight_sethsv_magenta(); | ||
| 525 | } | ||
| 526 | else if (default_layer & (1UL << _DVORAK)) { | ||
| 527 | rgblight_sethsv_green(); | ||
| 528 | } | ||
| 529 | else if (default_layer & (1UL << _WORKMAN)) { | ||
| 530 | rgblight_sethsv_goldenrod(); | ||
| 531 | } | ||
| 532 | else { | ||
| 533 | rgblight_sethsv_teal(); | ||
| 534 | } | ||
| 535 | if (biton32(state) == _MODS) { // If the non-OSM layer is enabled, then breathe | ||
| 536 | rgblight_mode(2); | ||
| 537 | } else { // otherwise, stay solid | ||
| 538 | rgblight_mode(1); | ||
| 539 | } | ||
| 540 | break; | ||
| 541 | } | 533 | } |
| 542 | } | ||
| 543 | #endif // RGBLIGHT_ENABLE | 534 | #endif // RGBLIGHT_ENABLE |
| 535 | break; | ||
| 536 | default: // for any other layers, or the default layer | ||
| 537 | if (default_layer & (1UL << _COLEMAK)) { | ||
| 538 | #ifdef RGBLIGHT_ENABLE | ||
| 539 | if (rgb_layer_change) { rgblight_sethsv_magenta(); } | ||
| 540 | #endif // RGBLIGHT_ENABLE | ||
| 541 | } | ||
| 542 | else if (default_layer & (1UL << _DVORAK)) { | ||
| 543 | #ifdef RGBLIGHT_ENABLE | ||
| 544 | if (rgb_layer_change) { rgblight_sethsv_green(); } | ||
| 545 | #endif // RGBLIGHT_ENABLE | ||
| 546 | } | ||
| 547 | else if (default_layer & (1UL << _WORKMAN)) { | ||
| 548 | #ifdef RGBLIGHT_ENABLE | ||
| 549 | if (rgb_layer_change) { rgblight_sethsv_goldenrod(); } | ||
| 550 | #endif // RGBLIGHT_ENABLE | ||
| 551 | } | ||
| 552 | else { | ||
| 553 | #ifdef RGBLIGHT_ENABLE | ||
| 554 | if (rgb_layer_change) { rgblight_sethsv_teal(); } | ||
| 555 | #endif // RGBLIGHT_ENABLE | ||
| 556 | } | ||
| 557 | if (biton32(state) == _MODS) { // If the non-OSM layer is enabled, then breathe | ||
| 558 | #ifdef RGBLIGHT_ENABLE | ||
| 559 | if (rgb_layer_change) { rgblight_mode(2); } | ||
| 560 | #endif // RGBLIGHT_ENABLE | ||
| 561 | } else { // otherwise, stay solid | ||
| 562 | #ifdef RGBLIGHT_ENABLE | ||
| 563 | if (rgb_layer_change) { rgblight_mode(1); } | ||
| 564 | #endif // RGBLIGHT_ENABLE | ||
| 565 | } | ||
| 566 | break; | ||
| 567 | } | ||
| 544 | return layer_state_set_keymap (state); | 568 | return layer_state_set_keymap (state); |
| 545 | } | 569 | } |
| 546 | 570 | ||
