modm API documentation
modm::platform::Adc Class Reference

#include <modm/platform/adc/adc.hpp>

Inheritance diagram for modm::platform::Adc:
modm::Adc modm::PeripheralDriver

Public Types

enum  Channel : uint8_t {
  Ch0 = 0, Ch1 = 1, Ch2 = 2, Ch3 = 3,
  Temperature = 4
}
 

Static Public Member Functions

template<class... Signals>
static void connect ()
 
static void initialize ()
 
static void disable ()
 
static bool setChannel (Channel)
 
static Channel getChannel ()
 
static bool isReady ()
 
static bool hasError ()
 
static uint16_t getValue ()
 
static uint16_t readChannel (Channel)
 
static void enableTemperatureSensor ()
 
static void disableTemperatureSensor ()
 
static float convertToVoltage (uint16_t value)
 
static float convertToTemperature (uint16_t value)
 
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 void disableFreeRunningMode ()
 
static void enableFreeRunningMode ()
 
static bool getInterruptFlag ()
 Read an interrupt flag.
 
static void getParameter ()
 returns a parameter
 
static bool isConversionFinished ()
 
static void setLeftAdjustResult ()
 Change the presentation of the ADC conversion result to left adjusted.
 
static void setParameter ()
 sets a parameter
 
static void setRightAdjustResult ()
 Change the presentation of the ADC conversion result to right adjusted.
 
static void startConversion ()
 

Static Public Attributes

static constexpr uint8_t Resolution = 12
 

Detailed Description

Analog/Digital-Converter module.

Not implemented yet:

  • Interrupts
  • FIFO
  • DMA

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.

static void modm::Adc::disableFreeRunningMode ( )
inheritedstatic

Disables free running mode

The ADC will do only one sample and stop. The result will be in the ADC register.

static void modm::Adc::enableFreeRunningMode ( )
inheritedstatic

Enables free running mode

The ADC will continously start conversions and provide the most recent result in the ADC register.

static bool modm::Adc::isConversionFinished ( )
inheritedstatic
Returns
true if all conversion have finished, false otherwise
static void modm::Adc::startConversion ( )
inheritedstatic

starts a conversion on the selected analog channel

Precondition
A channel must be selected with setChannel().

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