Pass serial to other serial connection and back. Simulates USB to UART functionality.
Fork of SerialPassthrough by
Revision 6:0c31964f8cf2, committed 2016-10-21
- Comitter:
- Wosser1sProductions
- Date:
- Fri Oct 21 21:24:45 2016 +0000
- Parent:
- 5:96cb82af9996
- Commit message:
- First commit
Changed in this revision
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 96cb82af9996 -r 0c31964f8cf2 main.cpp --- a/main.cpp Thu Apr 30 22:48:21 2015 +0000 +++ b/main.cpp Fri Oct 21 21:24:45 2016 +0000 @@ -1,31 +1,37 @@ #include "mbed.h" RawSerial pc(USBTX, USBRX); -RawSerial dev(D1, D0); + +//RawSerial dev(D1, D0); +RawSerial dev(A0, A1); + DigitalOut led1(LED1); DigitalOut led4(LED4); -void dev_recv() -{ +void dev_recv() { led1 = !led1; while(dev.readable()) { pc.putc(dev.getc()); } } -void pc_recv() -{ +void pc_recv() { led4 = !led4; while(pc.readable()) { dev.putc(pc.getc()); } } -int main() -{ - pc.baud(9600); - dev.baud(9600); +int main() { + #define BAUT 115200 + //#define BAUT 74880 + //#define BAUT 9600 + + pc.baud(BAUT); + dev.baud(BAUT); + pc.printf("Start...\r\n"); + pc.attach(&pc_recv, Serial::RxIrq); dev.attach(&dev_recv, Serial::RxIrq);
diff -r 96cb82af9996 -r 0c31964f8cf2 mbed.bld --- a/mbed.bld Thu Apr 30 22:48:21 2015 +0000 +++ b/mbed.bld Fri Oct 21 21:24:45 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/433970e64889 \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/25aea2a3f4e3 \ No newline at end of file