feat(usb): 简化USB状态管理并引入模式策略模块
- 修改usb_state_event结构,将复杂的flag操作简化为单一的state枚举值 - 新增usb_function_hook机制用于USB功能预初始化 - 将ble_adv_ctrl_module重命名为mode_policy_module以更好地反映其功能 - 在mode_policy_module中添加USB设备启用/暂停控制逻辑 - 添加对电源事件的处理支持休眠/唤醒功能 - 更新CMakeLists.txt添加必要的链接器脚本和源文件 - 移除不再需要的ble_adv_ctrl_module并添加新的mode_policy_module
This commit is contained in:
25
inc/usb_function_hook.h
Normal file
25
inc/usb_function_hook.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef BLINKY_USB_FUNCTION_HOOK_H_
|
||||
#define BLINKY_USB_FUNCTION_HOOK_H_
|
||||
|
||||
#include <zephyr/sys/iterable_sections.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct usb_function_hook {
|
||||
const char *name;
|
||||
int (*pre_stack_init)(void);
|
||||
};
|
||||
|
||||
#define USB_FUNCTION_HOOK_DEFINE(_name, _pre_stack_init) \
|
||||
const STRUCT_SECTION_ITERABLE(usb_function_hook, _name) = { \
|
||||
.name = STRINGIFY(_name), \
|
||||
.pre_stack_init = (_pre_stack_init), \
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BLINKY_USB_FUNCTION_HOOK_H_ */
|
||||
Reference in New Issue
Block a user