Input: refactoring, platform agnostic key configuration.

Update input usage across project. Minor queue usage fixes and tick timings. (#330)
This commit is contained in:
あく
2021-02-10 11:56:05 +03:00
committed by GitHub
parent 5dbe2983aa
commit 8b94eff7f9
36 changed files with 347 additions and 334 deletions

View File

@@ -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();
}
}