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/yiancardesigns/gingham/gingham.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'keyboards/yiancardesigns') diff --git a/keyboards/yiancardesigns/gingham/gingham.c b/keyboards/yiancardesigns/gingham/gingham.c index 9a5ffe4530..a70ca71df0 100644 --- a/keyboards/yiancardesigns/gingham/gingham.c +++ b/keyboards/yiancardesigns/gingham/gingham.c @@ -27,14 +27,11 @@ void matrix_init_kb(void) { matrix_init_user(); } -void led_set_kb(uint8_t usb_led) { - // Bit 3 is Green LED, bit 4 is Red LED. - if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { - send_data = 0x18; - } else { - send_data = 0x10; +bool led_update_kb(led_t led_state) { + bool res = led_update_user(led_state); + if(res) { + send_data = led_state.caps_lock ? 0x18 : 0x10; + i2c_writeReg((PORT_EXPANDER_ADDRESS << 1), 0x09, &send_data, 1, 20); } - i2c_writeReg((PORT_EXPANDER_ADDRESS << 1), 0x09, &send_data, 1, 20); - - led_set_user(usb_led); + return res; } -- cgit v1.2.3