summaryrefslogtreecommitdiffstats
path: root/users/drashna/rgb_stuff.c
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2018-11-06 06:36:26 +0100
committerJack Humbert <jack.humb@gmail.com>2018-11-06 06:36:26 +0100
commitf2101cfb6a2270345fe6235d4c36e2e0d49db528 (patch)
treedfa98b41f5dc9afd377712bb54aa6c0dde848178 /users/drashna/rgb_stuff.c
parent672926562519c1ee7370b3ef188c11525de326e5 (diff)
downloadqmk_firmware-f2101cfb6a2270345fe6235d4c36e2e0d49db528.tar.gz
qmk_firmware-f2101cfb6a2270345fe6235d4c36e2e0d49db528.tar.xz
Update to drashna keymaps (#4365)
* Consistency fixes and more eeprom defaults * Handle setting Unicode mode on eeprom reset better * Unicode EEPROM hack * Re-enable permissive hold and ignore mod tap * Set unicode input mode * More unicode stuff * more haaaaaacks * Attempted RGB Cleanup * Fix compiler issue * Add GitLab CI config for personal compiling * Add avr gcc version to GitLab CI script * Add rgblight init to matrix init
Diffstat (limited to 'users/drashna/rgb_stuff.c')
-rw-r--r--users/drashna/rgb_stuff.c35
1 files changed, 9 insertions, 26 deletions
diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c
index 9ad94c0c3..b6de4d39e 100644
--- a/users/drashna/rgb_stuff.c
+++ b/users/drashna/rgb_stuff.c
@@ -12,14 +12,6 @@ void rgblight_sethsv_default_helper(uint8_t index) {
#endif // RGBLIGHT_ENABLE
#ifdef INDICATOR_LIGHTS
-uint8_t last_mod;
-uint8_t last_led;
-uint8_t last_osm;
-uint8_t current_mod;
-uint8_t current_led;
-uint8_t current_osm;
-
-
void set_rgb_indicators(uint8_t this_mod, uint8_t this_led, uint8_t this_osm) {
if (userspace_config.rgb_layer_change && biton32(layer_state) == 0) {
if (this_mod & MODS_SHIFT_MASK || this_led & (1<<USB_LED_CAPS_LOCK) || this_osm & MODS_SHIFT_MASK) {
@@ -86,16 +78,7 @@ void set_rgb_indicators(uint8_t this_mod, uint8_t this_led, uint8_t this_osm) {
}
void matrix_scan_indicator(void) {
- current_mod = get_mods();
- current_led = host_keyboard_leds();
- current_osm = get_oneshot_mods();
-
- set_rgb_indicators(current_mod, current_led, current_osm);
-
- last_mod = current_mod;
- last_led = current_led;
- last_osm = current_osm;
-
+ set_rgb_indicators(get_mods(), host_keyboard_leds(), get_oneshot_mods());
}
#endif //INDICATOR_LIGHTS
@@ -255,13 +238,9 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) {
void matrix_init_rgb(void) {
-#ifdef INDICATOR_LIGHTS
- current_mod = last_mod = get_mods();
- current_led = last_led = host_keyboard_leds();
- current_osm = last_osm = get_oneshot_mods();
-#endif
if (userspace_config.rgb_layer_change) {
+ rgblight_init();
rgblight_enable_noeeprom();
switch (biton32(eeconfig_read_default_layer())) {
case _COLEMAK:
@@ -291,6 +270,7 @@ void matrix_scan_rgb(void) {
uint32_t layer_state_set_rgb(uint32_t state) {
#ifdef RGBLIGHT_ENABLE
+ static bool has_ran;
if (userspace_config.rgb_layer_change) {
switch (biton32(state)) {
case _MACROS:
@@ -332,7 +312,12 @@ uint32_t layer_state_set_rgb(uint32_t state) {
default:
rgblight_sethsv_noeeprom_cyan(); break;
}
- biton32(state) == _MODS ? rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING) : rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); // if _MODS layer is on, then breath to denote it
+ if (has_ran) {
+ biton32(state) == _MODS ? rgblight_mode(RGBLIGHT_MODE_BREATHING) : rgblight_mode(RGBLIGHT_MODE_STATIC_LIGHT); // if _MODS layer is on, then breath to denote it
+ } else {
+ biton32(state) == _MODS ? rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING) : rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); // if _MODS layer is on, then breath to denote it
+ has_ran = true;
+ }
break;
}
// layer_state_set_indicator(); // Runs every scan, so need to call this here .... since I can't get it working "right" anyhow
@@ -341,5 +326,3 @@ uint32_t layer_state_set_rgb(uint32_t state) {
return state;
}
-
-