aboutsummaryrefslogtreecommitdiffstats
path: root/pico-watch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pico-watch.cpp')
-rw-r--r--pico-watch.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/pico-watch.cpp b/pico-watch.cpp
index 54e78f4..a9e156a 100644
--- a/pico-watch.cpp
+++ b/pico-watch.cpp
@@ -1,9 +1,16 @@
-#include <stdio.h>
#include "pico/stdlib.h"
+#include <cstdlib>
+#ifndef SDL2_BUILD
+#include <stdio.h>
#include "hardware/i2c.h"
-#include "hardware/sync.h"
#include "hardware/rtc.h"
#include "pico/util/datetime.h"
+#include "hardware/sync.h"
+#else
+#include <chrono>
+#include <thread>
+#include <iostream>
+#endif
#include "init.hpp"
#include "hal/api.hpp"
@@ -35,24 +42,35 @@ bool cb_status_check(struct repeating_timer *t) {
}
int main() {
+#ifdef SDL2_BUILD
+ using namespace std::chrono_literals;
+#endif
init_all();
printf("~~~==~~~");
+ std::cerr << std::endl;
init_buttons();
app_api.init();
+#ifndef SDL2_BUILD
struct repeating_timer status_check_timer;
add_repeating_timer_ms(250, cb_status_check, NULL, &status_check_timer); // TODO: Execute on core1
+#endif
g_s.foreground_app = app_mgr::app_init(0);
while (1) {
if (g_s.app_ready && !g_s.is_sleeping) {
app_mgr::app_render(g_s.foreground_app);
- app_api.display_write_backbuffer();
+ bool do_quit = app_api.display_write_backbuffer();
+ if (do_quit) return 0;
}
if (g_s.is_sleeping)
+#ifndef SDL2_BUILD
__wfi();
+#else
+ ;//std::this_thread::sleep_for(10ms);
+#endif
else if (g_s.app_switch_requested) {
app_mgr::app_switch(g_s.foreground_app, g_s.app_switch_to_app);
g_s.app_switch_requested = false;