A USB to UART bridge

Dependencies:   USBDevice BufferedSerial mbed

Files at this revision

API Documentation at this revision

Comitter:
yihui
Date:
Fri Mar 04 14:00:51 2016 +0000
Parent:
4:9c038f12d460
Commit message:
add hardware flow control for LPC11Uxx target

Changed in this revision

BufferedSerial.lib Show annotated file Show diff for this revision Revisions of this file
USBDevice.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 9c038f12d460 -r 10fccccbbb11 BufferedSerial.lib
--- a/BufferedSerial.lib	Thu Jul 24 07:18:44 2014 +0000
+++ b/BufferedSerial.lib	Fri Mar 04 14:00:51 2016 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/sam_grove/code/BufferedSerial/#4d6a311fc8bf
+http://mbed.org/users/sam_grove/code/BufferedSerial/#779304f9c5d2
diff -r 9c038f12d460 -r 10fccccbbb11 USBDevice.lib
--- a/USBDevice.lib	Thu Jul 24 07:18:44 2014 +0000
+++ b/USBDevice.lib	Fri Mar 04 14:00:51 2016 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/USBDevice/#0c6524151939
+http://mbed.org/users/mbed_official/code/USBDevice/#d17693b10ae6
diff -r 9c038f12d460 -r 10fccccbbb11 main.cpp
--- a/main.cpp	Thu Jul 24 07:18:44 2014 +0000
+++ b/main.cpp	Fri Mar 04 14:00:51 2016 +0000
@@ -6,7 +6,7 @@
 #include "USBSerial.h"
 #include "BufferedSerial.h"
 
-BufferedSerial uart(USBTX, USBRX);
+BufferedSerial uart(P0_19, P0_18, 512);
 USBSerial pc;
 DigitalOut led1(LED1);
 DigitalOut led2(LED2);
@@ -18,6 +18,19 @@
 volatile bool txflag = false;
 
 
+#ifdef TARGET_LPC11UXX
+#include "LPC11Uxx.h"
+void enable_hardware_flow_control()
+{
+    LPC_IOCON->PIO0_17 = 0x01 | (0x1 << 3);     // RTS, 
+    LPC_IOCON->PIO0_7  = 0x01 | (0x1 << 3);     // CTS, pull-down
+    
+    // enable auto RTS and CTS
+    LPC_USART->MCR = (1 << 6) | (1 << 7);
+}
+#endif
+
+
 void indicate()
 {
     if (rxflag) {
@@ -54,8 +67,13 @@
     led1 = 0;
 }
 
+
 int main()
 {
+#ifdef TARGET_LPC11UXX
+    enable_hardware_flow_control();
+#endif
+    
     pc.attach(settings_changed);
     ticker.attach_us(indicate, 500);
     
diff -r 9c038f12d460 -r 10fccccbbb11 mbed.bld
--- a/mbed.bld	Thu Jul 24 07:18:44 2014 +0000
+++ b/mbed.bld	Fri Mar 04 14:00:51 2016 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/04dd9b1680ae
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/87f2f5183dfb
\ No newline at end of file