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::Adc modm::Mcp2515< SPI, CS, INT > modm_test::platform::CanDriver modm::I2cMultiplexerChannel< multiplexer, channel > modm::platform::BitBangI2cMaster< Scl, Sda > modm::platform::BitBangSpiMaster< Sck, Mosi, Miso > modm_test::platform::SpiMaster

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: