summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2021-10-14 16:32:53 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2021-10-14 16:32:53 +0200
commit4b0d2a30c0068ace46ae0cda442b01ae06a86e19 (patch)
tree40918726632dd035b5a84664f1d507c9ba3ac9ba /src
parentecfab2bb0ea4918b3ab02c3a64292a4a3ac13d01 (diff)
etcontroller: add application and makefile
Diffstat (limited to 'src')
-rw-r--r--src/app/etcontroller/Makefile.inc12
-rw-r--r--src/app/etcontroller/main.cc28
2 files changed, 40 insertions, 0 deletions
diff --git a/src/app/etcontroller/Makefile.inc b/src/app/etcontroller/Makefile.inc
new file mode 100644
index 0000000..0ac9285
--- /dev/null
+++ b/src/app/etcontroller/Makefile.inc
@@ -0,0 +1,12 @@
+ifdef app
+ override timer_s = 0
+ loop = 1
+endif
+
+ifneq (${etcontroller_reset_pin}, )
+ COMMON_FLAGS += -DCONFIG_ETCONTROLLER_RESET_PIN=${etcontroller_reset_pin}
+endif
+
+ifeq (${etcontroller_nrst}, 1)
+ COMMON_FLAGS += -DCONFIG_ETCONTROLLER_NRST
+endif
diff --git a/src/app/etcontroller/main.cc b/src/app/etcontroller/main.cc
new file mode 100644
index 0000000..5e7b339
--- /dev/null
+++ b/src/app/etcontroller/main.cc
@@ -0,0 +1,28 @@
+#include "arch.h"
+#include "driver/gpio.h"
+#include "driver/stdout.h"
+#include "driver/uptime.h"
+
+int main(void)
+{
+ arch.setup();
+ gpio.setup();
+ kout.setup();
+
+ kout << "Hello, World!" << endl;
+ kout << "Naptime." << endl;
+
+#ifdef CONFIG_ETCONTROLLER_NRST
+ gpio.output(CONFIG_ETCONTROLLER_RESET_PIN, 0);
+ arch.delay_ms(1);
+ gpio.write(CONFIG_ETCONTROLLER_RESET_PIN, 1);
+#else
+ gpio.output(CONFIG_ETCONTROLLER_RESET_PIN, 1);
+ arch.delay_ms(1);
+ gpio.write(CONFIG_ETCONTROLLER_RESET_PIN, 0);
+#endif
+
+ arch.idle();
+
+ return 0;
+}