Colin Hogben / Mbed OS putc_getc

Files at this revision

API Documentation at this revision

Comitter:
infinnovation
Date:
Mon Aug 22 13:13:18 2016 +0000
Commit message:
Initial version

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 2af96b59072d main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Aug 22 13:13:18 2016 +0000
@@ -0,0 +1,21 @@
+#include "mbed.h"
+Serial pc(USBTX, USBRX);
+
+void
+logchars(void) {
+    while (true) {
+        int c = pc.getc();
+        pc.printf("[%02x]\r\n", c);
+    }
+}
+
+int main(void) {
+    Thread logger;
+    pc.printf("putc/getc test\r\n");
+    logger.start(logchars);
+    while (true) {
+        pc.printf("tick\r\n");
+        wait(1.0);
+    }
+    return 0;
+}
\ No newline at end of file
diff -r 000000000000 -r 2af96b59072d mbed-os.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Mon Aug 22 13:13:18 2016 +0000
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os/#0712b8adf6bbc7eb796d5dac26f95d79d40745ef