Input: refactoring, platform agnostic key configuration.
Update input usage across project. Minor queue usage fixes and tick timings. (#330)
This commit is contained in:
@@ -28,10 +28,11 @@ void AppiButton::run() {
|
||||
|
||||
AppiButtonEvent event;
|
||||
while(1) {
|
||||
if(get_event(&event, 20)) {
|
||||
if(get_event(&event, 1024 / 8)) {
|
||||
if(event.type == AppiButtonEvent::EventTypeKey) {
|
||||
// press events
|
||||
if(event.value.input.state && event.value.input.input == InputBack) {
|
||||
if(event.value.input.type == InputTypeShort &&
|
||||
event.value.input.key == InputKeyBack) {
|
||||
view_port_enabled_set(view_port, false);
|
||||
gui_remove_view_port(gui, view_port);
|
||||
api_hal_timebase_insomnia_exit();
|
||||
@@ -39,11 +40,13 @@ void AppiButton::run() {
|
||||
osThreadExit();
|
||||
}
|
||||
|
||||
if(event.value.input.state && event.value.input.input == InputLeft) {
|
||||
if(event.value.input.type == InputTypeShort &&
|
||||
event.value.input.key == InputKeyLeft) {
|
||||
decrease_mode();
|
||||
}
|
||||
|
||||
if(event.value.input.state && event.value.input.input == InputRight) {
|
||||
if(event.value.input.type == InputTypeShort &&
|
||||
event.value.input.key == InputKeyRight) {
|
||||
increase_mode();
|
||||
}
|
||||
}
|
||||
|
@@ -29,11 +29,11 @@ void AppiButtonModeCyfralEmulate::event(AppiButtonEvent* event, AppiButtonState*
|
||||
app->blink_green();
|
||||
|
||||
} else if(event->type == AppiButtonEvent::EventTypeKey) {
|
||||
if(event->value.input.state && event->value.input.input == InputUp) {
|
||||
if(event->value.input.type == InputTypeShort && event->value.input.key == InputKeyUp) {
|
||||
app->decrease_cyfral_address();
|
||||
}
|
||||
|
||||
if(event->value.input.state && event->value.input.input == InputDown) {
|
||||
if(event->value.input.type == InputTypeShort && event->value.input.key == InputKeyDown) {
|
||||
app->increase_cyfral_address();
|
||||
}
|
||||
}
|
||||
|
@@ -59,11 +59,11 @@ void AppiButtonModeCyfralRead::event(AppiButtonEvent* event, AppiButtonState* st
|
||||
}
|
||||
}
|
||||
} else if(event->type == AppiButtonEvent::EventTypeKey) {
|
||||
if(event->value.input.state && event->value.input.input == InputUp) {
|
||||
if(event->value.input.type == InputTypeShort && event->value.input.key == InputKeyUp) {
|
||||
app->decrease_cyfral_address();
|
||||
}
|
||||
|
||||
if(event->value.input.state && event->value.input.input == InputDown) {
|
||||
if(event->value.input.type == InputTypeShort && event->value.input.key == InputKeyDown) {
|
||||
app->increase_cyfral_address();
|
||||
}
|
||||
}
|
||||
|
@@ -48,11 +48,11 @@ void AppiButtonModeDallasEmulate::event(AppiButtonEvent* event, AppiButtonState*
|
||||
app->blink_green();
|
||||
}
|
||||
} else if(event->type == AppiButtonEvent::EventTypeKey) {
|
||||
if(event->value.input.state && event->value.input.input == InputUp) {
|
||||
if(event->value.input.type == InputTypeShort && event->value.input.key == InputKeyUp) {
|
||||
app->decrease_dallas_address();
|
||||
}
|
||||
|
||||
if(event->value.input.state && event->value.input.input == InputDown) {
|
||||
if(event->value.input.type == InputTypeShort && event->value.input.key == InputKeyDown) {
|
||||
app->increase_dallas_address();
|
||||
}
|
||||
}
|
||||
|
@@ -46,11 +46,11 @@ void AppiButtonModeDallasRead::event(AppiButtonEvent* event, AppiButtonState* st
|
||||
}
|
||||
}
|
||||
} else if(event->type == AppiButtonEvent::EventTypeKey) {
|
||||
if(event->value.input.state && event->value.input.input == InputUp) {
|
||||
if(event->value.input.type == InputTypeShort && event->value.input.key == InputKeyUp) {
|
||||
app->decrease_dallas_address();
|
||||
}
|
||||
|
||||
if(event->value.input.state && event->value.input.input == InputDown) {
|
||||
if(event->value.input.type == InputTypeShort && event->value.input.key == InputKeyDown) {
|
||||
app->increase_dallas_address();
|
||||
}
|
||||
}
|
||||
|
@@ -39,11 +39,11 @@ void AppiButtonModeDallasWrite::event(AppiButtonEvent* event, AppiButtonState* s
|
||||
}
|
||||
|
||||
} else if(event->type == AppiButtonEvent::EventTypeKey) {
|
||||
if(event->value.input.state && event->value.input.input == InputUp) {
|
||||
if(event->value.input.type == InputTypeShort && event->value.input.key == InputKeyUp) {
|
||||
app->decrease_dallas_address();
|
||||
}
|
||||
|
||||
if(event->value.input.state && event->value.input.input == InputDown) {
|
||||
if(event->value.input.type == InputTypeShort && event->value.input.key == InputKeyDown) {
|
||||
app->increase_dallas_address();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user