Update keyboards to implement led_update_kb instead of led_set (#26388)

This commit is contained in:
Joel Challis
2026-08-08 23:06:15 +01:00
committed by GitHub
parent a3658c1f09
commit c7d8bdfce5
5 changed files with 32 additions and 41 deletions
+13
View File
@@ -0,0 +1,13 @@
// Copyright 2011 Jun Wako <wakojun@gmail.com>
// SPDX-License-Identifier: GPL-2.0-or-later
#include "led.h"
#include "adb.h"
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
adb_host_kbd_led(~led_state.raw);
}
return res;
}
-27
View File
@@ -1,27 +0,0 @@
/*
Copyright 2011 Jun Wako <wakojun@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include <util/delay.h>
#include "adb.h"
#include "led.h"
void led_set(uint8_t usb_led)
{
adb_host_kbd_led(~usb_led);
}
+1 -1
View File
@@ -1,5 +1,5 @@
CUSTOM_MATRIX = yes
SRC += matrix.c adb.c led.c
SRC += matrix.c adb.c
# OPT_DEFS += -DADB_MOUSE_ENABLE -DMOUSE_ENABLE
@@ -224,11 +224,14 @@ extern "C" {
}
}
void led_set(uint8_t usb_led) {
if (kbd1.isReady()) kbd1.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 (kbd4.isReady()) kbd4.SetReport(0, 0, 2, 0, 1, &usb_led);
led_update_kb((led_t){.raw = usb_led});
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
if (kbd1.isReady()) kbd1.SetReport(0, 0, 2, 0, 1, &led_state.raw);
if (kbd2.isReady()) kbd2.SetReport(0, 0, 2, 0, 1, &led_state.raw);
if (kbd3.isReady()) kbd3.SetReport(0, 0, 2, 0, 1, &led_state.raw);
if (kbd4.isReady()) kbd4.SetReport(0, 0, 2, 0, 1, &led_state.raw);
}
return res;
}
}
+9 -7
View File
@@ -210,13 +210,15 @@ extern "C"
}
}
void led_set(uint8_t usb_led)
{
kbd1.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);
kbd4.SetReport(0, 0, 2, 0, 1, &usb_led);
led_update_kb((led_t){.raw = usb_led});
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
kbd1.SetReport(0, 0, 2, 0, 1, &led_state.raw);
kbd2.SetReport(0, 0, 2, 0, 1, &led_state.raw);
kbd3.SetReport(0, 0, 2, 0, 1, &led_state.raw);
kbd4.SetReport(0, 0, 2, 0, 1, &led_state.raw);
}
return res;
}
};