mirror of
https://github.com/firewalkwithm3/qmk_firmware.git
synced 2024-11-22 03:21:48 +08:00
Remove deprecated led_set_user
(#23979)
This commit is contained in:
parent
99aa4f5191
commit
cb39df273d
|
@ -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:
|
||||
|
|
|
@ -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});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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});
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue