Read UART at 4800 then Resend thru the USB

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
icis4
Date:
Thu Jan 28 21:43:12 2016 +0000
Parent:
1:221b87b26f53
Commit message:
Two way transfer

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 221b87b26f53 -r 2fc8495988a0 main.cpp
--- a/main.cpp	Thu Jan 28 14:33:47 2016 +0000
+++ b/main.cpp	Thu Jan 28 21:43:12 2016 +0000
@@ -7,17 +7,23 @@
 
 Serial pc(SERIAL_TX, SERIAL_RX);
 Serial gps(PB_10, PC_5);
- 
-int main() {
-  uint8_t c;
-  pc.baud(4800);
-  gps.baud(4800);
-  pc.printf("*** GPS ***\n");
-  while(1) {
-      if (gps.readable()){
-      c = gps.getc();
-      pc.putc(c);
-      }
-  }
+
+int main()
+{
+    uint8_t c;
+    
+    pc.baud(4800);
+    gps.baud(4800);
+    
+    pc.printf("*** GPS ***\n");
+    while(1) {
+        if (gps.readable()) {
+            c = gps.getc();
+            pc.putc(c);
+        }
+        if (pc.readable()) {
+            c = pc.getc();
+            gps.putc(c);
+        }
+    }
 }
- 
\ No newline at end of file