summaryrefslogtreecommitdiff
path: root/keyboards/planck/ez
diff options
context:
space:
mode:
authorDrashna Jael're <drashna@live.com>2019-08-07 08:42:57 -0700
committerFlorian Didron <fdidron@users.noreply.github.com>2019-08-08 08:54:52 +0900
commit4de36ce45b4f5cce65f2a35c6288f0a23ca51a3e (patch)
treea30765e817cb3ca26218e710df5567e7f4112029 /keyboards/planck/ez
parent5a30142914d5cb1bb2ce50e133d6cb2cfa3a86ec (diff)
Update RGB Matrix configuration for Planck EZ
Use LED Flags for RGB matrix control instead Cleanup
Diffstat (limited to 'keyboards/planck/ez')
-rw-r--r--keyboards/planck/ez/ez.c42
-rw-r--r--keyboards/planck/ez/ez.h5
2 files changed, 46 insertions, 1 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;