![]() |
PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
|
Converted to C++ using spin2cpp and then modified to become a PrintCapable object in PropWare's arsenal. More...
#include <PropWare/serial/uart/fullduplexserial.h>
Inheritance diagram for PropWare::FullDuplexSerial:
Collaboration diagram for PropWare::FullDuplexSerial:Public Types | |
| enum | Mode { INVERT_RX = BIT_0, INVERT_TX = BIT_1, OPEN_DRAIN_SOURCE_TX = BIT_2, IGNORE_TX_ECHO_ON_RX = BIT_3 } |
Public Member Functions | |
| FullDuplexSerial (const int rxPinNumber=_cfg_rxpin, const int txPinNumber=_cfg_txpin, const uint32_t mode=0, const int baudrate=_cfg_baudrate) | |
| ~FullDuplexSerial () | |
| Stop the driver cog and return the locks. | |
| int | start () |
| Start the driver cog. More... | |
| void | truncate () |
| Empty the receive buffer. | |
| bool | receive_ready () const |
| Find out if a byte is waiting in the receive buffer. More... | |
| bool | get_char_non_blocking (char &c) |
| Check if byte received (never waits) More... | |
| bool | get_char (char &c, const unsigned int timeout) |
| Wait for a byte to be received and return after a timeout. More... | |
| char | get_char () |
| Read and return a single character. Whether the method is blocking or not depends entirely on the implementation. | |
| void | put_char (const char c) |
| Print a single character. More... | |
| void | puts (const char string[]) |
| Send a null-terminated character array. Though this method could be created using put_char, some objects (such as PropWare::UART), have optimized methods for sending a string and PrintCapable::puts can utilize them. More... | |
Static Public Attributes | |
| static const size_t | BUFFER_SIZE = 16 |
Converted to C++ using spin2cpp and then modified to become a PrintCapable object in PropWare's arsenal.
Definition at line 42 of file fullduplexserial.h.
| PropWare::FullDuplexSerial::FullDuplexSerial | ( | const int | rxPinNumber = _cfg_rxpin, |
| const int | txPinNumber = _cfg_txpin, |
||
| const uint32_t | mode = 0, |
||
| const int | baudrate = _cfg_baudrate |
||
| ) |
Construct a full-duplex, buffered UART instance
This object requires a dedicated cog to run the driver code. The driver must be started by invoking PropWare::FullDuplexSerial::start() on this object.
| rxPinNumber | Pin number to receive data |
| txPinNumber | Pin number to transmit data |
| mode | Combination of some, none, or all of the Mode values which can change the behavior of the device |
| baudrate | Baudrate to run the transmit and recieve routines |
Definition at line 67 of file fullduplexserial.h.
| bool PropWare::FullDuplexSerial::get_char | ( | char & | c, |
| const unsigned int | timeout | ||
| ) |
Wait for a byte to be received and return after a timeout.
| [out] | c | Byte received from the buffer |
| [in] | timeout | Timeout (in clock ticks) before exiting the function |
c is valid, false if no character was available before the timeout Definition at line 139 of file fullduplexserial.h.
Here is the call graph for this function:| bool PropWare::FullDuplexSerial::get_char_non_blocking | ( | char & | c | ) |
Check if byte received (never waits)
| [out] | c | Byte received from the buffer |
c is valid, false otherwise Definition at line 122 of file fullduplexserial.h.
Here is the call graph for this function:
Here is the caller graph for this function:
|
virtual |
Print a single character.
| [in] | c | Individual char to be printed |
Implements PropWare::PrintCapable.
Definition at line 153 of file fullduplexserial.h.
Here is the call graph for this function:
Here is the caller graph for this function:
|
virtual |
Send a null-terminated character array. Though this method could be created using put_char, some objects (such as PropWare::UART), have optimized methods for sending a string and PrintCapable::puts can utilize them.
string[] must be terminated with a null terminator| [in] | string[] | Array of data words with the final word being 0 - the null terminator |
Implements PropWare::PrintCapable.
Definition at line 164 of file fullduplexserial.h.
Here is the call graph for this function:| bool PropWare::FullDuplexSerial::receive_ready | ( | ) | const |
Find out if a byte is waiting in the receive buffer.
Definition at line 111 of file fullduplexserial.h.
Here is the caller graph for this function:| int PropWare::FullDuplexSerial::start | ( | ) |
Start the driver cog.
Definition at line 94 of file fullduplexserial.h.
1.8.17