c49acec24f7b33f4548b7e6b9210da25b78b06f2
[oswald.git] / ui / oswald.h
1 #ifndef _OSWALD_H
2 #define _OSWALD_H
3
4 #define DEBUG 1
5 #ifdef DEBUG
6 #define dbg_out( args... ) fprintf(stderr, args)
7 #else
8 #define dbg_out( args... ) do {} while (0)
9 #endif
10
11 typedef signed char s8t;
12 typedef unsigned char u8t;
13 typedef signed short s16t;
14 typedef unsigned short u16t;
15 typedef u8t boolean;
16 #ifdef TRUE
17 #undef TRUE
18 #endif
19 #define TRUE 1
20 #ifdef FALSE
21 #undef FALSE
22 #endif
23 #define FALSE 0
24 #ifndef NULL
25 #define NULL 0
26 #endif
27
28 typedef struct {
29         u8t     hour;
30         u8t     minute;
31         u8t     second;
32         u8t     day;
33         u8t     month;
34         u8t     year;
35 } clock_state;
36
37 typedef enum {
38         IDLE_SCREEN = 0,
39         ACCEL_DISPLAY_SCREEN,
40         DATETIME_SETTING_SCREEN,
41         MENU_TEST_SCREEN,
42 //      SCREEN2_SCREEN,
43 //      SCREEN3_SCREEN,
44 //      APPLICATION_SCREEN,
45         LAST_SCREEN,            // a marker for the last (not valid) screen)
46 } screen_number;
47
48 typedef enum {
49         BUTTON_A = 0,
50         BUTTON_B,
51         BUTTON_C,
52         BUTTON_D,
53         BUTTON_E,
54         BUTTON_F,
55 } watch_button;
56
57 #define EVENT_SCREEN_VISIBLE            (1<<0)          // screen just became visible
58 #define EVENT_SCREEN_DESTROY            (1<<1)          // screen is destroyed
59 #define EVENT_ONE_SEC_TIMER             (1<<2)
60 #define EVENT_MS_TIMER                  (1<<3)
61 #define EVENT_USER_BUTTONS              (1<<4)
62 #define EVENT_ACCEL_UPDATE              (1<<5)
63 #define EVENT_AMBIENTLIGHT_UPDATE       (1<<6)
64 #define EVENT_POWER_CHANGE              (1<<7)
65 #define EVENT_COMMS                     (1<<8)
66
67 typedef struct {
68         u16t event_mask;                                // the event the screen wants to receive
69         void (*event_func)(u16t event, void *data);     // callback for events
70 //      void (*button_func)(watch_button button);       // handles button presses
71 //      void (*screendraw_func)(void);                  // callback for screen update
72 //      void *user_data;
73 } watch_screen;
74
75 typedef struct {
76         screen_number   screen_id;
77         // void (*draw_watchface_func)(boolean show_seconds);
78         boolean idle_show_seconds;
79         watch_screen *screen;           // the current screen
80         // void (*user_button_func)(watch_button button);
81         // void (*user_screendraw_func)(void);
82 } watch_state;
83
84 #endif
85