UART Class

See the UART Entity for generic information.

class UARTClass : public Acroname::BrainStem2CLI::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()

Constructors.

~UARTClass()

Destructor.

!UARTClass ()

Finalizer.

void init (BrainStem2CLI::ModuleClass^ module, const unsigned char index)

Initializes the class. Should only be called when manually creating classes.

Parameters:
  • pModule – The module.

  • index – The cmdUART index to be addressed.

aErr setEnable(const unsigned char enabled)

Enable the UART channel.

Parameters:

enabled – true: enabled, false: disabled.

Returns:

Returns common entity return values

aErr getEnable(unsigned char %enabled)

Get the enabled state of the uart.

Parameters:

enabled – true: enabled, false: disabled.

Returns:

Returns common entity return values

aErr setBaudRate(const unsigned int 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(unsigned int %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 unsigned char protocol)

Set the UART protocol.

Parameters:

protocol – An enumeration of serial protocols.

Returns:

Returns common entity return values

aErr getProtocol(unsigned char %protocol)

Get the UART protocol.

Parameters:

protocol – Pointer to where result is placed.

Returns:

Returns common entity return values

aErr setLinkChannel(const unsigned char 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(unsigned char %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 unsigned char 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(unsigned char %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 unsigned char 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(unsigned char %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 unsigned char dataBits)

Set the number of bits per character

Parameters:

dataBits – Data Bits of UART Channel.

Returns:

Returns common entity return values

aErr getDataBits(unsigned char %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 unsigned char 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(unsigned char %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(unsigned int %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(unsigned int %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