diff --git a/keyboards/bpiphany/kitten_paw/keymaps/ickerwx/keymap.c b/keyboards/bpiphany/kitten_paw/keymaps/ickerwx/keymap.c index c0439912ffa..f0c75284f74 100644 --- a/keyboards/bpiphany/kitten_paw/keymaps/ickerwx/keymap.c +++ b/keyboards/bpiphany/kitten_paw/keymaps/ickerwx/keymap.c @@ -3,8 +3,6 @@ #define MEDAPP LT(MEDIA, KC_APP) -uint8_t current_layer_global = 255; - enum layers { DEFAULT, PROG1, @@ -87,25 +85,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______,_______,_______, LT(MISC, KC_SPC), _______,_______,_______,_______, _______,_______,_______, _______,_______), }; -void matrix_scan_user(void) { - uint8_t layer; - layer = get_highest_layer(layer_state); - - if (current_layer_global != layer) { - current_layer_global = layer; - - // unset CAPSLOCK and SCROLL LOCK LEDs - led_set(host_keyboard_leds() & ~(1<event.pressed) { if (record->tap.count > 0 && !record->tap.interrupted) { diff --git a/keyboards/cannonkeys/satisfaction75/satisfaction75.c b/keyboards/cannonkeys/satisfaction75/satisfaction75.c index ce870c49af6..29fb6e76191 100644 --- a/keyboards/cannonkeys/satisfaction75/satisfaction75.c +++ b/keyboards/cannonkeys/satisfaction75/satisfaction75.c @@ -243,22 +243,22 @@ void via_custom_value_command(uint8_t *data, uint8_t length) { void read_host_led_state(void) { - uint8_t leds = host_keyboard_leds(); - if (leds & (1 << USB_LED_NUM_LOCK)) { + led_t led_state = host_keyboard_led_state(); + if (led_state.num_lock) { if (led_numlock == false){ led_numlock = true;} } else { if (led_numlock == true){ led_numlock = false;} } - if (leds & (1 << USB_LED_CAPS_LOCK)) { + if (led_state.caps_lock) { if (led_capslock == false){ led_capslock = true;} } else { if (led_capslock == true){ led_capslock = false;} } - if (leds & (1 << USB_LED_SCROLL_LOCK)) { + if (led_state.scroll_lock) { if (led_scrolllock == false){ led_scrolllock = true;} } else { diff --git a/keyboards/ckeys/washington/keymaps/default/keymap.c b/keyboards/ckeys/washington/keymaps/default/keymap.c index 9ce0181fe42..8e1eb0e2728 100644 --- a/keyboards/ckeys/washington/keymaps/default/keymap.c +++ b/keyboards/ckeys/washington/keymaps/default/keymap.c @@ -75,10 +75,10 @@ bool oled_task_user(void) { } // Host Keyboard LED Status - uint8_t usb_led = host_keyboard_leds(); - oled_write_P(IS_LED_ON(usb_led, USB_LED_NUM_LOCK) ? PSTR("NUMLCK ") : PSTR(" "), false); - oled_write_P(IS_LED_ON(usb_led, USB_LED_CAPS_LOCK) ? PSTR("CAPLCK ") : PSTR(" "), false); - oled_write_P(IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK) ? PSTR("SCRLCK ") : PSTR(" "), false); + led_t led_state = host_keyboard_led_state(); + oled_write_P(led_state.num_lock ? PSTR("NUMLCK ") : 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; } #endif diff --git a/keyboards/converter/ibm_terminal/led.c b/keyboards/converter/ibm_terminal/led.c index e0f31ee4e15..1bcde277a21 100644 --- a/keyboards/converter/ibm_terminal/led.c +++ b/keyboards/converter/ibm_terminal/led.c @@ -20,14 +20,15 @@ along with this program. If not, see . #include "led.h" -void led_set(uint8_t usb_led) +bool led_update_kb(led_t led_state) { uint8_t ps2_led = 0; - if (usb_led & (1<event.key.col, keycode, name, - (leds & (1<. /* keyboard LEDs */ #define USB_LED_NUM_LOCK 0 #define USB_LED_CAPS_LOCK 1 -#define USB_LED_SCROLL_LOCK 2 #ifdef __cplusplus extern "C" { diff --git a/users/curry/oled.c b/users/curry/oled.c index 89112af121e..2defcbd80e2 100644 --- a/users/curry/oled.c +++ b/users/curry/oled.c @@ -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(); diff --git a/users/ericgebhart/oled/oled_stuff.c b/users/ericgebhart/oled/oled_stuff.c index f2c4f0f394b..211fe4ab3ef 100755 --- a/users/ericgebhart/oled/oled_stuff.c +++ b/users/ericgebhart/oled/oled_stuff.c @@ -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()); */ diff --git a/users/spidey3/layer_rgb.c b/users/spidey3/layer_rgb.c index cff20898cd9..be76788d219 100644 --- a/users/spidey3/layer_rgb.c +++ b/users/spidey3/layer_rgb.c @@ -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; } diff --git a/users/xulkal/custom_oled.c b/users/xulkal/custom_oled.c index fd03033ad67..c6341fa3d7d 100644 --- a/users/xulkal/custom_oled.c +++ b/users/xulkal/custom_oled.c @@ -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 } diff --git a/users/zer09/zer09.c b/users/zer09/zer09.c index 78433b4c20d..5e192f037a2 100644 --- a/users/zer09/zer09.c +++ b/users/zer09/zer09.c @@ -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; }