aboutsummaryrefslogtreecommitdiffstats
path: root/globals.hpp
diff options
context:
space:
mode:
authorConfuSomu2021-07-25 15:30:20 -0400
committerConfuSomu2021-07-25 15:30:20 -0400
commit5d896b77910431cdaac2ee4bfbfa8bbc91ab39ef (patch)
tree0ba254b91d209db1f20ac30bd90a5b646c4b433a /globals.hpp
parent0490fe7cbe0d55815723b942fa7ce4a86e540565 (diff)
downloadpico-watch-5d896b77910431cdaac2ee4bfbfa8bbc91ab39ef.tar
pico-watch-5d896b77910431cdaac2ee4bfbfa8bbc91ab39ef.tar.gz
pico-watch-5d896b77910431cdaac2ee4bfbfa8bbc91ab39ef.zip
Implement an app_manager that supports BaseApp
and create classes for home_menu and main_clock apps. This commit has a lot of changes as multiple parts of the project had to be changed to support running apps that are based on the BaseApp class. It could not have been done in multiple commits as the progam would not be able to build and thus I would not be able to test the changes.
Diffstat (limited to 'globals.hpp')
-rw-r--r--globals.hpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/globals.hpp b/globals.hpp
new file mode 100644
index 0000000..0f61f64
--- /dev/null
+++ b/globals.hpp
@@ -0,0 +1,28 @@
+#pragma once
+#include "base_app.hpp"
+
+struct global_status {
+ BaseApp* current_app = 0;
+ bool is_sleeping = false;
+ bool app_ready = true;
+ bool app_switch_requested = false;
+ int app_switch_to_app = 0;
+
+ // Debounce control
+ // See https://www.raspberrypi.org/forums/viewtopic.php?f=145&t=301522#p1812063
+ // Time is currently shared between all buttons.
+ unsigned long button_last_pressed_time;
+ const int button_delay_time = 125;
+};
+
+struct user_settings {
+ unsigned char oled_contrast = OLED_DEFAULT_CONTRAST;
+ // In milliseconds
+ unsigned int sleep_delay = ENTER_SLEEP_DELAY;
+ // true: 24h, false: AM/PM
+ // TODO: Use an enum, but this would make programming the UI more complex.
+ bool time_format = true;
+};
+
+extern global_status g_s;
+extern user_settings g_user; \ No newline at end of file
='n197' href='#n197'>197 198 199 200 201 202 203 204 205 206 207 208 209