A library for talking to Multi-Tech's Cellular SocketModem Devices.
Dependents: M2X_dev axeda_wrapper_dev MTS_M2x_Example1 MTS_Cellular_Connect_Example ... more
Diff: tests/flowControlPassThrough.h
- Revision:
- 118:da77017d6c09
- Parent:
- 117:e59a616ffe16
- Parent:
- 116:8b58efef3528
- Child:
- 119:544578fd290c
--- a/tests/flowControlPassThrough.h Tue Dec 31 22:00:53 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -#include "MTSSerialFlowControl.h" - -using namespace mts; - -void flowControlPassThrough() { - int tmp; - char buf[16]; - int size = 16; - int baud = 115200; - - MTSSerialFlowControl *port1 = new MTSSerialFlowControl(PTC4, PTC3, PTD5, PTA13, 64, 64); - port1->baud(baud); - MTSSerialFlowControl *port2 = new MTSSerialFlowControl(PTD3, PTD2, PTD1, PTD0, 64, 64); - port2->baud(baud); - - wait(3); - printf("starting flow control passthrough - baud: %d\n\r", baud); - - while (true) { - if ((tmp = port1->read(buf, size)) < 0) { - printf("read on port1 failed\n\r"); - } else if (tmp > 0) { - if ((tmp = port2->write(buf, tmp)) < 0) { - printf("write on port2 failed\n\r"); - } - } - if ((tmp = port2->read(buf, size)) < 0) { - printf("read on port2 failed\n\r"); - } else if (tmp > 0) { - if ((tmp = port1->write(buf, tmp)) < 0) { - printf("write on port1 failed\n\r"); - } - } - } -} \ No newline at end of file