|
enum | CalibrationMode : uint32_t { SingleEndedInputsMode = 0,
DifferntialInputsMode = ADC_CR_ADCALDIF,
DoNotCalibrate = 0xff
} |
|
enum | Channel : uint8_t {
Channel1 = 1,
Channel2 = 2,
Channel3 = 3,
Channel4 = 4,
Channel5 = 5,
Channel6 = 6,
Channel7 = 7,
Channel8 = 8,
Channel9 = 9,
Channel10 = 10,
Channel11 = 11,
Channel12 = 12,
Channel14 = 14,
Channel15 = 15,
Channel16 = 16,
Opamp3 = 13,
BatDiv3 = 17,
InternalReference = 18
} |
| Channels, which can be used with this ADC.
|
|
enum | ClockMode : uint32_t {
DoNotChange = 0xff,
Asynchronous = 0,
SynchronousPrescaler1 = ADC_CCR_CKMODE_0,
SynchronousPrescaler2 = ADC_CCR_CKMODE_1,
SynchronousPrescaler4 = ADC_CCR_CKMODE_1 | ADC_CCR_CKMODE_0
} |
|
enum | ClockSource : uint32_t { NoClock = 0,
Pll = RCC_CCIPR_ADC345SEL_0,
SystemClock = RCC_CCIPR_ADC345SEL_1
} |
|
enum | DmaMode : uint32_t { Disabled = 0,
OneShot = ADC_CFGR_DMAEN,
Circular = ADC_CFGR_DMACFG | ADC_CFGR_DMAEN,
Mask = Circular
} |
|
enum | Interrupt : uint32_t {
Ready = ADC_IER_ADRDYIE,
EndOfSampling = ADC_IER_EOSMPIE,
EndOfRegularConversion = ADC_IER_EOCIE,
EndOfRegularSequenceOfConversions = ADC_IER_EOSIE,
Overrun = ADC_IER_OVRIE,
EndOfInjectedConversion = ADC_IER_JEOCIE,
EndOfInjectedSequenceOfConversions = ADC_IER_JEOSIE,
AnalogWatchdog1 = ADC_IER_AWD1IE,
AnalogWatchdog2 = ADC_IER_AWD2IE,
AnalogWatchdog3 = ADC_IER_AWD3IE,
InjectedContextQueueOverflow = ADC_IER_JQOVFIE
} |
|
enum | InterruptFlag : uint32_t {
Ready = ADC_ISR_ADRDY,
EndOfSampling = ADC_ISR_EOSMP,
EndOfRegularConversion = ADC_ISR_EOC,
EndOfRegularSequenceOfConversions = ADC_ISR_EOS,
Overrun = ADC_ISR_OVR,
EndOfInjectedConversion = ADC_ISR_JEOC,
EndOfInjectedSequenceOfConversions = ADC_ISR_JEOS,
AnalogWatchdog1 = ADC_ISR_AWD1,
AnalogWatchdog2 = ADC_ISR_AWD2,
AnalogWatchdog3 = ADC_ISR_AWD3,
InjectedContextQueueOverflow = ADC_ISR_JQOVF,
All = ADC_ISR_ADRDY | ADC_ISR_EOSMP | ADC_ISR_EOC | ADC_ISR_EOS | ADC_ISR_OVR | ADC_ISR_JEOC | ADC_ISR_JEOS | ADC_ISR_AWD1 | ADC_ISR_AWD2 | ADC_ISR_AWD3 | ADC_ISR_JQOVF
} |
|
enum | Prescaler : uint32_t {
Disabled = 0,
Div1 = 0,
Div2 = ADC_CCR_PRESC_0,
Div4 = ADC_CCR_PRESC_1,
Div6 = ADC_CCR_PRESC_1 | ADC_CCR_PRESC_0,
Div8 = ADC_CCR_PRESC_2,
Div10 = ADC_CCR_PRESC_2 | ADC_CCR_PRESC_0,
Div12 = ADC_CCR_PRESC_2 | ADC_CCR_PRESC_1,
Div16 = ADC_CCR_PRESC_2 | ADC_CCR_PRESC_1 | ADC_CCR_PRESC_0,
Div32 = ADC_CCR_PRESC_3,
Div64 = ADC_CCR_PRESC_3 | ADC_CCR_PRESC_0,
Div128 = ADC_CCR_PRESC_3 | ADC_CCR_PRESC_1,
Div256 = ADC_CCR_PRESC_3 | ADC_CCR_PRESC_1 | ADC_CCR_PRESC_0,
Div256AllBits = ADC_CCR_PRESC_3 | ADC_CCR_PRESC_2 | ADC_CCR_PRESC_1 | ADC_CCR_PRESC_0
} |
|
enum | SampleTime : uint8_t {
Cycles2 = 0b000,
Cycles7 = 0b001,
Cycles13 = 0b010,
Cycles25 = 0b011,
Cycles48 = 0b100,
Cycles93 = 0b101,
Cycles248 = 0b110,
Cycles641 = 0b111
} |
|
enum | VoltageRegulatorState : uint32_t { Enabled = ADC_CR_ADVREGEN
} |
|
|
static void | attachInterruptHandler (Handler handler) |
|
static void | acknowledgeInterruptFlags (const InterruptFlag_t flags) |
|
static void | calibrate (const CalibrationMode mode, const bool blocking=true) |
|
template<class... Signals> |
static void | connect () |
|
static volatile uint32_t * | dataRegister () |
|
static void | disable (const bool blocking=true) |
|
static void | disableInterrupt (const Interrupt_t interrupt) |
|
static void | enableInterrupt (const Interrupt_t interrupt) |
|
static void | enableInterruptVector (const uint32_t priority, const bool enable=true) |
|
static auto | getInjectedConversionValue (uint8_t index) |
|
static InterruptFlag_t | getInterruptFlags () |
|
template<class Gpio > |
static constexpr Channel | getPinChannel () |
| Get the channel for a Pin.
|
|
static auto | getValue () |
|
static void | initialize (const ClockMode clk=ClockMode::DoNotChange, const ClockSource clk_src=ClockSource::SystemClock, const Prescaler pre=Prescaler::Disabled, const CalibrationMode cal=CalibrationMode::DoNotCalibrate, const bool blocking=true) |
|
static bool | isConversionFinished () |
|
static bool | isConversionSequenceFinished () |
|
static bool | isInjectedConversionFinished () |
|
static bool | isReady () |
|
static bool | setChannel (const Channel channel, const SampleTime sampleTime=static_cast< SampleTime >(0b000)) |
|
static bool | setChannelSequence (std::span< const SequenceChannel > sequence) |
|
static void | setDmaMode (DmaMode mode) |
|
static void | setFreeRunningMode (const bool enable) |
|
static bool | setInjectedConversionChannel (uint8_t index, Channel channel, SampleTime sampleTime) |
|
template<class Gpio > |
static bool | setInjectedConversionChannel (uint8_t index, SampleTime sampleTime) |
|
static bool | setInjectedConversionSequenceLength (uint8_t length) |
|
static void | setLeftAdjustResult (const bool enable) |
|
template<class Gpio > |
static bool | setPinChannel (SampleTime sampleTime=static_cast< SampleTime >(0b000)) |
| Setting the channel for a Pin.
|
|
static void | setPrescaler (const Prescaler pre) |
|
static void | startConversion () |
|
static void | startInjectedConversionSequence () |
|
static void | stopConversion () |
|
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
|
|
template<class... Signals> |
static void | connect () |
|
static void | disable () |
|
static void | disableFreeRunningMode () |
|
static void | enableFreeRunningMode () |
|
static uint8_t | getChannel () |
|
static bool | getInterruptFlag () |
| Read an interrupt flag.
|
|
static void | getParameter () |
| returns a parameter
|
|
static uint16_t | getValue () |
|
template<class SystemClock , frequency_t frequency = 200_kHz, percent_t tolerance = 10_pct> |
static void | initialize () |
|
static bool | isConversionFinished () |
|
static uint16_t | readChannel (Channel channel) |
|
static bool | setChannel (Channel channel) |
|
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 () |
|
ADC Interrupt module
This class allows you to attach functions to the ADC Conversion Complete Interrupt via function pointers. Be aware however, that this implementation is slower and requires more resources than writing the function code directly into the interrupt service routines.
- See also
- AnalogSensors uses this implemenation.
- Author
- Niklas Hauser