From bc30ef0daacae07a643ac73856950c8a30954ee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=20K=C3=A9vin?= Date: Fri, 25 Mar 2016 13:17:48 +0100 Subject: [PATCH] show RTC time on LEDs --- main.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/main.c b/main.c index b744127..54385b3 100644 --- a/main.c +++ b/main.c @@ -265,20 +265,23 @@ int main(void) printf("welcome to the CuVoodoo LED clock\n"); // print welcome message led_on(); // switch on LED to indicate setup completed - uint32_t time = 0; // the time to display - uint32_t current_time = 6*ticks_hour+45*ticks_minute+15*ticks_second+ticks_second/4; + + uint16_t* rtc_time = rtc_read_time(); // get current date + printf("current date: %04d-%02d-%02d %02d:%02d:%02d\n", rtc_time[6], rtc_time[5], rtc_time[4], rtc_time[2], rtc_time[1], rtc_time[0]); + uint32_t display_time = 0; // the time to display + uint32_t current_time = rtc_time[2]*ticks_hour+rtc_time[1]*ticks_minute+rtc_time[0]*ticks_second; // the current time printf("setting current time\n"); - while (time