semf
semf::Uart Class Referenceabstract

Interface for UART specific functionalities, which are not solved in a generic way in CommunicationHardware. More...

#include <uart.h>

Inheritance diagram for semf::Uart:
Inheritance graph
Collaboration diagram for semf::Uart:
Collaboration graph

Public Types

enum class  FlowControl : uint8_t { NoFlowControl = 0x00 , RtsFlowControl = 0x01 , CtsFlowControl = 0x10 , RtsAndCtsFlowControl = 0x11 }
 
enum class  Parity : uint8_t { NoParity , OddParity , EvenParity }
 
enum class  StopBits : uint8_t { Stopbits_0_5 , Stopbits_1 , Stopbits_1_5 , Stopbits_2 }
 
enum class  WireMode : uint8_t { ReadWire , WriteWire , ReadAndWriteWires }
 

Public Member Functions

virtual ~Uart ()=default
 
virtual void setFormat (uint8_t bits, WireMode wire, Parity par, StopBits stop, FlowControl flow)=0
 Sets the format for the spi slave device. More...
 
virtual void setBaud (uint32_t baud)=0
 Sets the baud rate. More...
 
virtual uint32_t baud ()=0
 Returns the currently used baud rate. More...
 

Detailed Description

Interface for UART specific functionalities, which are not solved in a generic way in CommunicationHardware.

See also
CommunicationHardware
UartHardware

Definition at line 24 of file uart.h.

Member Enumeration Documentation

◆ FlowControl

enum class semf::Uart::FlowControl : uint8_t
strong

Flow control modes for using RTS / CTS.

Enumerator
NoFlowControl 

No flow control setting, only RXD and TXD pins are used.

RtsFlowControl 

Receive flow control setting, RXD, TXD and RTS pins are used.

CtsFlowControl 

Transmit flow control setting, RXD, TXD and CTS pins are used.

RtsAndCtsFlowControl 

Full flow control setting, RXD, TXD, CTS and RTS pins are used.

Definition at line 28 of file uart.h.

◆ Parity

enum class semf::Uart::Parity : uint8_t
strong

Parity setting.

Enumerator
NoParity 
OddParity 
EvenParity 

Definition at line 36 of file uart.h.

◆ StopBits

enum class semf::Uart::StopBits : uint8_t
strong

Number of stop bits.

Enumerator
Stopbits_0_5 
Stopbits_1 
Stopbits_1_5 
Stopbits_2 

Definition at line 43 of file uart.h.

◆ WireMode

enum class semf::Uart::WireMode : uint8_t
strong

Wire mode for full- or half duplex mode.

Enumerator
ReadWire 
WriteWire 
ReadAndWriteWires 

Definition at line 51 of file uart.h.

Constructor & Destructor Documentation

◆ ~Uart()

virtual semf::Uart::~Uart ( )
virtualdefault

Member Function Documentation

◆ baud()

virtual uint32_t semf::Uart::baud ( )
pure virtual

Returns the currently used baud rate.

Returns
Baud rate.

Implemented in semf::Stm32Uart.

◆ setBaud()

virtual void semf::Uart::setBaud ( uint32_t  baud)
pure virtual

Sets the baud rate.

Parameters
baudBaud rate.

Implemented in semf::Stm32Uart.

◆ setFormat()

virtual void semf::Uart::setFormat ( uint8_t  bits,
WireMode  wire,
Parity  par,
StopBits  stop,
FlowControl  flow 
)
pure virtual

Sets the format for the spi slave device.

Parameters
bitsNumber of data bits (without parity) per frame.
wireFull duplex mode or half duplex mode.
parParity.
stopStop bits.
flowFlow control.
Note
Number of data bits differs that the number of bits to be send. i.e.: in case of sending a frame 8 bits without parity, number of data bits should be 8 bits. i.e.: in case of sending a frame of 8 bits including a parity, number of bits should be 7 bits.

Implemented in semf::Stm32Uart.