|
enum | Channel : uint8_t {
Channel0 = 0,
Channel1 = 1,
Channel2 = 2,
Channel3 = 3,
Channel4 = 4,
Channel5 = 5,
Channel6 = 6,
Channel7 = 7,
Channel8 = 8,
Channel9 = 9,
Channel10 = 10,
Channel11 = 11,
Channel12 = 12,
Channel13 = 13,
Channel14 = 14,
Channel15 = 15
} |
|
enum | SampleTime : uint8_t {
SampleTime::Cycles2 = 0b000,
SampleTime::Cycles8 = 0b001,
SampleTime::Cycles14 = 0b010,
SampleTime::Cycles29 = 0b011,
SampleTime::Cycles42 = 0b100,
SampleTime::Cycles56 = 0b101,
SampleTime::Cycles72 = 0b110,
SampleTime::Cycles240 = 0b111
} |
|
enum | RegularConversionExternalTrigger {
Event0 = 0x0u,
Event1 = 0x1u,
Event2 = 0x2u,
Event3 = 0x3u,
Event4 = 0x4u,
Event5 = 0x5u,
Event6 = 0x6u,
Event7 = 0x7u
} |
|
enum | Interrupt : uint32_t { Interrupt::AnalogWatchdog = ADC_CR1_AWDIE,
Interrupt::EndOfRegularConversion = ADC_CR1_EOCIE,
Interrupt::EndOfInjectedConversion = ADC_CR1_JEOCIE
} |
|
enum | InterruptFlag : uint32_t { InterruptFlag::AnalogWatchdog = ADC_SR_AWD,
InterruptFlag::EndOfRegularConversion = ADC_SR_EOC,
InterruptFlag::EndOfInjectedConversion = ADC_SR_JEOC,
InterruptFlag::All = ADC_SR_AWD | ADC_SR_EOC | ADC_SR_JEOC
} |
|
|
template<class... Signals> |
static void | connect () |
|
template<class SystemClock , frequency_t frequency = MHz(10), percent_t tolerance = pct(10)> |
static void | initialize () |
|
static void | enable () |
|
static void | disable () |
|
static void | startConversion () |
|
static bool | isConversionFinished () |
|
static uint16_t | getValue () |
|
static uint16_t | readChannel (Channel channel) |
|
static bool | setChannel (const Channel channel, const SampleTime sampleTime=static_cast< SampleTime >(0b000)) |
|
template<class Gpio > |
static bool | setPinChannel (SampleTime sampleTime=static_cast< SampleTime >(0b000)) |
| Setting the channel for a Pin.
|
|
template<class Gpio > |
static constexpr Channel | getPinChannel () |
| Get the channel for a Pin.
|
|
static Channel | getChannel () |
|
static void | enableFreeRunningMode () |
|
static void | disableFreeRunningMode () |
|
static void | setLeftAdjustResult () |
|
static void | setRightAdjustResult () |
|
static void | calibrate () |
|
static bool | addChannel (const Channel channel, const SampleTime sampleTime=static_cast< SampleTime >(0b000)) |
| Add a channel to conversion group.
|
|
static void | setSampleTime (const Channel channel, const SampleTime sampleTime=static_cast< SampleTime >(0b000)) |
| change sample time of ADC channel
|
|
static void | enableInterruptVector (const uint32_t priority, const bool enable=true) |
|
static void | enableInterrupt (const Interrupt_t interrupt) |
|
static void | disableInterrupt (const Interrupt_t interrupt) |
|
static InterruptFlag_t | getInterruptFlags () |
|
static void | acknowledgeInterruptFlags (const InterruptFlag_t flags) |
|
static uintptr_t | getDataRegisterAddress () |
|
static void | enableRegularConversionExternalTrigger (RegularConversionExternalTrigger regularConversionExternalTrigger) |
|
static void | enableDmaMode () |
|
static void | disableDmaMode () |
|
static bool | getAdcEnabled () |
|
static void | enableScanMode () |
|
static void | disableScanMode () |
|
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 bool | setChannel (Channel channel) |
|
static void | setParameter () |
| sets a parameter
|
|
Analog/Digital-Converter module (ADC2).
The 12-bit ADC is a successive approximation analog-to-digital converter. It has up to 18 multiplexed channels allowing it to measure signals from 16 external and two internal sources. The result of the ADC is stored in a left-aligned or right-aligned 16-bit data register.
- Author
- Stephan Kugelmann
-
David Hebbeker
-
ekiwi
template<class SystemClock , frequency_t frequency = MHz(10), percent_t tolerance = pct(10)>
static void modm::platform::Adc2::initialize |
( |
| ) |
|
|
static |
Initialize and enable the A/D converter.
Enables the ADC clock and switches on the ADC. The ADC clock prescaler will be set as well.
The ADC clock must not exceed 14 MHz.