Skip to content

Commit

Permalink
Merge pull request #5 from keychron-contrib/vr-q1-add-caps-lock-light
Browse files Browse the repository at this point in the history
[Q1] add caps lock indicator
  • Loading branch information
KeychronMacro authored Jan 24, 2022
2 parents 059710a + 33bfbef commit 955488a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
22 changes: 22 additions & 0 deletions keyboards/keychron/q1/q1.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,32 @@
#include "q1.h"
#include "test.c"

#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 ? 2 : 0));
}
return true;
}

#endif


#if defined(RGB_MATRIX_ENABLE) && defined(CAPS_LOCK_LED_INDEX)

#define CAPS_LOCK_BRIGHTNESS 0xFF
#ifdef RGB_MATRIX_MAXIMUM_BRIGHTNESS
#undef CAPS_LOCK_BRIGHTNESS
#define CAPS_LOCK_BRIGHTNESS RGB_MATRIX_MAXIMUM_BRIGHTNESS
#endif

__attribute__((weak))
void rgb_matrix_indicators_user(void) {
if (host_keyboard_led_state().caps_lock) {
rgb_matrix_set_color(CAPS_LOCK_LED_INDEX, CAPS_LOCK_BRIGHTNESS, CAPS_LOCK_BRIGHTNESS, CAPS_LOCK_BRIGHTNESS); // white
}
}

#endif
3 changes: 3 additions & 0 deletions keyboards/keychron/q1/q1_ansi_stm32l432_ec11/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,6 @@

/* Specifies the number of pulses the encoder registers between each detent */
#define ENCODER_RESOLUTION 4

/* Enable caps-lock LED */
#define CAPS_LOCK_LED_INDEX 44

0 comments on commit 955488a

Please sign in to comment.