feat: 添加模式切换模块支持USB/2.4G/BLE模式检测

- 在CMakeLists.txt中添加新的包含目录inc/events和源文件
  mode_switch_module.c、mode_switch_event.c
- 在设备树文件中添加模式切换ADC配置节点和通道设置
- 新增mode_switch_event.h头文件定义模式切换事件结构
- 实现mode_switch_event.c事件处理和日志记录功能
- 创建mode_switch_module.c核心模块实现ADC采样、
  模式检测和事件发布逻辑
- 支持三种模式:USB、2.4G、BLE的电压阈值判断
- 集成CAF事件系统,支持电源管理和状态转换
This commit is contained in:
2026-04-08 14:28:05 +08:00
parent e4c824d657
commit 6610b3471d
5 changed files with 312 additions and 1 deletions

View File

@@ -0,0 +1,29 @@
#ifndef BLINKY_MODE_SWITCH_EVENT_H_
#define BLINKY_MODE_SWITCH_EVENT_H_
#include <app_event_manager.h>
#include <app_event_manager_profiler_tracer.h>
#ifdef __cplusplus
extern "C" {
#endif
enum mode_switch_mode {
MODE_SWITCH_USB,
MODE_SWITCH_24G,
MODE_SWITCH_BLE,
};
struct mode_switch_event {
struct app_event_header header;
enum mode_switch_mode mode;
uint16_t voltage_mv;
};
APP_EVENT_TYPE_DECLARE(mode_switch_event);
#ifdef __cplusplus
}
#endif
#endif /* BLINKY_MODE_SWITCH_EVENT_H_ */