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

Revision:
140:bf0c8288eb78
Parent:
110:8f3149c99112
Child:
141:571e0ef6c8dc
--- a/io/MTSSerialFlowControl.cpp	Sat Jan 04 04:22:29 2014 +0000
+++ b/io/MTSSerialFlowControl.cpp	Sat Jan 04 05:07:22 2014 +0000
@@ -2,11 +2,11 @@
 
 using namespace mts;
 
-MTSSerialFlowControl::MTSSerialFlowControl(PinName TXD, PinName RXD, PinName RTS, PinName CTS, int txBufSize, int rxBufSize) 
-: MTSSerial(TXD, RXD, txBufSize, rxBufSize)
-, rxReadyFlag(false)
-, rts(RTS)
-, cts(CTS)
+MTSSerialFlowControl::MTSSerialFlowControl(PinName TXD, PinName RXD, PinName RTS, PinName CTS, int txBufSize, int rxBufSize)
+    : MTSSerial(TXD, RXD, txBufSize, rxBufSize)
+    , rxReadyFlag(false)
+    , rts(RTS)
+    , cts(CTS)
 {
     notifyStartSending();
 
@@ -21,9 +21,10 @@
 
 }
 
-void MTSSerialFlowControl::rxClear() {
+void MTSSerialFlowControl::rxClear()
+{
     MTSBufferedIO::rxClear();
-    notifyStartSending();   
+    notifyStartSending();
 }
 
 void MTSSerialFlowControl::notifyStartSending()
@@ -52,6 +53,11 @@
             rts.write(1);
             rxReadyFlag = false;
             printf("[ERROR] Serial Rx Byte Dropped [%c][0x%02X]\r\n", byte, byte);
+            if(byte == 0xFF) {
+                serial.attach(NULL, Serial::RxIrq);
+                serial.attach(this, &MTSSerialFlowControl::handleRead, Serial::RxIrq);
+                printf("[INFO] Reset the RxIrq.\n\r");
+            }
             return;
         }
         if (rxBuffer.size() > highThreshold) {