#include <modm/platform/adc/adc_interrupt.hpp>
|
enum | InterruptFlag : uint8_t { All = (1<<ADIF)
} |
|
enum | Reference : uint8_t { InternalRef = 0,
InternalVddNoCapacitor = 0x40,
Internal1V5NoCapacitor = 0x80,
Internal1V6NoCapacitor = 0xc0
} |
|
|
| MODM_FLAGS8 (InterruptFlag) |
|
|
static void | attachInterruptHandler (Handler handler) |
|
static void | acknowledgeInterruptFlag () |
| Clears the interrupt flag.
|
|
static void | acknowledgeInterruptFlags (const InterruptFlag_t flags) |
| Clears the interrupt flag if flags is set to InterruptFlag::All
|
|
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
|
|
template<class... Signals> |
static void | connect () |
|
static void | diableFreeRunningMode () |
|
static void | disable () |
|
static void | disableAutoTrigger () |
| Disable auto triggering of the ADC.
|
|
static void | disableFreeRunningMode () |
|
static void | disableInterrupt () |
| Disables the ADC Conversion Complete Interrupt.
|
|
static void | enableAutoTrigger () |
|
static void | enableFreeRunningMode () |
|
static void | enableInterrupt () |
| Enables the ADC Conversion Complete Interrupt.
|
|
static uint8_t | getChannel () |
|
static bool | getInterruptFlag () |
|
static InterruptFlag_t | getInterruptFlags () |
|
static void | getParameter () |
| returns a parameter
|
|
static uint16_t | getValue () |
|
template<class SystemClock , frequency_t frequency = kHz(100), percent_t tolerance = pct(10)> |
static void | initialize () |
|
static bool | isAvddOk () |
|
static bool | isConversionFinished () |
|
static bool | isReferenceVoltageOk () |
|
static uint16_t | readChannel (Channel channel) |
|
static void | setAnalogChannelChange () |
|
static void | setAutoTriggerSource (uint8_t source) |
|
static bool | setChannel (Channel channel) |
|
static void | setLeftAdjustResult () |
|
static void | setParameter () |
| sets a parameter
|
|
static void | setReference (Reference reference) |
|
static void | setRightAdjustResult () |
|
static void | startConversion () |
|
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 | getParameter () |
| returns a parameter
|
|
static void | setParameter () |
| sets a parameter
|
|
|
static Handler | handler |
|
static constexpr uint8_t | Resolution = 10 |
|
|
typedef void (* | Handler) () |
|
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<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::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::platform::Adc::enableAutoTrigger |
( |
| ) |
|
|
inheritedinlinestatic |
Enable auto triggering of the ADC
The ADC will start a conversion on a positive edge of the selected trigger signal.
- See also
- setAutoTriggerSource
static bool modm::platform::Adc::getInterruptFlag |
( |
| ) |
|
|
inheritedinlinestatic |
- Returns
true
if the flag is set, false
otherwise
static InterruptFlag_t modm::platform::Adc::getInterruptFlags |
( |
| ) |
|
|
inheritedinlinestatic |
- Returns
InterruptFlag::All
if the flag is set, 0
otherwise
static bool modm::platform::Adc::isAvddOk |
( |
| ) |
|
|
inheritedinlinestatic |
The analog functions of the ADC are powered from the AVDD domain. AVDD is supplied from an internal voltage regulator. Enabling the ADC will power-up the AVDD domain if not already requested by another functional group of the device. This method allows the user to monitor (poll) the status of the AVDD domain.
- Returns
true
indicates that AVDD has been powered-up.
static bool modm::platform::Adc::isReferenceVoltageOk |
( |
| ) |
|
|
inheritedinlinestatic |
The status of the internal generated reference voltage can be monitored through this bit. After enabling the ADC and setting the reference voltage, it will be available after a start-up delay.
- Returns
true
which indicates that the internal generated reference voltage is approaching final levels.
static uint16_t modm::platform::Adc::readChannel |
( |
Channel |
channel | ) |
|
|
inheritedinlinestatic |
Read the value an analog channel
A normal conversion takes 13 ADC clock cycles. With a clock frequency of for example 200 kHz a conversion therefore needs 65 microseconds. This time increases with a lower frequency.
static void modm::platform::Adc::setAnalogChannelChange |
( |
| ) |
|
|
inheritedinlinestatic |
The user can force a reset of the analog blocks by setting this without requesting a different channel. The analog blocks of the ADC will be reset to handle possible new voltage ranges. Such a reset phase is especially important for the gain amplifier. It could be temporarily disabled by a large step of its input common voltage leading to erroneous A/D conversion results.
static void modm::platform::Adc::setAutoTriggerSource |
( |
uint8_t |
source | ) |
|
|
inheritedinlinestatic |
Selects which source will trigger an ADC conversion
A conversion will be triggered by the rising edge of the selected Interrupt Flag. Note that switching from a trigger source that is cleared to a trigger source that is set, will generate a positive edge on the trigger signal. Set to 0 to enable Free Running Mode.
static void modm::platform::Adc::setReference |
( |
Reference |
reference | ) |
|
|
inheritedinlinestatic |
voltage reference for the ADC
The internal voltage reference options may not be used if an external reference voltage is being applied to the AREF pin.
The documentation for this class was generated from the following files:
- platform/adc/adc_interrupt.hpp
- adc_interrupt.cpp