MicroLabo / Mbed OS mbed-Dot-AT-Firmware

Dependencies:   MTS-Serial libmDot-mbed5

Fork of Dot-AT-Firmware by MultiTech

Embed: (wiki syntax)

« Back to documentation index

ATSerialFlowControl Class Reference

ATSerialFlowControl Class Reference

This class derives from MTSBufferedIO/ATSerial and provides a buffered wrapper to the standard mbed Serial class along with generic RTS/CTS HW flow control. More...

#include <ATSerialFlowControl.h>

Inherits mts::ATSerial.

Public Member Functions

 ATSerialFlowControl (PinName TXD, PinName RXD, PinName RTS, PinName CTS, int txBufSize=256, int rxBufSize=256)
 Creates a new ATSerialFlowControl object that can be used to talk to an mbed serial port through internal SW buffers.
virtual ~ATSerialFlowControl ()
 Destructs an ATSerialFlowControl object and frees all related resources.
void reattach (PinName TXD, PinName RXD)
 Attach the internal serial object to provided pins.
void baud (int baudrate)
 This method is used to the set the baud rate of the serial port.
void format (int bits=8, SerialBase::Parity parity=mbed::SerialBase::None, int stop_bits=1)
 This method sets the transmission format used by the serial port.
void sendBreak ()
 Generate a break condition on the serial line.
bool escaped ()
 Check for escape sequence detected on serial input.

Detailed Description

This class derives from MTSBufferedIO/ATSerial 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 DigitalIn 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 ATSerial instead. It should also be noted that the RTS/CTS functionality in this class is implemented as a DTE device.

Definition at line 17 of file ATSerialFlowControl.h.


Constructor & Destructor Documentation

ATSerialFlowControl ( PinName  TXD,
PinName  RXD,
PinName  RTS,
PinName  CTS,
int  txBufSize = 256,
int  rxBufSize = 256 
)

Creates a new ATSerialFlowControl 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. The RTS and CTS functionality assumes this is a DTE device.

Parameters:
TXDthe transmit data pin on the desired mbed serial interface.
RXDthe receive data pin on the desired mbed serial interface.
RTSthe DigitalOut pin that RTS will be attached to. (DTE)
CTSthe DigitalIn pin that CTS will be attached to. (DTE)
txBufferSizethe size in bytes of the internal SW transmit buffer. The default is 256 bytes.
rxBufferSizethe size in bytes of the internal SW receive buffer. The default is 256 bytes.

Definition at line 8 of file ATSerialFlowControl.cpp.

~ATSerialFlowControl (  ) [virtual]

Destructs an ATSerialFlowControl object and frees all related resources.

Definition at line 24 of file ATSerialFlowControl.cpp.


Member Function Documentation

void baud ( int  baudrate ) [inherited]

This method is used to the set the baud rate of the serial port.

Parameters:
baudratethe baudrate in bps as an int. The default is 9600 bps.

Definition at line 30 of file ATSerial.cpp.

bool escaped (  ) [inherited]

Check for escape sequence detected on serial input.

Returns:
true if escape sequence was seen

Definition at line 74 of file ATSerial.cpp.

void format ( int  bits = 8,
SerialBase::Parity  parity = mbed::SerialBase::None,
int  stop_bits = 1 
) [inherited]

This method sets the transmission format used by the serial port.

Parameters:
bitsthe number of bits in a word (5-8; default = 8)
paritythe parity used (SerialBase::None, SerialBase::Odd, SerialBase::Even, SerialBase::Forced1, SerialBase::Forced0; default = SerialBase::None)
stopthe number of stop bits (1 or 2; default = 1)

Definition at line 36 of file ATSerial.cpp.

void reattach ( PinName  TXD,
PinName  RXD 
) [inherited]

Attach the internal serial object to provided pins.

Parameters:
TXDthe transmit data pin on the desired mbed Serial interface.
RXDthe receive data pin on the desired mbed Serial interface.

Definition at line 60 of file ATSerial.cpp.

void sendBreak (  ) [inherited]

Generate a break condition on the serial line.

Definition at line 70 of file ATSerial.cpp.