- 修改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
42 lines
734 B
C
42 lines
734 B
C
#ifndef BLINKY_USB_STATE_EVENT_H_
|
|
#define BLINKY_USB_STATE_EVENT_H_
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <app_event_manager.h>
|
|
#include <app_event_manager_profiler_tracer.h>
|
|
#include <zephyr/sys/util.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
enum usb_state {
|
|
USB_STATE_DISABLED = 0,
|
|
USB_STATE_DISCONNECTED,
|
|
USB_STATE_POWERED,
|
|
USB_STATE_ACTIVE,
|
|
USB_STATE_SUSPENDED,
|
|
};
|
|
|
|
struct usb_state_event {
|
|
struct app_event_header header;
|
|
enum usb_state state;
|
|
};
|
|
|
|
APP_EVENT_TYPE_DECLARE(usb_state_event);
|
|
|
|
static inline void submit_usb_state(enum usb_state state)
|
|
{
|
|
struct usb_state_event *event = new_usb_state_event();
|
|
|
|
event->state = state;
|
|
APP_EVENT_SUBMIT(event);
|
|
}
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* BLINKY_USB_STATE_EVENT_H_ */
|