From 7ff80a57cbe57e888646c3b90e2f4f9dea977156 Mon Sep 17 00:00:00 2001 From: Ryan Date: Mon, 3 Jul 2023 04:24:22 +1000 Subject: Get rid of `USB_LED_SCROLL_LOCK` (#21405) --- keyboards/ergodox_ez/keymaps/bepo_tm_style/keymap.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'keyboards/ergodox_ez') 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; } -- cgit v1.2.3