Skip to content

Commit 6bea951

Browse files
authored
Add missing layer dip switch code for Keychron V2 (vial-kb#447)
* Add missing layer `dip switch` for Keychron V2 * Add missing `#if defined` block in `v2.c`
1 parent 06d2174 commit 6bea951

File tree

1 file changed

+14
-2
lines changed
  • keyboards/keychron/v2

1 file changed

+14
-2
lines changed

keyboards/keychron/v2/v2.c

+14-2
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,21 @@ const matrix_row_t matrix_mask[] = {
2626

2727
#ifdef DIP_SWITCH_ENABLE
2828

29+
bool dip_switch_update_kb(uint8_t index, bool active) {
30+
if (!dip_switch_update_user(index, active)) { return false;}
31+
if (index == 0) {
32+
default_layer_set(1UL << (active ? 1 : 0));
33+
}
34+
return true;
35+
}
36+
37+
#endif // DIP_SWITCH_ENABLE
38+
39+
#if defined(RGB_MATRIX_ENABLE) && defined(CAPS_LOCK_LED_INDEX)
40+
2941
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
3042
if (!process_record_user(keycode, record)) { return false; }
3143
switch (keycode) {
32-
#ifdef RGB_MATRIX_ENABLE
3344
case RGB_TOG:
3445
if (record->event.pressed) {
3546
switch (rgb_matrix_get_flags()) {
@@ -47,12 +58,13 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
4758
rgb_matrix_enable();
4859
}
4960
return false;
50-
#endif
5161
}
5262
return true;
5363
}
5464

5565
void rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) {
66+
// RGB_MATRIX_INDICATOR_SET_COLOR(index, red, green, blue);
67+
5668
if (host_keyboard_led_state().caps_lock) {
5769
RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_LED_INDEX, 255, 255, 255);
5870
} else {

0 commit comments

Comments
 (0)