summaryrefslogtreecommitdiff
path: root/frontends/calculator/CEdev/examples/real_time_clock
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2019-04-10 15:14:00 -0400
committerAndrew Opalach <andrew@akon.city> 2019-04-10 15:14:00 -0400
commit60699af63f92f43cc4b4b9e3050fcdd2a8468281 (patch)
tree20a18af2774daa43ae7f4352dd032a24f7e06075 /frontends/calculator/CEdev/examples/real_time_clock
parent4527bc20241068731c62101d0467d416119ec0c4 (diff)
downloadcetris-60699af63f92f43cc4b4b9e3050fcdd2a8468281.tar.gz
cetris-60699af63f92f43cc4b4b9e3050fcdd2a8468281.tar.bz2
cetris-60699af63f92f43cc4b4b9e3050fcdd2a8468281.zip
add opengl fronend, remove sdl frontend, refactor build system
Diffstat (limited to 'frontends/calculator/CEdev/examples/real_time_clock')
-rw-r--r--frontends/calculator/CEdev/examples/real_time_clock/makefile15
-rw-r--r--frontends/calculator/CEdev/examples/real_time_clock/readme.md10
-rw-r--r--frontends/calculator/CEdev/examples/real_time_clock/screenshot.gifbin0 -> 9251 bytes
-rw-r--r--frontends/calculator/CEdev/examples/real_time_clock/src/main.c39
4 files changed, 64 insertions, 0 deletions
diff --git a/frontends/calculator/CEdev/examples/real_time_clock/makefile b/frontends/calculator/CEdev/examples/real_time_clock/makefile
new file mode 100644
index 0000000..1f1b36b
--- /dev/null
+++ b/frontends/calculator/CEdev/examples/real_time_clock/makefile
@@ -0,0 +1,15 @@
+# ----------------------------
+# Set NAME to the program name
+# Set ICON to the png icon file name
+# Set DESCRIPTION to display within a compatible shell
+# Set COMPRESSED to "YES" to create a compressed program
+# ----------------------------
+
+NAME ?= DEMO
+COMPRESSED ?= NO
+ICON ?= iconc.png
+DESCRIPTION ?= "C SDK Demo"
+
+# ----------------------------
+
+include $(CEDEV)/include/.makefile
diff --git a/frontends/calculator/CEdev/examples/real_time_clock/readme.md b/frontends/calculator/CEdev/examples/real_time_clock/readme.md
new file mode 100644
index 0000000..08554eb
--- /dev/null
+++ b/frontends/calculator/CEdev/examples/real_time_clock/readme.md
@@ -0,0 +1,10 @@
+### Real Time Clock Demo
+
+This demo demonstrates how to use the basics of the real time clock (RTC)
+
+![Screenshot](screenshot.gif)
+
+---
+
+This demo is a part of the C SDK Toolchain for use on the CE.
+
diff --git a/frontends/calculator/CEdev/examples/real_time_clock/screenshot.gif b/frontends/calculator/CEdev/examples/real_time_clock/screenshot.gif
new file mode 100644
index 0000000..3e81f11
--- /dev/null
+++ b/frontends/calculator/CEdev/examples/real_time_clock/screenshot.gif
Binary files differ
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 <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <tice.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+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;
+ }
+ }
+}