FastArduino  v1.7
C++ library to build fast but small Arduino/AVR projects
serial::soft::UARX< board::InterruptPin, RX_ > Class Template Reference

#include <fastarduino/soft_uart.h>

Inheritance diagram for serial::soft::UARX< board::InterruptPin, RX_ >:
Collaboration diagram for serial::soft::UARX< board::InterruptPin, RX_ >:

Public Types

using PCI_TYPE = interrupt::PCI_SIGNAL< RX_ >
 The interrupt::PCISignal type for RX_ pin, if it is a PinChangeInterrupt pin. More...
 

Public Member Functions

template<uint8_t SIZE_RX>
 UARX (char(&input)[SIZE_RX], PCI_TYPE &enabler)
 Construct a new software 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::DigitalPin RX = board::PCI_PIN<RX_>()
 The board::DigitalPin which shall receive serial signal; this must be either an External INT pin (board::ExternalInterruptPin) or a PinChangeInterrupt pin (board::InterruptPin).
 

Friends

struct isr_handler
 

Detailed Description

template<board::InterruptPin RX_>
class serial::soft::UARX< board::InterruptPin, RX_ >

See also
UARX_PCI

Definition at line 581 of file soft_uart.h.

Member Typedef Documentation

◆ PCI_TYPE

template<board::InterruptPin RX_>
using serial::soft::UARX< board::InterruptPin, RX_ >::PCI_TYPE = interrupt::PCI_SIGNAL<RX_>

The interrupt::PCISignal type for RX_ pin, if it is a PinChangeInterrupt pin.

This type is used in begin() call.

See also
begin()

Definition at line 596 of file soft_uart.h.

Constructor & Destructor Documentation

◆ UARX()

template<board::InterruptPin RX_>
template<uint8_t SIZE_RX>
serial::soft::UARX< board::InterruptPin, RX_ >::UARX ( char(&)  input[SIZE_RX],
PCI_TYPE enabler 
)
inlineexplicit

Construct a new software 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().
enablerthe interrupt::PCISignal for the RX pin; it is used to enable interrupts on that pin.
See also
REGISTER_UART_PCI_ISR()

Definition at line 610 of file soft_uart.h.

Member Function Documentation

◆ begin()

template<board::InterruptPin RX_>
void serial::soft::UARX< board::InterruptPin, RX_ >::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 626 of file soft_uart.h.

◆ end()

template<board::InterruptPin RX_>
void serial::soft::UARX< board::InterruptPin, RX_ >::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 output buffer before ending transmissions

Definition at line 640 of file soft_uart.h.


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