Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a configurable modifier indicator color #19

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,11 @@ config ZMK_RGB_UNDERGLOW_AUTO_OFF_USB
bool "Turn off RGB underglow when USB is disconnected"
depends on USB_DEVICE_STACK

config ZMK_RGB_UNDERGLOW_MOD_COLOR
hex "RGB hex color of CAPS/SCROLL/NUM LOCK indicators"
range 0x000000 0xFFFFFF
default 0xFFFFFF

#ZMK_RGB_UNDERGLOW
endif

Expand Down
12 changes: 8 additions & 4 deletions app/src/rgb_underglow.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,11 @@ static bool zmk_kinesis_blink_step(uint8_t idx, uint8_t limit) {
return !last_ble_state[idx];
}

static struct led_rgb zmk_get_indicator_color(zmk_hid_indicators_t bit) {
return led_data.indicators & bit ? LED_RGB(CONFIG_ZMK_RGB_UNDERGLOW_MOD_COLOR)
: LED_RGB(0x000000);
}

static void zmk_rgb_underglow_effect_kinesis() {
#if ZMK_BLE_IS_CENTRAL
// update state and propagate to peripheral if necessary
Expand All @@ -286,7 +291,7 @@ static void zmk_rgb_underglow_effect_kinesis() {
// leds for central (left) side

// set first led to caps lock state
pixels[0] = led_data.indicators & ZMK_LED_CAPSLOCK_BIT ? LED_RGB(0xFFFFFF) : LED_RGB(0x000000);
pixels[0] = zmk_get_indicator_color(ZMK_LED_CAPSLOCK_BIT);

// set second led to bluetooth state, blinking quickly if bluetooth not paired,
// and slowly if not connected
Expand All @@ -303,9 +308,8 @@ static void zmk_rgb_underglow_effect_kinesis() {
// leds for peripheral (right) side

// set first and second leds to num lock and scroll lock state, respectively
pixels[2] = led_data.indicators & ZMK_LED_NUMLOCK_BIT ? LED_RGB(0xFFFFFF) : LED_RGB(0x000000);
pixels[1] =
led_data.indicators & ZMK_LED_SCROLLLOCK_BIT ? LED_RGB(0xFFFFFF) : LED_RGB(0x000000);
pixels[2] = zmk_get_indicator_color(ZMK_LED_NUMLOCK_BIT);
pixels[1] = zmk_get_indicator_color(ZMK_LED_SCROLLLOCK_BIT);

// set third led to layer state
pixels[0] = LAYER_COLORS[layer_color_right];
Expand Down
Loading