Remove IS_HOST_LED_ON and migrate usages (#19753)

This commit is contained in:
Ryan 2023-02-06 13:36:09 +11:00 committed by GitHub
parent d5e622b979
commit f0618a1d53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 94 additions and 80 deletions

View File

@ -233,7 +233,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
bool rgb_matrix_indicators_user(void) { bool rgb_matrix_indicators_user(void) {
// CapsLock Light // CapsLock Light
if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) { if (host_keyboard_led_state().caps_lock) {
rgb_matrix_set_color(30, MAIN_COLOR[0], MAIN_COLOR[1], MAIN_COLOR[2]); rgb_matrix_set_color(30, MAIN_COLOR[0], MAIN_COLOR[1], MAIN_COLOR[2]);
} }

View File

@ -142,7 +142,7 @@ bool rgb_matrix_indicators_user(void) {
const uint8_t led_constant_val = rgb_matrix_config.hsv.v < 100 ? 100 : rgb_matrix_config.hsv.v; const uint8_t led_constant_val = rgb_matrix_config.hsv.v < 100 ? 100 : rgb_matrix_config.hsv.v;
/* CapsLock LED indicator */ /* CapsLock LED indicator */
if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) { if (host_keyboard_led_state().caps_lock) {
rgb_matrix_set_color_hsv(30, 999, 0, led_constant_val, 0.75); // WHITE rgb_matrix_set_color_hsv(30, 999, 0, led_constant_val, 0.75); // WHITE
} }
@ -343,7 +343,7 @@ void send_french_accent(uint8_t letter, uint8_t accent) {
} }
} }
isCaps = IS_HOST_LED_ON(USB_LED_CAPS_LOCK) ? true : false; isCaps = host_keyboard_led_state().caps_lock ? true : false;
if (onMac) { if (onMac) {
if (isCaps) { if (isCaps) {
@ -469,7 +469,7 @@ void matrix_scan_user(void)
if (onMac) { if (onMac) {
SEND_STRING(SS_LALT("c")); SEND_STRING(SS_LALT("c"));
} else { } else {
IS_HOST_LED_ON(USB_LED_CAPS_LOCK) ? SEND_STRING(SS_DOWN(X_LALT) SS_TAP(X_P1) SS_TAP(X_P2) SS_TAP(X_P8) SS_UP(X_LALT)) : SEND_STRING(SS_DOWN(X_LALT) SS_TAP(X_P1) SS_TAP(X_P3) SS_TAP(X_P5) SS_UP(X_LALT)); host_keyboard_led_state().caps_lock ? SEND_STRING(SS_DOWN(X_LALT) SS_TAP(X_P1) SS_TAP(X_P2) SS_TAP(X_P8) SS_UP(X_LALT)) : SEND_STRING(SS_DOWN(X_LALT) SS_TAP(X_P1) SS_TAP(X_P3) SS_TAP(X_P5) SS_UP(X_LALT));
} }
} }
/* CapsLock */ /* CapsLock */

View File

@ -83,7 +83,7 @@ SFT, Z, X, C, V, B, N, M, COM, DOT, SLS, SHIFT, UP, 0
CTL, GUI, ALT, SPACEBAR, ALT, FN, CTL, LFT, DWN, RIT CTL, GUI, ALT, SPACEBAR, ALT, FN, CTL, LFT, DWN, RIT
*/ */
bool rgb_matrix_indicators_user(void) { bool rgb_matrix_indicators_user(void) {
if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) { if (host_keyboard_led_state().caps_lock) {
rgb_matrix_set_color(8, 0xFF, 0xFF, 0xFF); rgb_matrix_set_color(8, 0xFF, 0xFF, 0xFF);
} }

View File

@ -112,10 +112,11 @@ static void set_rgb_wlck_leds(void) {
} }
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) { led_t led_state = host_keyboard_led_state();
if (led_state.caps_lock) {
set_rgb_caps_leds(); set_rgb_caps_leds();
} }
if (!IS_HOST_LED_ON(USB_LED_NUM_LOCK)) { if (!led_state.num_lock) {
set_rgb_nlck_notset_leds(); set_rgb_nlck_notset_leds();
} }
if (keymap_config.no_gui) { if (keymap_config.no_gui) {

View File

@ -245,8 +245,10 @@ void hurt_paddle(void) {
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
if (get_rgb_nightmode()) rgb_matrix_set_color_all(RGB_OFF); if (get_rgb_nightmode()) rgb_matrix_set_color_all(RGB_OFF);
led_t led_state = host_keyboard_led_state();
// Scroll Lock RGB setup // Scroll Lock RGB setup
if (IS_HOST_LED_ON(USB_LED_SCROLL_LOCK)) { if (led_state.scroll_lock) {
rgb_matrix_set_color(LED_L3, RGB_RED); rgb_matrix_set_color(LED_L3, RGB_RED);
rgb_matrix_set_color(LED_L4, RGB_RED); rgb_matrix_set_color(LED_L4, RGB_RED);
rgb_matrix_set_color(LED_TAB, RGB_RED); rgb_matrix_set_color(LED_TAB, RGB_RED);
@ -256,7 +258,7 @@ bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
/* /*
// System NumLock warning indicator RGB setup // System NumLock warning indicator RGB setup
#ifdef INVERT_NUMLOCK_INDICATOR #ifdef INVERT_NUMLOCK_INDICATOR
if (!IS_HOST_LED_ON(USB_LED_NUM_LOCK)) { // on if NUM lock is OFF to bring attention to overlay numpad not functional when enabled if (!led_state.num_lock) { // on if NUM lock is OFF to bring attention to overlay numpad not functional when enabled
rgb_matrix_set_color(LED_GRV, RGB_ORANGE2); rgb_matrix_set_color(LED_GRV, RGB_ORANGE2);
rgb_matrix_set_color(LED_L1, RGB_ORANGE2); rgb_matrix_set_color(LED_L1, RGB_ORANGE2);
rgb_matrix_set_color(LED_L2, RGB_ORANGE2); rgb_matrix_set_color(LED_L2, RGB_ORANGE2);
@ -264,7 +266,7 @@ bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
rgb_matrix_set_color(LED_FN, RGB_ORANGE2); rgb_matrix_set_color(LED_FN, RGB_ORANGE2);
} }
#else #else
if (IS_HOST_LED_ON(USB_LED_NUM_LOCK)) { // Normal, on if NUM lock is ON if (led_state.num_lock) { // Normal, on if NUM lock is ON
rgb_matrix_set_color(LED_GRV, RGB_ORANGE2); rgb_matrix_set_color(LED_GRV, RGB_ORANGE2);
rgb_matrix_set_color(LED_L1, RGB_ORANGE2); rgb_matrix_set_color(LED_L1, RGB_ORANGE2);
rgb_matrix_set_color(LED_L2, RGB_ORANGE2); rgb_matrix_set_color(LED_L2, RGB_ORANGE2);
@ -275,7 +277,7 @@ bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
*/ */
// CapsLock RGB setup // CapsLock RGB setup
if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) { if (led_state.caps_lock) {
if (user_config.rgb_hilite_caps) { if (user_config.rgb_hilite_caps) {
for (uint8_t i = 0; i < ARRAYSIZE(LED_LIST_LETTERS); i++) { for (uint8_t i = 0; i < ARRAYSIZE(LED_LIST_LETTERS); i++) {
rgb_matrix_set_color(LED_LIST_LETTERS[i], RGB_CHARTREUSE); rgb_matrix_set_color(LED_LIST_LETTERS[i], RGB_CHARTREUSE);
@ -360,11 +362,11 @@ bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
// System NumLock warning indicator RGB setup // System NumLock warning indicator RGB setup
#ifdef INVERT_NUMLOCK_INDICATOR #ifdef INVERT_NUMLOCK_INDICATOR
if (!IS_HOST_LED_ON(USB_LED_NUM_LOCK)) { // on if NUM lock is OFF to bring attention to overlay numpad not functional when enabled if (!led_state.num_lock) { // on if NUM lock is OFF to bring attention to overlay numpad not functional when enabled
rgb_matrix_set_color(LED_N, RGB_ORANGE2); rgb_matrix_set_color(LED_N, RGB_ORANGE2);
} }
#else #else
if (IS_HOST_LED_ON(USB_LED_NUM_LOCK)) { // Normal, on if NUM lock is ON if (led_state.num_lock) { // Normal, on if NUM lock is ON
rgb_matrix_set_color(LED_N, RGB_ORANGE2); rgb_matrix_set_color(LED_N, RGB_ORANGE2);
} }
#endif // INVERT_NUMLOCK_INDICATOR #endif // INVERT_NUMLOCK_INDICATOR
@ -432,11 +434,11 @@ bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
// Numpad & Mouse Keys overlay RGB // Numpad & Mouse Keys overlay RGB
case _NUMPADMOUSE: case _NUMPADMOUSE:
#ifdef INVERT_NUMLOCK_INDICATOR #ifdef INVERT_NUMLOCK_INDICATOR
if (!IS_HOST_LED_ON(USB_LED_NUM_LOCK)) { // on if NUM lock is OFF to bring attention to overlay numpad not functional when enabled if (!led_state.num_lock) { // on if NUM lock is OFF to bring attention to overlay numpad not functional when enabled
rgb_matrix_set_color(LED_N, RGB_ORANGE2); rgb_matrix_set_color(LED_N, RGB_ORANGE2);
} }
#else #else
if (IS_HOST_LED_ON(USB_LED_NUM_LOCK)) { // Normal, on if NUM lock is ON if (led_state.num_lock) { // Normal, on if NUM lock is ON
rgb_matrix_set_color(LED_N, RGB_ORANGE2); rgb_matrix_set_color(LED_N, RGB_ORANGE2);
} }
#endif // INVERT_NUMLOCK_INDICATOR #endif // INVERT_NUMLOCK_INDICATOR

View File

@ -120,25 +120,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
#ifdef RGB_MATRIX_ENABLE #ifdef RGB_MATRIX_ENABLE
// Capslock, Scroll lock and Numlock indicator on Left side lights. // Capslock, Scroll lock and Numlock indicator on Left side lights.
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
led_t led_state = host_keyboard_led_state();
if (get_rgb_nightmode()) rgb_matrix_set_color_all(RGB_OFF); if (get_rgb_nightmode()) rgb_matrix_set_color_all(RGB_OFF);
if (IS_HOST_LED_ON(USB_LED_SCROLL_LOCK)) { if (led_state.scroll_lock) {
rgb_matrix_set_color(LED_L1, RGB_GREEN); rgb_matrix_set_color(LED_L1, RGB_GREEN);
rgb_matrix_set_color(LED_L2, RGB_GREEN); rgb_matrix_set_color(LED_L2, RGB_GREEN);
} }
#ifdef INVERT_NUMLOCK_INDICATOR #ifdef INVERT_NUMLOCK_INDICATOR
if (!IS_HOST_LED_ON(USB_LED_NUM_LOCK)) { // on if NUM lock is OFF if (!led_state.num_lock) { // on if NUM lock is OFF
rgb_matrix_set_color(LED_L3, RGB_MAGENTA); rgb_matrix_set_color(LED_L3, RGB_MAGENTA);
rgb_matrix_set_color(LED_L4, RGB_MAGENTA); rgb_matrix_set_color(LED_L4, RGB_MAGENTA);
} }
#else #else
if (IS_HOST_LED_ON(USB_LED_NUM_LOCK)) { // Normal, on if NUM lock is ON if (led_state.num_lock) { // Normal, on if NUM lock is ON
rgb_matrix_set_color(LED_L3, RGB_MAGENTA); rgb_matrix_set_color(LED_L3, RGB_MAGENTA);
rgb_matrix_set_color(LED_L4, RGB_MAGENTA); rgb_matrix_set_color(LED_L4, RGB_MAGENTA);
} }
#endif // INVERT_NUMLOCK_INDICATOR #endif // INVERT_NUMLOCK_INDICATOR
if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) { if (led_state.caps_lock) {
rgb_matrix_set_color(LED_L5, RGB_RED); rgb_matrix_set_color(LED_L5, RGB_RED);
rgb_matrix_set_color(LED_L6, RGB_RED); rgb_matrix_set_color(LED_L6, RGB_RED);
rgb_matrix_set_color(LED_L7, RGB_RED); rgb_matrix_set_color(LED_L7, RGB_RED);

View File

@ -82,7 +82,7 @@ static void set_rgb_side_leds(void) {
bool rgb_matrix_indicators_user(void) { bool rgb_matrix_indicators_user(void) {
rgb_matrix_set_color_all(0x0, 0x0, 0x0); rgb_matrix_set_color_all(0x0, 0x0, 0x0);
if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) { if (host_keyboard_led_state().caps_lock) {
rgb_matrix_set_color(3, RGB_WHITE); // CAPS rgb_matrix_set_color(3, RGB_WHITE); // CAPS
} }
set_rgb_side_leds(); set_rgb_side_leds();

View File

@ -427,7 +427,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
break; break;
} }
if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) { led_t led_state = host_keyboard_led_state();
if (led_state.caps_lock) {
if (!caps_active) { if (!caps_active) {
caps_active = true; caps_active = true;
caps_flash_on = true; caps_flash_on = true;
@ -453,7 +455,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
} else { } else {
caps_active = false; caps_active = false;
} }
if (IS_HOST_LED_ON(USB_LED_SCROLL_LOCK)) { if (led_state.scroll_lock) {
rgb_matrix_set_color(LED_F10, RGB_WHITE); rgb_matrix_set_color(LED_F10, RGB_WHITE);
} }
if (keymap_config.no_gui) { if (keymap_config.no_gui) {

View File

@ -246,8 +246,10 @@ void hurt_paddle(void) {
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
if (get_rgb_nightmode()) rgb_matrix_set_color_all(RGB_OFF); if (get_rgb_nightmode()) rgb_matrix_set_color_all(RGB_OFF);
led_t led_state = host_keyboard_led_state();
// Scroll Lock RGB setup // Scroll Lock RGB setup
if (IS_HOST_LED_ON(USB_LED_SCROLL_LOCK)) { if (led_state.scroll_lock) {
rgb_matrix_set_color(LED_L3, RGB_RED); rgb_matrix_set_color(LED_L3, RGB_RED);
rgb_matrix_set_color(LED_L4, RGB_RED); rgb_matrix_set_color(LED_L4, RGB_RED);
rgb_matrix_set_color(LED_TAB, RGB_RED); rgb_matrix_set_color(LED_TAB, RGB_RED);
@ -257,7 +259,7 @@ bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
/* /*
// System NumLock warning indicator RGB setup // System NumLock warning indicator RGB setup
#ifdef INVERT_NUMLOCK_INDICATOR #ifdef INVERT_NUMLOCK_INDICATOR
if (!IS_HOST_LED_ON(USB_LED_NUM_LOCK)) { // on if NUM lock is OFF to bring attention to overlay numpad not functional when enabled if (!led_state.num_lock) { // on if NUM lock is OFF to bring attention to overlay numpad not functional when enabled
rgb_matrix_set_color(LED_GRV, RGB_ORANGE2); rgb_matrix_set_color(LED_GRV, RGB_ORANGE2);
rgb_matrix_set_color(LED_L1, RGB_ORANGE2); rgb_matrix_set_color(LED_L1, RGB_ORANGE2);
rgb_matrix_set_color(LED_L2, RGB_ORANGE2); rgb_matrix_set_color(LED_L2, RGB_ORANGE2);
@ -265,7 +267,7 @@ bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
rgb_matrix_set_color(LED_FN, RGB_ORANGE2); rgb_matrix_set_color(LED_FN, RGB_ORANGE2);
} }
#else #else
if (IS_HOST_LED_ON(USB_LED_NUM_LOCK)) { // Normal, on if NUM lock is ON if (led_state.num_lock) { // Normal, on if NUM lock is ON
rgb_matrix_set_color(LED_GRV, RGB_ORANGE2); rgb_matrix_set_color(LED_GRV, RGB_ORANGE2);
rgb_matrix_set_color(LED_L1, RGB_ORANGE2); rgb_matrix_set_color(LED_L1, RGB_ORANGE2);
rgb_matrix_set_color(LED_L2, RGB_ORANGE2); rgb_matrix_set_color(LED_L2, RGB_ORANGE2);
@ -276,7 +278,7 @@ bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
*/ */
// CapsLock RGB setup // CapsLock RGB setup
if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) { if (led_state.caps_lock) {
if (user_config.rgb_hilite_caps) { if (user_config.rgb_hilite_caps) {
if (user_config.rgb_english_caps) { if (user_config.rgb_english_caps) {
for (uint8_t i = 0; i < ARRAYSIZE(LED_LIST_LETTERS); i++) { for (uint8_t i = 0; i < ARRAYSIZE(LED_LIST_LETTERS); i++) {
@ -368,11 +370,11 @@ bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
// System NumLock warning indicator RGB setup // System NumLock warning indicator RGB setup
#ifdef INVERT_NUMLOCK_INDICATOR #ifdef INVERT_NUMLOCK_INDICATOR
if (!IS_HOST_LED_ON(USB_LED_NUM_LOCK)) { // on if NUM lock is OFF to bring attention to overlay numpad not functional when enabled if (!led_state.num_lock) { // on if NUM lock is OFF to bring attention to overlay numpad not functional when enabled
rgb_matrix_set_color(LED_N, RGB_ORANGE2); rgb_matrix_set_color(LED_N, RGB_ORANGE2);
} }
#else #else
if (IS_HOST_LED_ON(USB_LED_NUM_LOCK)) { // Normal, on if NUM lock is ON if (led_state.num_lock) { // Normal, on if NUM lock is ON
rgb_matrix_set_color(LED_N, RGB_ORANGE2); rgb_matrix_set_color(LED_N, RGB_ORANGE2);
} }
#endif // INVERT_NUMLOCK_INDICATOR #endif // INVERT_NUMLOCK_INDICATOR
@ -445,11 +447,11 @@ bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
// Numpad & Mouse Keys overlay RGB // Numpad & Mouse Keys overlay RGB
case _NUMPADMOUSE: case _NUMPADMOUSE:
#ifdef INVERT_NUMLOCK_INDICATOR #ifdef INVERT_NUMLOCK_INDICATOR
if (!IS_HOST_LED_ON(USB_LED_NUM_LOCK)) { // on if NUM lock is OFF to bring attention to overlay numpad not functional when enabled if (!led_state.num_lock) { // on if NUM lock is OFF to bring attention to overlay numpad not functional when enabled
rgb_matrix_set_color(LED_N, RGB_ORANGE2); rgb_matrix_set_color(LED_N, RGB_ORANGE2);
} }
#else #else
if (IS_HOST_LED_ON(USB_LED_NUM_LOCK)) { // Normal, on if NUM lock is ON if (led_state.num_lock) { // Normal, on if NUM lock is ON
rgb_matrix_set_color(LED_N, RGB_ORANGE2); rgb_matrix_set_color(LED_N, RGB_ORANGE2);
} }
#endif // INVERT_NUMLOCK_INDICATOR #endif // INVERT_NUMLOCK_INDICATOR

View File

@ -110,25 +110,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
#ifdef RGB_MATRIX_ENABLE #ifdef RGB_MATRIX_ENABLE
// Capslock, Scroll lock and Numlock indicator on Left side lights. // Capslock, Scroll lock and Numlock indicator on Left side lights.
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
led_t led_state = host_keyboard_led_state();
if (get_rgb_nightmode()) rgb_matrix_set_color_all(RGB_OFF); if (get_rgb_nightmode()) rgb_matrix_set_color_all(RGB_OFF);
if (IS_HOST_LED_ON(USB_LED_SCROLL_LOCK)) { if (led_state.scroll_lock) {
rgb_matrix_set_color(LED_L1, RGB_GREEN); rgb_matrix_set_color(LED_L1, RGB_GREEN);
rgb_matrix_set_color(LED_L2, RGB_GREEN); rgb_matrix_set_color(LED_L2, RGB_GREEN);
} }
#ifdef INVERT_NUMLOCK_INDICATOR #ifdef INVERT_NUMLOCK_INDICATOR
if (!IS_HOST_LED_ON(USB_LED_NUM_LOCK)) { // on if NUM lock is OFF if (!led_state.num_lock) { // on if NUM lock is OFF
rgb_matrix_set_color(LED_L3, RGB_MAGENTA); rgb_matrix_set_color(LED_L3, RGB_MAGENTA);
rgb_matrix_set_color(LED_L4, RGB_MAGENTA); rgb_matrix_set_color(LED_L4, RGB_MAGENTA);
} }
#else #else
if (IS_HOST_LED_ON(USB_LED_NUM_LOCK)) { // Normal, on if NUM lock is ON if (led_state.num_lock) { // Normal, on if NUM lock is ON
rgb_matrix_set_color(LED_L3, RGB_MAGENTA); rgb_matrix_set_color(LED_L3, RGB_MAGENTA);
rgb_matrix_set_color(LED_L4, RGB_MAGENTA); rgb_matrix_set_color(LED_L4, RGB_MAGENTA);
} }
#endif // INVERT_NUMLOCK_INDICATOR #endif // INVERT_NUMLOCK_INDICATOR
if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) { if (led_state.caps_lock) {
rgb_matrix_set_color(LED_L5, RGB_RED); rgb_matrix_set_color(LED_L5, RGB_RED);
rgb_matrix_set_color(LED_L6, RGB_RED); rgb_matrix_set_color(LED_L6, RGB_RED);
rgb_matrix_set_color(LED_L7, RGB_RED); rgb_matrix_set_color(LED_L7, RGB_RED);

View File

@ -51,7 +51,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
}; };
bool rgb_matrix_indicators_user(void) { bool rgb_matrix_indicators_user(void) {
if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) if (host_keyboard_led_state().caps_lock)
{ {
rgb_matrix_set_color(22, 255, 255, 255); rgb_matrix_set_color(22, 255, 255, 255);
} }

View File

@ -51,7 +51,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
}; };
bool rgb_matrix_indicators_user(void) { bool rgb_matrix_indicators_user(void) {
if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) { if (host_keyboard_led_state().caps_lock) {
rgb_matrix_set_color(22, 255, 255, 255); rgb_matrix_set_color(22, 255, 255, 255);
} }
if (IS_LAYER_ON(_L1)) { if (IS_LAYER_ON(_L1)) {

View File

@ -158,7 +158,7 @@ layer_state_t default_layer_state_set_user(layer_state_t state) {
} }
bool led_update_user(led_t led_state) { bool led_update_user(led_t led_state) {
rgblight_set_layer_state(3, IS_HOST_LED_ON(USB_LED_CAPS_LOCK)); rgblight_set_layer_state(3, led_state.caps_lock);
return true; return true;
} }

View File

@ -53,9 +53,10 @@ bool oled_task_user(void) {
} }
// Host Keyboard LED Status // Host Keyboard LED Status
oled_write_P(IS_HOST_LED_ON(USB_LED_NUM_LOCK) ? PSTR("NUMLCK ") : PSTR(" "), false); led_t led_state = host_keyboard_led_state();
oled_write_P(IS_HOST_LED_ON(USB_LED_CAPS_LOCK) ? PSTR("CAPLCK ") : PSTR(" "), false); oled_write_P(led_state.num_lock ? PSTR("NUMLCK ") : PSTR(" "), false);
oled_write_P(IS_HOST_LED_ON(USB_LED_SCROLL_LOCK) ? PSTR("SCRLCK ") : PSTR(" "), false); oled_write_P(led_state.caps_lock ? PSTR("CAPLCK ") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCRLCK ") : PSTR(" "), false);
return false; return false;
} }
#endif #endif

View File

@ -27,9 +27,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
#ifdef OLED_ENABLE #ifdef OLED_ENABLE
bool oled_task_user(void) { bool oled_task_user(void) {
// Host Keyboard LED Status // Host Keyboard LED Status
oled_write_P(IS_HOST_LED_ON(USB_LED_NUM_LOCK) ? PSTR("NUMLCK ") : PSTR(" "), false); led_t led_state = host_keyboard_led_state();
oled_write_P(IS_HOST_LED_ON(USB_LED_CAPS_LOCK) ? PSTR("CAPLCK ") : PSTR(" "), false); oled_write_P(led_state.num_lock ? PSTR("NUMLCK ") : PSTR(" "), false);
oled_write_P(IS_HOST_LED_ON(USB_LED_SCROLL_LOCK) ? PSTR("SCRLCK ") : PSTR(" "), false); oled_write_P(led_state.caps_lock ? PSTR("CAPLCK ") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCRLCK ") : PSTR(" "), false);
return false; return false;
} }
#endif #endif

View File

@ -188,9 +188,10 @@ bool oled_task_user(void) {
} }
// Host Keyboard LED Status // Host Keyboard LED Status
oled_write_P(IS_HOST_LED_ON(USB_LED_NUM_LOCK) ? PSTR("NUMLCK ") : PSTR(" "), false); led_t led_state = host_keyboard_led_state();
oled_write_P(IS_HOST_LED_ON(USB_LED_CAPS_LOCK) ? PSTR("CAPLCK ") : PSTR(" "), false); oled_write_P(led_state.num_lock ? PSTR("NUMLCK ") : PSTR(" "), false);
oled_write_P(IS_HOST_LED_ON(USB_LED_SCROLL_LOCK) ? PSTR("SCRLCK ") : PSTR(" "), false); oled_write_P(led_state.caps_lock ? PSTR("CAPLCK ") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCRLCK ") : PSTR(" "), false);
return false; return false;
} }
#endif #endif

View File

@ -77,9 +77,10 @@ bool oled_task_user(void) {
} }
// Host Keyboard LED Status // Host Keyboard LED Status
oled_write_P(IS_HOST_LED_ON(USB_LED_NUM_LOCK) ? PSTR("NUMLCK ") : PSTR(" "), false); led_t led_state = host_keyboard_led_state();
oled_write_P(IS_HOST_LED_ON(USB_LED_CAPS_LOCK) ? PSTR("CAPLCK ") : PSTR(" "), false); oled_write_P(led_state.num_lock ? PSTR("NUMLCK ") : PSTR(" "), false);
oled_write_P(IS_HOST_LED_ON(USB_LED_SCROLL_LOCK) ? PSTR("SCRLCK ") : PSTR(" "), false); oled_write_P(led_state.caps_lock ? PSTR("CAPLCK ") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCRLCK ") : PSTR(" "), false);
return false; return false;
} }

View File

@ -77,9 +77,10 @@ bool oled_task_user(void) {
} }
// Host Keyboard LED Status // Host Keyboard LED Status
oled_write_P(IS_HOST_LED_ON(USB_LED_NUM_LOCK) ? PSTR("NUMLCK ") : PSTR(" "), false); led_t led_state = host_keyboard_led_state();
oled_write_P(IS_HOST_LED_ON(USB_LED_CAPS_LOCK) ? PSTR("CAPLCK ") : PSTR(" "), false); oled_write_P(led_state.num_lock ? PSTR("NUMLCK ") : PSTR(" "), false);
oled_write_P(IS_HOST_LED_ON(USB_LED_SCROLL_LOCK) ? PSTR("SCRLCK ") : PSTR(" "), false); oled_write_P(led_state.caps_lock ? PSTR("CAPLCK ") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCRLCK ") : PSTR(" "), false);
return false; return false;
} }

View File

@ -54,7 +54,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
bool rgb_matrix_indicators_user(void) { bool rgb_matrix_indicators_user(void) {
if (rgb_matrix_config.enable) { if (rgb_matrix_config.enable) {
HSV hsv = rgb_matrix_config.hsv; HSV hsv = rgb_matrix_config.hsv;
if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) { if (host_keyboard_led_state().caps_lock) {
HSV hsv_inv_hue = {hsv.h + 128, hsv.s, hsv.v}; HSV hsv_inv_hue = {hsv.h + 128, hsv.s, hsv.v};
set_hsv_at(hsv_inv_hue, 30); set_hsv_at(hsv_inv_hue, 30);
} }

View File

@ -46,26 +46,27 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
#ifdef RGB_MATRIX_ENABLE #ifdef RGB_MATRIX_ENABLE
// Capslock, Scroll lock and Numlock indicator // Capslock, Scroll lock and Numlock indicator
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
led_t led_state = host_keyboard_led_state();
if (get_rgb_nightmode()) rgb_matrix_set_color_all(RGB_OFF); if (get_rgb_nightmode()) rgb_matrix_set_color_all(RGB_OFF);
if (IS_HOST_LED_ON(USB_LED_SCROLL_LOCK)) { if (led_state.scroll_lock) {
rgb_matrix_set_color(LED_I, RGB_GREEN); rgb_matrix_set_color(LED_I, RGB_GREEN);
} }
#ifdef INVERT_NUMLOCK_INDICATOR #ifdef INVERT_NUMLOCK_INDICATOR
if (!IS_HOST_LED_ON(USB_LED_NUM_LOCK)) { // on if NUM lock is OFF if (!led_state.num_lock) { // on if NUM lock is OFF
rgb_matrix_set_color(LED_B, RGB_GREEN); rgb_matrix_set_color(LED_B, RGB_GREEN);
rgb_matrix_set_color(LED_N, RGB_GREEN); rgb_matrix_set_color(LED_N, RGB_GREEN);
rgb_matrix_set_color(LED_M, RGB_GREEN); rgb_matrix_set_color(LED_M, RGB_GREEN);
} }
#else #else
if (IS_HOST_LED_ON(USB_LED_NUM_LOCK)) { // Normal, on if NUM lock is ON if (led_state.num_lock) { // Normal, on if NUM lock is ON
rgb_matrix_set_color(LED_B, RGB_GREEN); rgb_matrix_set_color(LED_B, RGB_GREEN);
rgb_matrix_set_color(LED_N, RGB_GREEN); rgb_matrix_set_color(LED_N, RGB_GREEN);
rgb_matrix_set_color(LED_M, RGB_GREEN); rgb_matrix_set_color(LED_M, RGB_GREEN);
} }
#endif // INVERT_NUMLOCK_INDICATOR #endif // INVERT_NUMLOCK_INDICATOR
if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) { if (led_state.caps_lock) {
rgb_matrix_set_color(LED_CAPS, RGB_RED); rgb_matrix_set_color(LED_CAPS, RGB_RED);
rgb_matrix_set_color(LED_Q, RGB_RED); rgb_matrix_set_color(LED_Q, RGB_RED);
rgb_matrix_set_color(LED_A, RGB_RED); rgb_matrix_set_color(LED_A, RGB_RED);

View File

@ -35,7 +35,7 @@ static bool last_checked_layer;
static void check_light_layer(layer_state_t state) { static void check_light_layer(layer_state_t state) {
if (IS_LAYER_ON_STATE(state, L_FN)) { if (IS_LAYER_ON_STATE(state, L_FN)) {
fn_light(); fn_light();
} else if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) { } else if (host_keyboard_led_state().caps_lock) {
caps_light(); caps_light();
} else { } else {
restore_light(); restore_light();

View File

@ -44,7 +44,7 @@ bool rgb_matrix_indicators_kb(void) {
if (!rgb_matrix_indicators_user()) { if (!rgb_matrix_indicators_user()) {
return false; return false;
} }
if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) if (host_keyboard_led_state().caps_lock)
{ {
rgb_matrix_set_color(59, 0xFF, 0xFF, 0xFF); rgb_matrix_set_color(59, 0xFF, 0xFF, 0xFF);
} }

View File

@ -75,7 +75,7 @@ void update_led(void) {
rgblight_sethsv_noeeprom(HSV_MAGENTA); rgblight_sethsv_noeeprom(HSV_MAGENTA);
break; break;
} }
if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) { if (host_keyboard_led_state().caps_lock) {
rgblight_sethsv_range(HSV_WHITE,0,4); rgblight_sethsv_range(HSV_WHITE,0,4);
rgblight_sethsv_range(HSV_WHITE,12,16); rgblight_sethsv_range(HSV_WHITE,12,16);
} }

View File

@ -7,10 +7,11 @@ char host_led_state_str[24];
const char *read_host_led_state(void) const char *read_host_led_state(void)
{ {
led_t led_state = host_keyboard_led_state();
snprintf(host_led_state_str, sizeof(host_led_state_str), "NL:%s CL:%s SL:%s", snprintf(host_led_state_str, sizeof(host_led_state_str), "NL:%s CL:%s SL:%s",
(IS_HOST_LED_ON(USB_LED_NUM_LOCK)) ? "on" : "- ", led_state.num_lock ? "on" : "- ",
(IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) ? "on" : "- ", led_state.caps_lock ? "on" : "- ",
(IS_HOST_LED_ON(USB_LED_SCROLL_LOCK)) ? "on" : "- "); led_state.scroll_lock ? "on" : "- ");
return host_led_state_str; return host_led_state_str;
} }

View File

@ -108,8 +108,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
} }
bool oled_task_user(void) { bool oled_task_user(void) {
led_t led_state = host_keyboard_led_state();
if ( IS_HOST_LED_OFF(USB_LED_NUM_LOCK) && IS_HOST_LED_OFF(USB_LED_CAPS_LOCK) && selected_layer == 0 && get_highest_layer(layer_state) == 0 ) { if ( !led_state.num_lock && !led_state.caps_lock && selected_layer == 0 && get_highest_layer(layer_state) == 0 ) {
render_name(); render_name();
clear_screen = true; clear_screen = true;
} else { } else {

View File

@ -188,8 +188,8 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
} }
bool oled_task_user(void) { bool oled_task_user(void) {
led_t led_state = host_keyboard_led_state();
if ( IS_HOST_LED_OFF(USB_LED_NUM_LOCK) && IS_HOST_LED_OFF(USB_LED_CAPS_LOCK) && get_selected_layer() == 0 && get_highest_layer(layer_state) == 0 ) { if ( !led_state.num_lock && !led_state.caps_lock && get_selected_layer() == 0 && get_highest_layer(layer_state) == 0 ) {
render_name(); render_name();
clear_screen = true; clear_screen = true;
} else { } else {

View File

@ -126,7 +126,8 @@ bool oled_task_kb(void) {
if(!oled_task_user()) { if(!oled_task_user()) {
return false; return false;
} }
if ( IS_HOST_LED_OFF(USB_LED_NUM_LOCK) && IS_HOST_LED_OFF(USB_LED_CAPS_LOCK) && IS_HOST_LED_OFF(USB_LED_SCROLL_LOCK) && get_highest_layer(layer_state) == 0 ) { led_t led_state = host_keyboard_led_state();
if ( !led_state.num_lock && !led_state.caps_lock && !led_state.scroll_lock && get_highest_layer(layer_state) == 0 ) {
if (clear_screen_art == true) { if (clear_screen_art == true) {
oled_clear(); oled_clear();
oled_render(); oled_render();

View File

@ -183,7 +183,7 @@ static void self_testing(void)
if (rgb_state.duration) { if (rgb_state.duration) {
rgb_state.duration--; rgb_state.duration--;
} else { } else {
if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) { if (host_keyboard_led_state().caps_lock) {
rgb_state.state = CAPS_ALERT; rgb_state.state = CAPS_ALERT;
} else { } else {
rgb_state.state = NORMAL; rgb_state.state = NORMAL;

View File

@ -187,7 +187,7 @@ static void self_testing(void)
if (rgb_state.duration) { if (rgb_state.duration) {
rgb_state.duration--; rgb_state.duration--;
} else { } else {
if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) { if (host_keyboard_led_state().caps_lock) {
rgb_state.state = CAPS_ALERT; rgb_state.state = CAPS_ALERT;
} else { } else {
rgb_state.state = NORMAL; rgb_state.state = NORMAL;

View File

@ -107,7 +107,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
#ifdef RGB_MATRIX_ENABLE #ifdef RGB_MATRIX_ENABLE
bool rgb_matrix_indicators_user(void) { bool rgb_matrix_indicators_user(void) {
if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) { if (host_keyboard_led_state().caps_lock) {
rgb_matrix_set_color(USB_LED_CAPS_LOCK_SCANCODE, RGB_GREEN); rgb_matrix_set_color(USB_LED_CAPS_LOCK_SCANCODE, RGB_GREEN);
} else if (!HAS_ANY_FLAGS(rgb_matrix_get_flags(), LED_FLAG_KEYS)){ } else if (!HAS_ANY_FLAGS(rgb_matrix_get_flags(), LED_FLAG_KEYS)){
rgb_matrix_set_color(USB_LED_CAPS_LOCK_SCANCODE, 0, 0, 0); rgb_matrix_set_color(USB_LED_CAPS_LOCK_SCANCODE, 0, 0, 0);

View File

@ -95,7 +95,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
#ifdef RGB_MATRIX_ENABLE #ifdef RGB_MATRIX_ENABLE
bool rgb_matrix_indicators_user(void) { bool rgb_matrix_indicators_user(void) {
if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) { if (host_keyboard_led_state().caps_lock) {
rgb_matrix_set_color(USB_LED_CAPS_LOCK_SCANCODE, RGB_GREEN); rgb_matrix_set_color(USB_LED_CAPS_LOCK_SCANCODE, RGB_GREEN);
} else if (!HAS_ANY_FLAGS(rgb_matrix_get_flags(), LED_FLAG_KEYS)){ } else if (!HAS_ANY_FLAGS(rgb_matrix_get_flags(), LED_FLAG_KEYS)){
rgb_matrix_set_color(USB_LED_CAPS_LOCK_SCANCODE, 0, 0, 0); rgb_matrix_set_color(USB_LED_CAPS_LOCK_SCANCODE, 0, 0, 0);

View File

@ -26,9 +26,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define IS_LED_ON(leds, led_name) ((leds) & (1 << (led_name))) #define IS_LED_ON(leds, led_name) ((leds) & (1 << (led_name)))
#define IS_LED_OFF(leds, led_name) (~(leds) & (1 << (led_name))) #define IS_LED_OFF(leds, led_name) (~(leds) & (1 << (led_name)))
#define IS_HOST_LED_ON(led_name) IS_LED_ON(host_keyboard_leds(), led_name)
#define IS_HOST_LED_OFF(led_name) IS_LED_OFF(host_keyboard_leds(), led_name)
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View File

@ -592,7 +592,7 @@ bool caps_word_press_user(uint16_t keycode) {
// Turn on/off NUM LOCK if current state is different // Turn on/off NUM LOCK if current state is different
void activate_numlock(bool turn_on) { void activate_numlock(bool turn_on) {
if (IS_HOST_LED_ON(USB_LED_NUM_LOCK) != turn_on) { if (host_keyboard_led_state().num_lock != turn_on) {
tap_code(KC_NUM_LOCK); tap_code(KC_NUM_LOCK);
} }
} }

View File

@ -212,7 +212,7 @@ uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
// Turn on/off NUM LOCK if current state is different // Turn on/off NUM LOCK if current state is different
void activate_numlock(bool turn_on) { void activate_numlock(bool turn_on) {
if (IS_HOST_LED_ON(USB_LED_NUM_LOCK) != turn_on) { if (host_keyboard_led_state().num_lock != turn_on) {
tap_code(KC_NUM_LOCK); tap_code(KC_NUM_LOCK);
} }
} }

View File

@ -47,7 +47,7 @@ layer_state_t layer_state_set_user(layer_state_t state) {
#ifdef LAYER_NUMPAD #ifdef LAYER_NUMPAD
bool numpad = IS_LAYER_ON_STATE(state, L_NUMPAD); bool numpad = IS_LAYER_ON_STATE(state, L_NUMPAD);
bool num_lock = IS_HOST_LED_ON(USB_LED_NUM_LOCK); bool num_lock = host_keyboard_led_state().num_lock;
if (numpad != num_lock) { if (numpad != num_lock) {
tap_code(KC_NUM_LOCK); // Toggle Num Lock to match Numpad layer state tap_code(KC_NUM_LOCK); // Toggle Num Lock to match Numpad layer state
} }

View File

@ -9,7 +9,7 @@ static uint16_t current_state = 0;
void set_lights_default(void) { void set_lights_default(void) {
#ifdef RGBLIGHT_ENABLE #ifdef RGBLIGHT_ENABLE
if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) { if (host_keyboard_led_state().caps_lock) {
rgblight_sethsv_noeeprom(HSV_CAPS); rgblight_sethsv_noeeprom(HSV_CAPS);
} else { } else {
if (current_state == _BASE_MAC) { if (current_state == _BASE_MAC) {

View File

@ -257,7 +257,7 @@ void render_status_main(void) {
// Host Keyboard LED Status // Host Keyboard LED Status
oled_write_ln_P(IS_HOST_LED_ON(USB_LED_CAPS_LOCK) ? PSTR("Caps Lock\n") : PSTR(" \n"), false); oled_write_ln_P(host_keyboard_led_state().caps_lock ? PSTR("Caps Lock\n") : PSTR(" \n"), false);
} }
__attribute__ ((weak)) __attribute__ ((weak))
void oled_task_keymap(void) {} void oled_task_keymap(void) {}