summaryrefslogtreecommitdiffstats
path: root/apps/sensor-board-test
diff options
context:
space:
mode:
authorJoey Castillo <joeycastillo@utexas.edu>2022-07-05 22:53:04 -0500
committerJoey Castillo <joeycastillo@utexas.edu>2022-07-05 22:53:44 -0500
commit87da5f15ea314d53d97cee5f9fd13b4f83455256 (patch)
tree4ea3affa623d73d3e4df8b4b4e68c413a01fae39 /apps/sensor-board-test
parent3c5114ba4c087f85ff500696519d309298675bb0 (diff)
downloadSensor-Watch-87da5f15ea314d53d97cee5f9fd13b4f83455256.tar.gz
Sensor-Watch-87da5f15ea314d53d97cee5f9fd13b4f83455256.tar.bz2
Sensor-Watch-87da5f15ea314d53d97cee5f9fd13b4f83455256.zip
new tests
Diffstat (limited to 'apps/sensor-board-test')
-rw-r--r--apps/sensor-board-test/app.c75
-rwxr-xr-xapps/sensor-board-test/make/Makefile10
2 files changed, 85 insertions, 0 deletions
diff --git a/apps/sensor-board-test/app.c b/apps/sensor-board-test/app.c
new file mode 100644
index 00000000..d7da190a
--- /dev/null
+++ b/apps/sensor-board-test/app.c
@@ -0,0 +1,75 @@
+#include <stdio.h>
+#include <string.h>
+#include "watch.h"
+
+bool even = false;
+
+static void cb_tick(void) {
+ even = !even;
+}
+
+void app_init(void) {
+}
+
+void app_wake_from_backup(void) {
+}
+
+void app_setup(void) {
+ watch_enable_digital_output(RED);
+ watch_enable_digital_output(GREEN);
+ watch_enable_digital_output(A0);
+ watch_enable_digital_output(SCL);
+ watch_enable_digital_output(SDA);
+ watch_enable_digital_output(A1);
+ watch_enable_digital_output(A2);
+ watch_enable_digital_output(A3);
+ watch_enable_digital_output(A4);
+
+ watch_set_pin_level(A0, false);
+ watch_set_pin_level(SCL, false);
+ watch_set_pin_level(SDA, false);
+ watch_set_pin_level(A1, false);
+ watch_set_pin_level(A2, false);
+ watch_set_pin_level(A3, false);
+ watch_set_pin_level(A4, false);
+
+ watch_rtc_register_periodic_callback(cb_tick, 2);
+}
+
+void app_prepare_for_standby(void) {
+}
+
+void app_wake_from_standby(void) {
+}
+
+bool app_loop(void) {
+ watch_date_time date_time = watch_rtc_get_date_time();
+ char buf[16];
+ sprintf(buf, "%2d:%02d:%02d: ", date_time.unit.hour, date_time.unit.minute, date_time.unit.second);
+ printf(buf);
+ if (even) {
+ printf("Even\n");
+ watch_set_pin_level(RED, false);
+ watch_set_pin_level(GREEN, true);
+ watch_set_pin_level(A0, true);
+ watch_set_pin_level(SCL, false);
+ watch_set_pin_level(SDA, true);
+ watch_set_pin_level(A1, false);
+ watch_set_pin_level(A2, true);
+ watch_set_pin_level(A3, false);
+ watch_set_pin_level(A4, true);
+ } else {
+ printf("Odd\n");
+ watch_set_pin_level(RED, true);
+ watch_set_pin_level(GREEN, false);
+ watch_set_pin_level(A0, false);
+ watch_set_pin_level(SCL, true);
+ watch_set_pin_level(SDA, false);
+ watch_set_pin_level(A1, true);
+ watch_set_pin_level(A2, false);
+ watch_set_pin_level(A3, true);
+ watch_set_pin_level(A4, false);
+ }
+
+ return true;
+}
diff --git a/apps/sensor-board-test/make/Makefile b/apps/sensor-board-test/make/Makefile
new file mode 100755
index 00000000..c66ad20c
--- /dev/null
+++ b/apps/sensor-board-test/make/Makefile
@@ -0,0 +1,10 @@
+TOP = ../../..
+include $(TOP)/make.mk
+
+INCLUDES += \
+ -I../
+
+SRCS += \
+ ../app.c
+
+include $(TOP)/rules.mk