Axeda Ready Demo for Freescale FRDM-KL46Z as accident alert system
Dependencies: FRDM_MMA8451Q KL46Z-USBHost MAG3110 SocketModem TSI mbed FATFileSystem
Fork of AxedaGo-Freescal_FRDM-KL46Z revert by
MTSSerialFlowControl Class Reference
This class derives from MTSBufferedIO/MTSSerial and provides a buffered wrapper to the standard mbed Serial class along with generic RTS/CTS HW flow control. More...
#include <MTSSerialFlowControl.h>
Inherits mts::MTSSerial.
Public Member Functions | |
MTSSerialFlowControl (PinName TXD, PinName RXD, PinName RTS, PinName CTS, int txBufSize=64, int rxBufSize=64) | |
Creates a new MTSSerialFlowControl object that can be used to talk to an mbed serial port through internal SW buffers. | |
~MTSSerialFlowControl () | |
Destructs an MTSSerialFlowControl object and frees all related resources, including internal buffers. | |
virtual void | rxClear () |
This method clears all the data from the internal Rx or read buffer. | |
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. | |
int | write (const char *data, int length, unsigned int timeoutMillis) |
This method enables bulk writes to the Tx or write buffer. | |
int | write (const char *data, int length) |
This method enables bulk writes to the Tx or write buffer. | |
int | write (char data, unsigned int timeoutMillis) |
This method attempts to write a single byte to the tx buffer within the timeout period. | |
int | write (char data) |
This method writes a signle byte as a char to the Tx or write buffer. | |
int | writeable () |
This method is used to get the space available to write bytes to the Tx buffer. | |
int | read (char *data, int length, unsigned int timeoutMillis) |
This method enables bulk reads from the Rx or read buffer. | |
int | read (char *data, int length) |
This method enables bulk reads from the Rx or read buffer. | |
int | read (char &data, unsigned int timeoutMillis) |
This method reads a single byte from the Rx or read buffer. | |
int | read (char &data) |
This method reads a single byte from the Rx or read buffer. | |
int | readable () |
This method is used to get the number of bytes available to read from the Rx or read buffer. | |
bool | txEmpty () |
This method determines if the Tx or write buffer is empty. | |
bool | rxEmpty () |
This method determines if the Rx or read buffer is empty. | |
bool | txFull () |
This method determines if the Tx or write buffer is full. | |
bool | rxFull () |
This method determines if the Rx or read buffer is full. | |
virtual void | txClear () |
This method clears all the data from the internal Tx or write buffer. |
Detailed Description
This class derives from MTSBufferedIO/MTSSerial 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. It should also be noted that the RTS/CTS functionality in this class is implemented as a DTE device.
Definition at line 35 of file MTSSerialFlowControl.h.
Constructor & Destructor Documentation
MTSSerialFlowControl | ( | PinName | TXD, |
PinName | RXD, | ||
PinName | RTS, | ||
PinName | CTS, | ||
int | txBufSize = 64 , |
||
int | rxBufSize = 64 |
||
) |
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. The RTS and CTS functionality assumes this is a DTE device.
- Parameters:
-
TXD the transmit data pin on the desired mbed serial interface. RXD the receive data pin on the desired mbed serial interface. RTS the DigitalOut pin that RTS will be attached to. (DTE) CTS the DigitalIn pin that CTS will be attached to. (DTE) txBufferSize the size in bytes of the internal SW transmit buffer. The default is 64 bytes. rxBufferSize the size in bytes of the internal SW receive buffer. The default is 64 bytes. name an optional name for the serial port. The default is blank.
Definition at line 21 of file MTSSerialFlowControl.cpp.
~MTSSerialFlowControl | ( | ) |
Destructs an MTSSerialFlowControl object and frees all related resources, including internal buffers.
Definition at line 35 of file MTSSerialFlowControl.cpp.
Member Function Documentation
void baud | ( | int | baudrate ) | [inherited] |
This method is used to the set the baud rate of the serial port.
- Parameters:
-
baudrate the baudrate in bps as an int. The default is 9600 bps.
Definition at line 34 of file MTSSerial.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:
-
bits the number of bits in a word (5-8; default = 8) parity the parity used (SerialBase::None, SerialBase::Odd, SerialBase::Even, SerialBase::Forced1, SerialBase::Forced0; default = SerialBase::None) stop the number of stop bits (1 or 2; default = 1)
Definition at line 39 of file MTSSerial.cpp.
int read | ( | char * | data, |
int | length, | ||
unsigned int | timeoutMillis | ||
) | [inherited] |
This method enables bulk reads from the Rx or read buffer.
If more data is requested then available it simply returns all remaining data within the buffer.
- Parameters:
-
data the buffer where data read will be added to. length the amount of data in bytes to be read into the buffer. amount of time to complete operation.
- Returns:
- the total number of bytes that were read.
Definition at line 81 of file MTSBufferedIO.cpp.
int read | ( | char * | data, |
int | length | ||
) | [inherited] |
This method enables bulk reads from the Rx or read buffer.
If more data is requested then available it simply returns all remaining data within the buffer.
- Parameters:
-
data the buffer where data read will be added to. length the amount of data in bytes to be read into the buffer.
- Returns:
- the total number of bytes that were read.
Definition at line 93 of file MTSBufferedIO.cpp.
int read | ( | char & | data, |
unsigned int | timeoutMillis | ||
) | [inherited] |
This method reads a single byte from the Rx or read buffer.
- Parameters:
-
data char where the read byte will be stored. amount of time to complete operation.
- Returns:
- 1 if byte is read or 0 if no byte is available.
Definition at line 103 of file MTSBufferedIO.cpp.
int read | ( | char & | data ) | [inherited] |
This method reads a single byte from the Rx or read buffer.
- Parameters:
-
data char where the read byte will be stored.
- Returns:
- 1 if byte is read or 0 if no byte is available.
Definition at line 108 of file MTSBufferedIO.cpp.
int readable | ( | ) | [inherited] |
This method is used to get the number of bytes available to read from the Rx or read buffer.
- Returns:
- the number of bytes available, 0 if there are no bytes to read.
Definition at line 113 of file MTSBufferedIO.cpp.
void rxClear | ( | ) | [virtual] |
This method clears all the data from the internal Rx or read buffer.
Reimplemented from MTSBufferedIO.
Definition at line 40 of file MTSSerialFlowControl.cpp.
bool rxEmpty | ( | ) | [inherited] |
This method determines if the Rx or read buffer is empty.
- Returns:
- true if empty, otherwise false.
Definition at line 122 of file MTSBufferedIO.cpp.
bool rxFull | ( | ) | [inherited] |
This method determines if the Rx or read buffer is full.
- Returns:
- true if full, otherwise false.
Definition at line 132 of file MTSBufferedIO.cpp.
void txClear | ( | ) | [virtual, inherited] |
This method clears all the data from the internal Tx or write buffer.
Definition at line 137 of file MTSBufferedIO.cpp.
bool txEmpty | ( | ) | [inherited] |
This method determines if the Tx or write buffer is empty.
- Returns:
- true if empty, otherwise false.
Definition at line 117 of file MTSBufferedIO.cpp.
bool txFull | ( | ) | [inherited] |
This method determines if the Tx or write buffer is full.
- Returns:
- true if full, otherwise false.
Definition at line 127 of file MTSBufferedIO.cpp.
int write | ( | const char * | data, |
int | length, | ||
unsigned int | timeoutMillis | ||
) | [inherited] |
This method enables bulk writes to the Tx or write buffer.
If more data is requested to be written then space available the method writes as much data as possible within the timeout period and returns the actual amount written.
- Parameters:
-
data the byte array to be written. length the length of data to be written from the data parameter. amount of time in milliseconds to complete operation.
- Returns:
- the number of bytes written to the buffer, which is 0 if the buffer is full.
Definition at line 33 of file MTSBufferedIO.cpp.
int write | ( | const char * | data, |
int | length | ||
) | [inherited] |
This method enables bulk writes to the Tx or write buffer.
If more data is requested to be written then space available the method writes as much data as possible and returns the actual amount written.
- Parameters:
-
data the byte array to be written. length the length of data to be written from the data parameter.
- Returns:
- the number of bytes written to the buffer, which is 0 if the buffer is full.
Definition at line 52 of file MTSBufferedIO.cpp.
int write | ( | char | data, |
unsigned int | timeoutMillis | ||
) | [inherited] |
This method attempts to write a single byte to the tx buffer within the timeout period.
- Parameters:
-
data the byte to be written as a char. amount of time in milliseconds to complete operation.
- Returns:
- 1 if the byte was written or 0 if the buffer was full.
Definition at line 67 of file MTSBufferedIO.cpp.
int write | ( | char | data ) | [inherited] |
This method writes a signle byte as a char to the Tx or write buffer.
- Parameters:
-
data the byte to be written as a char.
- Returns:
- 1 if the byte was written or 0 if the buffer was full.
Definition at line 72 of file MTSBufferedIO.cpp.
int writeable | ( | ) | [inherited] |
This method is used to get the space available to write bytes to the Tx buffer.
- Returns:
- the number of bytes that can be written, 0 if the buffer is full.
Definition at line 77 of file MTSBufferedIO.cpp.
Generated on Wed Jul 13 2022 02:45:02 by 1.7.2