summaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-09-17 10:02:07 +0200
committerDaniel Friesel <derf@finalrewind.org>2018-09-17 10:02:07 +0200
commit4f6253aa9fec99260b8bb7b9b2e9003f5259b600 (patch)
tree2d0a3fdd10e258ecce5fb220547b1c43b870d6d2 /src/app
parent30c4f72770568749b4230a6b598e3fb87a065e91 (diff)
Import arduinojson and ubjson. Only partially working at the moment
Diffstat (limited to 'src/app')
-rw-r--r--src/app/prototest/Makefile.inc3
-rw-r--r--src/app/prototest/main.cc30
2 files changed, 33 insertions, 0 deletions
diff --git a/src/app/prototest/Makefile.inc b/src/app/prototest/Makefile.inc
new file mode 100644
index 0000000..d501de1
--- /dev/null
+++ b/src/app/prototest/Makefile.inc
@@ -0,0 +1,3 @@
+loop ?= 1
+
+TARGETS += src/lib/ubjson/ubjr.c src/lib/ubjson/ubjw.c
diff --git a/src/app/prototest/main.cc b/src/app/prototest/main.cc
new file mode 100644
index 0000000..c7d0838
--- /dev/null
+++ b/src/app/prototest/main.cc
@@ -0,0 +1,30 @@
+#include "arch.h"
+#include "driver/gpio.h"
+#include "driver/stdout.h"
+#include "lib/ArduinoJson.h"
+
+void loop(void)
+{
+ char json[] = "{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}";
+ ArduinoJson::StaticJsonBuffer<200> jsonBuffer;
+ ArduinoJson::JsonObject& root = jsonBuffer.parseObject(json);
+ const char *sensor = root["sensor"];
+ kout << "sensor: " << sensor << endl;
+ gpio.led_toggle(1);
+#ifdef TIMER_S
+ kout << dec << uptime.get_s() << endl;
+#endif
+}
+
+int main(void)
+{
+ arch.setup();
+ gpio.setup();
+ kout.setup();
+
+ gpio.led_on(0);
+ kout << "Hello, World!" << endl;
+ arch.idle_loop();
+
+ return 0;
+}