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: io/MTSSerialFlowControl.h
- Revision:
- 36:bb6b293c7495
- Parent:
- 10:2bd727a4b329
- Child:
- 40:14342c4de476
- Child:
- 45:40745c2036cf
--- a/io/MTSSerialFlowControl.h Wed Dec 18 23:05:31 2013 +0000 +++ b/io/MTSSerialFlowControl.h Thu Dec 19 16:47:26 2013 +0000 @@ -7,23 +7,46 @@ class MTSSerialFlowControl : public MTSBufferedIO { public: + /** 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. + * + * @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 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. + * @param rxBufferSize the size in bytes of the internal SW receive buffer. The + * default is 64 bytes. + * @param name an optional name for the serial port. The default is blank. + */ MTSSerialFlowControl(PinName TXD, PinName RXD, PinName RTS, PinName CTS, int txBufSize = 64, int rxBufSize = 64, char* name = ""); + + /** Destructs an MTSSerialFlowControl object and frees all related resources, + * including internal buffers. + */ ~MTSSerialFlowControl(); - + + /** This method is used to the set the baud rate of the serial port. + * + * @param baudrate the baudrate in bps as an int. The internal interface + * default is 9600 bps. + */ void baud(int baudrate); - + void notifyStartSending(); void notifyStopSending(); private: - InterruptIn* rts; - DigitalOut* cts; - Serial* serial; - bool clearToSend; - int highThreshold; + 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; - + char* if_name; + void startSending(); void stopSending();