7 #define OSWALD_VERSION "v0.3"
11 #define dbg_out( args... ) fprintf(stderr, args)
13 #define dbg_out( args... ) do {} while (0)
16 typedef uint8_t boolean;
34 uint8_t wday; // day in week, 0=sunday, 1=monday,...
41 #define WDAY_SUNDAY (1 << 0)
42 #define WDAY_MONDAY (1 << 1)
43 #define WDAY_TUESDAY (1 << 2)
44 #define WDAY_WEDNESDAY (1 << 3)
45 #define WDAY_THURSDAY (1 << 4)
46 #define WDAY_FRIDAY (1 << 5)
47 #define WDAY_SATURDAY (1 << 6)
51 uint8_t wday; // bitfield 0 to 6, 1=sunday, 2=monday, 4=tuesday...
61 LAST_SCREEN, // a marker for the last (not valid) screen)
64 DATETIME_SETTING_SCREEN,
78 #define EVENT_SCREEN_VISIBLE (1<<0) // screen just became visible
79 #define EVENT_SCREEN_DESTROY (1<<1) // screen is destroyed
80 #define EVENT_ONE_SEC_TIMER (1<<2) // one second timer for reguler clock
81 #define EVENT_HALF_SEC_TIMER (1<<3) // half second timer for blinking displays
82 #define EVENT_CS_TIMER (1<<4) // centisecond timer, e.g. for stop watch
83 #define EVENT_USER_BUTTONS (1<<5) // button presses
84 #define EVENT_ACCEL_UPDATE (1<<6) // accelerometer updates
85 #define EVENT_AMBIENTLIGHT_UPDATE (1<<7) // ambient light sensor updates
86 #define EVENT_POWER_CHANGE (1<<8) // power source status change
87 #define EVENT_COMMS (1<<9) // communication, like Bluetooth I/O
88 #define EVENT_POWER_STATE (1<<10) // power source changed or similar
91 EVENT_RET_UNHANDLED = 0,
97 uint16_t event_mask; // the event the screen wants to receive
98 event_ret_t (*event_func)(uint16_t event, void *data); // callback for events
103 screen_number screen_id;
104 watch_screen *screen; // the current screen
105 boolean pending_idle;
114 #define POWER_SOURCE_BATTERY 0
115 #define POWER_SOURCE_EXTERNAL 1
117 #define POWER_CHARGER_DONE 0
118 #define POWER_CHARGER_PRECHARGE 1
119 #define POWER_CHARGER_CHARGING 2
120 #define POWER_CHARGER_UNK 3
124 uint8_t charge_state;