aboutsummaryrefslogtreecommitdiff
path: root/src/rtc.c
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2026-02-28 17:37:19 +0530
committerAkshay Nair <phenax5@gmail.com>2026-02-28 17:37:19 +0530
commit18268280dc6c0bd44035b53655ae43e9c88245bd (patch)
treec17b1703d8a3deb4cd67a6e6466d024f02a49bb7 /src/rtc.c
parent02c12bfedcf669df81491ea49502a982e980bcda (diff)
downloaddaft-watch-18268280dc6c0bd44035b53655ae43e9c88245bd.tar.gz
daft-watch-18268280dc6c0bd44035b53655ae43e9c88245bd.zip
Add set time mode + test for button
Diffstat (limited to '')
-rw-r--r--src/rtc.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/rtc.c b/src/rtc.c
index 53a5983..bbf79e1 100644
--- a/src/rtc.c
+++ b/src/rtc.c
@@ -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;
+}