2026-04-13 11:55:59 +08:00
|
|
|
#ifndef BLINKY_KEY_FUNCTION_EVENT_H_
|
|
|
|
|
#define BLINKY_KEY_FUNCTION_EVENT_H_
|
|
|
|
|
|
|
|
|
|
#include <app_event_manager.h>
|
|
|
|
|
#include <app_event_manager_profiler_tracer.h>
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
enum key_function_action {
|
|
|
|
|
KEY_FUNCTION_ACTION_RELEASE = 0U,
|
|
|
|
|
KEY_FUNCTION_ACTION_PRESS = 1U,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct key_function_event {
|
|
|
|
|
struct app_event_header header;
|
|
|
|
|
uint16_t usage;
|
|
|
|
|
uint8_t action;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
APP_EVENT_TYPE_DECLARE(key_function_event);
|
|
|
|
|
|
2026-04-14 16:42:04 +08:00
|
|
|
static inline void submit_key_function_event(uint16_t usage, uint8_t action)
|
|
|
|
|
{
|
|
|
|
|
struct key_function_event *event = new_key_function_event();
|
|
|
|
|
|
|
|
|
|
event->usage = usage;
|
|
|
|
|
event->action = action;
|
|
|
|
|
APP_EVENT_SUBMIT(event);
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-13 11:55:59 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif /* BLINKY_KEY_FUNCTION_EVENT_H_ */
|