summaryrefslogtreecommitdiff
path: root/frontends/calculator/CEdev/examples/stopwatch
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2019-04-13 12:40:52 -0400
committerAndrew Opalach <andrew@akon.city> 2019-04-13 12:40:52 -0400
commit55bfff7cf6541caac172b43186cf14405185b14d (patch)
treec1ae99d2b39f8df8933d81ec2e61e81050bdb410 /frontends/calculator/CEdev/examples/stopwatch
parent761462861fc1228e65546c4e0f877d5212320082 (diff)
downloadcetris-55bfff7cf6541caac172b43186cf14405185b14d.tar.gz
cetris-55bfff7cf6541caac172b43186cf14405185b14d.tar.bz2
cetris-55bfff7cf6541caac172b43186cf14405185b14d.zip
fix curses on linux
Diffstat (limited to 'frontends/calculator/CEdev/examples/stopwatch')
-rw-r--r--frontends/calculator/CEdev/examples/stopwatch/makefile30
-rw-r--r--frontends/calculator/CEdev/examples/stopwatch/readme.md20
-rw-r--r--frontends/calculator/CEdev/examples/stopwatch/src/main.c120
3 files changed, 85 insertions, 85 deletions
diff --git a/frontends/calculator/CEdev/examples/stopwatch/makefile b/frontends/calculator/CEdev/examples/stopwatch/makefile
index 1f1b36b..d3deba8 100644
--- a/frontends/calculator/CEdev/examples/stopwatch/makefile
+++ b/frontends/calculator/CEdev/examples/stopwatch/makefile
@@ -1,15 +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
+# ----------------------------
+# 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/stopwatch/readme.md b/frontends/calculator/CEdev/examples/stopwatch/readme.md
index a10bdb9..f27edf4 100644
--- a/frontends/calculator/CEdev/examples/stopwatch/readme.md
+++ b/frontends/calculator/CEdev/examples/stopwatch/readme.md
@@ -1,10 +1,10 @@
-### Stopwatch Demo
-
-This demo demonstrates using the hardware timers to make a simple stopwatch
-displaying millisecond precision.
-
-![Screenshot](screenshot.png)
-
----
-
-This demo is a part of the C SDK Toolchain for use on the CE.
+### Stopwatch Demo
+
+This demo demonstrates using the hardware timers to make a simple stopwatch
+displaying millisecond precision.
+
+![Screenshot](screenshot.png)
+
+---
+
+This demo is a part of the C SDK Toolchain for use on the CE.
diff --git a/frontends/calculator/CEdev/examples/stopwatch/src/main.c b/frontends/calculator/CEdev/examples/stopwatch/src/main.c
index 3ec82b1..6dc8fdf 100644
--- a/frontends/calculator/CEdev/examples/stopwatch/src/main.c
+++ b/frontends/calculator/CEdev/examples/stopwatch/src/main.c
@@ -1,60 +1,60 @@
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <tice.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-/* Print a stopwatch value on the home screen */
-void print(float elapsed) {
- /* Float format for printf may be unimplemented, so go through an OS real */
- real_t elapsed_real;
-
- /* Max stopwatch value is (2^32 - 1) / 32768 = 131072.00, */
- /* so create a buffer with room for 9 characters plus a null terminator */
- char str[10];
-
- /* If the elapsed time is small enough that the OS would print it using */
- /* scientific notation, force it down to zero before conversion */
- elapsed_real = os_FloatToReal(elapsed <= 0.001f ? 0.0f : elapsed);
-
- /* Convert the elapsed time real to a string */
- os_RealToStr(str, &elapsed_real, 8, 1, 2);
-
- /* Print the string */
- os_SetCursorPos(0, 0);
- os_PutStrFull(str);
-}
-
-/* Put all your code here */
-void main(void) {
- /* Clear the homescreen */
- os_ClrHome();
-
- /* Display an initial time of zero */
- print(0.0f);
-
- /* Disable the timer */
- timer_Control = TIMER1_DISABLE;
-
- /* Reset the timer's counter */
- timer_1_Counter = 0;
-
- /* Wait for a key press */
- while (!os_GetCSC());
-
- /* Enable the timer while setting it to 32768 KHz and making it count up */
- timer_Control = TIMER1_ENABLE | TIMER1_32K | TIMER1_UP;
-
- /* Continue running until a key is pressed */
- do {
- /* Calculate and print the elapsed time */
- float elapsed = (float)atomic_load_increasing_32(&timer_1_Counter) / 32768;
- print(elapsed);
- } while (!os_GetCSC());
-
- /* Wait for a key press */
- while (!os_GetCSC());
-}
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <tice.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* Print a stopwatch value on the home screen */
+void print(float elapsed) {
+ /* Float format for printf may be unimplemented, so go through an OS real */
+ real_t elapsed_real;
+
+ /* Max stopwatch value is (2^32 - 1) / 32768 = 131072.00, */
+ /* so create a buffer with room for 9 characters plus a null terminator */
+ char str[10];
+
+ /* If the elapsed time is small enough that the OS would print it using */
+ /* scientific notation, force it down to zero before conversion */
+ elapsed_real = os_FloatToReal(elapsed <= 0.001f ? 0.0f : elapsed);
+
+ /* Convert the elapsed time real to a string */
+ os_RealToStr(str, &elapsed_real, 8, 1, 2);
+
+ /* Print the string */
+ os_SetCursorPos(0, 0);
+ os_PutStrFull(str);
+}
+
+/* Put all your code here */
+void main(void) {
+ /* Clear the homescreen */
+ os_ClrHome();
+
+ /* Display an initial time of zero */
+ print(0.0f);
+
+ /* Disable the timer */
+ timer_Control = TIMER1_DISABLE;
+
+ /* Reset the timer's counter */
+ timer_1_Counter = 0;
+
+ /* Wait for a key press */
+ while (!os_GetCSC());
+
+ /* Enable the timer while setting it to 32768 KHz and making it count up */
+ timer_Control = TIMER1_ENABLE | TIMER1_32K | TIMER1_UP;
+
+ /* Continue running until a key is pressed */
+ do {
+ /* Calculate and print the elapsed time */
+ float elapsed = (float)atomic_load_increasing_32(&timer_1_Counter) / 32768;
+ print(elapsed);
+ } while (!os_GetCSC());
+
+ /* Wait for a key press */
+ while (!os_GetCSC());
+}