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

Committer:
mfiore
Date:
2013-12-13
Revision:
10:2bd727a4b329
Parent:
2:8d3ea0dfce39
Child:
36:bb6b293c7495
Child:
39:6e94520a3217

File content as of revision 10:2bd727a4b329:

#ifndef MTSSERIALFLOWCONTROL_H
#define MTSSERIALFLOWCONTROL_H

#include "mbed.h"
#include "MTSBufferedIO.h"

class MTSSerialFlowControl : public MTSBufferedIO
{
public:
    MTSSerialFlowControl(PinName TXD, PinName RXD, PinName RTS, PinName CTS, int txBufSize = 64, int rxBufSize = 64, char* name = "");
    ~MTSSerialFlowControl();
    
    void baud(int baudrate);
    
    void notifyStartSending();
    void notifyStopSending();

private:
    InterruptIn* rts;
    DigitalOut* cts;
    Serial* serial;
    bool clearToSend;
    int highThreshold;
    int lowThreshold;
    char* if_name;
    
    void startSending();
    void stopSending();

    virtual void handleRead();
    virtual void handleWrite();
};

#endif /* MTSSERIALFLOWCONTROL */