1
0
Fork 0

Get rid of USB_LED_SCROLL_LOCK (#21405)

This commit is contained in:
Ryan 2023-07-03 04:24:22 +10:00 committed by GitHub
parent 9dbad1fa5c
commit 7ff80a57cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
62 changed files with 399 additions and 479 deletions

View file

@ -86,12 +86,12 @@ void render_layer_state(void) {
oled_write_P(PSTR(" Mods"), layer_state_is(_MODS));
}
void render_keylock_status(uint8_t led_usb_state) {
void render_keylock_status(led_t led_state) {
oled_write_P(PSTR("Lock:"), false);
oled_write_P(PSTR(" "), false);
oled_write_P(PSTR("N"), led_usb_state & (1 << USB_LED_NUM_LOCK));
oled_write_P(PSTR("C"), led_usb_state & (1 << USB_LED_CAPS_LOCK));
oled_write_ln_P(PSTR("S"), led_usb_state & (1 << USB_LED_SCROLL_LOCK));
oled_write_P(PSTR("N"), led_state.num_lock);
oled_write_P(PSTR("C"), led_state.caps_lock);
oled_write_ln_P(PSTR("S"), led_state.scroll_lock);
}
void render_mod_status(uint8_t modifiers) {
@ -129,7 +129,7 @@ void render_user_status(void) {
void render_status_main(void) {
/* Show Keyboard Layout */
render_default_layer_state();
render_keylock_status(host_keyboard_leds());
render_keylock_status(host_keyboard_led_state());
render_bootmagic_status();
render_user_status();

View file

@ -32,11 +32,11 @@ void oled_render_locale(void) {
}
}
void oled_render_keylock_status(uint8_t led_usb_state) {
void oled_render_keylock_status(led_t led_state) {
oled_write_P(PSTR(" Lock:"), false);
oled_write_P(PSTR("N"), led_usb_state & (1 << USB_LED_NUM_LOCK));
oled_write_P(PSTR("C"), led_usb_state & (1 << USB_LED_CAPS_LOCK));
oled_write_P(PSTR("S"), led_usb_state & (1 << USB_LED_SCROLL_LOCK));
oled_write_P(PSTR("N"), led_state.num_lock);
oled_write_P(PSTR("C"), led_state.caps_lock);
oled_write_P(PSTR("S"), led_state.scroll_lock);
}
void oled_render_mod_status(uint8_t modifiers) {
@ -49,7 +49,7 @@ void oled_render_mod_status(uint8_t modifiers) {
void oled_render_mod_lock_status(void){
oled_render_mod_status(get_mods() | get_oneshot_mods());
oled_render_keylock_status(host_keyboard_leds());
oled_render_keylock_status(host_keyboard_led_state());
}
@ -187,6 +187,3 @@ bool oled_task_user(void) {
}
#endif
/* oled_render_keylock_status(host_keyboard_leds()); */
/* oled_render_mod_status(get_mods() | get_oneshot_mods()); */

View file

@ -73,9 +73,9 @@ const rgblight_segment_t *const PROGMEM _rgb_layers[] = {
[LAYER_OFFSET + _NUMPAD] = _layer1_layer,
[LAYER_OFFSET + _FN] = _layer2_layer,
[LOCK_OFFSET + USB_LED_NUM_LOCK] = _numlock_layer,
[LOCK_OFFSET + USB_LED_CAPS_LOCK] = _capslock_layer,
[LOCK_OFFSET + USB_LED_SCROLL_LOCK] = _scrolllock_layer,
[LOCK_OFFSET + 0] = _numlock_layer,
[LOCK_OFFSET + 1] = _capslock_layer,
[LOCK_OFFSET + 2] = _scrolllock_layer,
[MISC_OFFSET + 0] = _gflock_layer,
[MISC_OFFSET + 1] = _glyphreplace_layer,
@ -374,9 +374,9 @@ layer_state_t layer_state_set_user_rgb(layer_state_t state) {
}
bool led_update_user_rgb(led_t led_state) {
rgblight_set_layer_state(LOCK_OFFSET + USB_LED_NUM_LOCK, led_state.num_lock);
rgblight_set_layer_state(LOCK_OFFSET + USB_LED_CAPS_LOCK, led_state.caps_lock);
rgblight_set_layer_state(LOCK_OFFSET + USB_LED_SCROLL_LOCK, led_state.scroll_lock);
rgblight_set_layer_state(LOCK_OFFSET + 0, led_state.num_lock);
rgblight_set_layer_state(LOCK_OFFSET + 1, led_state.caps_lock);
rgblight_set_layer_state(LOCK_OFFSET + 2, led_state.scroll_lock);
return true;
}

View file

@ -71,15 +71,15 @@ static void render_layer(void)
static void render_keyboard_leds(void)
{
// Host Keyboard LED Status
uint8_t led_state = host_keyboard_leds();
led_t led_state = host_keyboard_led_state();
#ifdef OLED_90ROTATION
oled_write_P(IS_LED_ON(led_state, USB_LED_NUM_LOCK) ? PSTR("NUMLK") : PSTR(" "), false);
oled_write_P(IS_LED_ON(led_state, USB_LED_CAPS_LOCK) ? PSTR("CAPLK") : PSTR(" "), false);
oled_write_P(IS_LED_ON(led_state, USB_LED_SCROLL_LOCK) ? PSTR("SCRLK") : PSTR(" "), false);
oled_write_P(led_state.num_lock ? PSTR("NUMLK") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CAPLK") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCRLK") : PSTR(" "), false);
#else
oled_write_P(IS_LED_ON(led_state, USB_LED_NUM_LOCK) ? PSTR("NUM ") : PSTR(" "), false);
oled_write_P(IS_LED_ON(led_state, USB_LED_CAPS_LOCK) ? PSTR("CAPS ") : PSTR(" "), false);
oled_write_P(IS_LED_ON(led_state, USB_LED_SCROLL_LOCK) ? PSTR("SCRL") : PSTR(" "), false);
oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CAPS ") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCRL") : PSTR(" "), false);
#endif
}

View file

@ -69,8 +69,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return process_record_keymap(keycode, record);
}
void led_set_user(uint8_t usb_led) {
if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
bool led_update_user(led_t led_state) {
if (led_state.caps_lock) {
rbw_led_keys[RBW_LCAP].status = ENABLED;
rbw_led_keys[RBW_RCAP].status = ENABLED;
} else {
@ -78,11 +78,12 @@ void led_set_user(uint8_t usb_led) {
rbw_led_keys[RBW_RCAP].status = DISABLED;
}
if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
if (led_state.scroll_lock) {
rbw_led_keys[RBW_SCRL].status = ENABLED;
} else {
rbw_led_keys[RBW_SCRL].status = DISABLED;
}
led_set_keymap(usb_led);
led_set_keymap(led_state.raw);
return false;
}