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
io/MTSSerialFlowControl.h@36:bb6b293c7495, 2013-12-19 (annotated)
- Committer:
- jengbrecht
- Date:
- Thu Dec 19 16:47:26 2013 +0000
- Revision:
- 36:bb6b293c7495
- Parent:
- 10:2bd727a4b329
- Child:
- 40:14342c4de476
- Child:
- 45:40745c2036cf
Added a ton more documentation to most of the headers files. Also removed the capacity and available functions from MTSBufferedIO in favor of readable and writeable. Removed the single available method call from the cellular class.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jengbrecht | 0:563b70517320 | 1 | #ifndef MTSSERIALFLOWCONTROL_H |
jengbrecht | 0:563b70517320 | 2 | #define MTSSERIALFLOWCONTROL_H |
jengbrecht | 0:563b70517320 | 3 | |
jengbrecht | 0:563b70517320 | 4 | #include "mbed.h" |
jengbrecht | 0:563b70517320 | 5 | #include "MTSBufferedIO.h" |
mfiore | 2:8d3ea0dfce39 | 6 | |
jengbrecht | 0:563b70517320 | 7 | class MTSSerialFlowControl : public MTSBufferedIO |
jengbrecht | 0:563b70517320 | 8 | { |
jengbrecht | 0:563b70517320 | 9 | public: |
jengbrecht | 36:bb6b293c7495 | 10 | /** Creates a new MTSSerialFlowControl object that can be used to talk to an Mbed serial |
jengbrecht | 36:bb6b293c7495 | 11 | * port through internal SW buffers. Note that this class also adds the ability to use |
jengbrecht | 36:bb6b293c7495 | 12 | * RTS/CTS HW Flow Conrtol through and standard Mbed DigitalIn and DigitalOut pins. |
jengbrecht | 36:bb6b293c7495 | 13 | * |
jengbrecht | 36:bb6b293c7495 | 14 | * @param TXD the transmit data pin on the desired Mbed serial interface. |
jengbrecht | 36:bb6b293c7495 | 15 | * @param RXD the receive data pin on the desired Mbed serial interface. |
jengbrecht | 36:bb6b293c7495 | 16 | * @param RTS the DigitalIn pin that RTS will be attached to. |
jengbrecht | 36:bb6b293c7495 | 17 | * @param CTS the DigitalOut pin that CTS will be attached to. |
jengbrecht | 36:bb6b293c7495 | 18 | * @param txBufferSize the size in bytes of the internal SW transmit buffer. The |
jengbrecht | 36:bb6b293c7495 | 19 | * default is 64 bytes. |
jengbrecht | 36:bb6b293c7495 | 20 | * @param rxBufferSize the size in bytes of the internal SW receive buffer. The |
jengbrecht | 36:bb6b293c7495 | 21 | * default is 64 bytes. |
jengbrecht | 36:bb6b293c7495 | 22 | * @param name an optional name for the serial port. The default is blank. |
jengbrecht | 36:bb6b293c7495 | 23 | */ |
mfiore | 10:2bd727a4b329 | 24 | MTSSerialFlowControl(PinName TXD, PinName RXD, PinName RTS, PinName CTS, int txBufSize = 64, int rxBufSize = 64, char* name = ""); |
jengbrecht | 36:bb6b293c7495 | 25 | |
jengbrecht | 36:bb6b293c7495 | 26 | /** Destructs an MTSSerialFlowControl object and frees all related resources, |
jengbrecht | 36:bb6b293c7495 | 27 | * including internal buffers. |
jengbrecht | 36:bb6b293c7495 | 28 | */ |
jengbrecht | 0:563b70517320 | 29 | ~MTSSerialFlowControl(); |
jengbrecht | 36:bb6b293c7495 | 30 | |
jengbrecht | 36:bb6b293c7495 | 31 | /** This method is used to the set the baud rate of the serial port. |
jengbrecht | 36:bb6b293c7495 | 32 | * |
jengbrecht | 36:bb6b293c7495 | 33 | * @param baudrate the baudrate in bps as an int. The internal interface |
jengbrecht | 36:bb6b293c7495 | 34 | * default is 9600 bps. |
jengbrecht | 36:bb6b293c7495 | 35 | */ |
mfiore | 10:2bd727a4b329 | 36 | void baud(int baudrate); |
jengbrecht | 36:bb6b293c7495 | 37 | |
mfiore | 2:8d3ea0dfce39 | 38 | void notifyStartSending(); |
mfiore | 2:8d3ea0dfce39 | 39 | void notifyStopSending(); |
jengbrecht | 0:563b70517320 | 40 | |
jengbrecht | 0:563b70517320 | 41 | private: |
jengbrecht | 36:bb6b293c7495 | 42 | InterruptIn* rts; // Used to monitor the RTS line |
jengbrecht | 36:bb6b293c7495 | 43 | DigitalOut* cts; // Used to control the CTS line |
jengbrecht | 36:bb6b293c7495 | 44 | Serial* serial; // Internal Mbed Serial object |
jengbrecht | 36:bb6b293c7495 | 45 | bool clearToSend; // flag determining if the CTS line is valid |
jengbrecht | 36:bb6b293c7495 | 46 | int highThreshold; // |
mfiore | 2:8d3ea0dfce39 | 47 | int lowThreshold; |
jengbrecht | 36:bb6b293c7495 | 48 | char* if_name; |
jengbrecht | 36:bb6b293c7495 | 49 | |
mfiore | 2:8d3ea0dfce39 | 50 | void startSending(); |
mfiore | 2:8d3ea0dfce39 | 51 | void stopSending(); |
mfiore | 2:8d3ea0dfce39 | 52 | |
mfiore | 2:8d3ea0dfce39 | 53 | virtual void handleRead(); |
mfiore | 2:8d3ea0dfce39 | 54 | virtual void handleWrite(); |
jengbrecht | 0:563b70517320 | 55 | }; |
mfiore | 2:8d3ea0dfce39 | 56 | |
jengbrecht | 0:563b70517320 | 57 | #endif /* MTSSERIALFLOWCONTROL */ |