feat(usb): 添加USB HID模块支持键盘和消费设备

- 添加USB HID模块实现键盘和消费控制设备功能
- 在CMakeLists.txt中添加usb_hid_module.c和相关事件文件
- 添加HID LED事件和设置协议事件定义及实现
- 配置设备树添加HID键盘和消费者设备节点
- 启用USB设备堆栈配置选项
- 修改键盘核心模块以处理协议切换事件
- 修复键映射中keypad enter的位置错误
- 注释掉电池模块中的调试日志输出
This commit is contained in:
2026-04-10 09:06:18 +08:00
parent 0da731e59d
commit b9bb326e8b
10 changed files with 818 additions and 3 deletions

View File

@@ -17,6 +17,24 @@
led0 = &myled0;
};
hid_kbd: hid_kbd {
compatible = "zephyr,hid-device";
label = "HID_KBD";
protocol-code = "keyboard";
in-report-size = <29>;
out-report-size = <1>;
in-polling-period-us = <1000>;
out-polling-period-us = <1000>;
};
hid_consumer: hid_consumer {
compatible = "zephyr,hid-device";
label = "HID_CONSUMER";
protocol-code = "none";
in-report-size = <2>;
in-polling-period-us = <1000>;
};
leds {
compatible = "gpio-leds";
myled0: led_0 {
@@ -128,3 +146,12 @@
&gpiote {
status = "okay";
};
&usbd {
status = "okay";
num-bidir-endpoints = <0>;
num-in-endpoints = <2>;
num-out-endpoints = <1>;
num-isoin-endpoints = <0>;
num-isoout-endpoints = <0>;
};