avr-classes
|
#include <usart.h>
Classes | |
struct | Config |
class | InterruptHandler |
Public Member Functions | |
virtual void | enable (bool state)=0 |
virtual void | configure (const Config &config)=0 |
virtual void | setData (uint8_t data)=0 |
virtual uint8_t | getData (void)=0 |
virtual bool | isReadable (void)=0 |
virtual bool | isWritable (void)=0 |
virtual void | setInterruptHandler (InterruptHandler *handler)=0 |
virtual void | enableDataRegisterEmptyInterrupt (bool state)=0 |
virtual void | enableRxCompleteInterrupt (bool state)=0 |
Static Public Member Functions | |
template<uint32_t CPUFREQUENCY> | |
static bool | autoFill (Config &config, uint32_t desiredBaudRate, const char *mode, uint32_t *actualBaudRate=nullptr) |
Interface for devices that implement an USART. The interface also contains a callback data type for using interrupts, but this is not required.
|
inlinestatic |
Automatically fills a configuration structure for USART operation.
config | Configuration structure to fill. |
desiredBaudRate | Desired baud rate, e.g. 9600. |
mode | Mode string consisting of 3 characters: number of data bits, parity (odd/even/none, case insensitive) and number of stop bits. Example: "8n1". |
actualBaudRate | Optional pointer to buffer to receive the baud rate that was actually configured. |
|
pure virtual |
Configures the USART device.
config | Configuration for USART device. |
Implemented in Usart0.
|
pure virtual |
Enables or disables the USART on hardware level.
state | Desired state of USART, true means enabled, false means disabled. |
Implemented in Usart0.
|
pure virtual |
Enables or disabled the Data Register Empty interrupt.
state | True to enable interrupt, false to disable. |
Implemented in Usart0.
|
pure virtual |
Enables or disabled the RX Complete interrupt.
state | True to enable interrupt, false to disable. |
Implemented in Usart0.
|
pure virtual |
Gets the content of the data register.
Implemented in Usart0.
|
pure virtual |
Checks if data is available for reading.
Implemented in Usart0.
|
pure virtual |
Checks if data register is ready for writing the next data byte.
Implemented in Usart0.
|
pure virtual |
Writes a data byte into the data register.
data | Data byte to write. |
Implemented in Usart0.
|
pure virtual |
Sets callback for interrupts.
handler | Pointer to class implementing the interrupt handler interface. |
Implemented in Usart0.