From cb39df273de782be1145dc5184bfd47d823531d5 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Sat, 22 Jun 2024 09:10:58 +0100 Subject: [PATCH] Remove deprecated `led_set_user` (#23979) --- docs/features/led_indicators.md | 7 +------ keyboards/converter/usb_usb/custom_matrix.cpp | 1 - keyboards/sirius/unigo66/custom_matrix.cpp | 1 - quantum/led.c | 11 +++-------- quantum/led.h | 3 --- 5 files changed, 4 insertions(+), 19 deletions(-) diff --git a/docs/features/led_indicators.md b/docs/features/led_indicators.md index 8435c69a552..211fda25815 100644 --- a/docs/features/led_indicators.md +++ b/docs/features/led_indicators.md @@ -21,9 +21,8 @@ There are three ways to get the lock LED state: The `host_keyboard_led_state()` may reflect an updated state before `led_update_user()` is called. ::: -Two deprecated functions that provide the LED state as `uint8_t`: +Deprecated functions that provide the LED state as `uint8_t`: -* `uint8_t led_set_user(uint8_t usb_led)` * `uint8_t host_keyboard_leds()` ## Configuration Options @@ -50,10 +49,6 @@ When the configuration options do not provide enough flexibility, the following Both receives LED state as a struct parameter. Returning `true` in `led_update_user()` will allow the keyboard level code in `led_update_kb()` to run as well. Returning `false` will override the keyboard level code, depending on how the keyboard level function is set up. -::: tip -This boolean return type of `led_update_user` allows for overriding keyboard LED controls, and is thus recommended over the void `led_set_user` function. -::: - ### Example of keyboard LED update implementation This is a template indicator function that can be implemented on keyboard level code: diff --git a/keyboards/converter/usb_usb/custom_matrix.cpp b/keyboards/converter/usb_usb/custom_matrix.cpp index ca0855a82b9..e1ef6955707 100644 --- a/keyboards/converter/usb_usb/custom_matrix.cpp +++ b/keyboards/converter/usb_usb/custom_matrix.cpp @@ -229,7 +229,6 @@ extern "C" { if (kbd2.isReady()) kbd2.SetReport(0, 0, 2, 0, 1, &usb_led); if (kbd3.isReady()) kbd3.SetReport(0, 0, 2, 0, 1, &usb_led); if (kbd4.isReady()) kbd4.SetReport(0, 0, 2, 0, 1, &usb_led); - led_set_user(usb_led); led_update_kb((led_t){.raw = usb_led}); } } diff --git a/keyboards/sirius/unigo66/custom_matrix.cpp b/keyboards/sirius/unigo66/custom_matrix.cpp index 25648a5f78e..879a0e7c153 100644 --- a/keyboards/sirius/unigo66/custom_matrix.cpp +++ b/keyboards/sirius/unigo66/custom_matrix.cpp @@ -216,7 +216,6 @@ extern "C" kbd2.SetReport(0, 0, 2, 0, 1, &usb_led); kbd3.SetReport(0, 0, 2, 0, 1, &usb_led); kbd4.SetReport(0, 0, 2, 0, 1, &usb_led); - led_set_user(usb_led); led_update_kb((led_t){.raw = usb_led}); } diff --git a/quantum/led.c b/quantum/led.c index e2b59851099..aec3edc8235 100644 --- a/quantum/led.c +++ b/quantum/led.c @@ -56,19 +56,15 @@ static void handle_backlight_caps_lock(led_t led_state) { #endif static uint32_t last_led_modification_time = 0; -uint32_t last_led_activity_time(void) { + +uint32_t last_led_activity_time(void) { return last_led_modification_time; } + uint32_t last_led_activity_elapsed(void) { return timer_elapsed32(last_led_modification_time); } -/** \brief Lock LED set callback - keymap/user level - * - * \deprecated Use led_update_user() instead. - */ -__attribute__((weak)) void led_set_user(uint8_t usb_led) {} - /** \brief Lock LED update callback - keymap/user level * * \return True if led_update_kb() should run its own code, false otherwise. @@ -146,7 +142,6 @@ __attribute__((weak)) void led_set(uint8_t usb_led) { handle_backlight_caps_lock((led_t)usb_led); #endif - led_set_user(usb_led); led_update_kb((led_t)usb_led); } diff --git a/quantum/led.h b/quantum/led.h index b9fad670aeb..669e93e1944 100644 --- a/quantum/led.h +++ b/quantum/led.h @@ -48,9 +48,6 @@ void led_wakeup(void); void led_task(void); -/* Deprecated callbacks */ -void led_set_user(uint8_t usb_led); - /* Callbacks */ bool led_update_user(led_t led_state); bool led_update_kb(led_t led_state);