#include <uart_base.h>
Public Member Functions | |
Status | Enable () |
Status | Disable () |
Status | SetBaudRate (uint32_t baud_rate) |
Status | SetFlowControl (bool enable) |
size_t | ConservativeReadAvailable () |
Status | ClearPendingReceiveBytes () |
The common abstract base class of the UART interface.
The UartBase
interface provides basic method for enabling and configuring a UART. Methods for actually communicating via the UART are on the Uart
and UartNonBlocking
child classes.
|
inline |
Empties the UART's receive buffer and discards any unread data.
This function removes all data from the receive buffer, resetting the buffer to an empty state. This is useful for situations where you want to disregard any previously received data and resynchronize.
embed:rst:leading-asterisk * * .. pw-status-codes:: * * OK: The operation was successful. * * May return other implementation-specific status codes. * *
|
inline |
Returns the number of bytes currently available for reading.
This function checks the receive buffer to determine how many bytes of data are ready to be read.
|
inline |
Disables the UART module. Disabling the UART shuts down communication and prevents the microcontroller from sending or receiving data through the UART port.
This is usually done to save power. Interrupt handlers should also be disabled.
embed:rst:leading-asterisk * * .. pw-status-codes:: * * OK: The UART module has been successfully initialized. * * INTERNAL: Internal errors within the hardware abstraction layer. * *
|
inline |
Initializes the UART module, sets it into the default state as determined by the concrete UART implementation. This function should be a no-op if the UART module is in an enabled state.
This may change the power state of the UART module, configure the interface parameters, enable the associated pins, setup the internal TX and RX buffers, etc...
embed:rst:leading-asterisk * * .. pw-status-codes:: * * OK: The UART module has been successfully initialized. * * INTERNAL: Internal errors within the hardware abstraction layer. * *
|
inline |
Configures the UART communication baud rate.
This function sets the communication speed (baud rate) for the UART. Whether the baud rate can be changed while the UART is enabled depends on the specific implementation.
embed:rst:leading-asterisk * * .. pw-status-codes:: * * OK: The UART has been successfully initialized. * * FAILED_PRECONDITION: The device is enabled and does not support * changing settings on the fly. * * INTERNAL: Internal errors within the hardware abstraction layer. * *
|
inline |
Configures the UART hardware flow control enable.
This function sets the hardware flow control enable for the UART. Whether the flow control setting rate can be changed while the UART is enabled depends on the specific implementation.
embed:rst:leading-asterisk * * .. pw-status-codes:: * * OK: The UART has been successfully initialized. * * FAILED_PRECONDITION: The device is enabled and does not support * changing settings on the fly. * * UNIMPLEMENTED: The device does not support flow control. * * INTERNAL: Internal errors within the hardware abstraction layer. * *