Update RGB Matrix configuration for Planck EZ
Use LED Flags for RGB matrix control instead Cleanup
This commit is contained in:
committed by
Florian Didron
parent
5a30142914
commit
4de36ce45b
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
enum planck_keycodes {
|
||||
RGB_SLD = SAFE_RANGE,
|
||||
TOGGLE_LAYER_COLOR,
|
||||
EPRM,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user