Add input_fake_event()

This commit is contained in:
Willy-JL
2023-07-23 19:58:28 +02:00
parent 461cace084
commit 96c1a3c1f0
2 changed files with 19 additions and 0 deletions
+17
View File
@@ -68,6 +68,23 @@ const char* input_get_type_name(InputType type) {
}
}
void input_fake_event(Input* input, InputKey key, InputType type) {
bool wrap = type == InputTypeShort || type == InputTypeLong;
InputEvent event;
event.key = key;
if(wrap) {
event.type = InputTypePress;
furi_pubsub_publish(input->event_pubsub, &event);
}
event.type = type;
furi_pubsub_publish(input->event_pubsub, &event);
if(wrap) {
event.type = InputTypeRelease;
furi_pubsub_publish(input->event_pubsub, &event);
}
}
int32_t input_srv(void* p) {
UNUSED(p);
input = malloc(sizeof(Input));
+2
View File
@@ -46,3 +46,5 @@ void input_isr(void* _ctx);
/** Input CLI command handler */
void input_cli(Cli* cli, FuriString* args, void* context);
void input_fake_event(Input* input, InputKey key, InputType type);