From 99cd0b13e109bb14f1e5af023c5fcb5e50a78e0a Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Fri, 9 Dec 2022 01:42:22 +0000 Subject: Refactor some led_set_kb instances (#19179) * Refactor some led_set_kb instances * Apply suggestions from code review Co-authored-by: Ryan Co-authored-by: Ryan --- keyboards/kinesis/alvicstep/alvicstep.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'keyboards/kinesis') diff --git a/keyboards/kinesis/alvicstep/alvicstep.c b/keyboards/kinesis/alvicstep/alvicstep.c index 735032d6a4..a2a62df36a 100644 --- a/keyboards/kinesis/alvicstep/alvicstep.c +++ b/keyboards/kinesis/alvicstep/alvicstep.c @@ -70,19 +70,20 @@ void blink_all_leds(void) matrix_init_user(); } -void led_set_kb(uint8_t usb_led) { - // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here +bool led_update_kb(led_t led_state) { + bool res = led_update_user(led_state); + if(res) { //Copyright 2014 Warren Janssens - uint8_t leds = 0xF0; - if (usb_led & 1 << USB_LED_NUM_LOCK) - leds &= ~0x10; - if (usb_led & 1 << USB_LED_CAPS_LOCK) - leds &= ~0x80; - if (usb_led & 1 << USB_LED_SCROLL_LOCK) - leds &= ~0x20; - PORTD = (PORTD & 0x0F) | leds; - - led_set_user(usb_led); - + uint8_t leds = 0xF0; + if (led_state.num_lock) + leds &= ~0x10; + if (led_state.caps_lock) + leds &= ~0x80; + if (led_state.scroll_lock) + leds &= ~0x20; + PORTD = (PORTD & 0x0F) | leds; + + } + return res; } -- cgit v1.2.3