PropWare  3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Public Types | Public Member Functions | Static Public Attributes | List of all members
PropWare::UARTTX Class Reference
+ Inheritance diagram for PropWare::UARTTX:
+ Collaboration diagram for PropWare::UARTTX:

Public Types

enum  Parity {
  Parity::NO_PARITY,
  Parity::EVEN_PARITY,
  Parity::ODD_PARITY
}
 
enum  ErrorCode {
  NO_ERROR = 0,
  BEG_ERROR = UART_ERRORS_BASE,
  BAUD_TOO_HIGH = BEG_ERROR,
  PARITY_ERROR,
  INVALID_DATA_WIDTH,
  INVALID_STOP_BIT_WIDTH,
  NULL_POINTER,
  TIMEOUT_ERROR,
  END_ERROR = UART::TIMEOUT_ERROR
}
 

Public Member Functions

 UARTTX (const Pin::Mask tx)
 
virtual void set_tx_mask (const Port::Mask tx)
 
Port::Mask get_tx_mask () const
 
virtual void send (uint16_t originalData) const
 
virtual void send_array (const char array[], uint32_t words) const
 
virtual void put_char (const char c)
 Print a single character. More...
 
virtual 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...
 
virtual ErrorCode set_data_width (const uint8_t dataWidth)
 
uint8_t get_data_width () const
 
virtual void set_parity (const UART::Parity parity)
 
UART::Parity get_parity () const
 
ErrorCode set_stop_bit_width (const uint8_t stopBitWidth)
 
uint8_t get_stop_bit_width () const
 
void set_baud_rate (const int32_t baudRate)
 
int32_t get_baud_rate () const
 

Static Public Attributes

static const uint8_t DEFAULT_DATA_WIDTH = 8
 
static const Parity DEFAULT_PARITY = Parity::NO_PARITY
 
static const uint8_t DEFAULT_STOP_BIT_WIDTH = 1
 
static const int MAX_BAUD = 4413793
 

Detailed Description

Examples
BufferedUART_Demo.cpp, UARTRX_Demo.cpp, and UARTTX_Demo.cpp.

Definition at line 38 of file uarttx.h.

Member Enumeration Documentation

◆ ErrorCode

enum PropWare::UART::ErrorCode
inherited

Error codes - Proceeded by SD, SPI, and HD44780

Enumerator
NO_ERROR 

No errors; Successful completion of the function

BEG_ERROR 

First error code for PropWare::UART

BAUD_TOO_HIGH 

The requested baud rate is too high

PARITY_ERROR 

A parity error has occurred during read

INVALID_DATA_WIDTH 

The requested data width is not between 1 and 16 (inclusive)

INVALID_STOP_BIT_WIDTH 

The requested stop bit width is not between 1 and 14 (inclusive)

NULL_POINTER 

Null pointer was passed as an argument

TIMEOUT_ERROR 

Reading from the serial connection timed out

END_ERROR 

Last error code used by PropWare::UART

Definition at line 102 of file uart.h.

◆ Parity

enum PropWare::UART::Parity
stronginherited
Enumerator
NO_PARITY 

No parity

EVEN_PARITY 

Even parity

ODD_PARITY 

Odd parity

Definition at line 88 of file uart.h.

Member Function Documentation

◆ put_char()

virtual void PropWare::UARTTX::put_char ( const char  c)
virtual

Print a single character.

Parameters
[in]cIndividual char to be printed

Implements PropWare::PrintCapable.

Definition at line 217 of file uarttx.h.

◆ puts()

virtual void PropWare::UARTTX::puts ( const char  string[])
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.

Precondition
string[] must be terminated with a null terminator
Parameters
[in]string[]Array of data words with the final word being 0 - the null terminator

Implements PropWare::PrintCapable.

Definition at line 221 of file uarttx.h.


The documentation for this class was generated from the following file: