From 60699af63f92f43cc4b4b9e3050fcdd2a8468281 Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Wed, 10 Apr 2019 15:14:00 -0400 Subject: add opengl fronend, remove sdl frontend, refactor build system --- .../CEdev/examples/real_time_clock/src/main.c | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 frontends/calculator/CEdev/examples/real_time_clock/src/main.c (limited to 'frontends/calculator/CEdev/examples/real_time_clock/src') diff --git a/frontends/calculator/CEdev/examples/real_time_clock/src/main.c b/frontends/calculator/CEdev/examples/real_time_clock/src/main.c new file mode 100644 index 0000000..1aa24cb --- /dev/null +++ b/frontends/calculator/CEdev/examples/real_time_clock/src/main.c @@ -0,0 +1,39 @@ +#include +#include +#include +#include + +#include +#include +#include + +unsigned int seconds = 0; + +void main(void) { + + /* Clear the homescreen */ + os_ClrHome(); + + /* Randomize things */ + srand(rtc_Time()); + + /* Configure the RTC */ + rtc_LoadSeconds = rtc_LoadMinutes = rtc_LoadHours = rtc_LoadDays = 0; + rtc_Control = RTC_ENABLE | RTC_LOAD | RTC_SEC_INT_SOURCE; + + /* Wait for the RTC to load in the new values and then acknowledge all the interrupts */ + while (rtc_IsBusy()); + rtc_IntAcknowledge = RTC_INT_MASK; + + /* Wait until 5 seconds have passed */ + while (seconds < 5) { + + /* If a second passed, increment the second counter */ + if (rtc_IntStatus & RTC_SEC_INT) { + memset(lcd_Ram, randInt(0,255), LCD_SIZE); + seconds++; + + rtc_IntAcknowledge = rtc_IntStatus; + } + } +} -- cgit v1.2.3-101-g0448