diff options
| author | Akshay Nair <phenax5@gmail.com> | 2026-02-28 17:37:19 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2026-02-28 17:37:19 +0530 |
| commit | 18268280dc6c0bd44035b53655ae43e9c88245bd (patch) | |
| tree | c17b1703d8a3deb4cd67a6e6466d024f02a49bb7 /src/rtc.c | |
| parent | 02c12bfedcf669df81491ea49502a982e980bcda (diff) | |
| download | daft-watch-18268280dc6c0bd44035b53655ae43e9c88245bd.tar.gz daft-watch-18268280dc6c0bd44035b53655ae43e9c88245bd.zip | |
Add set time mode + test for button
Diffstat (limited to 'src/rtc.c')
| -rw-r--r-- | src/rtc.c | 23 |
1 files changed, 15 insertions, 8 deletions
@@ -38,13 +38,20 @@ void rtc_increment(void) { seconds_digit2 = (seconds / 10) % 10; if (s >= 60) { uint8_t m = minutes + 1; - minutes = m % 60; - minutes_digit1 = minutes % 10; - minutes_digit2 = (minutes / 10) % 10; - if (m >= 60) { - hours = (hours + 1) % 24; - hours_digit1 = hours % 10; - hours_digit2 = (hours / 10) % 10; - } + rtc_set_minutes(m); + if (m >= 60) + rtc_set_hours(hours + 1); } } + +void rtc_set_minutes(uint8_t m) { + minutes = m % 60; + minutes_digit1 = minutes % 10; + minutes_digit2 = (minutes / 10) % 10; +} + +void rtc_set_hours(uint8_t h) { + hours = h % 24; + hours_digit1 = hours % 10; + hours_digit2 = (hours / 10) % 10; +} |
