IO::Serial Class Reference
Wrapper class for the UART driver. More...
#include <Serial.h>
Classes | |
struct | Config |
Public Member Functions | |
virtual | ~Serial () |
ErrorCode | open (uint8_t uart_nr, uint8_t txPin=UART_PIN_DEFAULT, uint8_t rxPin=UART_PIN_DEFAULT) |
Initialise the serial port with a default configuration. More... | |
void | close () |
Close the port. More... | |
bool | resizeBuffers (size_t rxSize, size_t txSize) |
Set required buffer sizes. More... | |
void | setCallback (smg_uart_callback_t callback, void *param) |
void | setBreak (bool state) |
size_t | available () const |
size_t | read (void *buffer, size_t size) |
size_t | write (const void *data, size_t len) |
void | swap (uint8_t txPin=1) |
void | clear (smg_uart_mode_t mode=UART_FULL) |
const Config & | getConfig () const |
void | setConfig (const Config &cfg) |
Detailed Description
Wrapper class for the UART driver.
RS485 requires efficient burst transfer access to the serial hardware, so uses the UART driver directly.
Constructor & Destructor Documentation
◆ ~Serial()
|
inlinevirtual |
Member Function Documentation
◆ available()
|
inline |
◆ clear()
|
inline |
◆ close()
void IO::Serial::close | ( | ) |
Close the port.
◆ getConfig()
|
inline |
◆ open()
ErrorCode IO::Serial::open | ( | uint8_t | uart_nr, |
uint8_t | txPin = UART_PIN_DEFAULT , |
||
uint8_t | rxPin = UART_PIN_DEFAULT |
||
) |
Initialise the serial port with a default configuration.
◆ read()
◆ resizeBuffers()
Set required buffer sizes.
Serial buffers are expanded if required, but not reduced.
- Parameters
-
rxSize txSize
- Return values
-
bool true on success
◆ setBreak()
|
inline |
◆ setCallback()
|
inline |
◆ setConfig()
void IO::Serial::setConfig | ( | const Config & | cfg | ) |
◆ swap()
|
inline |
◆ write()
The documentation for this class was generated from the following file: