summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboards/planck/ez/ez.c42
-rw-r--r--keyboards/planck/ez/ez.h5
-rw-r--r--keyboards/planck/keymaps/oryx/keymap.c1
3 files changed, 46 insertions, 2 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);
}
diff --git a/keyboards/planck/ez/ez.h b/keyboards/planck/ez/ez.h
index e2ddaf3cec..770d59acd4 100644
--- a/keyboards/planck/ez/ez.h
+++ b/keyboards/planck/ez/ez.h
@@ -60,13 +60,16 @@ void planck_ez_left_led_level(uint8_t level);
enum planck_ez_keycodes {
LED_LEVEL = SAFE_RANGE,
+ TOGGLE_LAYER_COLOR,
EZ_SAFE_RANGE,
};
typedef union {
uint32_t raw;
struct {
- uint8_t led_level :3;
+ uint8_t led_level :3;
+ bool disable_layer_led :1;
+ bool rgb_matrix_enable :1;
};
} keyboard_config_t;
diff --git a/keyboards/planck/keymaps/oryx/keymap.c b/keyboards/planck/keymaps/oryx/keymap.c
index 29ac0003a6..46737dbf7b 100644
--- a/keyboards/planck/keymaps/oryx/keymap.c
+++ b/keyboards/planck/keymaps/oryx/keymap.c
@@ -19,7 +19,6 @@
enum planck_keycodes {
RGB_SLD = SAFE_RANGE,
- TOGGLE_LAYER_COLOR,
EPRM,
};