Skip to content

Commit

Permalink
Remove deprecated led_set_user (#23979)
Browse files Browse the repository at this point in the history
  • Loading branch information
zvecr committed Jun 22, 2024
1 parent 99aa4f5 commit cb39df2
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 19 deletions.
7 changes: 1 addition & 6 deletions docs/features/led_indicators.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
1 change: 0 additions & 1 deletion keyboards/converter/usb_usb/custom_matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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});
}
}
1 change: 0 additions & 1 deletion keyboards/sirius/unigo66/custom_matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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});
}

Expand Down
11 changes: 3 additions & 8 deletions quantum/led.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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);
}

Expand Down
3 changes: 0 additions & 3 deletions quantum/led.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit cb39df2

Please sign in to comment.