diff options
author | Joey Castillo <jose.castillo@gmail.com> | 2021-10-04 00:37:58 -0400 |
---|---|---|
committer | Joey Castillo <jose.castillo@gmail.com> | 2021-10-04 00:38:09 -0400 |
commit | 51e2f0d77d95a6e5c3b1426fbc7874c3a59a5e00 (patch) | |
tree | 7f8f5a03415ef46d8bb11a7195bbc310aa1a64e5 /launcher/launcher.h | |
parent | a6115de94d977da69a6a81f93a92706e76324a37 (diff) | |
download | Sensor-Watch-51e2f0d77d95a6e5c3b1426fbc7874c3a59a5e00.tar.gz Sensor-Watch-51e2f0d77d95a6e5c3b1426fbc7874c3a59a5e00.tar.bz2 Sensor-Watch-51e2f0d77d95a6e5c3b1426fbc7874c3a59a5e00.zip |
event type / subsecond refactor
Diffstat (limited to 'launcher/launcher.h')
-rw-r--r-- | launcher/launcher.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/launcher/launcher.h b/launcher/launcher.h index 09b33dbb..d6ebbc2c 100644 --- a/launcher/launcher.h +++ b/launcher/launcher.h @@ -21,7 +21,7 @@ typedef union { uint32_t value; } LauncherSettings; -typedef enum LauncherEvent { +typedef enum { EVENT_NONE = 0, // There is no event to report. EVENT_ACTIVATE, // Your widget is entering the foreground. EVENT_TICK, // Most common event type. Your widget is being called from the tick callback. @@ -35,11 +35,21 @@ typedef enum LauncherEvent { EVENT_ALARM_BUTTON_DOWN, // The alarm button has been pressed, but not yet released. EVENT_ALARM_BUTTON_UP, // The alarm button was pressed and released. EVENT_ALARM_LONG_PRESS, // The alarm button was held for >2 seconds, and released. +} LauncherEventType; + +typedef union { + struct { + uint32_t event_type : 8; + uint32_t subsecond : 8; + uint32_t reserved : 16; + } bit; + uint32_t value; } LauncherEvent; + typedef void (*launcher_widget_setup)(LauncherSettings *settings, void ** context_ptr); typedef void (*launcher_widget_activate)(LauncherSettings *settings, void *context); -typedef void (*launcher_widget_loop)(LauncherEvent event, LauncherSettings *settings, uint8_t subsecond, void *context); +typedef void (*launcher_widget_loop)(LauncherEvent event, LauncherSettings *settings, void *context); typedef void (*launcher_widget_resign)(LauncherSettings *settings, void *context); typedef struct WatchWidget { |