-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added ability to make default time on the watch be PC clock's during … #414
base: main
Are you sure you want to change the base?
Changes from all commits
c9a4f0c
c5f688c
f3371ec
f9f1e7e
01d90dd
e7a9723
79a1b98
e91c095
57772f0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,51 @@ | |
#include "watch.h" | ||
#include "tusb.h" | ||
|
||
static inline uint32_t get_initial_year(void) | ||
{ | ||
#ifdef INITIAL_YEAR | ||
return INITIAL_YEAR; | ||
#else | ||
return 4; | ||
#endif | ||
} | ||
|
||
static inline uint32_t get_initial_month(void) | ||
{ | ||
#ifdef INITIAL_MONTH | ||
return INITIAL_MONTH; | ||
#else | ||
return 0; | ||
#endif | ||
} | ||
|
||
static inline uint32_t get_inital_day(void) | ||
{ | ||
#ifdef INITIAL_DAY | ||
return INITIAL_DAY; | ||
#else | ||
return 0; | ||
#endif | ||
} | ||
|
||
static inline uint32_t get_inital_hour(void) | ||
{ | ||
#ifdef INITIAL_HOUR | ||
return INITIAL_HOUR; | ||
#else | ||
return 0; | ||
#endif | ||
} | ||
|
||
static inline uint32_t get_inital_minute(void) | ||
{ | ||
#ifdef INITIAL_MINUTE | ||
return INITIAL_MINUTE; | ||
#else | ||
return 0; | ||
#endif | ||
} | ||
|
||
int main(void) { | ||
// ASF code. Initialize the MCU with configuration options from Atmel Studio. | ||
init_mcu(); | ||
|
@@ -69,7 +114,11 @@ int main(void) { | |
// if date/time register is 0 (power on reset state), default year to 2023. | ||
watch_date_time date_time = watch_rtc_get_date_time(); | ||
if (date_time.reg == 0) { | ||
date_time.unit.year = 3; | ||
date_time.unit.year = get_initial_year(); | ||
date_time.unit.month = get_initial_month(); | ||
date_time.unit.day = get_inital_day(); | ||
date_time.unit.hour = get_inital_hour(); | ||
date_time.unit.minute = get_inital_minute(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if this is worth much, but it's been helpful for me. For Linux users who only add these 4 lines and don't change any other files, From
I know it's not pretty, but it is handy. (It also adds 1 minute to the time to allow you to put the watch back together.) |
||
watch_rtc_set_date_time(date_time); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This adds a direct dependency on GNU coreutils for building the firmware. I consider that to be perfectly OK but then again I've been running Linux for over a decade. I have no idea how this impacts Windows users. Maintainers might want to double check this.