Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated led_set_user #23979

Merged
merged 1 commit into from
Jun 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading