new file mode 100644
(file)
index 0000000..
3a93f96
--- /dev/null
+# _mbed-os-tic2json_
+
+Non-functional implementation of tic2json for ARM Mbed.
+Gets TIC data on RX pin, outputs formatted JSON on UART TX.
+
+**Note:** it seems using stdio on this platform does not produce the expected
+results so this implementation will probably need more work. TBC.
+
+### Configure the project
+
+* Edit `tic2json/mbed_lib.json`: in `macros` adjust for `TICV01` or `TICV02`
+* Edit `main.cpp`, adjust defines at the top
+* Copy or link `mbed-os`
+
+### Build and Flash
+
+Before build, run `make -C tic2json/src csources`
+
+Build the project and flash it to the board, using Mbed Studio or `mbed`.
+
+Note: ARMC6 does not seem to correctly build this, use GCC_ARM instead.
new file mode 100644
(file)
index 0000000..
2971306
--- /dev/null
+//
+// main.cpp
+// app stub for ARM Mbed OS
+//
+// (C) 2021 Thibaut VARENE
+// License: GPLv2 - http://www.gnu.org/licenses/gpl-2.0.html
+//
+
+/**
+ * @file
+ * Receives TIC on RX, outputs JSON on TX.
+ */
+
+#include "mbed.h"
+
+#define TIC_TX CONSOLE_TX
+#define TIC_RX CONSOLE_RX
+#define TICBAUDRATE 9600 // 1200 for V01, 9600 for V02s
+
+//https://forums.mbed.com/t/hitchhikers-guide-to-printf-in-mbed-6/12492
+namespace mbed
+{
+ FileHandle *mbed_override_console(int fd)
+ {
+ static BufferedSerial console(TIC_TX, TIC_RX, TICBAUDRATE);
+ console.set_format(7, BufferedSerial::Even, 1);
+ return &console;
+ }
+}
+
+extern "C" {
+ void tic2json_main(void);
+}
+
+
+// main() runs in its own thread in the OS
+int main()
+{
+ while (true)
+ tic2json_main();
+
+ return 0;
+}