}
}
-void oswald_set_time(u8t hour, u8t minute, u8t second)
+void oswald_set_time(u8t hour, u8t minute, u8t second, boolean clk24hr)
{
OswaldClk.hour = hour;
OswaldClk.minute = minute;
OswaldClk.second = second;
+ OswaldClk.clk24hr = clk24hr;
+}
+
+void oswald_set_date(u8t day, u8t month, u16t year, boolean day_first)
+{
+ OswaldClk.day = day;
+ OswaldClk.month = month;
+ OswaldClk.year = year;
+ OswaldClk.day_first = day_first;
}
static void update_clock_state (void)
if (OswaldState.screen->event_func != NULL &&
(OswaldState.screen->event_mask & EVENT_ONE_SEC_TIMER))
OswaldState.screen->event_func(EVENT_ONE_SEC_TIMER, NULL);
- // oswald_update_screen();
+}
+
+void oswald_centisecond_tick(void)
+{
+ if (OswaldState.screen->event_func != NULL &&
+ (OswaldState.screen->event_mask & EVENT_CS_TIMER))
+ OswaldState.screen->event_func(EVENT_CS_TIMER, NULL);
+}
+
+void oswald_halfsecond_tick(void)
+{
+ if (OswaldState.screen->event_func != NULL &&
+ (OswaldState.screen->event_mask & EVENT_HALF_SEC_TIMER))
+ OswaldState.screen->event_func(EVENT_HALF_SEC_TIMER, NULL);
}
void oswald_handle_button_press(watch_button button)
OswaldState.screen->event_func(EVENT_USER_BUTTONS, &button);
break;
case BUTTON_C:
+ OswaldState.screen->event_func(EVENT_SCREEN_DESTROY, NULL);
// next screen
OswaldState.screen_id++;
if (OswaldState.screen_id >= LAST_SCREEN) {
};
}
+void oswald_handle_accel_event(u8t x, u8t y, u8t z)
+{
+ accel_data_t accel_data;
+
+ accel_data.x = x;
+ accel_data.y = y;
+ accel_data.z = z;
+
+ if (OswaldState.screen->event_func != NULL &&
+ (OswaldState.screen->event_mask & EVENT_ACCEL_UPDATE))
+ OswaldState.screen->event_func(EVENT_ACCEL_UPDATE, &accel_data);
+}
+
+void oswald_handle_ambientlight_event(u8t light_level)
+{
+ if (OswaldState.screen->event_func != NULL &&
+ (OswaldState.screen->event_mask & EVENT_AMBIENTLIGHT_UPDATE))
+ OswaldState.screen->event_func(EVENT_AMBIENTLIGHT_UPDATE, &light_level);
+}
+
void oswald_init(void)
{
OswaldScreens[IDLE_SCREEN].event_mask = EVENT_USER_BUTTONS | EVENT_ONE_SEC_TIMER;
OswaldScreens[IDLE_SCREEN].event_func = idle_handle_events;
- OswaldScreens[ACCEL_DISPLAY_SCREEN].event_mask = EVENT_USER_BUTTONS;
+ OswaldScreens[ACCEL_DISPLAY_SCREEN].event_mask = EVENT_USER_BUTTONS | EVENT_ACCEL_UPDATE;
OswaldScreens[ACCEL_DISPLAY_SCREEN].event_func = accel_handle_events;
-
- OswaldScreens[DATETIME_SETTING_SCREEN].event_mask = EVENT_USER_BUTTONS | EVENT_ONE_SEC_TIMER;
+ OswaldScreens[DATETIME_SETTING_SCREEN].event_mask = EVENT_USER_BUTTONS | EVENT_HALF_SEC_TIMER;
OswaldScreens[DATETIME_SETTING_SCREEN].event_func = datetime_setup_events;
OswaldScreens[MENU_TEST_SCREEN].event_mask = EVENT_USER_BUTTONS;