Remove deprecated led_set_kb (#19273)
* Remove led_set_kb maintaining existing led_set_user behaviour * Also call led_set_user
This commit is contained in:
parent
0fcf481cdd
commit
1124bbc1db
|
@ -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`:
|
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()`
|
* `uint8_t host_keyboard_leds()`
|
||||||
|
|
||||||
## Configuration Options
|
## Configuration Options
|
||||||
|
|
|
@ -188,7 +188,7 @@ The following functions are typically defined in this file:
|
||||||
* `void matrix_init_kb(void)`
|
* `void matrix_init_kb(void)`
|
||||||
* `void matrix_scan_kb(void)`
|
* `void matrix_scan_kb(void)`
|
||||||
* `bool process_record_kb(uint16_t keycode, keyrecord_t *record)`
|
* `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>`
|
### `<keyboard_name.h>`
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ QMK は HID 仕様で定義された5つの LED の読み取りメソッドを
|
||||||
|
|
||||||
LED の状態を `uint8_t` として提供する2つの非推奨の関数があります:
|
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()`
|
* `uint8_t host_keyboard_leds()`
|
||||||
|
|
||||||
## 設定オプション :id=configuration-options
|
## 設定オプション :id=configuration-options
|
||||||
|
|
|
@ -165,7 +165,7 @@ Clueboard は、サブフォルダをまとめるためとキーボードのリ
|
||||||
* `void matrix_init_kb(void)`
|
* `void matrix_init_kb(void)`
|
||||||
* `void matrix_scan_kb(void)`
|
* `void matrix_scan_kb(void)`
|
||||||
* `bool process_record_kb(uint16_t keycode, keyrecord_t *record)`
|
* `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>`
|
### `<keyboard_name.h>`
|
||||||
|
|
||||||
|
|
|
@ -95,13 +95,13 @@ void matrix_scan_user(void) {
|
||||||
current_layer_global = layer;
|
current_layer_global = layer;
|
||||||
|
|
||||||
// unset CAPSLOCK and SCROLL LOCK LEDs
|
// unset CAPSLOCK and SCROLL LOCK LEDs
|
||||||
led_set_kb(host_keyboard_leds() & ~(1<<USB_LED_CAPS_LOCK));
|
led_set(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_SCROLL_LOCK));
|
||||||
// set SCROLL LOCK LED when the mouse layer is active, CAPS LOCK when PROG layer is active
|
// set SCROLL LOCK LED when the mouse layer is active, CAPS LOCK when PROG layer is active
|
||||||
if (layer == MOUSE1 || layer == MOUSE2) {
|
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) {
|
} 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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -233,6 +233,7 @@ 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_kb(usb_led);
|
led_set_user(usb_led);
|
||||||
|
led_update_kb((led_t)usb_led)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,11 @@ void backlight_set(uint8_t level) {
|
||||||
level & BACKLIGHT_RGBBLUE ? (PORTD |= 0b00010000) : (PORTD &= ~0b00010000);
|
level & BACKLIGHT_RGBBLUE ? (PORTD |= 0b00010000) : (PORTD &= ~0b00010000);
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
||||||
backlight_os_state & (1<<USB_LED_CAPS_LOCK) ? (PORTB &= ~0b00000001) : (PORTB |= 0b00000001);
|
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_SCROLL_LOCK) ? (PORTB &= ~0b00010000) : (PORTB |= 0b00010000);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,9 @@ void backlight_set(uint8_t level) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Port from backlight_update_state
|
// 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] = {
|
bool status[7] = {
|
||||||
backlight_os_state & (1<<USB_LED_CAPS_LOCK),
|
backlight_os_state & (1<<USB_LED_CAPS_LOCK),
|
||||||
backlight_os_state & (1<<USB_LED_SCROLL_LOCK),
|
backlight_os_state & (1<<USB_LED_SCROLL_LOCK),
|
||||||
|
@ -110,4 +112,6 @@ void led_set_kb(uint8_t usb_led) {
|
||||||
indicator_leds_set(status);
|
indicator_leds_set(status);
|
||||||
backlight_os_state & (1<<USB_LED_CAPS_LOCK) ? (PORTB &= ~0b00000001) : (PORTB |= 0b00000001);
|
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_SCROLL_LOCK) ? (PORTB &= ~0b00010000) : (PORTB |= 0b00010000);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,9 @@ void backlight_set(uint8_t level) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// // Port from backlight_update_state
|
// // 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] = {
|
// bool status[7] = {
|
||||||
// backlight_os_state & (1<<USB_LED_CAPS_LOCK),
|
// backlight_os_state & (1<<USB_LED_CAPS_LOCK),
|
||||||
// backlight_os_state & (1<<USB_LED_SCROLL_LOCK),
|
// backlight_os_state & (1<<USB_LED_SCROLL_LOCK),
|
||||||
|
@ -114,6 +116,8 @@ void backlight_set(uint8_t level) {
|
||||||
// backlight_os_state & (1<<USB_LED_CAPS_LOCK) ? (PORTB &= ~0b00000001) : (PORTB |= 0b00000001);
|
// 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_SCROLL_LOCK) ? (PORTB &= ~0b00010000) : (PORTB |= 0b00010000);
|
||||||
// }
|
// }
|
||||||
|
// return res;
|
||||||
|
// }
|
||||||
|
|
||||||
// U5 Pin 1, 2, 3 connected to top left LEDs
|
// U5 Pin 1, 2, 3 connected to top left LEDs
|
||||||
|
|
||||||
|
|
|
@ -1,32 +1,15 @@
|
||||||
#include "oe.h"
|
#include "oe.h"
|
||||||
|
|
||||||
void led_set_kb(uint8_t usb_led) {
|
void led_init_ports(void) {
|
||||||
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
|
setPinOutput(B2);
|
||||||
DDRB |= (1<<6);
|
setPinOutput(B6);
|
||||||
if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
|
}
|
||||||
// output low
|
|
||||||
DDRB |= (1<<2);
|
bool led_update_kb(led_t led_state) {
|
||||||
PORTB &= ~(1<<2);
|
bool res = led_update_user(led_state);
|
||||||
} else {
|
if(res) {
|
||||||
// Hi-Z
|
writePin(B2, !led_state.caps_lock);
|
||||||
DDRB &= ~(1<<2);
|
writePin(B6, led_state == 0);
|
||||||
PORTB &= ~(1<<2);
|
}
|
||||||
}
|
return res;
|
||||||
// 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);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,7 +220,8 @@ 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_kb(usb_led);
|
led_set_user(usb_led);
|
||||||
|
led_update_kb((led_t)usb_led)
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -23,14 +23,6 @@ In `qmk_firmware/keyboards/lets_split/rev2/rev2.c`, replace contents with
|
||||||
```
|
```
|
||||||
#include "lets_split.h"
|
#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) {
|
void matrix_init_kb(void) {
|
||||||
|
|
||||||
// // green led on
|
// // green led on
|
||||||
|
|
|
@ -69,14 +69,6 @@ uint32_t last_led_activity_elapsed(void) {
|
||||||
*/
|
*/
|
||||||
__attribute__((weak)) void led_set_user(uint8_t usb_led) {}
|
__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
|
/** \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.
|
||||||
|
@ -154,7 +146,7 @@ __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_kb(usb_led);
|
led_set_user(usb_led);
|
||||||
led_update_kb((led_t)usb_led);
|
led_update_kb((led_t)usb_led);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,9 +55,10 @@ void led_wakeup(void);
|
||||||
|
|
||||||
void led_task(void);
|
void led_task(void);
|
||||||
|
|
||||||
/* Callbacks */
|
/* Deprecated callbacks */
|
||||||
void led_set_user(uint8_t usb_led);
|
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_user(led_t led_state);
|
||||||
bool led_update_kb(led_t led_state);
|
bool led_update_kb(led_t led_state);
|
||||||
void led_update_ports(led_t led_state);
|
void led_update_ports(led_t led_state);
|
||||||
|
|
Loading…
Reference in New Issue