aboutsummaryrefslogtreecommitdiff
path: root/ui.h
diff options
context:
space:
mode:
authorDavid Phillips <david@yeah.nah.nz>2021-03-13 20:03:55 +1300
committerDavid Phillips <david@yeah.nah.nz>2021-03-13 20:03:55 +1300
commitd9527ea3c5ab6f1e0776b86ecc43459eb1a706b2 (patch)
tree460b8dee91bc3d63a604d68d14745218e2cb7810 /ui.h
parent64a168c77568f8886662b535515ff25d056042e9 (diff)
downloadaltimeter-d9527ea3c5ab6f1e0776b86ecc43459eb1a706b2.tar.xz
First cut of UI state machine
This patch adds a first skeleton/draft of the UI state machine, with the altimeter setting logic implemented at a basic level. It also adds a Python script which uses GDB/MI to simulate/inject UI events on a GDB remote (i.e. qemu-avr running the sim copy of the firmware).
Diffstat (limited to 'ui.h')
-rw-r--r--ui.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/ui.h b/ui.h
index c51c261..3bb14c7 100644
--- a/ui.h
+++ b/ui.h
@@ -2,9 +2,25 @@
#include "data_manager.h"
+enum ui_state {
+ UI_STATE_MAIN,
+ UI_STATE_MAIN_WITH_SETTING,
+ UI_STATE_CHOOSE_UNIT_CATEGORY,
+ UI_STATE_CHANGE_UNIT_MODE,
+};
+
+enum ui_input_event {
+ UI_INPUT_EVENT_UP,
+ UI_INPUT_EVENT_DOWN,
+ UI_INPUT_EVENT_PRESS,
+ UI_INPUT_EVENT_HOLD,
+};
+
struct ui_ctx {
struct display *display;
+ enum ui_state state;
};
void ui_init(struct ui_ctx*, struct display *);
void ui_update(struct ui_ctx*, struct data_ctx*);
+void ui_input_event(struct ui_ctx*, struct data_ctx *dctx, enum ui_input_event);