aboutsummaryrefslogtreecommitdiff
path: root/src/rtc.c
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2026-02-19 21:47:19 +0530
committerAkshay Nair <phenax5@gmail.com>2026-02-19 21:47:19 +0530
commit2c4ba27ff0d110f8c9ef99e3493a4a9b2dddbcb6 (patch)
tree9922dc87c0edff3c601e7554223cfaeb7c06cd55 /src/rtc.c
parentffadf36040d103ed62c5e7281bdeb8ceedab7a8d (diff)
downloaddaft-watch-2c4ba27ff0d110f8c9ef99e3493a4a9b2dddbcb6.tar.gz
daft-watch-2c4ba27ff0d110f8c9ef99e3493a4a9b2dddbcb6.zip
Optimize display write
Diffstat (limited to 'src/rtc.c')
-rw-r--r--src/rtc.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/rtc.c b/src/rtc.c
index 053e651..53a5983 100644
--- a/src/rtc.c
+++ b/src/rtc.c
@@ -23,14 +23,28 @@ volatile uint8_t seconds = 0;
volatile uint8_t minutes = 0;
volatile uint8_t hours = 0;
+volatile uint8_t seconds_digit1 = 0;
+volatile uint8_t seconds_digit2 = 0;
+volatile uint8_t minutes_digit1 = 0;
+volatile uint8_t minutes_digit2 = 0;
+volatile uint8_t hours_digit1 = 0;
+volatile uint8_t hours_digit2 = 0;
+
void rtc_increment(void) {
uint8_t s = seconds + 1;
seconds = s % 60;
+ // TODO: Remove seconds digits calculation
+ seconds_digit1 = seconds % 10;
+ 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;
}
}
}