FastArduino  v1.7
C++ library to build fast but small Arduino/AVR projects
serial::hard::UARX< USART_ > Class Template Reference

Hardware serial receiver API. More...

#include <fastarduino/uart.h>

Inheritance diagram for serial::hard::UARX< USART_ >:
Collaboration diagram for serial::hard::UARX< USART_ >:

Public Member Functions

template<uint8_t SIZE_RX>
 UARX (char(&input)[SIZE_RX])
 Construct a new hardware serial receiver and provide it with a buffer for interrupt-based reception. More...
 
void begin (uint32_t rate, Parity parity=Parity::NONE, StopBits stop_bits=StopBits::ONE)
 Enable the receiver. More...
 
void end (BufferHandling buffer_handling=BufferHandling::KEEP)
 Stop reception. More...
 
- Public Member Functions inherited from serial::UARTErrors
void clear_errors ()
 Reset UART errors to no error.
 
uint8_t has_errors () const
 Indicate if there are UART errors pending. More...
 
bool frame_error () const
 Indicate if a frame error has occurred. More...
 
bool data_overrun () const
 Indicate if a data overrun has occurred. More...
 
bool queue_overflow () const
 Indicate if a queue overflow has occurred. More...
 
bool parity_error () const
 Indicate if a parity error has occurred. More...
 

Static Public Attributes

static constexpr const board::USART USART = USART_
 The hardware board::USART used by this UARX.
 

Friends

struct isr_handler
 

Detailed Description

template<board::USART USART_>
class serial::hard::UARX< USART_ >

Hardware serial receiver API.

For this API to be fully functional, you must register the right ISR in your program, through REGISTER_UARX_ISR().

Template Parameters
USART_the hardware board::USART to use
See also
REGISTER_UARX_ISR()

Definition at line 355 of file uart.h.

Constructor & Destructor Documentation

◆ UARX()

template<board::USART USART_>
template<uint8_t SIZE_RX>
serial::hard::UARX< USART_ >::UARX ( char(&)  input[SIZE_RX])
inlineexplicit

Construct a new hardware serial receiver and provide it with a buffer for interrupt-based reception.

Reception is asynchronous.

Parameters
inputan array of characters used by this receiver to store content received through serial line, buffered until read through in().
See also
REGISTER_UARX_ISR()

Definition at line 374 of file uart.h.

Member Function Documentation

◆ begin()

template<board::USART USART_>
void serial::hard::UARX< USART_ >::begin ( uint32_t  rate,
Parity  parity = Parity::NONE,
StopBits  stop_bits = StopBits::ONE 
)
inline

Enable the receiver.

This is needed before any reception can take place. Once called, it is possible to read content, received through serial connection, by using in().

Parameters
ratethe transmission rate in bits per second (bps)
paritythe kind of parity check used by transmission
stop_bitsthe number of stop bits used by transmission

Definition at line 389 of file uart.h.

◆ end()

template<board::USART USART_>
void serial::hard::UARX< USART_ >::end ( BufferHandling  buffer_handling = BufferHandling::KEEP)
inline

Stop reception.

Once called, it is possible to re-enable reception again by calling begin().

Parameters
buffer_handlinghow to handle input buffer before ending transmissions
See also
BufferHandling

Definition at line 402 of file uart.h.


The documentation for this class was generated from the following file: