Hardware serial receiver/transceiver API.
More...
#include <fastarduino/uart.h>
|
template<uint8_t SIZE_RX, uint8_t SIZE_TX> |
| UART (char(&input)[SIZE_RX], char(&output)[SIZE_TX]) |
| Construct a new hardware serial receiver/transceiver and provide it with 2 buffers, one for interrupt-based reception, one for interrupt-based 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...
|
|
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...
|
|
template<board::USART USART_>
class serial::hard::UART< USART_ >
Hardware serial receiver/transceiver API.
For this API to be fully functional, you must register the right ISR in your program, through REGISTER_UART_ISR()
.
- Template Parameters
-
- See also
- REGISTER_UART_ISR()
Definition at line 424 of file uart.h.
◆ UART()
template<board::USART USART_>
template<uint8_t SIZE_RX, uint8_t SIZE_TX>
Construct a new hardware serial receiver/transceiver and provide it with 2 buffers, one for interrupt-based reception, one for interrupt-based transmission.
- Parameters
-
input | an array of characters used by this receiver to store content received through serial line, buffered until read through in() . |
output | an array of characters used by this transmitter to buffer output during transmission so that write methods are not blocking. |
- See also
- REGISTER_UART_ISR()
Definition at line 450 of file uart.h.
◆ begin()
template<board::USART USART_>
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
-
rate | the transmission rate in bits per second (bps) |
parity | the kind of parity check used by transmission |
stop_bits | the number of stop bits used by transmission |
Definition at line 466 of file uart.h.
◆ end()
template<board::USART USART_>
Stop all transmissions and receptions.
Once called, it is possible to re-enable transmission and reception again by calling begin()
.
- Parameters
-
buffer_handling | how to handle output and input buffers before ending transmissions |
- See also
- BufferHandling
Definition at line 479 of file uart.h.
The documentation for this class was generated from the following file: