feat: 添加CDC协议通信模块支持

- 集成nanopb库用于protobuf序列化
- 创建cdc_wrapper_module.c实现帧解析功能
- 实现protocol_module.c处理协议编解码
- 定义device_comm.proto通信协议
- 修改CMakeLists.txt添加protobuf源文件
- 更新配置启用NANOPB支持
- 移除usb_cdc_module中基于行的处理逻辑
This commit is contained in:
2026-04-11 18:21:18 +08:00
parent 39c6a1fe84
commit 227158870a
8 changed files with 478 additions and 40 deletions

View File

@@ -4,12 +4,19 @@ cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(blinky)
list(APPEND CMAKE_MODULE_PATH ${ZEPHYR_BASE}/modules/nanopb)
include(nanopb)
zephyr_include_directories(
inc
inc/events
)
add_subdirectory(drivers)
zephyr_nanopb_sources(app
proto/device_comm.proto
)
target_sources(app PRIVATE
src/main.c
src/battery_module.c
@@ -22,8 +29,9 @@ target_sources(app PRIVATE
src/hid_flowctrl_module.c
src/keyboard_core_module.c
src/ui/ui_main.c
src/cdc_wrapper_module.c
src/protocol_module.c
src/usb_cdc_module.c
src/usb_cdc_test_module.c
src/usb_device_module.c
src/usb_hid_module.c
src/events/bat_state_event.c