summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrashna Jael're <drashna@live.com>2019-08-07 09:37:00 -0700
committerFlorian Didron <fdidron@users.noreply.github.com>2019-08-08 08:54:52 +0900
commitc8db6dfdd3748ef674ded84b61fb81129f1ac5de (patch)
tree8ec74040938a9d8f9f685a2979a45a8943487c8b
parent4de36ce45b4f5cce65f2a35c6288f0a23ca51a3e (diff)
Update RGB Matrix configuration for Ergodox EZ
-rw-r--r--keyboards/ergodox_ez/ergodox_ez.c37
-rw-r--r--keyboards/ergodox_ez/ergodox_ez.h3
2 files changed, 40 insertions, 0 deletions
diff --git a/keyboards/ergodox_ez/ergodox_ez.c b/keyboards/ergodox_ez/ergodox_ez.c
index 12b3419ecf..4dcf5e2754 100644
--- a/keyboards/ergodox_ez/ergodox_ez.c
+++ b/keyboards/ergodox_ez/ergodox_ez.c
@@ -46,6 +46,13 @@ void matrix_init_kb(void) {
keyboard_config.raw = eeconfig_read_kb();
ergodox_led_all_set((uint8_t)keyboard_config.led_level * 255 / 4 );
+#ifdef RGB_MATRIX_ENABLE
+ if (keyboard_config.rgb_matrix_enable) {
+ rgb_matrix_set_flags(LED_FLAG_ALL);
+ } else {
+ rgb_matrix_set_flags(LED_FLAG_NONE);
+ }
+#endif
ergodox_blink_all_leds();
@@ -319,6 +326,10 @@ led_config_t g_led_config = { {
4, 4, 1, 1, 1, 1
} };
+void keyboard_post_init_kb(void) {
+ rgb_matrix_enable_noeeprom();
+ keyboard_post_init_user();
+}
#endif
@@ -335,6 +346,31 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
layer_state_set_kb(layer_state);
}
break;
+#ifdef RGB_MATRIX_ENABLE
+ case TOGGLE_LAYER_COLOR:
+ if (record->event.pressed) {
+ keyboard_config.disable_layer_led ^= 1;
+ eeconfig_update_kb(keyboard_config.raw);
+ }
+ break;
+ case RGB_TOG:
+ if (record->event.pressed) {
+ switch (rgb_matrix_get_flags()) {
+ case LED_FLAG_ALL: {
+ rgb_matrix_set_flags(LED_FLAG_NONE);
+ keyboard_config.rgb_matrix_enable = false;
+ }
+ break;
+ default: {
+ rgb_matrix_set_flags(LED_FLAG_ALL);
+ keyboard_config.rgb_matrix_enable = true;
+ }
+ break;
+ }
+ eeconfig_update_kb(keyboard_config.raw);
+ }
+ return false;
+#endif
}
return process_record_user(keycode, record);
}
@@ -342,6 +378,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
void eeconfig_init_kb(void) { // EEPROM is getting reset!
keyboard_config.raw = 0;
keyboard_config.led_level = 4;
+ keyboard_config.rgb_matrix_enable = true;
eeconfig_update_kb(keyboard_config.raw);
eeconfig_init_user();
}
diff --git a/keyboards/ergodox_ez/ergodox_ez.h b/keyboards/ergodox_ez/ergodox_ez.h
index 38377fdf87..2b498ddb56 100644
--- a/keyboards/ergodox_ez/ergodox_ez.h
+++ b/keyboards/ergodox_ez/ergodox_ez.h
@@ -109,6 +109,7 @@ inline void ergodox_led_all_set(uint8_t n)
enum ergodox_ez_keycodes {
LED_LEVEL = SAFE_RANGE,
+ TOGGLE_LAYER_COLOR,
EZ_SAFE_RANGE,
};
@@ -116,6 +117,8 @@ typedef union {
uint32_t raw;
struct {
uint8_t led_level :3;
+ bool disable_layer_led :1;
+ bool rgb_matrix_enable :1;
};
} keyboard_config_t;