- 添加新的 function_bitmap_state_event 事件类型用于跟踪功能键位图状态 - 移除已废弃的 key_function_event 事件及其相关文件 - 更新 CMakeLists.txt 中的源文件列表以包含新事件文件 - 修改协议定义文件 device_comm.options 和 device_comm.proto 以使用位图方式传输功能键状态而不是单独的按键事件 - 更新键盘核心模块中的位图处理逻辑,添加 usage_to_bitmap_pos 辅助函数来正确定位修饰键和普通按键的位置 - 修改报告构建逻辑以正确处理新的位图布局 - 更新协议模块以处理新的功能位图状态事件和 LED 状态事件 - 实现协议模块中的 ACK、错误响应和 LED 状态编码功能
42 lines
844 B
C
42 lines
844 B
C
#ifndef BLINKY_FUNCTION_BITMAP_STATE_EVENT_H_
|
|
#define BLINKY_FUNCTION_BITMAP_STATE_EVENT_H_
|
|
|
|
#include <errno.h>
|
|
#include <string.h>
|
|
|
|
#include <app_event_manager.h>
|
|
#include <app_event_manager_profiler_tracer.h>
|
|
|
|
#include "keyboard_core.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
struct function_bitmap_state_event {
|
|
struct app_event_header header;
|
|
uint8_t bitmap[KEYBOARD_PROTOCOL_BITMAP_BYTES];
|
|
};
|
|
|
|
APP_EVENT_TYPE_DECLARE(function_bitmap_state_event);
|
|
|
|
static inline int submit_function_bitmap_state_event(const uint8_t *bitmap)
|
|
{
|
|
struct function_bitmap_state_event *event;
|
|
|
|
if (bitmap == NULL) {
|
|
return -EINVAL;
|
|
}
|
|
|
|
event = new_function_bitmap_state_event();
|
|
memcpy(event->bitmap, bitmap, sizeof(event->bitmap));
|
|
APP_EVENT_SUBMIT(event);
|
|
return 0;
|
|
}
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* BLINKY_FUNCTION_BITMAP_STATE_EVENT_H_ */
|