diff options
author | Joel Challis <git@zvecr.com> | 2022-12-14 11:14:10 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-14 11:14:10 +0000 |
commit | 1124bbc1db8fb26418bded7016c702de469b162f (patch) | |
tree | 6486fdf3ddcd39355af2a94b8998e57dc1d239cc | |
parent | 0fcf481cdd2a350b628462201b0a725df6c72b2b (diff) |
Remove deprecated led_set_kb (#19273)
* Remove led_set_kb maintaining existing led_set_user behaviour
* Also call led_set_user
-rw-r--r-- | docs/feature_led_indicators.md | 2 | ||||
-rw-r--r-- | docs/hardware_keyboard_guidelines.md | 2 | ||||
-rw-r--r-- | docs/ja/feature_led_indicators.md | 2 | ||||
-rw-r--r-- | docs/ja/hardware_keyboard_guidelines.md | 2 | ||||
-rw-r--r-- | keyboards/bpiphany/kitten_paw/keymaps/ickerwx/keymap.c | 8 | ||||
-rw-r--r-- | keyboards/converter/usb_usb/custom_matrix.cpp | 3 | ||||
-rw-r--r-- | keyboards/duck/octagon/v1/v1.c | 10 | ||||
-rw-r--r-- | keyboards/duck/octagon/v2/v2.c | 28 | ||||
-rw-r--r-- | keyboards/duck/tcv3/tcv3.c | 30 | ||||
-rw-r--r-- | keyboards/exclusive/e6v2/oe/oe.c | 41 | ||||
-rw-r--r-- | keyboards/sirius/unigo66/custom_matrix.cpp | 3 | ||||
-rw-r--r-- | layouts/community/ortho_4x12/wanleg/readme.md | 8 | ||||
-rw-r--r-- | quantum/led.c | 10 | ||||
-rw-r--r-- | quantum/led.h | 5 |
14 files changed, 68 insertions, 86 deletions
diff --git a/docs/feature_led_indicators.md b/docs/feature_led_indicators.md index d89562a377..1f71cdb1c8 100644 --- a/docs/feature_led_indicators.md +++ b/docs/feature_led_indicators.md @@ -19,7 +19,7 @@ There are three ways to get the lock LED state: Two deprecated functions that provide the LED state as `uint8_t`: -* `uint8_t led_set_kb(uint8_t usb_led)` and `_user(uint8_t usb_led)` +* `uint8_t led_set_user(uint8_t usb_led)` * `uint8_t host_keyboard_leds()` ## Configuration Options diff --git a/docs/hardware_keyboard_guidelines.md b/docs/hardware_keyboard_guidelines.md index 6df86fb0fb..247ec9982f 100644 --- a/docs/hardware_keyboard_guidelines.md +++ b/docs/hardware_keyboard_guidelines.md @@ -188,7 +188,7 @@ The following functions are typically defined in this file: * `void matrix_init_kb(void)` * `void matrix_scan_kb(void)` * `bool process_record_kb(uint16_t keycode, keyrecord_t *record)` -* `void led_set_kb(uint8_t usb_led)` +* `bool led_update_kb(led_t led_state)` ### `<keyboard_name.h>` diff --git a/docs/ja/feature_led_indicators.md b/docs/ja/feature_led_indicators.md index 764b478c31..94ee063234 100644 --- a/docs/ja/feature_led_indicators.md +++ b/docs/ja/feature_led_indicators.md @@ -22,7 +22,7 @@ QMK は HID 仕様で定義された5つの LED の読み取りメソッドを LED の状態を `uint8_t` として提供する2つの非推奨の関数があります: -* `uint8_t led_set_kb(uint8_t usb_led)` と `_user(uint8_t usb_led)` +* `uint8_t led_set_user(uint8_t usb_led)` * `uint8_t host_keyboard_leds()` ## 設定オプション :id=configuration-options diff --git a/docs/ja/hardware_keyboard_guidelines.md b/docs/ja/hardware_keyboard_guidelines.md index c0e7c18be0..ef5f6df2b9 100644 --- a/docs/ja/hardware_keyboard_guidelines.md +++ b/docs/ja/hardware_keyboard_guidelines.md @@ -165,7 +165,7 @@ Clueboard は、サブフォルダをまとめるためとキーボードのリ * `void matrix_init_kb(void)` * `void matrix_scan_kb(void)` * `bool process_record_kb(uint16_t keycode, keyrecord_t *record)` -* `void led_set_kb(uint8_t usb_led)` +* `bool led_update_kb(led_t led_state)` ### `<keyboard_name.h>` diff --git a/keyboards/bpiphany/kitten_paw/keymaps/ickerwx/keymap.c b/keyboards/bpiphany/kitten_paw/keymaps/ickerwx/keymap.c index 3f858734c9..7d4c53c61f 100644 --- a/keyboards/bpiphany/kitten_paw/keymaps/ickerwx/keymap.c +++ b/keyboards/bpiphany/kitten_paw/keymaps/ickerwx/keymap.c @@ -95,13 +95,13 @@ void matrix_scan_user(void) { current_layer_global = layer; // unset CAPSLOCK and SCROLL LOCK LEDs - led_set_kb(host_keyboard_leds() & ~(1<<USB_LED_CAPS_LOCK)); - led_set_kb(host_keyboard_leds() & ~(1<<USB_LED_SCROLL_LOCK)); + led_set(host_keyboard_leds() & ~(1<<USB_LED_CAPS_LOCK)); + led_set(host_keyboard_leds() & ~(1<<USB_LED_SCROLL_LOCK)); // set SCROLL LOCK LED when the mouse layer is active, CAPS LOCK when PROG layer is active if (layer == MOUSE1 || layer == MOUSE2) { - led_set_kb(host_keyboard_leds() | (1<<USB_LED_SCROLL_LOCK)); + led_set(host_keyboard_leds() | (1<<USB_LED_SCROLL_LOCK)); } else if (layer == PROG1 || layer == PROG2) { - led_set_kb(host_keyboard_leds() | (1<<USB_LED_CAPS_LOCK)); + led_set(host_keyboard_leds() | (1<<USB_LED_CAPS_LOCK)); } } } diff --git a/keyboards/converter/usb_usb/custom_matrix.cpp b/keyboards/converter/usb_usb/custom_matrix.cpp index a92feeb6c1..1463f27b86 100644 --- a/keyboards/converter/usb_usb/custom_matrix.cpp +++ b/keyboards/converter/usb_usb/custom_matrix.cpp @@ -233,6 +233,7 @@ 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_kb(usb_led); + led_set_user(usb_led); + led_update_kb((led_t)usb_led) } } diff --git a/keyboards/duck/octagon/v1/v1.c b/keyboards/duck/octagon/v1/v1.c index e9e88c70d0..575847f588 100644 --- a/keyboards/duck/octagon/v1/v1.c +++ b/keyboards/duck/octagon/v1/v1.c @@ -40,7 +40,11 @@ void backlight_set(uint8_t level) { level & BACKLIGHT_RGBBLUE ? (PORTD |= 0b00010000) : (PORTD &= ~0b00010000); } -void led_set_kb(uint8_t usb_led) { - backlight_os_state & (1<<USB_LED_CAPS_LOCK) ? (PORTB &= ~0b00000001) : (PORTB |= 0b00000001); - backlight_os_state & (1<<USB_LED_SCROLL_LOCK) ? (PORTB &= ~0b00010000) : (PORTB |= 0b00010000); +bool led_update_kb(led_t led_state) { + bool res = led_update_user(led_state); + if(res) { + backlight_os_state & (1<<USB_LED_CAPS_LOCK) ? (PORTB &= ~0b00000001) : (PORTB |= 0b00000001); + backlight_os_state & (1<<USB_LED_SCROLL_LOCK) ? (PORTB &= ~0b00010000) : (PORTB |= 0b00010000); + } + return res; } diff --git a/keyboards/duck/octagon/v2/v2.c b/keyboards/duck/octagon/v2/v2.c index 23e92b2769..19bef7f877 100644 --- a/keyboards/duck/octagon/v2/v2.c +++ b/keyboards/duck/octagon/v2/v2.c @@ -97,17 +97,21 @@ void backlight_set(uint8_t level) { } // Port from backlight_update_state -void led_set_kb(uint8_t usb_led) { +bool led_update_kb(led_t led_state) { + bool res = led_update_user(led_state); + if(res) { bool status[7] = { - backlight_os_state & (1<<USB_LED_CAPS_LOCK), - backlight_os_state & (1<<USB_LED_SCROLL_LOCK), - backlight_os_state & (1<<USB_LED_NUM_LOCK), - backlight_layer_state & (1<<1), - backlight_layer_state & (1<<2), - backlight_layer_state & (1<<3), - backlight_layer_state & (1<<4) - }; - indicator_leds_set(status); - backlight_os_state & (1<<USB_LED_CAPS_LOCK) ? (PORTB &= ~0b00000001) : (PORTB |= 0b00000001); - backlight_os_state & (1<<USB_LED_SCROLL_LOCK) ? (PORTB &= ~0b00010000) : (PORTB |= 0b00010000); + backlight_os_state & (1<<USB_LED_CAPS_LOCK), + backlight_os_state & (1<<USB_LED_SCROLL_LOCK), + backlight_os_state & (1<<USB_LED_NUM_LOCK), + backlight_layer_state & (1<<1), + backlight_layer_state & (1<<2), + backlight_layer_state & (1<<3), + backlight_layer_state & (1<<4) + }; + indicator_leds_set(status); + backlight_os_state & (1<<USB_LED_CAPS_LOCK) ? (PORTB &= ~0b00000001) : (PORTB |= 0b00000001); + backlight_os_state & (1<<USB_LED_SCROLL_LOCK) ? (PORTB &= ~0b00010000) : (PORTB |= 0b00010000); + } + return res; } diff --git a/keyboards/duck/tcv3/tcv3.c b/keyboards/duck/tcv3/tcv3.c index 4d52d22c11..805d2b75d5 100644 --- a/keyboards/duck/tcv3/tcv3.c +++ b/keyboards/duck/tcv3/tcv3.c @@ -100,19 +100,23 @@ void backlight_set(uint8_t level) { } // // Port from backlight_update_state -// void led_set_kb(uint8_t usb_led) { -// bool status[7] = { -// backlight_os_state & (1<<USB_LED_CAPS_LOCK), -// backlight_os_state & (1<<USB_LED_SCROLL_LOCK), -// backlight_os_state & (1<<USB_LED_NUM_LOCK), -// backlight_layer_state & (1<<1), -// backlight_layer_state & (1<<2), -// backlight_layer_state & (1<<3), -// backlight_layer_state & (1<<4) -// }; -// indicator_leds_set(status); -// backlight_os_state & (1<<USB_LED_CAPS_LOCK) ? (PORTB &= ~0b00000001) : (PORTB |= 0b00000001); -// backlight_os_state & (1<<USB_LED_SCROLL_LOCK) ? (PORTB &= ~0b00010000) : (PORTB |= 0b00010000); +// bool led_update_kb(led_t led_state) { +// bool res = led_update_user(led_state); +// if(res) { +// bool status[7] = { +// backlight_os_state & (1<<USB_LED_CAPS_LOCK), +// backlight_os_state & (1<<USB_LED_SCROLL_LOCK), +// backlight_os_state & (1<<USB_LED_NUM_LOCK), +// backlight_layer_state & (1<<1), +// backlight_layer_state & (1<<2), +// backlight_layer_state & (1<<3), +// backlight_layer_state & (1<<4) +// }; +// indicator_leds_set(status); +// backlight_os_state & (1<<USB_LED_CAPS_LOCK) ? (PORTB &= ~0b00000001) : (PORTB |= 0b00000001); +// backlight_os_state & (1<<USB_LED_SCROLL_LOCK) ? (PORTB &= ~0b00010000) : (PORTB |= 0b00010000); +// } +// return res; // } // U5 Pin 1, 2, 3 connected to top left LEDs diff --git a/keyboards/exclusive/e6v2/oe/oe.c b/keyboards/exclusive/e6v2/oe/oe.c index 3c6627894f..2570bc101a 100644 --- a/keyboards/exclusive/e6v2/oe/oe.c +++ b/keyboards/exclusive/e6v2/oe/oe.c @@ -1,32 +1,15 @@ #include "oe.h" -void led_set_kb(uint8_t usb_led) { - // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here - DDRB |= (1<<6); - if (usb_led & (1<<USB_LED_CAPS_LOCK)) { - // output low - DDRB |= (1<<2); - PORTB &= ~(1<<2); - } else { - // Hi-Z - DDRB &= ~(1<<2); - PORTB &= ~(1<<2); - } - // DDRB |= (1<<7); - // DDRB |= (1<<1); - // DDRB |= (1<<3); - // DDRE |= (1<<6); - if (usb_led == 0){ - PORTB |= (1<<6); - // PORTB |= (1<<7); - // PORTB |= (1<<1); - // PORTB |= (1<<3); - // PORTE |= (1<<6); - } - else{ - PORTB &= ~(1<<6); - // PORTB &= ~(1<<7); - } - - led_set_user(usb_led); +void led_init_ports(void) { + setPinOutput(B2); + setPinOutput(B6); +} + +bool led_update_kb(led_t led_state) { + bool res = led_update_user(led_state); + if(res) { + writePin(B2, !led_state.caps_lock); + writePin(B6, led_state == 0); + } + return res; } diff --git a/keyboards/sirius/unigo66/custom_matrix.cpp b/keyboards/sirius/unigo66/custom_matrix.cpp index 72e120400f..a399312b7d 100644 --- a/keyboards/sirius/unigo66/custom_matrix.cpp +++ b/keyboards/sirius/unigo66/custom_matrix.cpp @@ -220,7 +220,8 @@ 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_kb(usb_led); + led_set_user(usb_led); + led_update_kb((led_t)usb_led) } }; diff --git a/layouts/community/ortho_4x12/wanleg/readme.md b/layouts/community/ortho_4x12/wanleg/readme.md index 1cd41d116d..3fc1fc65ad 100644 --- a/layouts/community/ortho_4x12/wanleg/readme.md +++ b/layouts/community/ortho_4x12/wanleg/readme.md @@ -23,14 +23,6 @@ In `qmk_firmware/keyboards/lets_split/rev2/rev2.c`, replace contents with ``` #include "lets_split.h" - -#ifdef SSD1306OLED -void led_set_kb(uint8_t usb_led) { - // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here - led_set_user(usb_led); -} -#endif - void matrix_init_kb(void) { // // green led on diff --git a/quantum/led.c b/quantum/led.c index 7db38bb88c..42144566fd 100644 --- a/quantum/led.c +++ b/quantum/led.c @@ -69,14 +69,6 @@ uint32_t last_led_activity_elapsed(void) { */ __attribute__((weak)) void led_set_user(uint8_t usb_led) {} -/** \brief Lock LED set callback - keyboard level - * - * \deprecated Use led_update_kb() instead. - */ -__attribute__((weak)) void led_set_kb(uint8_t usb_led) { - led_set_user(usb_led); -} - /** \brief Lock LED update callback - keymap/user level * * \return True if led_update_kb() should run its own code, false otherwise. @@ -154,7 +146,7 @@ __attribute__((weak)) void led_set(uint8_t usb_led) { handle_backlight_caps_lock((led_t)usb_led); #endif - led_set_kb(usb_led); + led_set_user(usb_led); led_update_kb((led_t)usb_led); } diff --git a/quantum/led.h b/quantum/led.h index d12e519ea2..b9ad7ed9ae 100644 --- a/quantum/led.h +++ b/quantum/led.h @@ -55,9 +55,10 @@ void led_wakeup(void); void led_task(void); -/* Callbacks */ +/* Deprecated callbacks */ void led_set_user(uint8_t usb_led); -void led_set_kb(uint8_t usb_led); + +/* Callbacks */ bool led_update_user(led_t led_state); bool led_update_kb(led_t led_state); void led_update_ports(led_t led_state); |