Add missing layer dip switch
code for Keychron V2 (#447)
* Add missing layer `dip switch` for Keychron V2 * Add missing `#if defined` block in `v2.c`
This commit is contained in:
parent
06d21745a6
commit
6bea951a12
1 changed files with 14 additions and 2 deletions
|
@ -26,10 +26,21 @@ const matrix_row_t matrix_mask[] = {
|
||||||
|
|
||||||
#ifdef DIP_SWITCH_ENABLE
|
#ifdef DIP_SWITCH_ENABLE
|
||||||
|
|
||||||
|
bool dip_switch_update_kb(uint8_t index, bool active) {
|
||||||
|
if (!dip_switch_update_user(index, active)) { return false;}
|
||||||
|
if (index == 0) {
|
||||||
|
default_layer_set(1UL << (active ? 1 : 0));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // DIP_SWITCH_ENABLE
|
||||||
|
|
||||||
|
#if defined(RGB_MATRIX_ENABLE) && defined(CAPS_LOCK_LED_INDEX)
|
||||||
|
|
||||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
||||||
if (!process_record_user(keycode, record)) { return false; }
|
if (!process_record_user(keycode, record)) { return false; }
|
||||||
switch (keycode) {
|
switch (keycode) {
|
||||||
#ifdef RGB_MATRIX_ENABLE
|
|
||||||
case RGB_TOG:
|
case RGB_TOG:
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
switch (rgb_matrix_get_flags()) {
|
switch (rgb_matrix_get_flags()) {
|
||||||
|
@ -47,12 +58,13 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
||||||
rgb_matrix_enable();
|
rgb_matrix_enable();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) {
|
void rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) {
|
||||||
|
// RGB_MATRIX_INDICATOR_SET_COLOR(index, red, green, blue);
|
||||||
|
|
||||||
if (host_keyboard_led_state().caps_lock) {
|
if (host_keyboard_led_state().caps_lock) {
|
||||||
RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_LED_INDEX, 255, 255, 255);
|
RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_LED_INDEX, 255, 255, 255);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue