UART Class¶
See the UART Entity for generic information.
-
class UARTClass : public Acroname::BrainStem::EntityClass¶
UARTClass: A UART is a “Universal Asynchronous Receiver/Transmitter. Many times referred to as a COM (communication), Serial, or TTY (teletypewriter) port. The UART Class allows the enabling and disabling of the UART data lines.
Public Functions
-
UARTClass(void)¶
Constructor.
-
virtual ~UARTClass(void)¶
Destructor.
-
void init(Module *pModule, const uint8_t index)¶
Initialize the UART Class.
- Parameters:
pModule – The module to which this entity belongs.
index – The index of the UART entity to be addressed.
-
aErr setEnable(const uint8_t enabled)¶
Enable the UART channel.
- Parameters:
enabled – true: enabled, false: disabled.
- Returns:
Returns common entity return values
-
aErr getEnable(uint8_t *enabled)¶
Get the enabled state of the uart.
- Parameters:
enabled – true: enabled, false: disabled.
- Returns:
Returns common entity return values
-
aErr setBaudRate(const uint32_t rate)¶
Set the UART baud rate. If zero, automatic baud rate selection is used.
- Parameters:
rate – baud rate.
- Returns:
Returns common entity return values
-
aErr getBaudRate(uint32_t *rate)¶
Get the UART baud rate. If zero, automatic baud rate selection is used.
- Parameters:
rate – Pointer variable to be filled with baud rate.
- Returns:
Returns common entity return values
-
aErr setProtocol(const uint8_t protocol)¶
Set the UART protocol.
- Parameters:
protocol – An enumeration of serial protocols.
- Returns:
Returns common entity return values
-
aErr getProtocol(uint8_t *protocol)¶
Get the UART protocol.
- Parameters:
protocol – Pointer to where result is placed.
- Returns:
Returns common entity return values
-
aErr setLinkChannel(const uint8_t channel)¶
Set the index of another UART Entity that should be linked to this UART.
If set to the index of this entity, the channel will not be linked. If set to the index of another UART entity, data will be sent between the two UART entities with no additional processing.
- Parameters:
channel – Index of the UART Entity to link
- Returns:
Returns common entity return values
-
aErr getLinkChannel(uint8_t *channel)¶
Gets the index of the UART Entity that this entity is linked to.
- Parameters:
channel – Pointer to where result is placed.
- Returns:
Returns common entity return values
-
aErr setStopBits(const uint8_t stopBits)¶
Set the UART stop bit configuration
- Parameters:
stopBits – Stop Bits of UART Channel. Allowed options:
uartStopBits_1_Value
uartStopBits_1p5_Value
uartStopBits_2_Value
- Returns:
Returns common entity return values
-
aErr getStopBits(uint8_t *stopBits)¶
Set the UART stop bit configuration
- Parameters:
stopBits – Pointer to where result is placed. Possible values:
uartStopBits_1_Value
uartStopBits_1p5_Value
uartStopBits_2_Value
- Returns:
Returns common entity return values
-
aErr setParity(const uint8_t parity)¶
Set the UART parity.
- Parameters:
parity – Parity of UART Channel. Allowed options:
uartParity_None_Value
uartParity_Odd_Value
uartParity_Even_Value
uartParity_Mark_Value
uartParity_Space_Value
- Returns:
Returns common entity return values
-
aErr getParity(uint8_t *parity)¶
Get the UART parity.
- Parameters:
parity – Pointer variable to be filled with value. Possible values:
uartParity_None_Value
uartParity_Odd_Value
uartParity_Even_Value
uartParity_Mark_Value
uartParity_Space_Value
- Returns:
Returns common entity return values
-
aErr setDataBits(const uint8_t dataBits)¶
Set the number of bits per character
- Parameters:
dataBits – Data Bits of UART Channel.
- Returns:
Returns common entity return values
-
aErr getDataBits(uint8_t *dataBits)¶
Get the number of bits per character
- Parameters:
dataBits – Pointer to where result is placed.
- Returns:
Returns common entity return values
-
aErr setFlowControl(const uint8_t flowControl)¶
Set the UART flow control configuration
- Parameters:
flowControl – Flow Control of UART Channel as a bitmask. Allowed bits:
uartFlowControl_RTS_CTS_Bit
uartFlowControl_DSR_DTR_Bit
uartFlowControl_XON_XOFF_Bit
- Returns:
Returns common entity return values
-
aErr getFlowControl(uint8_t *flowControl)¶
Set the UART flow control configuration
- Parameters:
flowControl – Pointer to bitmask where result is placed. Possible bits:
uartFlowControl_RTS_CTS_Bit
uartFlowControl_DSR_DTR_Bit
uartFlowControl_XON_XOFF_Bit
- Returns:
Returns common entity return values
-
aErr getCapableProtocols(uint32_t *protocols)¶
Returns a bitmask containing a list of protocols that this UART entity is allowed to select. This does not guarantee that selecting a protocol with “setProtocol” will have an available resource.
- Parameters:
protocols – Bitmask containing list of protocols that may be selected. The value of the uartProtocol is mapped to the bit index (e.g. uartProtocol_Undefined is bit 0, uartProtocol_ExtronResponder_Value is bit 1, etc.)
- Returns:
Returns common entity return values
-
aErr getAvailableProtocols(uint32_t *protocols)¶
Returns a bitmask containing a list of protocols that this UART entity is capable of selecting, and has an available protocol resource to assign.
- Parameters:
protocols – Bitmask containing list of protocols that are available to select. The value of the uartProtocol is mapped to the bit index (e.g. uartProtocol_Undefined is bit 0, uartProtocol_ExtronResponder_Value is bit 1, etc.)
- Returns:
Returns common entity return values
-
UARTClass(void)¶