FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
Loading...
Searching...
No Matches
serial::soft::UART< board::InterruptPin, RX_, TX_ > Class Template Reference

#include <fastarduino/soft_uart.h>

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

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, uint8_t SIZE_TX>
 UART (char(&input)[SIZE_RX], char(&output)[SIZE_TX], PCI_TYPE &enabler)
 Construct a new software serial receiver/transceiver and provide it with 2 buffers, one for interrupt-based reception, one for transmission. More...
 
void begin (uint32_t rate, Parity parity=Parity::NONE, StopBits stop_bits=StopBits::ONE)
 Enable the receiver/transceiver. More...
 
void end (BufferHandling buffer_handling=BufferHandling::KEEP)
 Stop all transmissions and receptions. More...
 
- Public Member Functions inherited from serial::UARTErrors
void clear_errors ()
 Reset UART errors to no error. More...
 
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 TX = TX_
 The board::DigitalPin to which transmitted signal is sent. More...
 
static constexpr const board::DigitalPin RX = board::PCI_PIN<RX_>()
 The board::DigitalPin which shall receive serial signal. More...
 

Friends

struct isr_handler
 

Detailed Description

template<board::InterruptPin RX_, board::DigitalPin TX_>
class serial::soft::UART< board::InterruptPin, RX_, TX_ >
See also
UART_PCI

Definition at line 688 of file soft_uart.h.

Member Typedef Documentation

◆ PCI_TYPE

using serial::soft::UART< board::InterruptPin, RX_, TX_ >::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 703 of file soft_uart.h.

Constructor & Destructor Documentation

◆ UART()

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

Construct a new software serial receiver/transceiver and provide it with 2 buffers, one for interrupt-based reception, one for transmission.

Parameters
inputan array of characters used by this receiver to store content received through serial line, buffered until read through in().
outputan array of characters used by this transmitter to buffer output during transmission.
enablerthe interrupt::PCISignal for the RX pin; it is used to enable interrupts on that pin.

Definition at line 718 of file soft_uart.h.

Member Function Documentation

◆ begin()

void serial::soft::UART< board::InterruptPin, RX_, TX_ >::begin ( uint32_t  rate,
Parity  parity = Parity::NONE,
StopBits  stop_bits = StopBits::ONE 
)
inline

Enable the receiver/transceiver.

This is needed before any transmission or reception can take place. Once called, it is possible to send and receive content through serial connection, by using in() for reading and out() for writing.

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 734 of file soft_uart.h.

◆ end()

void serial::soft::UART< board::InterruptPin, RX_, TX_ >::end ( BufferHandling  buffer_handling = BufferHandling::KEEP)
inline

Stop all transmissions and receptions.

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

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

Definition at line 751 of file soft_uart.h.

Friends And Related Function Documentation

◆ isr_handler

friend struct isr_handler
friend

Definition at line 781 of file soft_uart.h.

Member Data Documentation

◆ TX

constexpr const board::DigitalPin serial::soft::UART< board::InterruptPin, RX_, TX_ >::TX = TX_
staticconstexpr

The board::DigitalPin to which transmitted signal is sent.

Definition at line 692 of file soft_uart.h.

◆ RX

constexpr const board::DigitalPin serial::soft::UART< board::InterruptPin, RX_, TX_ >::RX = board::PCI_PIN<RX_>()
staticconstexpr

The board::DigitalPin which shall receive serial signal.

Definition at line 696 of file soft_uart.h.


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