avr-classes
Public Member Functions | Protected Attributes | List of all members
SimpleUsart Class Reference

#include <simpleusart.h>

Inheritance diagram for SimpleUsart:
BufferedUsart< RXQUEUESIZE, TXQUEUESIZE > NotifyingBufferedUsart< RXQUEUESIZE, TXQUEUESIZE >

Public Member Functions

 SimpleUsart (Usart *usart)
 
void enable (bool state)
 
uint8_t read (void)
 
void write (uint8_t byte)
 

Protected Attributes

Usart *const m_usart
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ SimpleUsart()

SimpleUsart::SimpleUsart ( Usart usart)
inline

Constructor.

Parameters
usartPointer to USART device to be used.

Member Function Documentation

◆ enable()

void SimpleUsart::enable ( bool  state)
inline

Enables or disables the USART on hardware level.

Parameters
stateDesired 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
byteData byte to send.

Member Data Documentation

◆ m_usart

Usart* const SimpleUsart::m_usart
protected

Pointer to USART device to be used.