modm API documentation
modm::PeripheralDriver Class Reference

#include <modm/architecture/interface/peripheral.hpp>

Inheritance diagram for modm::PeripheralDriver:
modm::Adc modm::Can modm::I2cMaster modm::SpiMaster modm::Uart modm::AdcInterrupt modm::platform::Adc1 modm::platform::Adc2 modm::platform::Adc3 modm::Mcp2515< SPI, CS, INT > modm::platform::Can1 modm::platform::Can2 modm_test::platform::CanDriver modm::I2cMultiplexerChannel< multiplexer, channel > modm::platform::BitBangI2cMaster< Scl, Sda > modm::platform::I2cMaster1 modm::platform::I2cMaster2 modm::platform::I2cMaster3 modm::platform::BitBangSpiMaster< Sck, Mosi, Miso > modm::platform::SpiMaster1 modm::platform::SpiMaster2 modm::platform::SpiMaster3 modm::platform::SpiMaster4 modm::platform::SpiMaster5 modm::platform::SpiMaster6 modm::platform::UartSpiMaster1 modm::platform::UartSpiMaster2 modm::platform::UartSpiMaster3 modm::platform::UartSpiMaster6 modm_test::platform::SpiMaster modm::platform::Itm modm::platform::Rtt modm::platform::Uart4 modm::platform::Uart5 modm::platform::Uart7 modm::platform::Uart8 modm::platform::Usart1 modm::platform::Usart2 modm::platform::Usart3 modm::platform::Usart6 modm::platform::UsbUart< ITF >

Static Public Member Functions

static void initialize ()
 initializes the peripheral, must be called before use.
static void configurePurpose ()
 configures a peripheral for a specific purpose
static void setParameter ()
 sets a parameter
static void getParameter ()
 returns a parameter
static bool getInterruptFlag ()
 Read an interrupt flag.
static void acknowledgeInterruptFlag ()
template<baudrate_t available, baudrate_t requested, percent_t tolerance>
static void assertBaudrateInTolerance ()

Detailed Description

Peripheral class

This class acts as a base class for all classes describing the public interface of common peripheral drivers. As there is no implementation given, the classes specific to the platform inherit from their respective base classes and must shadow the methods of them.

The inheritance is only visible for the documentation, it is completely removed during compile time keeping a possible error at platform level. This is safe, because only one platform can be compiled at once.

This way, no virtual functions are needed and no overhead is generated, but we still have clean inheritance in the documentation. There is no need to document the platform specific implementation, since it is taken from the base class.

Niklas Hauser

Member Function Documentation

static void modm::PeripheralDriver::acknowledgeInterruptFlag ( )

Acknowledge an interrupt flag.

We use acknowledge here, since it describes the intention rather than the actual implementation.

template<baudrate_t available, baudrate_t requested, percent_t tolerance>
static void modm::PeripheralDriver::assertBaudrateInTolerance ( )

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.

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