Merge pull request #5 from keychron-contrib/vr-q1-add-caps-lock-light

[Q1] add caps lock indicator
This commit is contained in:
lalalademaxiya1 2022-01-24 09:43:06 +08:00 committed by GitHub
commit 955488a679
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 0 deletions

View File

@ -17,6 +17,8 @@
#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) {
@ -24,3 +26,23 @@ bool dip_switch_update_kb(uint8_t index, bool active) {
}
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

View File

@ -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