#include <modm/architecture/interface/uart.hpp>
|
| template<class... Signals> |
| static void | connect () |
| |
| template<class SystemClock , baudrate_t baudrate, percent_t tolerance = 10_pct> |
| static void | initialize () |
| |
|
static void | writeBlocking (uint8_t data) |
| | Write a single byte and wait for completion.
|
| |
|
static void | writeBlocking (const uint8_t *data, std::size_t length) |
| | Write a block of bytes and wait for completion.
|
| |
|
static void | flushWriteBuffer () |
| | Flush the write buffer, waits in a while loop until isWriteFinished() returns true
|
| |
| static bool | write (uint8_t data) |
| |
| static std::size_t | write (const uint8_t *data, std::size_t length) |
| |
| static bool | isWriteFinished () |
| |
| static bool | read (uint8_t &data) |
| |
| static std::size_t | read (uint8_t *data, std::size_t length) |
| |
| static std::size_t | receiveBufferSize () |
| |
| static std::size_t | discardReceiveBuffer () |
| |
| static std::size_t | transmitBufferSize () |
| |
| static std::size_t | discardTransmitBuffer () |
| |
| static bool | hasError () |
| |
|
static void | clearError () |
| | Reset the sticky error indication.
|
| |
| static void | acknowledgeInterruptFlag () |
| |
| template<uint64_t available, uint64_t requested, percent_t tolerance> |
| static void | assertBaudrateInTolerance () |
| |
|
template<double available, double requested, percent_t tolerance> |
| static void | assertDurationInTolerance () |
| |
|
static void | configurePurpose () |
| | configures a peripheral for a specific purpose
|
| |
|
static bool | getInterruptFlag () |
| | Read an interrupt flag.
|
| |
|
static void | getParameter () |
| | returns a parameter
|
| |
|
static void | setParameter () |
| | sets a parameter
|
| |
|
|
static constexpr size_t | RxBufferSize = 16 |
| | Size of the receive buffer.
|
| |
|
static constexpr size_t | TxBufferSize = 16 |
| | Size of the transmit buffer.
|
| |
Interface of an Uart.
Asynchronous and synchronous, buffered access to the Uart.
- Author
- Niklas Hauser
| static void modm::PeripheralDriver::acknowledgeInterruptFlag |
( |
| ) |
|
|
inheritedstatic |
Acknowledge an interrupt flag.
We use acknowledge here, since it describes the intention rather than the actual implementation.
template<uint64_t available, uint64_t requested, percent_t tolerance>
| static void modm::PeripheralDriver::assertBaudrateInTolerance |
( |
| ) |
|
|
inheritedinlinestatic |
Since baudrates are usually generated by prescaling a system clock, only several distinct values can be generated. This method checks if the user requested baudrate is within error tolerance of the system achievable baudrate.
template<class... Signals>
| static void modm::Uart::connect |
( |
| ) |
|
|
static |
Connect GPIOs to the peripheral and configure them.
This configures the Tx and Rx signals as output and input and connects them.
- Template Parameters
-
| Signals | One Tx and one Rx signal are required and can be passed out-of-order. |
| static std::size_t modm::Uart::discardReceiveBuffer |
( |
| ) |
|
|
static |
Empty the receive FIFO queue and hardware buffer.
- Returns
- the size of the deleted FIFO queue.
| static std::size_t modm::Uart::discardTransmitBuffer |
( |
| ) |
|
|
static |
Empty the transmit FIFO queue and hardware buffer.
- Returns
- the size of the deleted FIFO queue.
| static bool modm::Uart::hasError |
( |
| ) |
|
|
static |
- Returns
true if an error occured during any write or read
template<class SystemClock , baudrate_t baudrate, percent_t tolerance = 10_pct>
| static void modm::Uart::initialize |
( |
| ) |
|
|
static |
Initializes the hardware and sets the baudrate.
- Template Parameters
-
| SystemClock | the currently active system clock |
| baudrate | desired baud rate in Hz |
| tolerance | the allowed absolute tolerance for the resulting baudrate |
| static bool modm::Uart::isWriteFinished |
( |
| ) |
|
|
static |
- Returns
true if the buffer is empty and the last byte has been sent
| static bool modm::Uart::read |
( |
uint8_t & |
data | ) |
|
|
static |
Read a single byte.
- Parameters
-
| [out] | data | Byte read, if any |
- Returns
true if a byte was received, false otherwise
| static std::size_t modm::Uart::read |
( |
uint8_t * |
data, |
|
|
std::size_t |
length |
|
) |
| |
|
static |
Read a block of bytes.
- Parameters
-
| [out] | data | Pointer to a buffer big enough to store length bytes |
| length | Number of bytes to be read |
- Returns
- Number of bytes which could be read, maximal
length
| static std::size_t modm::Uart::receiveBufferSize |
( |
| ) |
|
|
static |
- Returns
- the size of the receive FIFO queue.
| static std::size_t modm::Uart::transmitBufferSize |
( |
| ) |
|
|
static |
- Returns
- the size of the transmit FIFO queue.
| static std::size_t modm::Uart::write |
( |
const uint8_t * |
data, |
|
|
std::size_t |
length |
|
) |
| |
|
static |
Pushes a block of bytes into the buffer.
- Parameters
-
| data | Pointer to a buffer big enough to store length bytes |
| length | Number of bytes to be written |
- Returns
- the number of bytes pushed into the buffer, maximal
length
| static bool modm::Uart::write |
( |
uint8_t |
data | ) |
|
|
static |
Pushes a single byte into the buffer.
- Returns
true if data has been buffered, false if buffer is full
The documentation for this class was generated from the following file:
- architecture/interface/uart.hpp