2026-04-08 16:32:13 +08:00
|
|
|
#ifndef BLINKY_KEYBOARD_HID_REPORT_EVENT_H_
|
|
|
|
|
#define BLINKY_KEYBOARD_HID_REPORT_EVENT_H_
|
|
|
|
|
|
2026-04-14 16:42:04 +08:00
|
|
|
#include <errno.h>
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
2026-04-08 16:32:13 +08:00
|
|
|
#include <app_event_manager.h>
|
|
|
|
|
#include <app_event_manager_profiler_tracer.h>
|
|
|
|
|
|
|
|
|
|
#include "keyboard_core.h"
|
|
|
|
|
#include "mode_switch_event.h"
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
struct keyboard_hid_report_event {
|
|
|
|
|
struct app_event_header header;
|
|
|
|
|
enum mode_switch_mode mode;
|
|
|
|
|
enum keyboard_report_type report_type;
|
|
|
|
|
enum keyboard_protocol_mode protocol_mode;
|
2026-04-10 13:46:50 +08:00
|
|
|
enum hid_queue_policy queue_policy;
|
2026-04-08 16:32:13 +08:00
|
|
|
struct event_dyndata dyndata;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
APP_EVENT_TYPE_DYNDATA_DECLARE(keyboard_hid_report_event);
|
|
|
|
|
|
2026-04-14 16:42:04 +08:00
|
|
|
static inline int submit_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, const uint8_t *data, size_t size)
|
|
|
|
|
{
|
|
|
|
|
struct keyboard_hid_report_event *event;
|
|
|
|
|
|
|
|
|
|
if ((data == NULL) && (size > 0U)) {
|
|
|
|
|
return -EINVAL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
event = new_keyboard_hid_report_event(size);
|
|
|
|
|
event->mode = mode;
|
|
|
|
|
event->report_type = report_type;
|
|
|
|
|
event->protocol_mode = protocol_mode;
|
|
|
|
|
event->queue_policy = queue_policy;
|
|
|
|
|
if (size > 0U) {
|
|
|
|
|
memcpy(event->dyndata.data, data, size);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
APP_EVENT_SUBMIT(event);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-08 16:32:13 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif /* BLINKY_KEYBOARD_HID_REPORT_EVENT_H_ */
|