feat: 添加HID流控制模块和相关事件处理
- 添加hid_flowctrl_module.c实现HID报告流控制功能,包括FIFO队列管理和 报告发送控制 - 新增hid_report_sent_event、hid_transport_state_event和 hid_tx_report_event事件类型及其对应的头文件和实现 - 在CMakeLists.txt中注册新模块和事件源文件 - 修改keyboard_core_module.c以支持队列策略,并添加编码器事件处理逻辑 - 更新usb_hid_module.c将直接的键盘HID报告事件改为通过 hid_tx_report_event进行传输,并添加状态报告事件 - 在keyboard_hid_report_event中增加queue_policy字段以支持不同 队列策略
This commit is contained in:
27
inc/events/hid_report_sent_event.h
Normal file
27
inc/events/hid_report_sent_event.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef BLINKY_HID_REPORT_SENT_EVENT_H_
|
||||
#define BLINKY_HID_REPORT_SENT_EVENT_H_
|
||||
|
||||
#include <app_event_manager.h>
|
||||
#include <app_event_manager_profiler_tracer.h>
|
||||
|
||||
#include "keyboard_core.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct hid_report_sent_event {
|
||||
struct app_event_header header;
|
||||
enum hid_transport transport;
|
||||
enum keyboard_report_type report_type;
|
||||
uint16_t sequence;
|
||||
bool error;
|
||||
};
|
||||
|
||||
APP_EVENT_TYPE_DECLARE(hid_report_sent_event);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BLINKY_HID_REPORT_SENT_EVENT_H_ */
|
||||
28
inc/events/hid_transport_state_event.h
Normal file
28
inc/events/hid_transport_state_event.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef BLINKY_HID_TRANSPORT_STATE_EVENT_H_
|
||||
#define BLINKY_HID_TRANSPORT_STATE_EVENT_H_
|
||||
|
||||
#include <app_event_manager.h>
|
||||
#include <app_event_manager_profiler_tracer.h>
|
||||
|
||||
#include "keyboard_core.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct hid_transport_state_event {
|
||||
struct app_event_header header;
|
||||
enum hid_transport transport;
|
||||
bool ready;
|
||||
bool keys_ready;
|
||||
bool consumer_ready;
|
||||
enum keyboard_protocol_mode protocol_mode;
|
||||
};
|
||||
|
||||
APP_EVENT_TYPE_DECLARE(hid_transport_state_event);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BLINKY_HID_TRANSPORT_STATE_EVENT_H_ */
|
||||
28
inc/events/hid_tx_report_event.h
Normal file
28
inc/events/hid_tx_report_event.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef BLINKY_HID_TX_REPORT_EVENT_H_
|
||||
#define BLINKY_HID_TX_REPORT_EVENT_H_
|
||||
|
||||
#include <app_event_manager.h>
|
||||
#include <app_event_manager_profiler_tracer.h>
|
||||
|
||||
#include "keyboard_core.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct hid_tx_report_event {
|
||||
struct app_event_header header;
|
||||
enum hid_transport transport;
|
||||
enum keyboard_report_type report_type;
|
||||
enum keyboard_protocol_mode protocol_mode;
|
||||
uint16_t sequence;
|
||||
struct event_dyndata dyndata;
|
||||
};
|
||||
|
||||
APP_EVENT_TYPE_DYNDATA_DECLARE(hid_tx_report_event);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BLINKY_HID_TX_REPORT_EVENT_H_ */
|
||||
@@ -16,6 +16,7 @@ struct keyboard_hid_report_event {
|
||||
enum mode_switch_mode mode;
|
||||
enum keyboard_report_type report_type;
|
||||
enum keyboard_protocol_mode protocol_mode;
|
||||
enum hid_queue_policy queue_policy;
|
||||
struct event_dyndata dyndata;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user