Remove deprecated led_set_user (#23979)

This commit is contained in:
Joel Challis 2024-06-22 09:10:58 +01:00 committed by GitHub
parent 99aa4f5191
commit cb39df273d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 4 additions and 19 deletions

View file

@ -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. 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()` * `uint8_t host_keyboard_leds()`
## Configuration Options ## 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. 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 ### Example of keyboard LED update implementation
This is a template indicator function that can be implemented on keyboard level code: This is a template indicator function that can be implemented on keyboard level code:

View file

@ -229,7 +229,6 @@ extern "C" {
if (kbd2.isReady()) kbd2.SetReport(0, 0, 2, 0, 1, &usb_led); 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 (kbd3.isReady()) kbd3.SetReport(0, 0, 2, 0, 1, &usb_led);
if (kbd4.isReady()) kbd4.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}); led_update_kb((led_t){.raw = usb_led});
} }
} }

View file

@ -216,7 +216,6 @@ extern "C"
kbd2.SetReport(0, 0, 2, 0, 1, &usb_led); kbd2.SetReport(0, 0, 2, 0, 1, &usb_led);
kbd3.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); kbd4.SetReport(0, 0, 2, 0, 1, &usb_led);
led_set_user(usb_led);
led_update_kb((led_t){.raw = usb_led}); led_update_kb((led_t){.raw = usb_led});
} }

View file

@ -56,19 +56,15 @@ static void handle_backlight_caps_lock(led_t led_state) {
#endif #endif
static uint32_t last_led_modification_time = 0; 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; return last_led_modification_time;
} }
uint32_t last_led_activity_elapsed(void) { uint32_t last_led_activity_elapsed(void) {
return timer_elapsed32(last_led_modification_time); 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 /** \brief Lock LED update callback - keymap/user level
* *
* \return True if led_update_kb() should run its own code, false otherwise. * \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); handle_backlight_caps_lock((led_t)usb_led);
#endif #endif
led_set_user(usb_led);
led_update_kb((led_t)usb_led); led_update_kb((led_t)usb_led);
} }

View file

@ -48,9 +48,6 @@ void led_wakeup(void);
void led_task(void); void led_task(void);
/* Deprecated callbacks */
void led_set_user(uint8_t usb_led);
/* Callbacks */ /* Callbacks */
bool led_update_user(led_t led_state); bool led_update_user(led_t led_state);
bool led_update_kb(led_t led_state); bool led_update_kb(led_t led_state);