aboutsummaryrefslogtreecommitdiffstats
path: root/users/drashna/rgb_stuff.c
diff options
context:
space:
mode:
authorGravatar Drashna Jaelre <drashna@live.com>2018-11-26 16:45:24 -0800
committerGravatar MechMerlin <30334081+mechmerlin@users.noreply.github.com>2018-11-26 16:45:24 -0800
commitecd21b44a8efd5c7241ebf48c65fc7b30134865f (patch)
tree6fd84ca4bc241d9dbbe8ea3b81a7c8341b80ecc3 /users/drashna/rgb_stuff.c
parentedb6c98fd23ab102069037f3dbfbd46c6067e86a (diff)
downloadqmk_firmware-ecd21b44a8efd5c7241ebf48c65fc7b30134865f.tar.gz
Update to drashna userspace and keymaps (#4459)
* Fix reversed bool check in layer_state_set * Add Quefrency 65 for a friend * Add Ergodox EZ Glow keymap * Add RGB Matrix Code * Further changes to rgb matrix ErgoDox EZ * Update bjohnson keymaps * Fix CRKBD display * Overhaul to corne keyboard * Narrow scope for keylogger * Minor layout tweaks to Corne Keyboard * additional CRKBD tweaks * Minor tweaks to CRKBD * Add all characters for keylogger * Ergodox EZ Glow overhaul * Fix Ergodox EZ Glow layer colors * Increase Tapping Term for Corne Keyboard * Fix unicode-ish * Revert some changes * Add layer specific lighting effects * Some minor tweaks to ergodox glow config * revert changes to ergodox files * Update Glow readme * Add more tapping term defines * Fix changes * Fix ergodox keymap * Hopefully fix sleeping * Disable layer indications if rgb matrix is disabled * Add support for sleeping and rgb layer change toggle to ergodox ez glow * Make RGB Layer Indication Great Again * Make Unicode Great Again * Remove placeholder define Co-Authored-By: drashna <drashna@live.com> * Remove placeholder define Co-Authored-By: drashna <drashna@live.com> * Remove old EEPROM Reset keycode
Diffstat (limited to 'users/drashna/rgb_stuff.c')
-rw-r--r--users/drashna/rgb_stuff.c86
1 files changed, 60 insertions, 26 deletions
diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c
index b6de4d39e..d238c2065 100644
--- a/users/drashna/rgb_stuff.c
+++ b/users/drashna/rgb_stuff.c
@@ -2,8 +2,11 @@
#include "rgb_stuff.h"
#include "eeprom.h"
+#if defined(RGBLIGHT_ENABLE)
extern rgblight_config_t rgblight_config;
-extern userspace_config_t userspace_config;
+#elif defined(RGB_MATRIX_ENABLE)
+extern rgb_config_t rgb_matrix_config;
+#endif
#ifdef RGBLIGHT_ENABLE
void rgblight_sethsv_default_helper(uint8_t index) {
@@ -209,7 +212,7 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) {
return true; break;
#endif // RGBLIGHT_TWINKLE
case KC_RGB_T: // This allows me to use underglow as layer indication, or as normal
-#ifdef RGBLIGHT_ENABLE
+#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
if (record->event.pressed) {
userspace_config.rgb_layer_change ^= 1;
xprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change);
@@ -237,24 +240,25 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) {
-void matrix_init_rgb(void) {
+ void matrix_init_rgb(void) {
- if (userspace_config.rgb_layer_change) {
- rgblight_init();
- rgblight_enable_noeeprom();
- switch (biton32(eeconfig_read_default_layer())) {
- case _COLEMAK:
- rgblight_sethsv_noeeprom_magenta(); break;
- case _DVORAK:
- rgblight_sethsv_noeeprom_springgreen(); break;
- case _WORKMAN:
- rgblight_sethsv_noeeprom_goldenrod(); break;
- default:
- rgblight_sethsv_noeeprom_cyan(); break;
- }
- rgblight_mode(RGBLIGHT_MODE_STATIC_LIGHT);
- }
-}
+// #ifdef RGBLIGHT_ENABLE
+// if (userspace_config.rgb_layer_change) {
+// rgblight_enable_noeeprom();
+// switch (biton32(eeconfig_read_default_layer())) {
+// case _COLEMAK:
+// rgblight_sethsv_noeeprom_magenta(); break;
+// case _DVORAK:
+// rgblight_sethsv_noeeprom_springgreen(); break;
+// case _WORKMAN:
+// rgblight_sethsv_noeeprom_goldenrod(); break;
+// default:
+// rgblight_sethsv_noeeprom_cyan(); break;
+// }
+// rgblight_mode(RGBLIGHT_MODE_STATIC_LIGHT);
+// }
+// #endif
+ }
void matrix_scan_rgb(void) {
#ifdef RGBLIGHT_TWINKLE
@@ -270,7 +274,6 @@ 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:
@@ -312,12 +315,7 @@ uint32_t layer_state_set_rgb(uint32_t state) {
default:
rgblight_sethsv_noeeprom_cyan(); break;
}
- 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;
- }
+ 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
break;
}
// layer_state_set_indicator(); // Runs every scan, so need to call this here .... since I can't get it working "right" anyhow
@@ -326,3 +324,39 @@ uint32_t layer_state_set_rgb(uint32_t state) {
return state;
}
+
+uint32_t default_layer_state_set_rgb(uint32_t state) {
+#ifdef RGBLIGHT_ENABLE
+ if (userspace_config.rgb_layer_change) {
+ rgblight_config_t temp_rgblight_config = rgblight_config;
+ switch (biton32(state)) {
+ case _COLEMAK:
+ temp_rgblight_config.hue = 300;
+ temp_rgblight_config.val = 255;
+ temp_rgblight_config.sat = 255;
+ temp_rgblight_config.mode = 1;
+ break;
+ case _DVORAK:
+ temp_rgblight_config.hue = 150;
+ temp_rgblight_config.val = 255;
+ temp_rgblight_config.sat = 255;
+ temp_rgblight_config.mode = 1;
+ case _WORKMAN:
+ temp_rgblight_config.hue = 43;
+ temp_rgblight_config.val = 218;
+ temp_rgblight_config.sat = 218;
+ temp_rgblight_config.mode = 1;
+ default:
+ temp_rgblight_config.hue = 180;
+ temp_rgblight_config.val = 255;
+ temp_rgblight_config.sat = 255;
+ temp_rgblight_config.mode = 1;
+ }
+ if (temp_rgblight_config.raw != eeconfig_read_rgblight()) {
+ xprintf("rgblight set default layer hsv [EEPROM]: %u,%u,%u,%u\n", temp_rgblight_config.hue, temp_rgblight_config.sat, temp_rgblight_config.val, temp_rgblight_config.mode);
+ eeconfig_update_rgblight(temp_rgblight_config.raw);
+ }
+ }
+#endif // RGBLIGHT_ENABLE
+ return state;
+}