summaryrefslogtreecommitdiff
path: root/keyboards/planck/ez/ez.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/planck/ez/ez.c')
-rw-r--r--keyboards/planck/ez/ez.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/keyboards/planck/ez/ez.c b/keyboards/planck/ez/ez.c
index 67a578d89e..fc2c938eeb 100644
--- a/keyboards/planck/ez/ez.c
+++ b/keyboards/planck/ez/ez.c
@@ -209,14 +209,31 @@ void led_initialize_hardware(void) {
void keyboard_pre_init_kb(void) {
// read kb settings from eeprom
keyboard_config.raw = eeconfig_read_kb();
+#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
// initialize settings for front LEDs
led_initialize_hardware();
+ keyboard_pre_init_user();
}
+#ifdef RGB_MATRIX_ENABLE
+void keyboard_post_init_kb(void) {
+ rgb_matrix_enable_noeeprom();
+ keyboard_post_init_user();
+}
+#endif
+
void eeconfig_init_kb(void) { // EEPROM is getting reset!
keyboard_config.raw = 0;
+ keyboard_config.rgb_matrix_enable = true;
keyboard_config.led_level = 4;
+
eeconfig_update_kb(keyboard_config.raw);
eeconfig_init_user();
}
@@ -258,6 +275,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);
}