summaryrefslogtreecommitdiff
path: root/keyboards
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards')
-rw-r--r--keyboards/bpiphany/kitten_paw/keymaps/ickerwx/keymap.c21
-rw-r--r--keyboards/cannonkeys/satisfaction75/satisfaction75.c8
-rw-r--r--keyboards/ckeys/washington/keymaps/default/keymap.c8
-rw-r--r--keyboards/converter/ibm_terminal/led.c9
-rw-r--r--keyboards/crkbd/keymaps/oled_sample/keymap.c10
-rw-r--r--keyboards/crkbd/lib/host_led_state_reader.c8
-rw-r--r--keyboards/duck/octagon/v1/v1.c4
-rw-r--r--keyboards/duck/octagon/v2/v2.c10
-rw-r--r--keyboards/duck/tcv3/tcv3.c83
-rwxr-xr-xkeyboards/ergodox_ez/keymaps/bepo_tm_style/keymap.c20
-rw-r--r--keyboards/gh80_3000/keymaps/ansi_std/keymap.c28
-rw-r--r--keyboards/gh80_3000/keymaps/ansi_wkl/keymap.c40
-rw-r--r--keyboards/gh80_3000/keymaps/default/keymap.c28
-rw-r--r--keyboards/gh80_3000/keymaps/iso_default/keymap.c28
-rw-r--r--keyboards/gh80_3000/keymaps/iso_std/keymap.c40
-rw-r--r--keyboards/gh80_3000/keymaps/iso_wkl/keymap.c40
-rw-r--r--keyboards/handwired/datahand/keymaps/default/keymap.c9
-rw-r--r--keyboards/handwired/jopr/keymaps/default/keymap.c9
-rw-r--r--keyboards/handwired/jopr/keymaps/modded_white/keymap.c9
-rw-r--r--keyboards/handwired/myskeeb/oled.c10
-rw-r--r--keyboards/helix/rev2/keymaps/edvorakjp/oled.c8
-rw-r--r--keyboards/helix/rev2/keymaps/five_rows_jis/keymap.c8
-rw-r--r--keyboards/helix/rev2/keymaps/froggy/keymap.c14
-rw-r--r--keyboards/helix/rev2/keymaps/froggy_106/keymap.c14
-rw-r--r--keyboards/helix/rev2/keymaps/yshrsmz/keymap.c20
-rw-r--r--keyboards/hineybush/h87a/keymaps/gam3cat/keymap.c7
-rw-r--r--keyboards/hineybush/hbcp/hbcp.c46
-rw-r--r--keyboards/hineybush/hbcp/keymaps/hiney/keymap.c9
-rw-r--r--keyboards/kingly_keys/romac_plus/keymaps/default/keymap.c8
-rw-r--r--keyboards/marksard/treadstone48/common/oled_helper.c8
-rw-r--r--keyboards/matrix/noah/noah.c8
-rw-r--r--keyboards/nullbitsco/snap/keymaps/bongo_reactive/keymap.c14
-rw-r--r--keyboards/nullbitsco/snap/keymaps/oled/keymap.c14
-rw-r--r--keyboards/nullbitsco/snap/keymaps/typehud/keymap.c14
-rw-r--r--keyboards/nullbitsco/tidbit/keymaps/snailmap_lite/keymap.c8
-rw-r--r--keyboards/orange75/keymaps/default/keymap.c9
-rw-r--r--keyboards/planck/keymaps/vaire/keymap.c19
-rw-r--r--keyboards/plut0nium/0x3e/keymaps/default/keymap.c8
-rw-r--r--keyboards/primekb/prime_e/keymaps/default/keymap.c14
-rw-r--r--keyboards/primekb/prime_e/keymaps/via/keymap.c14
-rw-r--r--keyboards/rgbkb/sol/keymaps/brianweyer/keymap.c8
-rw-r--r--keyboards/rgbkb/sol/keymaps/danielhklein/keymap.c8
-rw-r--r--keyboards/rgbkb/sol/keymaps/default/keymap.c8
-rw-r--r--keyboards/rgbkb/sol/keymaps/xyverz/keymap.c8
-rw-r--r--keyboards/rgbkb/zen/rev2/rev2.c8
-rw-r--r--keyboards/rgbkb/zygomorph/keymaps/5x6pad/keymap.c7
-rw-r--r--keyboards/rgbkb/zygomorph/keymaps/default_oled/keymap.c8
-rw-r--r--keyboards/satt/comet46/lib/host_led_state_reader.c8
-rw-r--r--keyboards/splitkb/kyria/keymaps/cwebster2/keymap.c8
-rw-r--r--keyboards/splitkb/kyria/keymaps/shinze/keymap.c8
-rw-r--r--keyboards/splitkb/kyria/keymaps/tessachka/keymap.c8
-rw-r--r--keyboards/splitkb/kyria/keymaps/thomasbaart/keymap.c8
-rw-r--r--keyboards/viktus/at101_bh/keymaps/default/keymap.c9
-rw-r--r--keyboards/viktus/omnikey_bh/keymaps/default/keymap.c9
-rw-r--r--keyboards/yosino58/lib/host_led_state_reader.c8
55 files changed, 365 insertions, 442 deletions
diff --git a/keyboards/bpiphany/kitten_paw/keymaps/ickerwx/keymap.c b/keyboards/bpiphany/kitten_paw/keymaps/ickerwx/keymap.c
index c0439912ff..f0c75284f7 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<<USB_LED_CAPS_LOCK));
- led_set(host_keyboard_leds() & ~(1<<USB_LED_SCROLL_LOCK));
- // set SCROLL LOCK LED when the mouse layer is active, CAPS LOCK when PROG layer is active
- if (layer == MOUSE1 || layer == MOUSE2) {
- led_set(host_keyboard_leds() | (1<<USB_LED_SCROLL_LOCK));
- } else if (layer == PROG1 || layer == PROG2) {
- led_set(host_keyboard_leds() | (1<<USB_LED_CAPS_LOCK));
- }
- }
-}
-
void tap_helper(keyrecord_t *record, uint16_t orig_mod, uint16_t macro_mod, uint16_t macro_kc ) {
if (record->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 ce870c49af..29fb6e7619 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 9ce0181fe4..8e1eb0e272 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 e0f31ee4e1..1bcde277a2 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 <http://www.gnu.org/licenses/>.
#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<<USB_LED_SCROLL_LOCK))
+ if (led_state.scroll_lock)
ps2_led |= (1<<PS2_LED_SCROLL_LOCK);
- if (usb_led & (1<<USB_LED_NUM_LOCK))
+ if (led_state.num_lock)
ps2_led |= (1<<PS2_LED_NUM_LOCK);
- if (usb_led & (1<<USB_LED_CAPS_LOCK))
+ if (led_state.caps_lock)
ps2_led |= (1<<PS2_LED_CAPS_LOCK);
ps2_host_set_led(ps2_led);
+ return false;
}
diff --git a/keyboards/crkbd/keymaps/oled_sample/keymap.c b/keyboards/crkbd/keymaps/oled_sample/keymap.c
index 1a48165e3f..84a4f9204f 100644
--- a/keyboards/crkbd/keymaps/oled_sample/keymap.c
+++ b/keyboards/crkbd/keymaps/oled_sample/keymap.c
@@ -147,12 +147,12 @@ void render_layer_state(void) {
oled_write_P(PSTR("Raise"), layer_state_is(_RAISE));
}
-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) {
@@ -183,7 +183,7 @@ void render_bootmagic_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_mod_status(get_mods());
render_bootmagic_status();
diff --git a/keyboards/crkbd/lib/host_led_state_reader.c b/keyboards/crkbd/lib/host_led_state_reader.c
index a0684e4a27..2593ac5f8b 100644
--- a/keyboards/crkbd/lib/host_led_state_reader.c
+++ b/keyboards/crkbd/lib/host_led_state_reader.c
@@ -5,11 +5,11 @@ char host_led_state_str[24];
const char *read_host_led_state(void)
{
- uint8_t leds = host_keyboard_leds();
+ led_t led_state = host_keyboard_led_state();
snprintf(host_led_state_str, sizeof(host_led_state_str), "NL:%s CL:%s SL:%s",
- (leds & (1 << USB_LED_NUM_LOCK)) ? "on" : "- ",
- (leds & (1 << USB_LED_CAPS_LOCK)) ? "on" : "- ",
- (leds & (1 << USB_LED_SCROLL_LOCK)) ? "on" : "- ");
+ (led_state.num_lock) ? "on" : "- ",
+ (led_state.caps_lock) ? "on" : "- ",
+ (led_state.scroll_lock) ? "on" : "- ");
return host_led_state_str;
}
diff --git a/keyboards/duck/octagon/v1/v1.c b/keyboards/duck/octagon/v1/v1.c
index dc3b7fc728..35aea54456 100644
--- a/keyboards/duck/octagon/v1/v1.c
+++ b/keyboards/duck/octagon/v1/v1.c
@@ -43,8 +43,8 @@ void backlight_set(uint8_t level) {
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
- backlight_os_state & (1<<USB_LED_CAPS_LOCK) ? (PORTB &= ~0b00000001) : (PORTB |= 0b00000001);
- backlight_os_state & (1<<USB_LED_SCROLL_LOCK) ? (PORTB &= ~0b00010000) : (PORTB |= 0b00010000);
+ backlight_os_state & 2 ? (PORTB &= ~0b00000001) : (PORTB |= 0b00000001);
+ backlight_os_state & 4 ? (PORTB &= ~0b00010000) : (PORTB |= 0b00010000);
}
return res;
}
diff --git a/keyboards/duck/octagon/v2/v2.c b/keyboards/duck/octagon/v2/v2.c
index 612df9aa3e..7a3ad76027 100644
--- a/keyboards/duck/octagon/v2/v2.c
+++ b/keyboards/duck/octagon/v2/v2.c
@@ -101,17 +101,17 @@ bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
bool status[7] = {
- backlight_os_state & (1<<USB_LED_CAPS_LOCK),
- backlight_os_state & (1<<USB_LED_SCROLL_LOCK),
- backlight_os_state & (1<<USB_LED_NUM_LOCK),
+ backlight_os_state & 2,
+ backlight_os_state & 4,
+ backlight_os_state & 1,
backlight_layer_state & (1<<1),
backlight_layer_state & (1<<2),
backlight_layer_state & (1<<3),
backlight_layer_state & (1<<4)
};
indicator_leds_set(status);
- backlight_os_state & (1<<USB_LED_CAPS_LOCK) ? (PORTB &= ~0b00000001) : (PORTB |= 0b00000001);
- backlight_os_state & (1<<USB_LED_SCROLL_LOCK) ? (PORTB &= ~0b00010000) : (PORTB |= 0b00010000);
+ backlight_os_state & 2 ? (PORTB &= ~0b00000001) : (PORTB |= 0b00000001);
+ backlight_os_state & 4 ? (PORTB &= ~0b00010000) : (PORTB |= 0b00010000);
}
return res;
}
diff --git a/keyboards/duck/tcv3/tcv3.c b/keyboards/duck/tcv3/tcv3.c
index ab89e180c0..87b22443e4 100644
--- a/keyboards/duck/tcv3/tcv3.c
+++ b/keyboards/duck/tcv3/tcv3.c
@@ -24,69 +24,6 @@ enum BACKLIGHT_AREAS {
BACKLIGHT_SWITCH = 0b0001111
};
-// uint8_t backlight_rgb_r = 255;
-// uint8_t backlight_rgb_g = 0;
-// uint8_t backlight_rgb_b = 0;
-// uint8_t backlight_os_state = 0;
-// uint32_t backlight_layer_state = 0;
-
-// void backlight_toggle_rgb(bool enabled)
-// {
-// if(enabled) {
-// uint8_t rgb[17][3] = {
-// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
-// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
-// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
-// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
-// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
-// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
-// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
-// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
-// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
-// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
-// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
-// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
-// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
-// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
-// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
-// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
-// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}
-// };
-// backlight_set_rgb(rgb);
-// } else {
-// uint8_t rgb[17][3] = {
-// {0, 0, 0},
-// {0, 0, 0},
-// {0, 0, 0},
-// {0, 0, 0},
-// {0, 0, 0},
-// {0, 0, 0},
-// {0, 0, 0},
-// {0, 0, 0},
-// {0, 0, 0},
-// {0, 0, 0},
-// {0, 0, 0},
-// {0, 0, 0},
-// {0, 0, 0},
-// {0, 0, 0},
-// {0, 0, 0},
-// {0, 0, 0},
-// {0, 0, 0}
-// };
-// backlight_set_rgb(rgb);
-// }
-// }
-
-// void backlight_set_rgb(uint8_t cfg[17][3])
-// {
-// cli();
-// for(uint8_t i = 0; i < 17; ++i) {
-// send_color(cfg[i][0], cfg[i][1], cfg[i][2], Device_PCBRGB);
-// }
-// sei();
-// show();
-// }
-
// Q5, Q6, Q7 is connected to B1 - alphas
// Q8, Q9 is connected to B2 - frow
// Q1, Q2, Q3 is connected to B3 - mods
@@ -99,26 +36,6 @@ void backlight_set(uint8_t level) {
level & BACKLIGHT_MACRO ? (PORTE |= 0b01000000) : (PORTE &= ~0b01000000);
}
-// // Port from backlight_update_state
-// bool led_update_kb(led_t led_state) {
-// bool res = led_update_user(led_state);
-// if(res) {
-// bool status[7] = {
-// backlight_os_state & (1<<USB_LED_CAPS_LOCK),
-// backlight_os_state & (1<<USB_LED_SCROLL_LOCK),
-// backlight_os_state & (1<<USB_LED_NUM_LOCK),
-// backlight_layer_state & (1<<1),
-// backlight_layer_state & (1<<2),
-// backlight_layer_state & (1<<3),
-// backlight_layer_state & (1<<4)
-// };
-// indicator_leds_set(status);
-// backlight_os_state & (1<<USB_LED_CAPS_LOCK) ? (PORTB &= ~0b00000001) : (PORTB |= 0b00000001);
-// backlight_os_state & (1<<USB_LED_SCROLL_LOCK) ? (PORTB &= ~0b00010000) : (PORTB |= 0b00010000);
-// }
-// return res;
-// }
-
// U5 Pin 1, 2, 3 connected to top left LEDs
// U6 Pin 1, 2, 3 connected to bottom right leds col of 3
diff --git a/keyboards/ergodox_ez/keymaps/bepo_tm_style/keymap.c b/keyboards/ergodox_ez/keymaps/bepo_tm_style/keymap.c
index 45a101ec81..99d10e9a12 100755
--- a/keyboards/ergodox_ez/keymaps/bepo_tm_style/keymap.c
+++ b/keyboards/ergodox_ez/keymaps/bepo_tm_style/keymap.c
@@ -253,12 +253,7 @@ void matrix_scan_user(void) {
};
// The state of the LEDs requested by the system, as a bitmask.
-static uint8_t sys_led_state = 0;
-
-// Use these masks to read the system LEDs state.
-static const uint8_t sys_led_mask_num_lock = 1 << USB_LED_NUM_LOCK;
-static const uint8_t sys_led_mask_caps_lock = 1 << USB_LED_CAPS_LOCK;
-static const uint8_t sys_led_mask_scroll_lock = 1 << USB_LED_SCROLL_LOCK;
+static led_t sys_led_state = {0};
// Value to use to switch LEDs on. The default value of 255 is far too bright.
static const uint8_t max_led_value = 20;
@@ -294,25 +289,26 @@ void led_3_off(void) {
}
// Called when the computer wants to change the state of the keyboard LEDs.
-void led_set_user(uint8_t usb_led) {
- sys_led_state = usb_led;
+bool led_update_user(led_t led_state) {
+ sys_led_state = led_state;
if (LAYER_ON(SYSLEDS)) {
- if (sys_led_state & sys_led_mask_caps_lock) {
+ if (sys_led_state.caps_lock) {
led_1_on();
} else {
led_1_off();
}
- if (sys_led_state & sys_led_mask_num_lock) {
+ if (sys_led_state.num_lock) {
led_2_on();
} else {
led_2_off();
}
- if (sys_led_state & sys_led_mask_scroll_lock) {
+ if (sys_led_state.scroll_lock) {
led_3_on();
} else {
led_3_off();
}
}
+ return false;
}
layer_state_t layer_state_set_user(layer_state_t state) {
@@ -327,7 +323,7 @@ layer_state_t layer_state_set_user(layer_state_t state) {
}
if (LAYER_ON(SYSLEDS)) {
- led_set_user(sys_led_state);
+ led_update_user(sys_led_state);
return state;
}
diff --git a/keyboards/gh80_3000/keymaps/ansi_std/keymap.c b/keyboards/gh80_3000/keymaps/ansi_std/keymap.c
index f33767ca64..f99d522ead 100644
--- a/keyboards/gh80_3000/keymaps/ansi_std/keymap.c
+++ b/keyboards/gh80_3000/keymaps/ansi_std/keymap.c
@@ -12,23 +12,29 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
-void led_set_user(uint8_t usb_led) {
-
- if (usb_led & (1 << USB_LED_NUM_LOCK)) {
- DDRB |= (1 << 5); PORTB &= ~(1 << 5);
+bool led_update_user(led_t led_state) {
+ if (led_state.num_lock) {
+ DDRB |= (1 << 5);
+ PORTB &= ~(1 << 5);
} else {
- DDRB &= ~(1 << 5); PORTB &= ~(1 << 5);
+ DDRB &= ~(1 << 5);
+ PORTB &= ~(1 << 5);
}
- if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
- DDRB |= (1 << 6); PORTB &= ~(1 << 6);
+ if (led_state.caps_lock) {
+ DDRB |= (1 << 6);
+ PORTB &= ~(1 << 6);
} else {
- DDRB &= ~(1 << 6); PORTB &= ~(1 << 6);
+ DDRB &= ~(1 << 6);
+ PORTB &= ~(1 << 6);
}
- if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
- DDRB |= (1 << 7); PORTB &= ~(1 << 7);
+ if (led_state.scroll_lock) {
+ DDRB |= (1 << 7);
+ PORTB &= ~(1 << 7);
} else {
- DDRB &= ~(1 << 7); PORTB &= ~(1 << 7);
+ DDRB &= ~(1 << 7);
+ PORTB &= ~(1 << 7);
}
+ return false;
}
diff --git a/keyboards/gh80_3000/keymaps/ansi_wkl/keymap.c b/keyboards/gh80_3000/keymaps/ansi_wkl/keymap.c
index 28a34c4269..b3f2426e88 100644
--- a/keyboards/gh80_3000/keymaps/ansi_wkl/keymap.c
+++ b/keyboards/gh80_3000/keymaps/ansi_wkl/keymap.c
@@ -12,23 +12,29 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
-void led_set_user(uint8_t usb_led) {
+bool led_update_user(led_t led_state) {
+ if (led_state.num_lock) {
+ DDRB |= (1 << 5);
+ PORTB &= ~(1 << 5);
+ } else {
+ DDRB &= ~(1 << 5);
+ PORTB &= ~(1 << 5);
+ }
- if (usb_led & (1 << USB_LED_NUM_LOCK)) {
- DDRB |= (1 << 5); PORTB &= ~(1 << 5);
- } else {
- DDRB &= ~(1 << 5); PORTB &= ~(1 << 5);
- }
+ if (led_state.caps_lock) {
+ DDRB |= (1 << 6);
+ PORTB &= ~(1 << 6);
+ } else {
+ DDRB &= ~(1 << 6);
+ PORTB &= ~(1 << 6);
+ }
- if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
- DDRB |= (1 << 6); PORTB &= ~(1 << 6);
- } else {
- DDRB &= ~(1 << 6); PORTB &= ~(1 << 6);
- }
-
- if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
- DDRB |= (1 << 7); PORTB &= ~(1 << 7);
- } else {
- DDRB &= ~(1 << 7); PORTB &= ~(1 << 7);
- }
+ if (led_state.scroll_lock) {
+ DDRB |= (1 << 7);
+ PORTB &= ~(1 << 7);
+ } else {
+ DDRB &= ~(1 << 7);
+ PORTB &= ~(1 << 7);
+ }
+ return false;
}
diff --git a/keyboards/gh80_3000/keymaps/default/keymap.c b/keyboards/gh80_3000/keymaps/default/keymap.c
index 264f20fbca..b74127fc5e 100644
--- a/keyboards/gh80_3000/keymaps/default/keymap.c
+++ b/keyboards/gh80_3000/keymaps/default/keymap.c
@@ -12,23 +12,29 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
-void led_set_user(uint8_t usb_led) {
-
- if (usb_led & (1 << USB_LED_NUM_LOCK)) {
- DDRB |= (1 << 5); PORTB &= ~(1 << 5);
+bool led_update_user(led_t led_state) {
+ if (led_state.num_lock) {
+ DDRB |= (1 << 5);
+ PORTB &= ~(1 << 5);
} else {
- DDRB &= ~(1 << 5); PORTB &= ~(1 << 5);
+ DDRB &= ~(1 << 5);
+ PORTB &= ~(1 << 5);
}
- if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
- DDRB |= (1 << 6); PORTB &= ~(1 << 6);
+ if (led_state.caps_lock) {
+ DDRB |= (1 << 6);
+ PORTB &= ~(1 << 6);
} else {
- DDRB &= ~(1 << 6); PORTB &= ~(1 << 6);
+ DDRB &= ~(1 << 6);
+ PORTB &= ~(1 << 6);
}
- if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
- DDRB |= (1 << 7); PORTB &= ~(1 << 7);
+ if (led_state.scroll_lock) {
+ DDRB |= (1 << 7);
+ PORTB &= ~(1 << 7);
} else {
- DDRB &= ~(1 << 7); PORTB &= ~(1 << 7);
+ DDRB &= ~(1 << 7);
+ PORTB &= ~(1 << 7);
}
+ return false;
}
diff --git a/keyboards/gh80_3000/keymaps/iso_default/keymap.c b/keyboards/gh80_3000/keymaps/iso_default/keymap.c
index 137a6513b6..4c4b10f458 100644
--- a/keyboards/gh80_3000/keymaps/iso_default/keymap.c
+++ b/keyboards/gh80_3000/keymaps/iso_default/keymap.c
@@ -12,23 +12,29 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
-void led_set_user(uint8_t usb_led) {
-
- if (usb_led & (1 << USB_LED_NUM_LOCK)) {
- DDRB |= (1 << 5); PORTB &= ~(1 << 5);
+bool led_update_user(led_t led_state) {
+ if (led_state.num_lock) {
+ DDRB |= (1 << 5);
+ PORTB &= ~(1 << 5);
} else {
- DDRB &= ~(1 << 5); PORTB &= ~(1 << 5);
+ DDRB &= ~(1 << 5);
+ PORTB &= ~(1 << 5);
}
- if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
- DDRB |= (1 << 6); PORTB &= ~(1 << 6);
+ if (led_state.caps_lock) {
+ DDRB |= (1 << 6);
+ PORTB &= ~(1 << 6);
} else {
- DDRB &= ~(1 << 6); PORTB &= ~(1 << 6);
+ DDRB &= ~(1 << 6);
+ PORTB &= ~(1 << 6);
}
- if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
- DDRB |= (1 << 7); PORTB &= ~(1 << 7);
+ if (led_state.scroll_lock) {
+ DDRB |= (1 << 7);
+ PORTB &= ~(1 << 7);
} else {
- DDRB &= ~(1 << 7); PORTB &= ~(1 << 7);
+ DDRB &= ~(1 << 7);
+ PORTB &= ~(1 << 7);
}
+ return false;
}
diff --git a/keyboards/gh80_3000/keymaps/iso_std/keymap.c b/keyboards/gh80_3000/keymaps/iso_std/keymap.c
index 434abf68f5..9559bde119 100644
--- a/keyboards/gh80_3000/keymaps/iso_std/keymap.c
+++ b/keyboards/gh80_3000/keymaps/iso_std/keymap.c
@@ -12,23 +12,29 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
-void led_set_user(uint8_t usb_led) {
+bool led_update_user(led_t led_state) {
+ if (led_state.num_lock) {
+ DDRB |= (1 << 5);
+ PORTB &= ~(1 << 5);
+ } else {
+ DDRB &= ~(1 << 5);
+ PORTB &= ~(1 << 5);
+ }
- if (usb_led & (1 << USB_LED_NUM_LOCK)) {
- DDRB |= (1 << 5); PORTB &= ~(1 << 5);
- } else {
- DDRB &= ~(1 << 5); PORTB &= ~(1 << 5);
- }
+ if (led_state.caps_lock) {
+ DDRB |= (1 << 6);
+ PORTB &= ~(1 << 6);
+ } else {
+ DDRB &= ~(1 << 6);
+ PORTB &= ~(1 << 6);
+ }
- if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
- DDRB |= (1 << 6); PORTB &= ~(1 << 6);
- } else {
- DDRB &= ~(1 << 6); PORTB &= ~(1 << 6);
- }
-
- if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
- DDRB |= (1 << 7); PORTB &= ~(1 << 7);
- } else {
- DDRB &= ~(1 << 7); PORTB &= ~(1 << 7);
- }
+ if (led_state.scroll_lock) {
+ DDRB |= (1 << 7);
+ PORTB &= ~(1 << 7);
+ } else {
+ DDRB &= ~(1 << 7);
+ PORTB &= ~(1 << 7);
+ }
+ return false;
}
diff --git a/keyboards/gh80_3000/keymaps/iso_wkl/keymap.c b/keyboards/gh80_3000/keymaps/iso_wkl/keymap.c
index f275a3e789..86054ba1fd 100644
--- a/keyboards/gh80_3000/keymaps/iso_wkl/keymap.c
+++ b/keyboards/gh80_3000/keymaps/iso_wkl/keymap.c
@@ -12,23 +12,29 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
-void led_set_user(uint8_t usb_led) {
+bool led_update_user(led_t led_state) {
+ if (led_state.num_lock) {
+ DDRB |= (1 << 5);
+ PORTB &= ~(1 << 5);
+ } else {
+ DDRB &= ~(1 << 5);
+ PORTB &= ~(1 << 5);
+ }
- if (usb_led & (1 << USB_LED_NUM_LOCK)) {
- DDRB |= (1 << 5); PORTB &= ~(1 << 5);
- } else {
- DDRB &= ~(1 << 5); PORTB &= ~(1 << 5);
- }
+ if (led_state.caps_lock) {
+ DDRB |= (1 << 6);
+ PORTB &= ~(1 << 6);
+ } else {
+ DDRB &= ~(1 << 6);
+ PORTB &= ~(1 << 6);
+ }
- if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
- DDRB |= (1 << 6); PORTB &= ~(1 << 6);
- } else {
- DDRB &= ~(1 << 6); PORTB &= ~(1 << 6);
- }
-
- if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
- DDRB |= (1 << 7); PORTB &= ~(1 << 7);
- } else {
- DDRB &= ~(1 << 7); PORTB &= ~(1 << 7);
- }
+ if (led_state.scroll_lock) {
+ DDRB |= (1 << 7);
+ PORTB &= ~(1 << 7);
+ } else {
+ DDRB &= ~(1 << 7);
+ PORTB &= ~(1 << 7);
+ }
+ return false;
}
diff --git a/keyboards/handwired/datahand/keymaps/default/keymap.c b/keyboards/handwired/datahand/keymaps/default/keymap.c
index 7ebcff366f..608c45dea3 100644
--- a/keyboards/handwired/datahand/keymaps/default/keymap.c
+++ b/keyboards/handwired/datahand/keymaps/default/keymap.c
@@ -302,8 +302,9 @@ void matrix_init_user(void) {
#endif
}
-void led_set_user(uint8_t usb_led) {
- lock_led_set(usb_led & (1<<USB_LED_NUM_LOCK), LED_NUM_LOCK);
- lock_led_set(usb_led & (1<<USB_LED_CAPS_LOCK), LED_CAPS_LOCK);
- lock_led_set(usb_led & (1<<USB_LED_SCROLL_LOCK), LED_SCROLL_LOCK);
+bool led_update_user(led_t led_state) {
+ lock_led_set(led_state.num_lock, LED_NUM_LOCK);
+ lock_led_set(led_state.caps_lock, LED_CAPS_LOCK);
+ lock_led_set(led_state.scroll_lock, LED_SCROLL_LOCK);
+ return false;
}
diff --git a/keyboards/handwired/jopr/keymaps/default/keymap.c b/keyboards/handwired/jopr/keymaps/default/keymap.c
index 1dc0f3a59e..fc615b0109 100644
--- a/keyboards/handwired/jopr/keymaps/default/keymap.c
+++ b/keyboards/handwired/jopr/keymaps/default/keymap.c
@@ -22,23 +22,24 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
-void led_set_user(uint8_t usb_led) {
+bool led_update_user(led_t led_state) {
- if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
+ if (led_state.caps_lock) {
writePinHigh(F1);
} else {
writePinLow(F1);
}
- if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
+ if (led_state.scroll_lock) {
writePinHigh(F0);
} else {
writePinLow(F0);
}
- if (!(IS_LED_ON(usb_led, USB_LED_NUM_LOCK))) {
+ if (!led_state.num_lock) {
tap_code(KC_NUM_LOCK);
}
+ return false;
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
static bool sysreq_led = false;
diff --git a/keyboards/handwired/jopr/keymaps/modded_white/keymap.c b/keyboards/handwired/jopr/keymaps/modded_white/keymap.c
index edaabe78e6..69d1a56bb5 100644
--- a/keyboards/handwired/jopr/keymaps/modded_white/keymap.c
+++ b/keyboards/handwired/jopr/keymaps/modded_white/keymap.c
@@ -22,23 +22,24 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
-void led_set_user(uint8_t usb_led) {
+bool led_update_user(led_t led_state) {
- if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
+ if (led_state.caps_lock) {
writePinHigh(F1);
} else {
writePinLow(F1);
}
- if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
+ if (led_state.scroll_lock) {
writePinHigh(F0);
} else {
writePinLow(F0);
}
- if (!(IS_LED_ON(usb_led, USB_LED_NUM_LOCK))) {
+ if (!led_state.num_lock) {
tap_code(KC_NUM_LOCK);
}
+ return false;
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
static bool sysreq_led = false;
diff --git a/keyboards/handwired/myskeeb/oled.c b/keyboards/handwired/myskeeb/oled.c
index 3f43590b8e..675b290630 100644
--- a/keyboards/handwired/myskeeb/oled.c
+++ b/keyboards/handwired/myskeeb/oled.c
@@ -127,13 +127,13 @@ void render_layer_state(void){
}
// Keylock State
-void render_keylock_status(uint8_t led_usb_state) {
+void render_keylock_status(led_t led_state) {
oled_write_P(PSTR(" "), false);
- oled_write_P(led_usb_state & (1<<USB_LED_NUM_LOCK) ? PSTR("-NUML") : PSTR("-----"), false);
+ oled_write_P(led_state.num_lock ? PSTR("-NUML") : PSTR("-----"), false);
oled_write_P(PSTR(" "), false);
- oled_write_P(led_usb_state & (1<<USB_LED_CAPS_LOCK) ? PSTR("-CAPS") : PSTR("-----"), false);
+ oled_write_P(led_state.caps_lock ? PSTR("-CAPS") : PSTR("-----"), false);
oled_write_P(PSTR(" "), false);
- oled_write_P(led_usb_state & (1<<USB_LED_SCROLL_LOCK) ? PSTR("-SCRL") : PSTR("-----"), false);
+ oled_write_P(led_state.scroll_lock ? PSTR("-SCRL") : PSTR("-----"), false);
oled_write_P(PSTR(" "), false);
}
@@ -213,7 +213,7 @@ if (is_keyboard_master()) {
oled_write_P(oled_layer_line_end, false);
oled_write_P(oled_layer_keylog_bottom, false);
oled_write_P(oled_line_start, false);
- render_keylock_status(host_keyboard_leds());
+ render_keylock_status(host_keyboard_led_state());
oled_write_P(oled_layer_line_end, false);
oled_write_P(oled_mods_bottom, false);
oled_write_P(oled_line_start, false);
diff --git a/keyboards/helix/rev2/keymaps/edvorakjp/oled.c b/keyboards/helix/rev2/keymaps/edvorakjp/oled.c
index 14e3e5533b..38a91c1639 100644
--- a/keyboards/helix/rev2/keymaps/edvorakjp/oled.c
+++ b/keyboards/helix/rev2/keymaps/edvorakjp/oled.c
@@ -5,13 +5,9 @@
#ifdef OLED_ENABLE
void render_host_led_state(void) {
char led_state_str[24];
- uint8_t leds = host_keyboard_leds();
+ led_t led_state = host_keyboard_led_state();
- bool is_num_lock_enabled = leds & (1 << USB_LED_NUM_LOCK);
- bool is_caps_lock_enabled = leds & (1 << USB_LED_CAPS_LOCK);
- bool is_scroll_lock_enabled = leds & (1 << USB_LED_SCROLL_LOCK);
-
- snprintf(led_state_str, sizeof(led_state_str), "NL:%s CL:%s SL:%s", is_num_lock_enabled ? "on" : "- ", is_caps_lock_enabled ? "on" : "- ", is_scroll_lock_enabled ? "on" : "- ");
+ snprintf(led_state_str, sizeof(led_state_str), "NL:%s CL:%s SL:%s", led_state.num_lock ? "on" : "- ", led_state.caps_lock ? "on" : "- ", led_state.scroll_lock ? "on" : "- ");
oled_write(led_state_str, false);
}
diff --git a/keyboards/helix/rev2/keymaps/five_rows_jis/keymap.c b/keyboards/helix/rev2/keymaps/five_rows_jis/keymap.c
index 32b446c498..ff7b174f5b 100644
--- a/keyboards/helix/rev2/keymaps/five_rows_jis/keymap.c
+++ b/keyboards/helix/rev2/keymaps/five_rows_jis/keymap.c
@@ -205,7 +205,7 @@ const char code_to_name[60] = {
static inline void set_keylog(uint16_t keycode, keyrecord_t *record)
{
char name = ' ';
- uint8_t leds = host_keyboard_leds();
+ led_t led_state = host_keyboard_led_state();
if (keycode < 60)
{
@@ -218,9 +218,9 @@ static inline void set_keylog(uint16_t keycode, keyrecord_t *record)
record->event.key.col,
keycode,
name,
- (leds & (1<<USB_LED_NUM_LOCK)) ? 'N' : ' ',
- (leds & (1<<USB_LED_CAPS_LOCK)) ? 'C' : ' ',
- (leds & (1<<USB_LED_SCROLL_LOCK)) ? 'S' : ' '
+ led_state.num_lock ? 'N' : ' ',
+ led_state.caps_lock ? 'C' : ' ',
+ led_state.scroll_lock ? 'S' : ' '
);
}
#endif
diff --git a/keyboards/helix/rev2/keymaps/froggy/keymap.c b/keyboards/helix/rev2/keymaps/froggy/keymap.c
index 8463365f59..c29c5832de 100644
--- a/keyboards/helix/rev2/keymaps/froggy/keymap.c
+++ b/keyboards/helix/rev2/keymaps/froggy/keymap.c
@@ -704,9 +704,10 @@ void render_status(struct CharacterMatrix *matrix) {
int rows = 0;
//Set Indicator icon
- if (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) { rown = 4; } else { rown = 0; }
- if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) { rowa = 4; } else { rowa = 0; }
- if (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) { rows = 4; } else { rows = 0; }
+ led_t led_state = host_keyboard_led_state();
+ if (led_state.num_lock) { rown = 4; } else { rown = 0; }
+ if (led_state.caps_lock) { rowa = 4; } else { rowa = 0; }
+ if (led_state.scroll_lock) { rows = 4; } else { rows = 0; }
if (layer_state == L_FUNC) { rowf = 4; }
matrix_write(matrix, indctr[rown] [0]);
@@ -813,9 +814,10 @@ void render_status(void) {
int rows = 0;
//Set Indicator icon
- if (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) { rown = 4; } else { rown = 0; }
- if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) { rowa = 4; } else { rowa = 0; }
- if (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) { rows = 4; } else { rows = 0; }
+ led_t led_state = host_keyboard_led_state();
+ if (led_state.num_lock) { rown = 4; } else { rown = 0; }
+ if (led_state.caps_lock) { rowa = 4; } else { rowa = 0; }
+ if (led_state.scroll_lock) { rows = 4; } else { rows = 0; }
if (layer_state == L_FUNC) { rowf = 4; }
oled_write(indctr[rown] [0], false);
diff --git a/keyboards/helix/rev2/keymaps/froggy_106/keymap.c b/keyboards/helix/rev2/keymaps/froggy_106/keymap.c
index a370c21ea2..b9c6aa2324 100644
--- a/keyboards/helix/rev2/keymaps/froggy_106/keymap.c
+++ b/keyboards/helix/rev2/keymaps/froggy_106/keymap.c
@@ -782,9 +782,10 @@ void render_status(struct CharacterMatrix *matrix) {
int rowj = 1;
//Set Indicator icon
- if (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) { rown = 4; }
- if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) { rowa = 4; }
- if (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) { rows = 4; }
+ led_t led_state = host_keyboard_led_state();
+ if (led_state.num_lock) { rown = 4; }
+ if (led_state.caps_lock) { rowa = 4; }
+ if (led_state.scroll_lock) { rows = 4; }
if (IS_LAYER_ON(_FUNC)) { rowf = 4; }
//Set Mode icon
@@ -909,9 +910,10 @@ void render_status(void) {
int rowj = 1;
//Set Indicator icon
- if (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) { rown = 4; }
- if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) { rowa = 4; }
- if (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) { rows = 4; }
+ led_t led_state = host_keyboard_led_state();
+ if (led_state.num_lock) { rown = 4; }
+ if (led_state.caps_lock) { rowa = 4; }
+ if (led_state.scroll_lock) { rows = 4; }
if (IS_LAYER_ON(_FUNC)) { rowf = 4; }
//Set Mode icon
diff --git a/keyboards/helix/rev2/keymaps/yshrsmz/keymap.c b/keyboards/helix/rev2/keymaps/yshrsmz/keymap.c
index b3ae8a3d25..1fc5dfba99 100644
--- a/keyboards/helix/rev2/keymaps/yshrsmz/keymap.c
+++ b/keyboards/helix/rev2/keymaps/yshrsmz/keymap.c
@@ -459,12 +459,10 @@ void render_status(struct CharacterMatrix *matrix) {
matrix_write_P(matrix, PSTR("\n"));
// Host Keyboard LED Status
- matrix_write_P(matrix, (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ?
- PSTR("NUMLOCK") : PSTR(" "));
- matrix_write_P(matrix, (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ?
- PSTR("CAPS") : PSTR(" "));
- matrix_write_P(matrix, (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ?
- PSTR("SCLK") : PSTR(" "));
+ led_t led_state = host_keyboard_led_state();
+ matrix_write_P(matrix, led_state.num_lock ? PSTR("NUMLOCK") : PSTR(" "));
+ matrix_write_P(matrix, led_state.caps_lock ? PSTR("CAPS") : PSTR(" "));
+ matrix_write_P(matrix, led_state.scroll_lock ? PSTR("SCLK") : PSTR(" "));
matrix_write_P(matrix, PSTR("\n"));
render_rgbled_status(true, matrix);
}
@@ -580,12 +578,10 @@ void render_status(void) {
render_layer_status();
// Host Keyboard LED Status
- oled_write_P((host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ?
- PSTR("NUMLOCK") : PSTR(" "), false);
- oled_write_P((host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ?
- PSTR("CAPS") : PSTR(" "), false);
- oled_write_P((host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ?
- PSTR("SCLK") : PSTR(" "), false);
+ led_t led_state = host_keyboard_led_state();
+ oled_write_P(led_state.num_lock ? PSTR("NUMLOCK") : PSTR(" "), false);
+ oled_write_P(led_state.caps_lock ? PSTR("CAPS") : PSTR(" "), false);
+ oled_write_P(led_state.scroll_lock ? PSTR("SCLK") : PSTR(" "), false);
oled_write_P(PSTR("\n"), false);
render_rgbled_status(true);
oled_write_P(PSTR("\n"), false);
diff --git a/keyboards/hineybush/h87a/keymaps/gam3cat/keymap.c b/keyboards/hineybush/h87a/keymaps/gam3cat/keymap.c
index 76fd4abae9..6d064455b3 100644
--- a/keyboards/hineybush/h87a/keymaps/gam3cat/keymap.c
+++ b/keyboards/hineybush/h87a/keymaps/gam3cat/keymap.c
@@ -278,15 +278,16 @@ void led_init_ports(void) {
DDRE |= (1<<6); // OUT
}
-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) {
DDRD |= (1 << 5); PORTD &= ~(1 << 5);
} else {
DDRD &= ~(1 << 5); PORTD &= ~(1 << 5);
}
- if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
+ if (led_state.scroll_lock) {
DDRE |= (1 << 6); PORTE &= ~(1 << 6);
} else {
DDRE &= ~(1 << 6); PORTE &= ~(1 << 6);
}
+ return false;
}
diff --git a/keyboards/hineybush/hbcp/hbcp.c b/keyboards/hineybush/hbcp/hbcp.c
index d4601cd2e3..7d0f5ecf73 100644
--- a/keyboards/hineybush/hbcp/hbcp.c
+++ b/keyboards/hineybush/hbcp/hbcp.c
@@ -45,32 +45,40 @@ void eeconfig_init_kb(void) { // EEPROM is getting reset!
#ifdef RGBLIGHT_ENABLE
-__attribute__ ((weak))
-void led_set_user(uint8_t usb_led) {
- if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
- sethsv_raw(HSV_CAPS, (LED_TYPE *)&led[0]);
- } else {
- sethsv(HSV_BLACK, (LED_TYPE *)&led[0]);
- }
- if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) {
- sethsv_raw(HSV_NLCK, (LED_TYPE *)&led[1]);
- } else {
- sethsv(HSV_BLACK, (LED_TYPE *)&led[1]);
- }
- if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
- sethsv_raw(HSV_SCRL, (LED_TYPE *)&led[2]);
- } else {
- sethsv(HSV_BLACK, (LED_TYPE *)&led[2]);
+bool led_update_kb(led_t led_state) {
+ bool res = led_update_user(led_state);
+ if (res) {
+ if (led_state.caps_lock) {
+ sethsv_raw(HSV_CAPS, (LED_TYPE *)&led[0]);
+ } else {
+ sethsv(HSV_BLACK, (LED_TYPE *)&led[0]);
+ }
+ if (led_state.num_lock) {
+ sethsv_raw(HSV_NLCK, (LED_TYPE *)&led[1]);
+ } else {
+ sethsv(HSV_BLACK, (LED_TYPE *)&led[1]);
+ }
+ if (led_state.scroll_lock) {
+ sethsv_raw(HSV_SCRL, (LED_TYPE *)&led[2]);
+ } else {
+ sethsv(HSV_BLACK, (LED_TYPE *)&led[2]);
+ }
+ rgblight_set();
}
- rgblight_set();
+ return false;
}
__attribute__ ((weak))
void keyboard_post_init_user(void) {
rgblight_set_effect_range(3, RGBLED_NUM-3);
- led_set_user(_BV(USB_LED_CAPS_LOCK)|_BV(USB_LED_NUM_LOCK)|_BV(USB_LED_SCROLL_LOCK));
+ led_t led_state = {
+ .caps_lock = true,
+ .num_lock = true,
+ .scroll_lock = true
+ };
+ led_update_kb(led_state);
wait_ms(300);
- led_set_user(0);
+ led_update_kb((led_t){0});
}
__attribute__ ((weak))
diff --git a/keyboards/hineybush/hbcp/keymaps/hiney/keymap.c b/keyboards/hineybush/hbcp/keymaps/hiney/keymap.c
index 5f1d7700f6..26a67fe7ca 100644
--- a/keyboards/hineybush/hbcp/keymaps/hiney/keymap.c
+++ b/keyboards/hineybush/hbcp/keymaps/hiney/keymap.c
@@ -77,23 +77,24 @@ void matrix_scan_user(void) {
#ifdef RGBLIGHT_ENABLE
// The first three LEDs are used as indicators for CAPS_LOCK, NUM_LOCK and SCROLL_LOCK.
-void led_set_user(uint8_t usb_led) {
- if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
+bool led_update_user(led_t led_state) {
+ if (led_state.caps_lock) {
sethsv_raw(HSV_SOFT_RED, (LED_TYPE *)&led[0]);
} else {
sethsv(HSV_BLACK, (LED_TYPE *)&led[0]);
}
- if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) {
+ if (led_state.num_lock) {
sethsv_raw(HSV_WARM_WHITE, (LED_TYPE *)&led[1]);
} else {
sethsv(HSV_BLACK, (LED_TYPE *)&led[1]);
}
- if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
+ if (led_state.scroll_lock) {
sethsv_raw(HSV_SOFT_BLUE, (LED_TYPE *)&led[2]);
} else {
sethsv(HSV_BLACK, (LED_TYPE *)&led[2]);
}
rgblight_set();
+ return false;
}
#endif
diff --git a/keyboards/kingly_keys/romac_plus/keymaps/default/keymap.c b/keyboards/kingly_keys/romac_plus/keymaps/default/keymap.c
index 62c2349150..ce84abb24d 100644
--- a/keyboards/kingly_keys/romac_plus/keymaps/default/keymap.c
+++ b/keyboards/kingly_keys/romac_plus/keymaps/default/keymap.c
@@ -57,10 +57,10 @@ bool oled_task_user(void) {
}
// Host Keyboard LED Status
- uint8_t led_usb_state = host_keyboard_leds();
- oled_write_P(IS_LED_ON(led_usb_state, USB_LED_NUM_LOCK) ? PSTR("NLCK ") : PSTR(" "), false);
- oled_write_P(IS_LED_ON(led_usb_state, USB_LED_CAPS_LOCK) ? PSTR("CAPS ") : PSTR(" "), false);
- oled_write_P(IS_LED_ON(led_usb_state, USB_LED_SCROLL_LOCK) ? PSTR("SCRLK") : PSTR(" "), false);
+ led_t led_state = host_keyboard_led_state();
+ oled_write_P(led_state.num_lock ? PSTR("NLCK ") : PSTR(" "), false);
+ oled_write_P(led_state.caps_lock ? PSTR("CAPS ") : PSTR(" "), false);
+ oled_write_P(led_state.scroll_lock ? PSTR("SCRLK") : PSTR(" "), false);
return false;
}
diff --git a/keyboards/marksard/treadstone48/common/oled_helper.c b/keyboards/marksard/treadstone48/common/oled_helper.c
index c3c8f23cbc..e9a8cf564a 100644
--- a/keyboards/marksard/treadstone48/common/oled_helper.c
+++ b/keyboards/marksard/treadstone48/common/oled_helper.c
@@ -43,10 +43,10 @@ void render_key_status(void) {
static char lock_buf[24] = "Lock state ready.\n";
void update_lock_status(void) {
- uint8_t leds = host_keyboard_leds();
- char *num_lock = (leds & (1<<USB_LED_NUM_LOCK)) ? "Num" : "";
- char *caps_lock = (leds & (1<<USB_LED_CAPS_LOCK)) ? "Caps" : "";
- char *scrl_lock = (leds & (1<<USB_LED_SCROLL_LOCK)) ? "Scrn" : "";
+ led_t led_state = host_keyboard_led_state();
+ char *num_lock = led_state.num_lock ? "Num" : "";
+ char *caps_lock = led_state.caps_lock ? "Caps" : "";
+ char *scrl_lock = led_state.scroll_lock ? "Scrn" : "";
snprintf(lock_buf, sizeof(lock_buf) - 1, "Lock:%s %s %s\n",
num_lock, caps_lock, scrl_lock);
}
diff --git a/keyboards/matrix/noah/noah.c b/keyboards/matrix/noah/noah.c
index 671d272d85..0969998fa9 100644
--- a/keyboards/matrix/noah/noah.c
+++ b/keyboards/matrix/noah/noah.c
@@ -32,14 +32,14 @@ void rgblight_set(void) {
}
}
if (noah_led_mode) {
- uint8_t ind_led = host_keyboard_leds();
- if (IS_LED_ON(ind_led, USB_LED_CAPS_LOCK)) {
+ led_t led_state = host_keyboard_led_state();
+ if (led_state.caps_lock) {
noah_leds[0] = led[0];
}
- if (IS_LED_ON(ind_led, USB_LED_SCROLL_LOCK)) {
+ if (led_state.scroll_lock) {
noah_leds[1] = led[1];
}
- if (IS_LED_ON(ind_led, USB_LED_NUM_LOCK)) {
+ if (led_state.num_lock) {
noah_leds[2] = led[2];
}
for (int32_t i = 0; i < 4; i++) {
diff --git a/keyboards/nullbitsco/snap/keymaps/bongo_reactive/keymap.c b/keyboards/nullbitsco/snap/keymaps/bongo_reactive/keymap.c
index 31e58c24a6..3dfe7e4057 100644
--- a/keyboards/nullbitsco/snap/keymaps/bongo_reactive/keymap.c
+++ b/keyboards/nullbitsco/snap/keymaps/bongo_reactive/keymap.c
@@ -87,27 +87,27 @@ static void render_status(void) {
// Host Keyboard LED Status
oled_set_cursor(0, 1);
- static uint8_t persistent_led_state = 0;
- uint8_t led_usb_state = host_keyboard_leds();
+ static led_t persistent_led_state = {0};
+ led_t led_state = host_keyboard_led_state();
// Only update if the LED state has changed
// Otherwise, the OLED will not turn off if an LED is on.
- if (persistent_led_state != led_usb_state) {
- persistent_led_state = led_usb_state;
+ if (persistent_led_state != led_state) {
+ persistent_led_state = led_state;
oled_write_ln_P(PSTR(""), false);
- if (IS_LED_ON(led_usb_state, USB_LED_CAPS_LOCK)) {
+ if (led_state.caps_lock) {
oled_set_cursor(0, 1);
oled_write_P(PSTR("CAPS"), false);
}
- if (IS_LED_ON(led_usb_state, USB_LED_NUM_LOCK)) {
+ if (led_state.num_lock) {
oled_set_cursor(5, 1);
oled_write_P(PSTR("NUM"), true);
}
- if (IS_LED_ON(led_usb_state, USB_LED_SCROLL_LOCK)) {
+ if (led_state.scroll_lock) {
oled_set_cursor(9, 1);
oled_write_P(PSTR("SCR"), false);
}
diff --git a/keyboards/nullbitsco/snap/keymaps/oled/keymap.c b/keyboards/nullbitsco/snap/keymaps/oled/keymap.c
index 3a48e90134..004d2f40c1 100644
--- a/keyboards/nullbitsco/snap/keymaps/oled/keymap.c
+++ b/keyboards/nullbitsco/snap/keymaps/oled/keymap.c
@@ -114,27 +114,27 @@ static void render_status(void) {
// Host Keyboard LED Status
oled_set_cursor(0, 1);
- static uint8_t persistent_led_state = 0;
- uint8_t led_usb_state = host_keyboard_leds();
+ static led_t persistent_led_state = {0};
+ led_t led_state = host_keyboard_led_state();
// Only update if the LED state has changed
// Otherwise, the OLED will not turn off if an LED is on.
- if (persistent_led_state != led_usb_state) {
- persistent_led_state = led_usb_state;
+ if (persistent_led_state != led_state) {
+ persistent_led_state = led_state;
oled_write_ln_P(PSTR(""), false);
- if (IS_LED_ON(led_usb_state, USB_LED_CAPS_LOCK)) {
+ if (led_state.caps_lock) {
oled_set_cursor(0, 1);
oled_write_P(PSTR("CAPS"), false);
}
- if (IS_LED_ON(led_usb_state, USB_LED_NUM_LOCK)) {
+ if (led_state.num_lock) {
oled_set_cursor(5, 1);
oled_write_P(PSTR("NUM"), true);
}
- if (IS_LED_ON(led_usb_state, USB_LED_SCROLL_LOCK)) {
+ if (led_state.scroll_lock) {
oled_set_cursor(9, 1);
oled_write_P(PSTR("SCR"), false);
}
diff --git a/keyboards/nullbitsco/snap/keymaps/typehud/keymap.c b/keyboards/nullbitsco/snap/keymaps/typehud/keymap.c
index 50e164f408..afdc5333ee 100644
--- a/keyboards/nullbitsco/snap/keymaps/typehud/keymap.c
+++ b/keyboards/nullbitsco/snap/keymaps/typehud/keymap.c
@@ -94,27 +94,27 @@ static void render_status(void) {
// Host Keyboard LED Status
oled_set_cursor(0, 1);
- static uint8_t persistent_led_state = 0;
- uint8_t led_usb_state = host_keyboard_leds();
+ static led_t persistent_led_state = {0};
+ led_t led_state = host_keyboard_led_state();
// Only update if the LED state has changed
// Otherwise, the OLED will not turn off if an LED is on.
- if (persistent_led_state != led_usb_state) {
- persistent_led_state = led_usb_state;
+ if (persistent_led_state != led_state) {
+ persistent_led_state = led_state;
oled_write_ln_P(PSTR(" "), false);
- if (IS_LED_ON(led_usb_state, USB_LED_CAPS_LOCK)) {
+ if (led_state.caps_lock) {
oled_set_cursor(0, 1);
oled_write_P(PSTR("CAPS"), false);
}
- if (IS_LED_ON(led_usb_state, USB_LED_NUM_LOCK)) {
+ if (led_state.num_lock) {
oled_set_cursor(5, 1);
oled_write_P(PSTR("NUM"), true);
}
- if (IS_LED_ON(led_usb_state, USB_LED_SCROLL_LOCK)) {
+ if (led_state.scroll_lock) {
oled_set_cursor(9, 1);
oled_write_P(PSTR("SCR"), false);
}
diff --git a/keyboards/nullbitsco/tidbit/keymaps/snailmap_lite/keymap.c b/keyboards/nullbitsco/tidbit/keymaps/snailmap_lite/keymap.c
index 37bbaaab32..b7236ef01b 100644
--- a/keyboards/nullbitsco/tidbit/keymaps/snailmap_lite/keymap.c
+++ b/keyboards/nullbitsco/tidbit/keymaps/snailmap_lite/keymap.c
@@ -179,13 +179,13 @@ static void render_wpm_counters(uint8_t current_wpm) {
static void render_led_status(void) {
// Host Keyboard LED Status
- uint8_t led_usb_state = host_keyboard_leds();
+ led_t led_state = host_keyboard_led_state();
oled_set_cursor(0, 8);
- oled_write_P(IS_LED_ON(led_usb_state, USB_LED_CAPS_LOCK) ? PSTR(CAPLCK_STR) : PSTR(EMPTY_STR), false);
+ oled_write_P(led_state.caps_lock ? PSTR(CAPLCK_STR) : PSTR(EMPTY_STR), false);
oled_set_cursor(0, 9);
- oled_write_P(IS_LED_ON(led_usb_state, USB_LED_NUM_LOCK) ? PSTR(NUMLCK_STR) : PSTR(EMPTY_STR), false);
+ oled_write_P(led_state.num_lock ? PSTR(NUMLCK_STR) : PSTR(EMPTY_STR), false);
oled_set_cursor(0, 10);
- oled_write_P(IS_LED_ON(led_usb_state, USB_LED_SCROLL_LOCK) ? PSTR(SCRLK_STR) : PSTR(EMPTY_STR), false);
+ oled_write_P(led_state.scroll_lock ? PSTR(SCRLK_STR) : PSTR(EMPTY_STR), false);
}
// Update WPM snail icon
diff --git a/keyboards/orange75/keymaps/default/keymap.c b/keyboards/orange75/keymaps/default/keymap.c
index c79fc918d0..d6b585145d 100644
--- a/keyboards/orange75/keymaps/default/keymap.c
+++ b/keyboards/orange75/keymaps/default/keymap.c
@@ -52,9 +52,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
-void led_set_user(uint8_t usb_led) {
+bool led_update_user(led_t led_state) {
- if (usb_led & (1 << USB_LED_NUM_LOCK)) {
+ if (led_state.num_lock) {
setPinOutput(B0);
writePinLow(B0);
} else {
@@ -62,7 +62,7 @@ void led_set_user(uint8_t usb_led) {
writePinLow(B0);
}
- if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
+ if (led_state.caps_lock) {
setPinOutput(B1);
writePinLow(B1);
} else {
@@ -70,11 +70,12 @@ void led_set_user(uint8_t usb_led) {
writePinLow(B1);
}
- if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
+ if (led_state.scroll_lock) {
setPinOutput(B2);
writePinLow(B2);
} else {
setPinInput(B2);
writePinLow(B2);
}
+ return false;
}
diff --git a/keyboards/planck/keymaps/vaire/keymap.c b/keyboards/planck/keymaps/vaire/keymap.c
index 05f7f4a520..f58486cda8 100644
--- a/keyboards/planck/keymaps/vaire/keymap.c
+++ b/keyboards/planck/keymaps/vaire/keymap.c
@@ -80,47 +80,48 @@ void matrix_init_user(void)
println("Matrix Init");
}
-void led_set_user(uint8_t usb_led)
+bool led_update_user(led_t led_state)
{
- static uint8_t old_usb_led = 0;
+ static led_t old_led_state = {0};
_delay_ms(10); // gets rid of tick
if (!is_playing_notes())
{
- if ((usb_led & (1<<USB_LED_CAPS_LOCK)) && !(old_usb_led & (1<<USB_LED_CAPS_LOCK)))
+ if (led_state.caps_lock && !old_led_state.caps_lock)
{
// If CAPS LK LED is turning on...
PLAY_SONG(tone_caps_on);
}
- else if (!(usb_led & (1<<USB_LED_CAPS_LOCK)) && (old_usb_led & (1<<USB_LED_CAPS_LOCK)))
+ else if (!led_state.caps_lock && old_led_state.caps_lock)
{
// If CAPS LK LED is turning off...
PLAY_SONG(tone_caps_off);
}
- else if ((usb_led & (1<<USB_LED_NUM_LOCK)) && !(old_usb_led & (1<<USB_LED_NUM_LOCK)))
+ else if (led_state.num_lock && !old_led_state.num_lock)
{
// If NUM LK LED is turning on...
PLAY_SONG(tone_numlk_on);
}
- else if (!(usb_led & (1<<USB_LED_NUM_LOCK)) && (old_usb_led & (1<<USB_LED_NUM_LOCK)))
+ else if (!led_state.num_lock && old_led_state.num_lock)
{
// If NUM LED is turning off...
PLAY_SONG(tone_numlk_off);
}
- else if ((usb_led & (1<<USB_LED_SCROLL_LOCK)) && !(old_usb_led & (1<<USB_LED_SCROLL_LOCK)))
+ else if (led_state.scroll_lock && !old_led_state.scroll_lock)
{
// If SCROLL LK LED is turning on...
PLAY_SONG(tone_scroll_on);
}
- else if (!(usb_led & (1<<USB_LED_SCROLL_LOCK)) && (old_usb_led & (1<<USB_LED_SCROLL_LOCK)))
+ else if (!led_state.scroll_lock && old_led_state.scroll_lock)
{
// If SCROLL LED is turning off...
PLAY_SONG(tone_scroll_off);
}
}
- old_usb_led = usb_led;
+ old_led_state = led_state;
+ return false;
}
diff --git a/keyboards/plut0nium/0x3e/keymaps/default/keymap.c b/keyboards/plut0nium/0x3e/keymaps/default/keymap.c
index 0b4c26369d..a906ebd24e 100644
--- a/keyboards/plut0nium/0x3e/keymaps/default/keymap.c
+++ b/keyboards/plut0nium/0x3e/keymaps/default/keymap.c
@@ -136,14 +136,6 @@ bool oled_task_user(void) {
oled_write_ln_P(PSTR("Undf"), false);
}
- // Host Keyboard LED Status
- // uint8_t led_usb_state = host_keyboard_leds();
- // oled_write_P(PSTR("-----"), false);
- // oled_write_P(PSTR("Stats"), false);
- // oled_write_P(led_usb_state & (1<<USB_LED_NUM_LOCK) ? PSTR("num:*") : PSTR("num:."), false);
- // oled_write_P(led_usb_state & (1<<USB_LED_CAPS_LOCK) ? PSTR("cap:*") : PSTR("cap:."), false);
- // oled_write_P(led_usb_state & (1<<USB_LED_SCROLL_LOCK) ? PSTR("scr:*") : PSTR("scr:."), false);
-
oled_write_P(PSTR("-----"), false);
render_backlight_status();
diff --git a/keyboards/primekb/prime_e/keymaps/default/keymap.c b/keyboards/primekb/prime_e/keymaps/default/keymap.c
index 08067b3132..e5e47cffc2 100644
--- a/keyboards/primekb/prime_e/keymaps/default/keymap.c
+++ b/keyboards/primekb/prime_e/keymaps/default/keymap.c
@@ -57,24 +57,18 @@ void matrix_init_user(void) {
writePinLow(B3);
}
-void led_set_user(uint8_t usb_led) {
- if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) {
+bool led_update_user(led_t led_state) {
+ if (led_state.num_lock) {
writePinHigh(B2);
} else {
writePinLow(B2);
}
- if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
+ if (led_state.caps_lock) {
writePinHigh(B1);
} else {
writePinLow(B1);
}
-/*
- if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
- writePinHigh(B3);
- } else {
- writePinLow(B3);
- }*/
-
+ return false;
}
//function for layer indicator LED
diff --git a/keyboards/primekb/prime_e/keymaps/via/keymap.c b/keyboards/primekb/prime_e/keymaps/via/keymap.c
index 2d1d003d51..09a42b0d16 100644
--- a/keyboards/primekb/prime_e/keymaps/via/keymap.c
+++ b/keyboards/primekb/prime_e/keymaps/via/keymap.c
@@ -85,24 +85,18 @@ void matrix_init_user(void) {
writePinLow(B3);
}
-void led_set_user(uint8_t usb_led) {
- if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) {
+bool led_update_user(led_t led_state) {
+ if (led_state.num_lock) {
writePinHigh(B2);
} else {
writePinLow(B2);
}
- if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
+ if (led_state.caps_lock) {
writePinHigh(B1);
} else {
writePinLow(B1);
}
-/*
- if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
- writePinHigh(B3);
- } else {
- writePinLow(B3);
- }*/
-
+ return false;
}
//function for layer indicator LED
diff --git a/keyboards/rgbkb/sol/keymaps/brianweyer/keymap.c b/keyboards/rgbkb/sol/keymaps/brianweyer/keymap.c
index c476f4c2df..194ec4de2f 100644
--- a/keyboards/rgbkb/sol/keymaps/brianweyer/keymap.c
+++ b/keyboards/rgbkb/sol/keymaps/brianweyer/keymap.c
@@ -254,10 +254,10 @@ static void render_status(void) {
}
// Host Keyboard LED Status
- uint8_t led_usb_state = host_keyboard_leds();
- oled_write_P(led_usb_state & (1<<USB_LED_NUM_LOCK) ? PSTR("NUMLOCK ") : PSTR(" "), false);
- oled_write_P(led_usb_state & (1<<USB_LED_CAPS_LOCK) ? PSTR("CAPS ") : PSTR(" "), false);
- oled_write_P(led_usb_state & (1<<USB_LED_SCROLL_LOCK) ? PSTR("SCLK ") : PSTR(" "), false);
+ led_t led_state = host_keyboard_led_state();
+ oled_write_P(led_state.num_lock ? PSTR("NUMLOCK ") : PSTR(" "), false);
+ oled_write_P(led_state.caps_lock ? PSTR("CAPS ") : PSTR(" "), false);
+ oled_write_P(led_state.scroll_lock ? PSTR("SCLK ") : PSTR(" "), false);
}
bool oled_task_user(void) {
diff --git a/keyboards/rgbkb/sol/keymaps/danielhklein/keymap.c b/keyboards/rgbkb/sol/keymaps/danielhklein/keymap.c
index 6f222dcd71..24583f0d17 100644
--- a/keyboards/rgbkb/sol/keymaps/danielhklein/keymap.c
+++ b/keyboards/rgbkb/sol/keymaps/danielhklein/keymap.c
@@ -318,10 +318,10 @@ static void render_status(void) {
}
// Host Keyboard LED Status
- uint8_t led_usb_state = host_keyboard_leds();
- oled_write_P(led_usb_state & (1<<USB_LED_NUM_LOCK) ? PSTR("NUMLOCK ") : PSTR(" "), false);
- oled_write_P(led_usb_state & (1<<USB_LED_CAPS_LOCK) ? PSTR("CAPS ") : PSTR(" "), false);
- oled_write_P(led_usb_state & (1<<USB_LED_SCROLL_LOCK) ? PSTR("SCLK ") : PSTR(" "), false);
+ led_t led_state = host_keyboard_led_state();
+ oled_write_P(led_state.num_lock ? PSTR("NUMLOCK ") : PSTR(" "), false);
+ oled_write_P(led_state.caps_lock ? PSTR("CAPS ") : PSTR(" "), false);
+ oled_write_P(led_state.scroll_lock ? PSTR("SCLK ") : PSTR(" "), false);
}
bool oled_task_user(void) {
diff --git a/keyboards/rgbkb/sol/keymaps/default/keymap.c b/keyboards/rgbkb/sol/keymaps/default/keymap.c
index 60e4873275..4a6511cbfc 100644
--- a/keyboards/rgbkb/sol/keymaps/default/keymap.c
+++ b/keyboards/rgbkb/sol/keymaps/default/keymap.c
@@ -344,11 +344,11 @@ static void render_status(void) {
}
// Host Keyboard LED Status
- uint8_t led_state = host_keyboard_leds();
+ led_t led_state = host_keyboard_led_state();
oled_write_P(PSTR("-----"), false);
- 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);
#ifdef RGB_OLED_MENU
static char buffer[31] = { 0 };
diff --git a/keyboards/rgbkb/sol/keymaps/xyverz/keymap.c b/keyboards/rgbkb/sol/keymaps/xyverz/keymap.c
index a5b62eb1da..0ef9def55d 100644
--- a/keyboards/rgbkb/sol/keymaps/xyverz/keymap.c
+++ b/keyboards/rgbkb/sol/keymaps/xyverz/keymap.c
@@ -334,11 +334,11 @@ static void render_status(void) {
}
// Host Keyboard LED Status
- uint8_t led_state = host_keyboard_leds();
+ led_t led_state = host_keyboard_led_state();
oled_write_P(PSTR("-----"), false);
- 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);
#ifdef RGB_OLED_MENU
static char buffer[31] = { 0 };
diff --git a/keyboards/rgbkb/zen/rev2/rev2.c b/keyboards/rgbkb/zen/rev2/rev2.c
index 4c308264d6..c36a32c161 100644
--- a/keyboards/rgbkb/zen/rev2/rev2.c
+++ b/keyboards/rgbkb/zen/rev2/rev2.c
@@ -40,11 +40,11 @@ void render_status(void) {
oled_write_P(layer_name_user(get_highest_layer(layer_state)), false);
// Host Keyboard LED Status
- uint8_t led_usb_state = host_keyboard_leds();
+ led_t led_state = host_keyboard_led_state();
oled_set_cursor(0, oled_max_lines() - 4); // Line 13
- oled_write_P(led_usb_state & (1<<USB_LED_NUM_LOCK) ? PSTR("NUMLK") : PSTR(" "), false); // Line 14
- oled_write_P(led_usb_state & (1<<USB_LED_CAPS_LOCK) ? PSTR("CAPLK") : PSTR(" "), false); // Line 15
- oled_write_P(led_usb_state & (1<<USB_LED_SCROLL_LOCK) ? PSTR("SCRLK") : PSTR(" "), false); // Line 16
+ oled_write_P(led_state.num_lock ? PSTR("NUMLK") : PSTR(" "), false); // Line 14
+ oled_write_P(led_state.caps_lock ? PSTR("CAPLK") : PSTR(" "), false); // Line 15
+ oled_write_P(led_state.scroll_lock ? PSTR("SCRLK") : PSTR(" "), false); // Line 16
}
oled_rotation_t oled_init_kb(oled_rotation_t rotation) {
diff --git a/keyboards/rgbkb/zygomorph/keymaps/5x6pad/keymap.c b/keyboards/rgbkb/zygomorph/keymaps/5x6pad/keymap.c
index 131ac0e820..01cccab9e5 100644
--- a/keyboards/rgbkb/zygomorph/keymaps/5x6pad/keymap.c
+++ b/keyboards/rgbkb/zygomorph/keymaps/5x6pad/keymap.c
@@ -253,10 +253,11 @@ void render_status(struct CharacterMatrix *matrix) {
// Host Keyboard LED Status
char led[40];
+ led_t led_state = host_keyboard_led_state();
snprintf(led, sizeof(led), "\n%s %s %s",
- (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ",
- (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ",
- (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " ");
+ led_state.num_lock ? "NUMLOCK" : " ",
+ led_state.caps_lock ? "CAPS" : " ",
+ led_state.scroll_lock ? "SCLK" : " ");
matrix_write(matrix, led);
}
diff --git a/keyboards/rgbkb/zygomorph/keymaps/default_oled/keymap.c b/keyboards/rgbkb/zygomorph/keymaps/default_oled/keymap.c
index 63a26989b1..c4da28ba35 100644
--- a/keyboards/rgbkb/zygomorph/keymaps/default_oled/keymap.c
+++ b/keyboards/rgbkb/zygomorph/keymaps/default_oled/keymap.c
@@ -216,10 +216,10 @@ static void render_status(void) {
}
// Host Keyboard LED Status
- uint8_t led_usb_state = host_keyboard_leds();
- oled_write_P(led_usb_state & (1<<USB_LED_NUM_LOCK) ? PSTR("NUMLCK ") : PSTR(" "), false);
- oled_write_P(led_usb_state & (1<<USB_LED_CAPS_LOCK) ? PSTR("CAPLCK ") : PSTR(" "), false);
- oled_write_ln_P(led_usb_state & (1<<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_ln_P(led_state.scroll_lock ? PSTR("SCRLCK ") : PSTR(" "), false);
}
bool oled_task_user(void) {
diff --git a/keyboards/satt/comet46/lib/host_led_state_reader.c b/keyboards/satt/comet46/lib/host_led_state_reader.c
index 758fc4c1dc..e9910e0141 100644
--- a/keyboards/satt/comet46/lib/host_led_state_reader.c
+++ b/keyboards/satt/comet46/lib/host_led_state_reader.c
@@ -4,12 +4,12 @@
char host_led_state_str[22];
const char *read_host_led_state(void) {
- uint8_t leds = host_keyboard_leds();
+ led_t led_state = host_keyboard_led_state();
snprintf(host_led_state_str, sizeof(host_led_state_str), "Lock: %s%s%s",
- (leds & (1 << USB_LED_CAPS_LOCK)) ? "CAPL " : "",
- (leds & (1 << USB_LED_SCROLL_LOCK)) ? "SCRL " : "",
- (leds & (1 << USB_LED_NUM_LOCK)) ? "NUML" : "");
+ led_state.caps_lock ? "CAPL " : "",
+ led_state.scroll_lock ? "SCRL " : "",
+ led_state.num_lock ? "NUML" : "");
return host_led_state_str;
}
diff --git a/keyboards/splitkb/kyria/keymaps/cwebster2/keymap.c b/keyboards/splitkb/kyria/keymaps/cwebster2/keymap.c
index 3a5aa429d5..e93857f4cc 100644
--- a/keyboards/splitkb/kyria/keymaps/cwebster2/keymap.c
+++ b/keyboards/splitkb/kyria/keymaps/cwebster2/keymap.c
@@ -384,10 +384,10 @@ static void render_status(void) {
oled_write_P(PSTR("\n"), false);
// Host Keyboard LED Status
- uint8_t led_usb_state = host_keyboard_leds();
- oled_write_P(IS_LED_ON(led_usb_state, USB_LED_NUM_LOCK) ? PSTR("NUMLCK ") : PSTR(" "), false);
- oled_write_P(IS_LED_ON(led_usb_state, USB_LED_CAPS_LOCK) ? PSTR("CAPLCK ") : PSTR(" "), false);
- oled_write_P(IS_LED_ON(led_usb_state, 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);
}
diff --git a/keyboards/splitkb/kyria/keymaps/shinze/keymap.c b/keyboards/splitkb/kyria/keymaps/shinze/keymap.c
index 3483410525..ecc70055b2 100644
--- a/keyboards/splitkb/kyria/keymaps/shinze/keymap.c
+++ b/keyboards/splitkb/kyria/keymaps/shinze/keymap.c
@@ -210,10 +210,10 @@ static void render_status(void) {
}
// Host Keyboard LED Status
- uint8_t led_usb_state = host_keyboard_leds();
- oled_write_P(IS_LED_ON(led_usb_state, USB_LED_NUM_LOCK) ? PSTR("NUMLCK ") : PSTR(" "), false);
- oled_write_P(IS_LED_ON(led_usb_state, USB_LED_CAPS_LOCK) ? PSTR("CAPLCK ") : PSTR(" "), false);
- oled_write_P(IS_LED_ON(led_usb_state, 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);
}
bool oled_task_user(void) {
diff --git a/keyboards/splitkb/kyria/keymaps/tessachka/keymap.c b/keyboards/splitkb/kyria/keymaps/tessachka/keymap.c
index 6720a6b35c..87f51c4cd3 100644
--- a/keyboards/splitkb/kyria/keymaps/tessachka/keymap.c
+++ b/keyboards/splitkb/kyria/keymaps/tessachka/keymap.c
@@ -225,10 +225,10 @@ static void render_status(void) {
}
// Host Keyboard LED Status
- uint8_t led_usb_state = host_keyboard_leds();
- oled_write_P(IS_LED_ON(led_usb_state, USB_LED_NUM_LOCK) ? PSTR("NUMLCK ") : PSTR(" "), false);
- oled_write_P(IS_LED_ON(led_usb_state, USB_LED_CAPS_LOCK) ? PSTR("CAPLCK ") : PSTR(" "), false);
- oled_write_P(IS_LED_ON(led_usb_state, 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);
}
bool oled_task_user(void) {
diff --git a/keyboards/splitkb/kyria/keymaps/thomasbaart/keymap.c b/keyboards/splitkb/kyria/keymaps/thomasbaart/keymap.c
index 3ed7dbee6e..14ce1b1a6e 100644
--- a/keyboards/splitkb/kyria/keymaps/thomasbaart/keymap.c
+++ b/keyboards/splitkb/kyria/keymaps/thomasbaart/keymap.c
@@ -286,10 +286,10 @@ static void render_status(void) {
}
// Host Keyboard LED Status
- uint8_t led_usb_state = host_keyboard_leds();
- oled_write_P(IS_LED_ON(led_usb_state, USB_LED_NUM_LOCK) ? PSTR("NUMLCK ") : PSTR(" "), false);
- oled_write_P(IS_LED_ON(led_usb_state, USB_LED_CAPS_LOCK) ? PSTR("CAPLCK ") : PSTR(" "), false);
- oled_write_P(IS_LED_ON(led_usb_state, 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);
}
bool oled_task_user(void) {
diff --git a/keyboards/viktus/at101_bh/keymaps/default/keymap.c b/keyboards/viktus/at101_bh/keymaps/default/keymap.c
index 692c30ac61..d05e549d21 100644
--- a/keyboards/viktus/at101_bh/keymaps/default/keymap.c
+++ b/keyboards/viktus/at101_bh/keymaps/default/keymap.c
@@ -19,26 +19,27 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
};
-void led_set_user(uint8_t usb_led) {
+bool led_update_user(led_t led_state) {
setPinOutput(B4);
setPinOutput(D6);
setPinOutput(D7);
- if (usb_led & (1 << USB_LED_NUM_LOCK)) {
+ if (led_state.num_lock) {
writePinHigh(D7);
} else {
writePinLow(D7);
}
- if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
+ if (led_state.caps_lock) {
writePinHigh(B4);
} else {
writePinLow(B4);
}
- if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
+ if (led_state.scroll_lock) {
writePinHigh(D6);
} else {
writePinLow(D6);
}
+ return false;
}
diff --git a/keyboards/viktus/omnikey_bh/keymaps/default/keymap.c b/keyboards/viktus/omnikey_bh/keymaps/default/keymap.c
index 96976ba2a3..e5fb6bf902 100644
--- a/keyboards/viktus/omnikey_bh/keymaps/default/keymap.c
+++ b/keyboards/viktus/omnikey_bh/keymaps/default/keymap.c
@@ -22,24 +22,25 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
};
-void led_set_user(uint8_t usb_led) {
+bool led_update_user(led_t led_state) {
DDRB |= (1 << 4) | (1 << 5) | (1 << 6);
- if (usb_led & (1 << USB_LED_NUM_LOCK)) {
+ if (led_state.num_lock) {
PORTB |= (1 << 4);
} else {
PORTB &= ~(1 << 4);
}
- if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
+ if (led_state.caps_lock) {
PORTB |= (1 << 5);
} else {
PORTB &= ~(1 << 5);
}
- if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
+ if (led_state.scroll_lock) {
PORTB |= (1 << 6);
} else {
PORTB &= ~(1 << 6);
}
+ return false;
}
diff --git a/keyboards/yosino58/lib/host_led_state_reader.c b/keyboards/yosino58/lib/host_led_state_reader.c
index abcfefffb4..87249d8d4f 100644
--- a/keyboards/yosino58/lib/host_led_state_reader.c
+++ b/keyboards/yosino58/lib/host_led_state_reader.c
@@ -4,11 +4,11 @@ char host_led_state_str[24];
const char *read_host_led_state(void)
{
- uint8_t leds = host_keyboard_leds();
+ led_t led_state = host_keyboard_led_state();
snprintf(host_led_state_str, sizeof(host_led_state_str), "NL:%s CL:%s SL:%s",
- (leds & (1 << USB_LED_NUM_LOCK)) ? "on" : "- ",
- (leds & (1 << USB_LED_CAPS_LOCK)) ? "on" : "- ",
- (leds & (1 << USB_LED_SCROLL_LOCK)) ? "on" : "- ");
+ led_state.num_lock ? "on" : "- ",
+ led_state.caps_lock ? "on" : "- ",
+ led_state.scroll_lock ? "on" : "- ");
return host_led_state_str;
}