Files
blinky/src/events/set_protocol_event.c

41 lines
1.1 KiB
C
Raw Normal View History

#include "set_protocol_event.h"
static const char *protocol_mode_name(enum keyboard_protocol_mode protocol_mode)
{
switch (protocol_mode) {
case KEYBOARD_PROTOCOL_MODE_BOOT:
return "boot";
case KEYBOARD_PROTOCOL_MODE_REPORT:
return "report";
default:
return "?";
}
}
static void log_set_protocol_event(const struct app_event_header *aeh)
{
const struct set_protocol_event *event = cast_set_protocol_event(aeh);
APP_EVENT_MANAGER_LOG(aeh, "protocol:%s",
protocol_mode_name(event->protocol_mode));
}
static void profile_set_protocol_event(struct log_event_buf *buf,
const struct app_event_header *aeh)
{
const struct set_protocol_event *event = cast_set_protocol_event(aeh);
nrf_profiler_log_encode_uint8(buf, event->protocol_mode);
}
APP_EVENT_INFO_DEFINE(set_protocol_event,
ENCODE(NRF_PROFILER_ARG_U8),
ENCODE("protocol_mode"),
profile_set_protocol_event);
APP_EVENT_TYPE_DEFINE(set_protocol_event,
log_set_protocol_event,
&set_protocol_event_info,
APP_EVENT_FLAGS_CREATE(
APP_EVENT_TYPE_FLAGS_INIT_LOG_ENABLE));