]> git.karo-electronics.de Git - oswald.git/blobdiff - ui/oswald.h
Rework font code, add new fonts, also proportional, rework watch usage - "SET" button...
[oswald.git] / ui / oswald.h
index ee51438c1edbe39141fc39627f3683b8db1f5208..b03a6b33331d7717679ba7e65bb7be65ad4c47c3 100644 (file)
 #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;
+typedef uint8_t boolean;
 #ifdef TRUE
 #undef TRUE
 #endif
@@ -29,13 +25,13 @@ typedef u8t boolean;
 #endif
 
 typedef struct {
-       u8t     hour;
-       u8t     minute;
-       u8t     second;
-       u8t     day;
-       u8t     wday; // day in week, 0=sunday, 1=monday,...
-       u8t     month;
-       u16t    year;
+       uint8_t hour;
+       uint8_t minute;
+       uint8_t second;
+       uint8_t day;
+       uint8_t wday; // day in week, 0=sunday, 1=monday,...
+       uint8_t month;
+       uint16_t        year;
        boolean clk24hr;
        boolean day_first;
 } clock_state;
@@ -48,9 +44,9 @@ typedef struct {
 #define WDAY_FRIDAY    (1 << 5)
 #define WDAY_SATURDAY  (1 << 6)
 typedef struct {
-       u8t     hour;
-       u8t     minute;
-       u8t     wday; // bitfield 0 to 6, 1=sunday, 2=monday, 4=tuesday...
+       uint8_t hour;
+       uint8_t minute;
+       uint8_t wday; // bitfield 0 to 6, 1=sunday, 2=monday, 4=tuesday...
 } alarm_clk;
 
 typedef enum {
@@ -88,10 +84,15 @@ typedef enum {
 #define EVENT_COMMS                    (1<<9)          // communication, like Bluetooth I/O
 #define EVENT_POWER_STATE              (1<<10)         // power source changed or similar
 
+typedef enum {
+       EVENT_RET_UNHANDLED = 0,
+       EVENT_RET_HANDLED,
+       EVENT_RET_ERR
+} event_ret_t;
 
 typedef struct {
-       u16t event_mask;                                // the event the screen wants to receive
-       void (*event_func)(u16t event, void *data);     // callback for events
+       uint16_t event_mask;                            // the event the screen wants to receive
+       event_ret_t (*event_func)(uint16_t event, void *data);  // callback for events
        void *user_data;
 } watch_screen;
 
@@ -102,9 +103,9 @@ typedef struct {
 } watch_state;
 
 typedef struct {
-       u8t     x;
-       u8t     y;
-       u8t     z;
+       uint8_t x;
+       uint8_t y;
+       uint8_t z;
 } accel_data_t;
 
 #define POWER_SOURCE_BATTERY   0
@@ -116,10 +117,10 @@ typedef struct {
 #define POWER_CHARGER_UNK      3
 
 typedef struct {
-       u8t     source;
-       u8t     charge_state;
-       u8t     percent;
-       u16t    level;
+       uint8_t source;
+       uint8_t charge_state;
+       uint8_t percent;
+       uint16_t        level;
 } power_state;
 
 typedef enum {