]> git.karo-electronics.de Git - oswald.git/blobdiff - ui/oswald.h
Redesign to an event based handling
[oswald.git] / ui / oswald.h
index c2ea5d3b5ecfc37d6989724e7f595ef71fdd637f..c49acec24f7b33f4548b7e6b9210da25b78b06f2 100644 (file)
@@ -1,8 +1,17 @@
 #ifndef _OSWALD_H
 #define _OSWALD_H
 
+#define DEBUG 1
+#ifdef DEBUG
+#define dbg_out( args... ) fprintf(stderr, args)
+#else
+#define dbg_out( args... ) do {} while (0)
+#endif
+
 typedef signed char s8t;
 typedef unsigned char u8t;
+typedef signed short s16t;
+typedef unsigned short u16t;
 typedef u8t boolean;
 #ifdef TRUE
 #undef TRUE
@@ -27,7 +36,13 @@ typedef struct {
 
 typedef enum {
        IDLE_SCREEN = 0,
-       APPLICATION_SCREEN,
+       ACCEL_DISPLAY_SCREEN,
+       DATETIME_SETTING_SCREEN,
+       MENU_TEST_SCREEN,
+//     SCREEN2_SCREEN,
+//     SCREEN3_SCREEN,
+//     APPLICATION_SCREEN,
+       LAST_SCREEN,            // a marker for the last (not valid) screen)
 } screen_number;
 
 typedef enum {
@@ -39,12 +54,32 @@ typedef enum {
        BUTTON_F,
 } watch_button;
 
+#define EVENT_SCREEN_VISIBLE           (1<<0)          // screen just became visible
+#define EVENT_SCREEN_DESTROY           (1<<1)          // screen is destroyed
+#define EVENT_ONE_SEC_TIMER            (1<<2)
+#define EVENT_MS_TIMER                 (1<<3)
+#define EVENT_USER_BUTTONS             (1<<4)
+#define EVENT_ACCEL_UPDATE             (1<<5)
+#define EVENT_AMBIENTLIGHT_UPDATE      (1<<6)
+#define EVENT_POWER_CHANGE             (1<<7)
+#define EVENT_COMMS                    (1<<8)
+
 typedef struct {
-       screen_number   screen;
-       void (*idle_draw_func)(boolean show_seconds);
+       u16t event_mask;                                // the event the screen wants to receive
+       void (*event_func)(u16t event, void *data);     // callback for events
+//     void (*button_func)(watch_button button);       // handles button presses
+//     void (*screendraw_func)(void);                  // callback for screen update
+//     void *user_data;
+} watch_screen;
+
+typedef struct {
+       screen_number   screen_id;
+       // void (*draw_watchface_func)(boolean show_seconds);
        boolean idle_show_seconds;
+       watch_screen *screen;           // the current screen
+       // void (*user_button_func)(watch_button button);
+       // void (*user_screendraw_func)(void);
 } watch_state;
 
-
 #endif