feat: 更新键盘固件的事件系统和模块配置
- 在CMakeLists.txt中添加hid_boot_event.c、keyboard_led_event.c和ble_slot_ctrl_module.c源文件 - 新增Kconfig配置项NEW_KBD_BLE_BOND_ENABLE用于启用应用特定的BLE绑定支持 - 修改prj.conf配置,禁用配对模式下的设备名称广播功能 - 重构电池状态事件结构,将charging和full布尔字段改为flags位域,并提供相应的访问函数 - 添加hid_boot_event事件类型,用于处理HID Boot协议输入报告 - 重命名keyboard_led_state_event为keyboard_led_event并改进LED状态处理逻辑 - 移除hid_protocol_event中的transport字段,简化协议事件处理 - 分离hid_report_event和hid_boot_event,明确区分Report和Boot协议报文处理 - 重构battery_module.c代码结构,改用上下文结构体管理电池模块状态 - 更新ble_battery_module.c使用新的电池状态事件访问接口
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#ifndef MODE_EVENT_H
|
||||
#define MODE_EVENT_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <app_event_manager.h>
|
||||
#include <app_event_manager_profiler_tracer.h>
|
||||
|
||||
@@ -20,4 +22,32 @@ struct mode_event
|
||||
|
||||
APP_EVENT_TYPE_DECLARE(mode_event);
|
||||
|
||||
static inline void mode_event_submit(mode_type_t mode)
|
||||
{
|
||||
struct mode_event *event = new_mode_event();
|
||||
|
||||
event->mode_type = mode;
|
||||
APP_EVENT_SUBMIT(event);
|
||||
}
|
||||
|
||||
static inline mode_type_t mode_event_get_mode(const struct mode_event *event)
|
||||
{
|
||||
return event->mode_type;
|
||||
}
|
||||
|
||||
static inline bool mode_event_is_usb(const struct mode_event *event)
|
||||
{
|
||||
return event->mode_type == MODE_TYPE_USB;
|
||||
}
|
||||
|
||||
static inline bool mode_event_is_ble(const struct mode_event *event)
|
||||
{
|
||||
return event->mode_type == MODE_TYPE_BLE;
|
||||
}
|
||||
|
||||
static inline bool mode_event_is_2g4(const struct mode_event *event)
|
||||
{
|
||||
return event->mode_type == MODE_TYPE_2G4;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user