mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-06-07 19:01:54 -07:00
Add input_fake_event()
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user