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:
45:40745c2036cf
Parent:
36:bb6b293c7495
Child:
46:b30547bf07d5
--- a/io/MTSSerialFlowControl.h	Thu Dec 19 16:54:09 2013 +0000
+++ b/io/MTSSerialFlowControl.h	Thu Dec 19 21:38:01 2013 +0000
@@ -4,16 +4,23 @@
 #include "mbed.h"
 #include "MTSBufferedIO.h"
 
+/** This class derives from MTSBufferedIO and provides a buffered wrapper to the
+* standard mbed Serial class along with generic RTS/CTS HW flow control. Since it
+* depends only on the mbed Serial, DigitalOut and InterruptIn classes for accessing
+* the serial data, this class is inherently portable accross different mbed platforms
+* and provides HW flow control even when not natively supported by the processors
+* serial port. If HW flow control is not needed, use MTSSerial instead.
+*/
 class MTSSerialFlowControl : public MTSBufferedIO
 {
 public:
-    /** Creates a new MTSSerialFlowControl object that can be used to talk to an Mbed serial
+    /** Creates a new MTSSerialFlowControl object that can be used to talk to an mbed serial
     * port through internal SW buffers. Note that this class also adds the ability to use
-    * RTS/CTS HW Flow Conrtol through and standard Mbed DigitalIn and DigitalOut pins.
+    * RTS/CTS HW Flow Conrtol through and standard mbed InterruptIn and DigitalOut pins.
     *
-    * @param TXD the transmit data pin on the desired Mbed serial interface.
-    * @param RXD the receive data pin on the desired Mbed serial interface.
-    * @param RTS the DigitalIn pin that RTS will be attached to.
+    * @param TXD the transmit data pin on the desired mbed serial interface.
+    * @param RXD the receive data pin on the desired mbed serial interface.
+    * @param RTS the InterruptIn pin that RTS will be attached to.
     * @param CTS the DigitalOut pin that CTS will be attached to.
     * @param txBufferSize the size in bytes of the internal SW transmit buffer. The
     * default is 64 bytes.
@@ -35,23 +42,31 @@
     */
     void baud(int baudrate);
 
-    void notifyStartSending();
-    void notifyStopSending();
+    /** This method sets the transmission format used by the serial port.
+    *
+    * @param bits the number of bits in a word (5-8; default = 8)
+    * @param parity the parity used (SerialBase::None, SerialBase::Odd, SerialBase::Even,
+    * SerialBase::Forced1, SerialBase::Forced0; default = SerialBase::None)
+    * @param stop the number of stop bits (1 or 2; default = 1)
+    */
+    void format(int bits=8, SerialBase::Parity parity=SerialBase::None, int stop_bits=1);
 
 private:
     InterruptIn* rts; // Used to monitor the RTS line
     DigitalOut* cts; // Used to control the CTS line
     Serial* serial; // Internal Mbed Serial object
-    bool clearToSend; // flag determining if the CTS line is valid
-    int highThreshold; //
-    int lowThreshold;
-    char* if_name; 
+    bool clearToSend; // Flag determining if the CTS line is valid
+    int highThreshold; // High water mark for setting cts to stop
+    int lowThreshold; // Low water mark for setting cts to start
+    char* if_name; // Internal variable for interface name
 
-    void startSending();
-    void stopSending();
+    void startSending(); // Used to process rts start signal
+    void stopSending(); // Used to process rts stop signal
+    void notifyStartSending(); // Used to set cts start signal 
+    void notifyStopSending(); // Used to set cts stop signal
 
-    virtual void handleRead();
-    virtual void handleWrite();
+    virtual void handleRead(); // Method for handling data to be read
+    virtual void handleWrite(); // Method for handling data to be written
 };
 
 #endif /* MTSSERIALFLOWCONTROL */
\ No newline at end of file