diff options
Diffstat (limited to 'Smol Watch Project/My Project/main.c')
-rw-r--r-- | Smol Watch Project/My Project/main.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/Smol Watch Project/My Project/main.c b/Smol Watch Project/My Project/main.c index 3af1ed07..b803fb6d 100644 --- a/Smol Watch Project/My Project/main.c +++ b/Smol Watch Project/My Project/main.c @@ -4,38 +4,38 @@ #include "mars_clock.h" Watch watch; -bool locked = true; +bool local = true; void calendar_callback(struct calendar_descriptor *const calendar) { } static void mode_callback() { - locked = !locked; - gpio_set_pin_level(GREEN, !locked); + local = !local; + struct calendar_date_time date_time; + calendar_get_date_time(&CALENDAR_0, &date_time); + update_display(&watch, date_time, local); } static void light_callback() { - if (locked) return; struct calendar_date_time date_time; calendar_get_date_time(&CALENDAR_0, &date_time); date_time.time.min = (date_time.time.min + 1) % 60; watch_set_date_time(date_time); - update_display(&watch, date_time); + update_display(&watch, date_time, local); } static void alarm_callback() { - if (locked) return; struct calendar_date_time date_time; calendar_get_date_time(&CALENDAR_0, &date_time); date_time.time.sec = 0; watch_set_date_time(date_time); - update_display(&watch, date_time); + update_display(&watch, date_time, local); } static void tick_callback() { struct calendar_date_time date_time; calendar_get_date_time(&CALENDAR_0, &date_time); - update_display(&watch, date_time); + update_display(&watch, date_time, local); } int main(void) @@ -61,11 +61,11 @@ int main(void) watch_enable_date_time(&watch); struct calendar_date_time date_time; - date_time.date.year = 1; // reference year is 2020, add this to that. + date_time.date.year = 2021; date_time.date.month = 5; - date_time.date.day = 2; - date_time.time.hour = 7; - date_time.time.min = 15; + date_time.date.day = 6; + date_time.time.hour = 23; + date_time.time.min = 30; date_time.time.sec = 0; watch_set_date_time(date_time); /* struct calendar_alarm alarm; @@ -76,7 +76,7 @@ int main(void) alarm.callback = calendar_callback; calendar_set_alarm(&CALENDAR_0, &alarm, &calendar_callback); */ - update_display(&watch, date_time); + update_display(&watch, date_time, local); watch_enable_tick(tick_callback); while (1) { |