#include <simpleusart.h>
Simple USART implementation that makes use of hardware units implementing the Usart interface. Read and write class are synchronous. In case non-blocking calls are required, please use BufferedUsart instead.
- Note
- The USART device needs to be configured separately, see Usart::Config and Usart::autoFill.
◆ SimpleUsart()
SimpleUsart::SimpleUsart |
( |
Usart * |
usart | ) |
|
|
inline |
Constructor.
- Parameters
-
usart | Pointer to USART device to be used. |
◆ enable()
void SimpleUsart::enable |
( |
bool |
state | ) |
|
|
inline |
Enables or disables the USART on hardware level.
- Parameters
-
state | Desired state of USART, true means enabled, false means disabled. |
◆ read()
uint8_t SimpleUsart::read |
( |
void |
| ) |
|
|
inline |
Read a data byte. This call is blocking and returns only when a data byte was received.
- Returns
- Data byte read.
◆ write()
void SimpleUsart::write |
( |
uint8_t |
byte | ) |
|
|
inline |
Write a data byte. This call is blocking and returns only when a data byte was placed for sending. This does not mean that the byte was sent, e.g. when sending another byte the next call will do the waiting.
- Parameters
-
◆ m_usart
Usart* const SimpleUsart::m_usart |
|
protected |
Pointer to USART device to be used.