Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: uartPassThrough.cpp
- Revision:
- 1:63664175e603
diff -r 73f2160fef5a -r 63664175e603 uartPassThrough.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/uartPassThrough.cpp Mon May 13 13:59:19 2019 +0000
@@ -0,0 +1,31 @@
+#include "mbed.h"
+
+RawSerial pc1(USBTX, USBRX);
+RawSerial dev(D1, D0);
+DigitalOut CS(D10);
+
+void dev_recv()
+{
+ while(dev.readable()) {
+ pc1.putc(dev.getc());
+ }
+}
+
+void pc_recv()
+{
+ while(pc1.readable()) {
+ dev.putc(pc1.getc());
+ }
+}
+
+int mai()
+{
+ CS=1;
+ pc1.baud(9600);
+ dev.baud(9600);
+
+ while(1) {
+ pc_recv();
+ dev_recv();
+ }
+}