feat: 添加模式切换模块支持多协议键盘

添加了完整的模式切换功能,通过ADC采样检测模式拨码开关,
实现USB、BLE和2.4G三种工作模式的自动识别和切换。

- 新增mode_event事件用于传递模式状态
- 实现mode_switch_module模块,包含ADC初始化、
  模式识别算法和状态管理逻辑
- 配置CMakeLists.txt添加新源文件和头文件目录
- 更新设备树配置启用ADC和IO通道
- 添加Kconfig选项CONFIG_ADC=y
- 实现防抖机制和稳定的模式检测逻辑
- 集成到CAF事件系统,支持电源管理状态切换
This commit is contained in:
2026-03-11 10:44:50 +08:00
parent 3d9ce9168f
commit 86af0d2373
6 changed files with 311 additions and 2 deletions

View File

@@ -1,4 +1,9 @@
/{};
/ {
zephyr,user {
io-channels = <&adc 5>, <&adc 7>;
};
};
&gpio0 {
status = "okay";
};
@@ -13,4 +18,9 @@
&led_0 {
status = "okay";
};
};
/* 使能 SAADCmode_switch_module 使用 channel 7 采样模式拨码电压。 */
&adc {
status = "okay";
};