Jason Mishou
/
SerialTest
Test serial to raspberry pi
Fork of Serial_ex_2 by
Revision 2:b18ad269066c, committed 2017-08-21
- Comitter:
- M15H
- Date:
- Mon Aug 21 22:45:13 2017 +0000
- Parent:
- 1:4cf190502c9e
- Commit message:
- Test Serial
Changed in this revision
diff -r 4cf190502c9e -r b18ad269066c BufferedSerial.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BufferedSerial.lib Mon Aug 21 22:45:13 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/sam_grove/code/BufferedSerial/#a0d37088b405
diff -r 4cf190502c9e -r b18ad269066c main.cpp --- a/main.cpp Fri Jun 23 15:53:02 2017 -0500 +++ b/main.cpp Mon Aug 21 22:45:13 2017 +0000 @@ -1,15 +1,33 @@ #include "mbed.h" -//K64F -Serial pc(USBTX, USBRX); // tx, rx -Serial device(MBED_CONF_APP_UART1_TX, MBED_CONF_APP_UART1_RX); // tx, rx +#include "BufferedSerial.h" + +BufferedSerial *pc; +BufferedSerial *pi; + +char c; +char buffer[128]; +int x; int main() { + pc = new BufferedSerial(USBTX, USBRX); + pi = new BufferedSerial(PB_6, PB_7); + + pc->baud(115200*2); + pc->format(8); + pc->printf("Hello World\n\r"); + + pi->baud(57600); + pi->format(8); + pi->printf("Hello World\n\r"); + + + + pi->printf("Hello World\n"); + pc->printf("Hello World\n"); while(1) { - if(pc.readable()) { - device.putc(pc.getc()); - } - if(device.readable()) { - pc.putc(device.getc()); - } + wait(1); + pi->printf("Iteration %d\n", x); + pc->printf("Iteration %d\n", x); + x++; } }
diff -r 4cf190502c9e -r b18ad269066c mbed_app.json --- a/mbed_app.json Fri Jun 23 15:53:02 2017 -0500 +++ b/mbed_app.json Mon Aug 21 22:45:13 2017 +0000 @@ -11,8 +11,8 @@ }, "target_overrides": { "K64F": { - "uart1_tx": "D5", - "uart1_rx": "D3" + "uart1_tx": "PB_6", + "uart1_rx": "PB_7" } } }