2026-04-10 13:46:50 +08:00
|
|
|
#ifndef BLINKY_HID_TX_REPORT_EVENT_H_
|
|
|
|
|
#define BLINKY_HID_TX_REPORT_EVENT_H_
|
|
|
|
|
|
2026-04-14 16:42:04 +08:00
|
|
|
#include <errno.h>
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
2026-04-10 13:46:50 +08:00
|
|
|
#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;
|
2026-04-15 15:47:14 +08:00
|
|
|
enum hid_send_channel channel;
|
2026-04-10 13:46:50 +08:00
|
|
|
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);
|
|
|
|
|
|
2026-04-15 15:47:14 +08:00
|
|
|
static inline int submit_hid_tx_report_event(enum hid_send_channel channel,
|
2026-04-14 16:42:04 +08:00
|
|
|
enum keyboard_report_type report_type,
|
|
|
|
|
enum keyboard_protocol_mode protocol_mode,
|
|
|
|
|
uint16_t sequence,
|
|
|
|
|
const uint8_t *data, size_t size)
|
|
|
|
|
{
|
|
|
|
|
struct hid_tx_report_event *event;
|
|
|
|
|
|
|
|
|
|
if ((data == NULL) && (size > 0U)) {
|
|
|
|
|
return -EINVAL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
event = new_hid_tx_report_event(size);
|
2026-04-15 15:47:14 +08:00
|
|
|
event->channel = channel;
|
2026-04-14 16:42:04 +08:00
|
|
|
event->report_type = report_type;
|
|
|
|
|
event->protocol_mode = protocol_mode;
|
|
|
|
|
event->sequence = sequence;
|
|
|
|
|
if (size > 0U) {
|
|
|
|
|
memcpy(event->dyndata.data, data, size);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
APP_EVENT_SUBMIT(event);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-10 13:46:50 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif /* BLINKY_HID_TX_REPORT_EVENT_H_ */
|