diff options
| author | Drashna Jaelre <drashna@live.com> | 2019-03-15 08:57:44 -0700 |
|---|---|---|
| committer | MechMerlin <30334081+mechmerlin@users.noreply.github.com> | 2019-03-15 08:57:44 -0700 |
| commit | 493fbb3dc1423e0d42e57a6dc7ba38b880b37eb5 (patch) | |
| tree | d351bb45b24f55eb355b5724f97b0942214fd781 /users/drashna/rgb_stuff.c | |
| parent | e0a03bfa6c148da2936b27a2285f1928c5574ac0 (diff) | |
| download | qmk_firmware-493fbb3dc1423e0d42e57a6dc7ba38b880b37eb5.tar.gz qmk_firmware-493fbb3dc1423e0d42e57a6dc7ba38b880b37eb5.zip | |
[Keymap] Update to drashna keymaps: Conform to QMK Standards Edition (#5377)
* Use correct functions for dip switch code
* Some planck cleanup
* Hopefully fix RGB Sleeping with RGB Matrix
* Add rgbmatrix extern
* Add numpad 5x6 layout
* RGB Tweaks
* Add RGB startup animation
* Minor RGB Fixes
* Turn off RBG on planck
* Enable separate storage of EEPROM
* Update Macro pad
* Add BJohnson Keymap and minor darshna tweaks
* Clean up rgb and other code for new numpad
* Remove clicky hachy thing
* Update my code to use built in MOD_MASK defines
* Fix up modifier calls
* Tweak to KC_MAKE
* Tweak to KC_MAKE
* Add Semi-colon to numpad
* Preprocess out rgb matrix stuff if not enabled
* Formatting of KC_MAKE
* Add stuff for matrix and light rgb coexistance
* Fix bad spelling
* Change where layer indication shows based on rgblight status
* Force set mods in KC_MAKE
* Optimize CRKBD
Diffstat (limited to 'users/drashna/rgb_stuff.c')
| -rw-r--r-- | users/drashna/rgb_stuff.c | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c index 7eaa7e949..a98ad590c 100644 --- a/users/drashna/rgb_stuff.c +++ b/users/drashna/rgb_stuff.c | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #if defined(RGBLIGHT_ENABLE) | 5 | #if defined(RGBLIGHT_ENABLE) |
| 6 | extern rgblight_config_t rgblight_config; | 6 | extern rgblight_config_t rgblight_config; |
| 7 | bool has_initialized; | ||
| 7 | #elif defined(RGB_MATRIX_ENABLE) | 8 | #elif defined(RGB_MATRIX_ENABLE) |
| 8 | extern rgb_config_t rgb_matrix_config; | 9 | extern rgb_config_t rgb_matrix_config; |
| 9 | #endif | 10 | #endif |
| @@ -17,7 +18,7 @@ void rgblight_sethsv_default_helper(uint8_t index) { | |||
| 17 | #ifdef INDICATOR_LIGHTS | 18 | #ifdef INDICATOR_LIGHTS |
| 18 | void set_rgb_indicators(uint8_t this_mod, uint8_t this_led, uint8_t this_osm) { | 19 | void set_rgb_indicators(uint8_t this_mod, uint8_t this_led, uint8_t this_osm) { |
| 19 | if (userspace_config.rgb_layer_change && biton32(layer_state) == 0) { | 20 | if (userspace_config.rgb_layer_change && biton32(layer_state) == 0) { |
| 20 | if (this_mod & MODS_SHIFT_MASK || this_led & (1<<USB_LED_CAPS_LOCK) || this_osm & MODS_SHIFT_MASK) { | 21 | if ( (this_mod | this_osm) & MOD_MASK_SHIFT || this_led & (1<<USB_LED_CAPS_LOCK) ) { |
| 21 | #ifdef SHFT_LED1 | 22 | #ifdef SHFT_LED1 |
| 22 | rgblight_sethsv_at(120, 255, 255, SHFT_LED1); | 23 | rgblight_sethsv_at(120, 255, 255, SHFT_LED1); |
| 23 | #endif // SHFT_LED1 | 24 | #endif // SHFT_LED1 |
| @@ -32,7 +33,7 @@ void set_rgb_indicators(uint8_t this_mod, uint8_t this_led, uint8_t this_osm) { | |||
| 32 | rgblight_sethsv_default_helper(SHFT_LED2); | 33 | rgblight_sethsv_default_helper(SHFT_LED2); |
| 33 | #endif // SHFT_LED2 | 34 | #endif // SHFT_LED2 |
| 34 | } | 35 | } |
| 35 | if (this_mod & MODS_CTRL_MASK || this_osm & MODS_CTRL_MASK) { | 36 | if ( (this_mod | this_osm) & MOD_MASK_CTRL) { |
| 36 | #ifdef CTRL_LED1 | 37 | #ifdef CTRL_LED1 |
| 37 | rgblight_sethsv_at(0, 255, 255, CTRL_LED1); | 38 | rgblight_sethsv_at(0, 255, 255, CTRL_LED1); |
| 38 | #endif // CTRL_LED1 | 39 | #endif // CTRL_LED1 |
| @@ -47,7 +48,7 @@ void set_rgb_indicators(uint8_t this_mod, uint8_t this_led, uint8_t this_osm) { | |||
| 47 | rgblight_sethsv_default_helper(CTRL_LED2); | 48 | rgblight_sethsv_default_helper(CTRL_LED2); |
| 48 | #endif // CTRL_LED2 | 49 | #endif // CTRL_LED2 |
| 49 | } | 50 | } |
| 50 | if (this_mod & MODS_GUI_MASK || this_osm & MODS_GUI_MASK) { | 51 | if ( (this_mod | this_osm) & MOD_MASK_GUI) { |
| 51 | #ifdef GUI_LED1 | 52 | #ifdef GUI_LED1 |
| 52 | rgblight_sethsv_at(51, 255, 255, GUI_LED1); | 53 | rgblight_sethsv_at(51, 255, 255, GUI_LED1); |
| 53 | #endif // GUI_LED1 | 54 | #endif // GUI_LED1 |
| @@ -62,7 +63,7 @@ void set_rgb_indicators(uint8_t this_mod, uint8_t this_led, uint8_t this_osm) { | |||
| 62 | rgblight_sethsv_default_helper(GUI_LED2); | 63 | rgblight_sethsv_default_helper(GUI_LED2); |
| 63 | #endif // GUI_LED2 | 64 | #endif // GUI_LED2 |
| 64 | } | 65 | } |
| 65 | if (this_mod & MODS_ALT_MASK || this_osm & MODS_ALT_MASK) { | 66 | if ( (this_mod | this_osm) & MOD_MASK_ALT) { |
| 66 | #ifdef ALT_LED1 | 67 | #ifdef ALT_LED1 |
| 67 | rgblight_sethsv_at(240, 255, 255, ALT_LED1); | 68 | rgblight_sethsv_at(240, 255, 255, ALT_LED1); |
| 68 | #endif // ALT_LED1 | 69 | #endif // ALT_LED1 |
| @@ -81,7 +82,9 @@ void set_rgb_indicators(uint8_t this_mod, uint8_t this_led, uint8_t this_osm) { | |||
| 81 | } | 82 | } |
| 82 | 83 | ||
| 83 | void matrix_scan_indicator(void) { | 84 | void matrix_scan_indicator(void) { |
| 84 | set_rgb_indicators(get_mods(), host_keyboard_leds(), get_oneshot_mods()); | 85 | if (has_initialized) { |
| 86 | set_rgb_indicators(get_mods(), host_keyboard_leds(), get_oneshot_mods()); | ||
| 87 | } | ||
| 85 | } | 88 | } |
| 86 | #endif //INDICATOR_LIGHTS | 89 | #endif //INDICATOR_LIGHTS |
| 87 | 90 | ||
| @@ -244,22 +247,16 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { | |||
| 244 | 247 | ||
| 245 | 248 | ||
| 246 | void keyboard_post_init_rgb(void) { | 249 | void keyboard_post_init_rgb(void) { |
| 247 | |||
| 248 | #ifdef RGBLIGHT_ENABLE | 250 | #ifdef RGBLIGHT_ENABLE |
| 249 | if (userspace_config.rgb_layer_change) { | 251 | rgblight_enable_noeeprom(); |
| 250 | rgblight_enable_noeeprom(); | 252 | layer_state_set_user(layer_state); |
| 251 | switch (biton32(eeconfig_read_default_layer())) { | 253 | uint16_t old_hue = rgblight_config.hue; |
| 252 | case _COLEMAK: | 254 | rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); |
| 253 | rgblight_sethsv_noeeprom_magenta(); break; | 255 | for (uint16_t i = 360; i > 0; i--) { |
| 254 | case _DVORAK: | 256 | rgblight_sethsv_noeeprom( ( i + old_hue) % 360, 255, 255); |
| 255 | rgblight_sethsv_noeeprom_springgreen(); break; | 257 | wait_ms(10); |
| 256 | case _WORKMAN: | 258 | } |
| 257 | rgblight_sethsv_noeeprom_goldenrod(); break; | 259 | layer_state_set_user(layer_state); |
| 258 | default: | ||
| 259 | rgblight_sethsv_noeeprom_cyan(); break; | ||
| 260 | } | ||
| 261 | rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); | ||
| 262 | } | ||
| 263 | #endif | 260 | #endif |
| 264 | } | 261 | } |
| 265 | 262 | ||
