modm API documentation

#include <modm/platform/uart/uart0.hpp>

Inheritance diagram for modm::platform::Uart0:
modm::Uart modm::PeripheralDriver

Static Public Member Functions

template<class... Signals>
static void connect (Gpio::InputType InputTypeRx=Gpio::InputType::PullUp)
 
template<class SystemClock , baudrate_t baudrate, percent_t tolerance = pct(2)>
static void initialize ()
 
static void writeBlocking (uint8_t data)
 
static void writeBlocking (const uint8_t *data, std::size_t length)
 
static void flushWriteBuffer ()
 
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 *buffer, std::size_t length)
 
static std::size_t discardReceiveBuffer ()
 
static std::size_t discardTransmitBuffer ()
 
static uint8_t getErrorFlags ()
 
static void acknowledgeErrorFlags ()
 Clears the error flags.
 
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 clearError ()
 Reset the sticky error indication.
 
static void configurePurpose ()
 configures a peripheral for a specific purpose
 
template<class... Signals>
static void connect ()
 
static bool getInterruptFlag ()
 Read an interrupt flag.
 
static void getParameter ()
 returns a parameter
 
static bool hasError ()
 
static std::size_t receiveBufferSize ()
 
static void setParameter ()
 sets a parameter
 
static std::size_t transmitBufferSize ()
 

Static Public Attributes

static constexpr size_t RxBufferSize = 8
 
static constexpr size_t TxBufferSize = 64
 

Static Protected Member Functions

static void initialize (uint16_t ubrr)
 

Detailed Description

(Non-)Buffered Uart0

This implementation uses a ringbuffer. The size of the ringbuffer can be changed in the options.

Author
Fabian Greif
Niklas Hauser

Member Function Documentation

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 ( )
inheritedstatic

Connect GPIOs to the peripheral and configure them.

This configures the Tx and Rx signals as output and input and connects them.

Template Parameters
SignalsOne Tx and one Rx signal are required and can be passed out-of-order.
uint8_t modm::platform::Uart0::getErrorFlags ( )
static

Check whether any errors occurred during receiving. Be aware that these indicate an error that occurred somewhere since resetting the Error Flags (with acknowledgeErrorFlags()), so you cannot tell which byte had the error.

Returns
0 if no errors occurred, otherwise a value that corresponds to the Error Flags in register A.
static bool modm::Uart::hasError ( )
inheritedstatic
Returns
true if an error occured during any write or read
static std::size_t modm::Uart::receiveBufferSize ( )
inheritedstatic
Returns
the size of the receive FIFO queue.
static std::size_t modm::Uart::transmitBufferSize ( )
inheritedstatic
Returns
the size of the transmit FIFO queue.

The documentation for this class was generated from the following files: