Device interface library for multiple platforms including Mbed.

Dependents:   DeepCover Embedded Security in IoT MaximInterface MAXREFDES155#

Embed: (wiki syntax)

« Back to documentation index

Uart Class Reference

Uart Class Reference

Universal asynchronous receiver-transmitter interface. More...

#include <Uart.hpp>

Inherited by SerialPort, and Uart.

Public Types

enum  ErrorValue { TimeoutError = 1, OverrunError }

Public Member Functions

virtual Result< void > setBaudRate (int_least32_t baudRate)=0
 Set the baud rate of the port in Hz.
virtual Result< void > sendBreak ()=0
 Generate a break condition on the port for a small amount of time.
virtual Result< void > clearReadBuffer ()=0
 Clear all received data that was buffered.
virtual Result< void > writeByte (uint_least8_t data)=0
 Writes a byte of data to the port.
virtual
MaximInterfaceCore_EXPORT
Result< void > 
writeBlock (span< const uint_least8_t > data)
 Writes a block of data to the port.
virtual Result< uint_least8_t > readByte ()=0
 Reads a byte of data from the port.
virtual
MaximInterfaceCore_EXPORT
Result< void > 
readBlock (span< uint_least8_t > data)
 Read a block of data from the port.

Detailed Description

Universal asynchronous receiver-transmitter interface.

Definition at line 45 of file MaximInterfaceCore/Uart.hpp.


Member Enumeration Documentation

enum ErrorValue
Enumerator:
TimeoutError 

Read operation aborted due to timeout.

OverrunError 

Received data lost due to read buffer overrun.

Reimplemented in Uart.

Definition at line 47 of file MaximInterfaceCore/Uart.hpp.


Member Function Documentation

Result< void > clearReadBuffer (  ) [pure virtual]

Clear all received data that was buffered.

Implemented in Uart.

Definition at line 53 of file MaximInterfaceMbed/Uart.cpp.

Result< void > readBlock ( span< uint_least8_t >  data ) [virtual]

Read a block of data from the port.

Block until data is received or a timeout is reached.

Parameters:
[out]dataData read from the port if successful.

Definition at line 45 of file MaximInterfaceCore/Uart.cpp.

Result< uint_least8_t > readByte (  ) [pure virtual]

Reads a byte of data from the port.

Block until data is received or a timeout is reached.

Returns:
Data read from the port if successful.

Implemented in Uart.

Definition at line 74 of file MaximInterfaceMbed/Uart.cpp.

Result< void > sendBreak (  ) [pure virtual]

Generate a break condition on the port for a small amount of time.

Implemented in Uart.

Definition at line 48 of file MaximInterfaceMbed/Uart.cpp.

Result< void > setBaudRate ( int_least32_t  baudRate ) [pure virtual]

Set the baud rate of the port in Hz.

Implemented in Uart.

Definition at line 43 of file MaximInterfaceMbed/Uart.cpp.

Result< void > writeBlock ( span< const uint_least8_t >  data ) [virtual]

Writes a block of data to the port.

Definition at line 38 of file MaximInterfaceCore/Uart.cpp.

Result< void > writeByte ( uint_least8_t  data ) [pure virtual]

Writes a byte of data to the port.

Implemented in Uart.

Definition at line 60 of file MaximInterfaceMbed/Uart.cpp.