aboutsummaryrefslogtreecommitdiff
path: root/src/rtc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rtc.c')
-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;
+}