ADC - Analog to Digital Converter#
Analog to Digital Converter (ADC) Peripheral API.
This module contains functions to control the ADC peripheral of Silicon Labs 32-bit MCUs and SoCs. The ADC is used to convert analog signals into a digital representation.
Modules#
Enumerations#
Acquisition time (in ADC clock cycles).
Oversample rate select.
Peripheral Reflex System signal used to trigger a single sample.
ADC Reference.
Sample resolution.
Positive input selection for single and scan conversion.
Negative input selection for single and scan conversion.
ADC scan input groups.
ADC scan alternative negative inputs.
ADC start command.
Warm-up mode.
ADC EM2 clock configuration.
Functions#
Initialize ADC.
Clear ADC scan input configuration.
Initialize ADC scan single-ended input configuration.
Initialize the ADC scan differential input configuration.
Initialize the ADC scan sequence.
Initialize the single ADC sample conversion.
Get a scan result and scan select ID.
Calculate the prescaler value used to determine the ADC clock.
Reset ADC to a state that it was in after a hardware reset.
Calculate a timebase value to get a timebase providing at least 1 us.
Get a single conversion result.
Peek single conversion result.
Get a scan result.
Peek scan result.
Clear one or more pending ADC interrupts.
Disable one or more ADC interrupts.
Enable one or more ADC interrupts.
Get pending ADC interrupt flags.
Get enabled and pending ADC interrupt flags.
Set one or more pending ADC interrupts from software.
Start scan sequence and/or single conversion.
Macros#
Single and scan mode voltage references.
Define none selected group for ADC_SCANINPUTSEL.
Define none selected for ADC_SCANINPUTSEL.
Default configuration for ADC initialization structure.
Default configuration for ADC scan initialization structure.
Default configuration for ADC single conversion initialization structure.
Enumeration Documentation#
ADC_AcqTime_TypeDef#
ADC_AcqTime_TypeDef
Acquisition time (in ADC clock cycles).
Enumerator | |
---|---|
adcAcqTime1 | 1 clock cycle. |
adcAcqTime2 | 2 clock cycles. |
adcAcqTime4 | 4 clock cycles. |
adcAcqTime8 | 8 clock cycles. |
adcAcqTime16 | 16 clock cycles. |
adcAcqTime32 | 32 clock cycles. |
adcAcqTime64 | 64 clock cycles. |
adcAcqTime128 | 128 clock cycles. |
adcAcqTime256 | 256 clock cycles. |
53
of file platform/emlib/inc/em_adc.h
ADC_OvsRateSel_TypeDef#
ADC_OvsRateSel_TypeDef
Oversample rate select.
Enumerator | |
---|---|
adcOvsRateSel2 | 2 samples per conversion result. |
adcOvsRateSel4 | 4 samples per conversion result. |
adcOvsRateSel8 | 8 samples per conversion result. |
adcOvsRateSel16 | 16 samples per conversion result. |
adcOvsRateSel32 | 32 samples per conversion result. |
adcOvsRateSel64 | 64 samples per conversion result. |
adcOvsRateSel128 | 128 samples per conversion result. |
adcOvsRateSel256 | 256 samples per conversion result. |
adcOvsRateSel512 | 512 samples per conversion result. |
adcOvsRateSel1024 | 1024 samples per conversion result. |
adcOvsRateSel2048 | 2048 samples per conversion result. |
adcOvsRateSel4096 | 4096 samples per conversion result. |
80
of file platform/emlib/inc/em_adc.h
ADC_PRSSEL_TypeDef#
ADC_PRSSEL_TypeDef
Peripheral Reflex System signal used to trigger a single sample.
Enumerator | |
---|---|
adcPRSSELCh0 | PRS channel 0. |
adcPRSSELCh1 | PRS channel 1. |
adcPRSSELCh2 | PRS channel 2. |
adcPRSSELCh3 | PRS channel 3. |
adcPRSSELCh4 | PRS channel 4. |
adcPRSSELCh5 | PRS channel 5. |
adcPRSSELCh6 | PRS channel 6. |
adcPRSSELCh7 | PRS channel 7. |
adcPRSSELCh8 | PRS channel 8. |
adcPRSSELCh9 | PRS channel 9. |
adcPRSSELCh10 | PRS channel 10. |
adcPRSSELCh11 | PRS channel 11. |
119
of file platform/emlib/inc/em_adc.h
ADC_Ref_TypeDef#
ADC_Ref_TypeDef
ADC Reference.
Enumerator | |
---|---|
adcRef1V25 | Internal 1.25 V reference. |
adcRef2V5 | Internal 2.5 V reference. |
adcRefVDD | Buffered VDD. |
adcRef5V | Internal 5 V reference. |
adcRefExtSingle | Single-ended external reference from pin 6. |
adcRef2xExtDiff | Differential external reference from pin 6 and 7. |
adcRef2xVDD | Unbuffered 2xVDD. |
adcRefVBGR | Custom VFS: Internal Bandgap reference. |
adcRefVddxAtt | Custom VFS: Scaled AVDD: AVDD * VREFATT. |
adcRefVPxAtt | Custom VFS: Scaled singled ended external reference from pin 6: VREFP * VREFATT. |
adcRefP | Custom VFS: Raw single-ended external reference from pin 6. |
adcRefVEntropy | Custom VFS: Special mode for entropy generation. |
adcRefVPNxAtt | Custom VFS: Scaled differential external Vref from pin 6 and 7: (VREFP - VREFN) * VREFATT. |
adcRefPN | Custom VFS: Raw differential external Vref from pin 6 and 7: VREFP - VREFN. |
185
of file platform/emlib/inc/em_adc.h
ADC_Res_TypeDef#
ADC_Res_TypeDef
Sample resolution.
Enumerator | |
---|---|
adcRes12Bit | 12 bit sampling. |
adcRes8Bit | 8 bit sampling. |
adcRes6Bit | 6 bit sampling. |
adcResOVS | Oversampling. |
261
of file platform/emlib/inc/em_adc.h
ADC_PosSel_TypeDef#
ADC_PosSel_TypeDef
Positive input selection for single and scan conversion.
Enumerator | |
---|---|
adcPosSelAPORT0XCH0 | |
adcPosSelAPORT0XCH1 | |
adcPosSelAPORT0XCH2 | |
adcPosSelAPORT0XCH3 | |
adcPosSelAPORT0XCH4 | |
adcPosSelAPORT0XCH5 | |
adcPosSelAPORT0XCH6 | |
adcPosSelAPORT0XCH7 | |
adcPosSelAPORT0XCH8 | |
adcPosSelAPORT0XCH9 | |
adcPosSelAPORT0XCH10 | |
adcPosSelAPORT0XCH11 | |
adcPosSelAPORT0XCH12 | |
adcPosSelAPORT0XCH13 | |
adcPosSelAPORT0XCH14 | |
adcPosSelAPORT0XCH15 | |
adcPosSelAPORT0YCH0 | |
adcPosSelAPORT0YCH1 | |
adcPosSelAPORT0YCH2 | |
adcPosSelAPORT0YCH3 | |
adcPosSelAPORT0YCH4 | |
adcPosSelAPORT0YCH5 | |
adcPosSelAPORT0YCH6 | |
adcPosSelAPORT0YCH7 | |
adcPosSelAPORT0YCH8 | |
adcPosSelAPORT0YCH9 | |
adcPosSelAPORT0YCH10 | |
adcPosSelAPORT0YCH11 | |
adcPosSelAPORT0YCH12 | |
adcPosSelAPORT0YCH13 | |
adcPosSelAPORT0YCH14 | |
adcPosSelAPORT0YCH15 | |
adcPosSelAPORT1XCH0 | |
adcPosSelAPORT1YCH1 | |
adcPosSelAPORT1XCH2 | |
adcPosSelAPORT1YCH3 | |
adcPosSelAPORT1XCH4 | |
adcPosSelAPORT1YCH5 | |
adcPosSelAPORT1XCH6 | |
adcPosSelAPORT1YCH7 | |
adcPosSelAPORT1XCH8 | |
adcPosSelAPORT1YCH9 | |
adcPosSelAPORT1XCH10 | |
adcPosSelAPORT1YCH11 | |
adcPosSelAPORT1XCH12 | |
adcPosSelAPORT1YCH13 | |
adcPosSelAPORT1XCH14 | |
adcPosSelAPORT1YCH15 | |
adcPosSelAPORT1XCH16 | |
adcPosSelAPORT1YCH17 | |
adcPosSelAPORT1XCH18 | |
adcPosSelAPORT1YCH19 | |
adcPosSelAPORT1XCH20 | |
adcPosSelAPORT1YCH21 | |
adcPosSelAPORT1XCH22 | |
adcPosSelAPORT1YCH23 | |
adcPosSelAPORT1XCH24 | |
adcPosSelAPORT1YCH25 | |
adcPosSelAPORT1XCH26 | |
adcPosSelAPORT1YCH27 | |
adcPosSelAPORT1XCH28 | |
adcPosSelAPORT1YCH29 | |
adcPosSelAPORT1XCH30 | |
adcPosSelAPORT1YCH31 | |
adcPosSelAPORT2YCH0 | |
adcPosSelAPORT2XCH1 | |
adcPosSelAPORT2YCH2 | |
adcPosSelAPORT2XCH3 | |
adcPosSelAPORT2YCH4 | |
adcPosSelAPORT2XCH5 | |
adcPosSelAPORT2YCH6 | |
adcPosSelAPORT2XCH7 | |
adcPosSelAPORT2YCH8 | |
adcPosSelAPORT2XCH9 | |
adcPosSelAPORT2YCH10 | |
adcPosSelAPORT2XCH11 | |
adcPosSelAPORT2YCH12 | |
adcPosSelAPORT2XCH13 | |
adcPosSelAPORT2YCH14 | |
adcPosSelAPORT2XCH15 | |
adcPosSelAPORT2YCH16 | |
adcPosSelAPORT2XCH17 | |
adcPosSelAPORT2YCH18 | |
adcPosSelAPORT2XCH19 | |
adcPosSelAPORT2YCH20 | |
adcPosSelAPORT2XCH21 | |
adcPosSelAPORT2YCH22 | |
adcPosSelAPORT2XCH23 | |
adcPosSelAPORT2YCH24 | |
adcPosSelAPORT2XCH25 | |
adcPosSelAPORT2YCH26 | |
adcPosSelAPORT2XCH27 | |
adcPosSelAPORT2YCH28 | |
adcPosSelAPORT2XCH29 | |
adcPosSelAPORT2YCH30 | |
adcPosSelAPORT2XCH31 | |
adcPosSelAPORT3XCH0 | |
adcPosSelAPORT3YCH1 | |
adcPosSelAPORT3XCH2 | |
adcPosSelAPORT3YCH3 | |
adcPosSelAPORT3XCH4 | |
adcPosSelAPORT3YCH5 | |
adcPosSelAPORT3XCH6 | |
adcPosSelAPORT3YCH7 | |
adcPosSelAPORT3XCH8 | |
adcPosSelAPORT3YCH9 | |
adcPosSelAPORT3XCH10 | |
adcPosSelAPORT3YCH11 | |
adcPosSelAPORT3XCH12 | |
adcPosSelAPORT3YCH13 | |
adcPosSelAPORT3XCH14 | |
adcPosSelAPORT3YCH15 | |
adcPosSelAPORT3XCH16 | |
adcPosSelAPORT3YCH17 | |
adcPosSelAPORT3XCH18 | |
adcPosSelAPORT3YCH19 | |
adcPosSelAPORT3XCH20 | |
adcPosSelAPORT3YCH21 | |
adcPosSelAPORT3XCH22 | |
adcPosSelAPORT3YCH23 | |
adcPosSelAPORT3XCH24 | |
adcPosSelAPORT3YCH25 | |
adcPosSelAPORT3XCH26 | |
adcPosSelAPORT3YCH27 | |
adcPosSelAPORT3XCH28 | |
adcPosSelAPORT3YCH29 | |
adcPosSelAPORT3XCH30 | |
adcPosSelAPORT3YCH31 | |
adcPosSelAPORT4YCH0 | |
adcPosSelAPORT4XCH1 | |
adcPosSelAPORT4YCH2 | |
adcPosSelAPORT4XCH3 | |
adcPosSelAPORT4YCH4 | |
adcPosSelAPORT4XCH5 | |
adcPosSelAPORT4YCH6 | |
adcPosSelAPORT4XCH7 | |
adcPosSelAPORT4YCH8 | |
adcPosSelAPORT4XCH9 | |
adcPosSelAPORT4YCH10 | |
adcPosSelAPORT4XCH11 | |
adcPosSelAPORT4YCH12 | |
adcPosSelAPORT4XCH13 | |
adcPosSelAPORT4YCH14 | |
adcPosSelAPORT4XCH15 | |
adcPosSelAPORT4YCH16 | |
adcPosSelAPORT4XCH17 | |
adcPosSelAPORT4YCH18 | |
adcPosSelAPORT4XCH19 | |
adcPosSelAPORT4YCH20 | |
adcPosSelAPORT4XCH21 | |
adcPosSelAPORT4YCH22 | |
adcPosSelAPORT4XCH23 | |
adcPosSelAPORT4YCH24 | |
adcPosSelAPORT4XCH25 | |
adcPosSelAPORT4YCH26 | |
adcPosSelAPORT4XCH27 | |
adcPosSelAPORT4YCH28 | |
adcPosSelAPORT4XCH29 | |
adcPosSelAPORT4YCH30 | |
adcPosSelAPORT4XCH31 | |
adcPosSelAVDD | |
adcPosSelBUVDD | |
adcPosSelDVDD | |
adcPosSelPAVDD | |
adcPosSelDECOUPLE | |
adcPosSelIOVDD | |
adcPosSelIOVDD1 | |
adcPosSelVSP | |
adcPosSelOPA2 | |
adcPosSelTEMP | |
adcPosSelDAC0OUT0 | |
adcPosSelR5VOUT | |
adcPosSelSP1 | |
adcPosSelSP2 | |
adcPosSelDAC0OUT1 | |
adcPosSelSUBLSB | |
adcPosSelOPA3 | |
adcPosSelDEFAULT | |
adcPosSelVSS |
325
of file platform/emlib/inc/em_adc.h
ADC_NegSel_TypeDef#
ADC_NegSel_TypeDef
Negative input selection for single and scan conversion.
Enumerator | |
---|---|
adcNegSelAPORT0XCH0 | |
adcNegSelAPORT0XCH1 | |
adcNegSelAPORT0XCH2 | |
adcNegSelAPORT0XCH3 | |
adcNegSelAPORT0XCH4 | |
adcNegSelAPORT0XCH5 | |
adcNegSelAPORT0XCH6 | |
adcNegSelAPORT0XCH7 | |
adcNegSelAPORT0XCH8 | |
adcNegSelAPORT0XCH9 | |
adcNegSelAPORT0XCH10 | |
adcNegSelAPORT0XCH11 | |
adcNegSelAPORT0XCH12 | |
adcNegSelAPORT0XCH13 | |
adcNegSelAPORT0XCH14 | |
adcNegSelAPORT0XCH15 | |
adcNegSelAPORT0YCH0 | |
adcNegSelAPORT0YCH1 | |
adcNegSelAPORT0YCH2 | |
adcNegSelAPORT0YCH3 | |
adcNegSelAPORT0YCH4 | |
adcNegSelAPORT0YCH5 | |
adcNegSelAPORT0YCH6 | |
adcNegSelAPORT0YCH7 | |
adcNegSelAPORT0YCH8 | |
adcNegSelAPORT0YCH9 | |
adcNegSelAPORT0YCH10 | |
adcNegSelAPORT0YCH11 | |
adcNegSelAPORT0YCH12 | |
adcNegSelAPORT0YCH13 | |
adcNegSelAPORT0YCH14 | |
adcNegSelAPORT0YCH15 | |
adcNegSelAPORT1XCH0 | |
adcNegSelAPORT1YCH1 | |
adcNegSelAPORT1XCH2 | |
adcNegSelAPORT1YCH3 | |
adcNegSelAPORT1XCH4 | |
adcNegSelAPORT1YCH5 | |
adcNegSelAPORT1XCH6 | |
adcNegSelAPORT1YCH7 | |
adcNegSelAPORT1XCH8 | |
adcNegSelAPORT1YCH9 | |
adcNegSelAPORT1XCH10 | |
adcNegSelAPORT1YCH11 | |
adcNegSelAPORT1XCH12 | |
adcNegSelAPORT1YCH13 | |
adcNegSelAPORT1XCH14 | |
adcNegSelAPORT1YCH15 | |
adcNegSelAPORT1XCH16 | |
adcNegSelAPORT1YCH17 | |
adcNegSelAPORT1XCH18 | |
adcNegSelAPORT1YCH19 | |
adcNegSelAPORT1XCH20 | |
adcNegSelAPORT1YCH21 | |
adcNegSelAPORT1XCH22 | |
adcNegSelAPORT1YCH23 | |
adcNegSelAPORT1XCH24 | |
adcNegSelAPORT1YCH25 | |
adcNegSelAPORT1XCH26 | |
adcNegSelAPORT1YCH27 | |
adcNegSelAPORT1XCH28 | |
adcNegSelAPORT1YCH29 | |
adcNegSelAPORT1XCH30 | |
adcNegSelAPORT1YCH31 | |
adcNegSelAPORT2YCH0 | |
adcNegSelAPORT2XCH1 | |
adcNegSelAPORT2YCH2 | |
adcNegSelAPORT2XCH3 | |
adcNegSelAPORT2YCH4 | |
adcNegSelAPORT2XCH5 | |
adcNegSelAPORT2YCH6 | |
adcNegSelAPORT2XCH7 | |
adcNegSelAPORT2YCH8 | |
adcNegSelAPORT2XCH9 | |
adcNegSelAPORT2YCH10 | |
adcNegSelAPORT2XCH11 | |
adcNegSelAPORT2YCH12 | |
adcNegSelAPORT2XCH13 | |
adcNegSelAPORT2YCH14 | |
adcNegSelAPORT2XCH15 | |
adcNegSelAPORT2YCH16 | |
adcNegSelAPORT2XCH17 | |
adcNegSelAPORT2YCH18 | |
adcNegSelAPORT2XCH19 | |
adcNegSelAPORT2YCH20 | |
adcNegSelAPORT2XCH21 | |
adcNegSelAPORT2YCH22 | |
adcNegSelAPORT2XCH23 | |
adcNegSelAPORT2YCH24 | |
adcNegSelAPORT2XCH25 | |
adcNegSelAPORT2YCH26 | |
adcNegSelAPORT2XCH27 | |
adcNegSelAPORT2YCH28 | |
adcNegSelAPORT2XCH29 | |
adcNegSelAPORT2YCH30 | |
adcNegSelAPORT2XCH31 | |
adcNegSelAPORT3XCH0 | |
adcNegSelAPORT3YCH1 | |
adcNegSelAPORT3XCH2 | |
adcNegSelAPORT3YCH3 | |
adcNegSelAPORT3XCH4 | |
adcNegSelAPORT3YCH5 | |
adcNegSelAPORT3XCH6 | |
adcNegSelAPORT3YCH7 | |
adcNegSelAPORT3XCH8 | |
adcNegSelAPORT3YCH9 | |
adcNegSelAPORT3XCH10 | |
adcNegSelAPORT3YCH11 | |
adcNegSelAPORT3XCH12 | |
adcNegSelAPORT3YCH13 | |
adcNegSelAPORT3XCH14 | |
adcNegSelAPORT3YCH15 | |
adcNegSelAPORT3XCH16 | |
adcNegSelAPORT3YCH17 | |
adcNegSelAPORT3XCH18 | |
adcNegSelAPORT3YCH19 | |
adcNegSelAPORT3XCH20 | |
adcNegSelAPORT3YCH21 | |
adcNegSelAPORT3XCH22 | |
adcNegSelAPORT3YCH23 | |
adcNegSelAPORT3XCH24 | |
adcNegSelAPORT3YCH25 | |
adcNegSelAPORT3XCH26 | |
adcNegSelAPORT3YCH27 | |
adcNegSelAPORT3XCH28 | |
adcNegSelAPORT3YCH29 | |
adcNegSelAPORT3XCH30 | |
adcNegSelAPORT3YCH31 | |
adcNegSelAPORT4YCH0 | |
adcNegSelAPORT4XCH1 | |
adcNegSelAPORT4YCH2 | |
adcNegSelAPORT4XCH3 | |
adcNegSelAPORT4YCH4 | |
adcNegSelAPORT4XCH5 | |
adcNegSelAPORT4YCH6 | |
adcNegSelAPORT4XCH7 | |
adcNegSelAPORT4YCH8 | |
adcNegSelAPORT4XCH9 | |
adcNegSelAPORT4YCH10 | |
adcNegSelAPORT4XCH11 | |
adcNegSelAPORT4YCH12 | |
adcNegSelAPORT4XCH13 | |
adcNegSelAPORT4YCH14 | |
adcNegSelAPORT4XCH15 | |
adcNegSelAPORT4YCH16 | |
adcNegSelAPORT4XCH17 | |
adcNegSelAPORT4YCH18 | |
adcNegSelAPORT4XCH19 | |
adcNegSelAPORT4YCH20 | |
adcNegSelAPORT4XCH21 | |
adcNegSelAPORT4YCH22 | |
adcNegSelAPORT4XCH23 | |
adcNegSelAPORT4YCH24 | |
adcNegSelAPORT4XCH25 | |
adcNegSelAPORT4YCH26 | |
adcNegSelAPORT4XCH27 | |
adcNegSelAPORT4YCH28 | |
adcNegSelAPORT4XCH29 | |
adcNegSelAPORT4YCH30 | |
adcNegSelAPORT4XCH31 | |
adcNegSelTESTN | |
adcNegSelDEFAULT | |
adcNegSelVSS |
518
of file platform/emlib/inc/em_adc.h
ADC_ScanInputGroup_TypeDef#
ADC_ScanInputGroup_TypeDef
ADC scan input groups.
Enumerator | |
---|---|
adcScanInputGroup0 | |
adcScanInputGroup1 | |
adcScanInputGroup2 | |
adcScanInputGroup3 |
687
of file platform/emlib/inc/em_adc.h
ADC_ScanNegInput_TypeDef#
ADC_ScanNegInput_TypeDef
ADC scan alternative negative inputs.
Enumerator | |
---|---|
adcScanNegInput1 | |
adcScanNegInput3 | |
adcScanNegInput5 | |
adcScanNegInput7 | |
adcScanNegInput8 | |
adcScanNegInput10 | |
adcScanNegInput12 | |
adcScanNegInput14 | |
adcScanNegInputDefault |
707
of file platform/emlib/inc/em_adc.h
ADC_Start_TypeDef#
ADC_Start_TypeDef
ADC start command.
Enumerator | |
---|---|
adcStartSingle | Start a single conversion. |
adcStartScan | Start a scan sequence. |
adcStartScanAndSingle | Start a scan sequence and single conversion, typically used when tailgating a single conversion after a scan sequence. |
721
of file platform/emlib/inc/em_adc.h
ADC_Warmup_TypeDef#
ADC_Warmup_TypeDef
Warm-up mode.
Enumerator | |
---|---|
adcWarmupNormal | ADC shutdown after each conversion. |
adcWarmupKeepInStandby | ADC is kept in standby mode between conversions. |
adcWarmupKeepInSlowAcq | ADC is kept in slow acquisition mode between conversions. |
adcWarmupKeepADCWarm | ADC and reference selected for scan mode kept at warmup allowing continuous conversion. |
736
of file platform/emlib/inc/em_adc.h
ADC_EM2ClockConfig_TypeDef#
ADC_EM2ClockConfig_TypeDef
ADC EM2 clock configuration.
Enumerator | |
---|---|
adcEm2Disabled | |
adcEm2ClockOnDemand | |
adcEm2ClockAlwaysOn |
769
of file platform/emlib/inc/em_adc.h
Function Documentation#
ADC_Init#
void ADC_Init (ADC_TypeDef * adc, const ADC_Init_TypeDef * init)
Initialize ADC.
[in] | adc | A pointer to the ADC peripheral register block. |
[in] | init | A pointer to the ADC initialization structure. |
Initializes common parts for both single conversion and scan sequence. In addition, single and/or scan control configuration must be done. See ADC_InitSingle() and ADC_InitScan() respectively. For ADC architectures with the ADCn->SCANINPUTSEL register, use ADC_ScanSingleEndedInputAdd() to configure single-ended scan inputs or ADC_ScanDifferentialInputAdd() to configure differential scan inputs. ADC_ScanInputClear() is also provided for applications that need to update the input configuration.
Note
This function will stop any ongoing conversion.
373
of file platform/emlib/src/em_adc.c
ADC_ScanInputClear#
void ADC_ScanInputClear (ADC_InitScan_TypeDef * scanInit)
Clear ADC scan input configuration.
[in] | scanInit | Structure to hold the scan configuration and input configuration. |
471
of file platform/emlib/src/em_adc.c
ADC_ScanSingleEndedInputAdd#
uint32_t ADC_ScanSingleEndedInputAdd (ADC_InitScan_TypeDef * scanInit, ADC_ScanInputGroup_TypeDef inputGroup, ADC_PosSel_TypeDef singleEndedSel)
Initialize ADC scan single-ended input configuration.
[in] | scanInit | ADC scan initialization structure |
[in] | inputGroup | ADC scan input group. See section 25.3.4 in the reference manual for more information. |
[in] | singleEndedSel | APORT select. |
Set a configuration for ADC scan conversion with single-ended inputs. The ADC_InitScan_TypeDef structure updated from this function will be passed to ADC_InitScan().
Returns
Scan ID of selected ADC input. See section 25.3.4 in the reference manual for more information. Note that the returned integer represents the bit position in ADCn_SCANMASK set by this function. The accumulated mask is stored in scanInit->scanInputConfig->scanInputEn.
508
of file platform/emlib/src/em_adc.c
ADC_ScanDifferentialInputAdd#
uint32_t ADC_ScanDifferentialInputAdd (ADC_InitScan_TypeDef * scanInit, ADC_ScanInputGroup_TypeDef inputGroup, ADC_PosSel_TypeDef posSel, ADC_ScanNegInput_TypeDef negInput)
Initialize the ADC scan differential input configuration.
[in] | scanInit | Structure to hold the scan and input configuration. |
[in] | inputGroup | ADC scan input group. See section 25.3.4 in the reference manual for more information. |
[in] | posSel | APORT bus pair select. The negative terminal is implicitly selected by the positive terminal. |
[in] | negInput | ADC scan alternative negative input. Set to adcScanNegInputDefault to select a default negative input (implicit from posSel). |
Set a configuration for the ADC scan conversion with differential inputs. The ADC_InitScan_TypeDef structure updated by this function should be passed to ADC_InitScan().
Returns
Scan ID of the selected ADC input. See section 25.3.4 in the reference manual for more information. Note that the returned integer represents the bit position in ADCn_SCANMASK set by this function. The accumulated mask is stored in the scanInit->scanInputConfig->scanInputEn.
581
of file platform/emlib/src/em_adc.c
ADC_InitScan#
void ADC_InitScan (ADC_TypeDef * adc, const ADC_InitScan_TypeDef * init)
Initialize the ADC scan sequence.
[in] | adc | A pointer to the ADC peripheral register block. |
[in] | init | A pointer to the ADC initialization structure. |
See ADC_Start() for starting a scan sequence.
When selecting an external reference, the gain and offset calibration must be set explicitly (CAL register). For other references, the calibration is updated with values defined during manufacturing. For ADC architectures with the ADCn->SCANINPUTSEL register, use ADC_ScanSingleEndedInputAdd() to configure single-ended scan inputs or ADC_ScanDifferentialInputAdd() to configure differential scan inputs. ADC_ScanInputClear() is also provided for applications that need to update the input configuration.
Note
This function will stop any ongoing scan sequence.
719
of file platform/emlib/src/em_adc.c
ADC_InitSingle#
void ADC_InitSingle (ADC_TypeDef * adc, const ADC_InitSingle_TypeDef * init)
Initialize the single ADC sample conversion.
[in] | adc | A pointer to the ADC peripheral register block. |
[in] | init | A pointer to the ADC initialization structure. |
See ADC_Start() for starting a single conversion.
When selecting an external reference, the gain and offset calibration must be set explicitly (CAL register). For other references, the calibration is updated with values defined during manufacturing.
Note
This function will stop any ongoing single conversion.
This function will set the BIASPROG_GPBIASACC bit when selecting the internal temperature sensor and clear the bit otherwise. Any application that depends on the state of the BIASPROG_GPBIASACC bit should modify it after a call to this function.
856
of file platform/emlib/src/em_adc.c
ADC_DataIdScanGet#
uint32_t ADC_DataIdScanGet (ADC_TypeDef * adc, uint32_t * scanId)
Get a scan result and scan select ID.
[in] | adc | A pointer to the ADC peripheral register block. |
[out] | scanId | A scan select ID of the first data in the scan FIFO. |
Note
Only use if scan data valid. This function does not check the DV flag. The return value is meant to be used as an index for the scan select ID.
Returns
The first scan data in the scan FIFO.
987
of file platform/emlib/src/em_adc.c
ADC_PrescaleCalc#
uint8_t ADC_PrescaleCalc (uint32_t adcFreq, uint32_t hfperFreq)
Calculate the prescaler value used to determine the ADC clock.
[in] | adcFreq | ADC frequency wanted. The frequency will automatically be adjusted to a valid range according to the reference manual. |
[in] | hfperFreq | Frequency in Hz of reference HFPER/HFPERC clock. Set to 0 to use currently defined HFPER/HFPERC clock setting. |
The ADC clock is given by: (HFPERCLK or HFPERCCLK) / (prescale + 1).
Note
The return value is clamped to the maximum prescaler value that the hardware supports.
Returns
A prescaler value to use for ADC in order to achieve a clock value <=
adcFreq
.
1018
of file platform/emlib/src/em_adc.c
ADC_Reset#
void ADC_Reset (ADC_TypeDef * adc)
Reset ADC to a state that it was in after a hardware reset.
[in] | adc | A pointer to ADC peripheral register block. |
Note
The ROUTE register is NOT reset by this function to allow a centralized setup of this feature.
1063
of file platform/emlib/src/em_adc.c
ADC_TimebaseCalc#
uint8_t ADC_TimebaseCalc (uint32_t hfperFreq)
Calculate a timebase value to get a timebase providing at least 1 us.
[in] | hfperFreq | Frequency in Hz of the reference HFPER/HFPERC clock. Set to 0 to use currently defined HFPER/HFPERC clock setting. |
Returns
A timebase value to use for ADC to achieve at least 1 us.
1114
of file platform/emlib/src/em_adc.c
ADC_DataSingleGet#
uint32_t ADC_DataSingleGet (ADC_TypeDef * adc)
Get a single conversion result.
[in] | adc | A pointer to the ADC peripheral register block. |
Note
Check data valid flag before calling this function.
Returns
Single conversion data.
1073
of file platform/emlib/inc/em_adc.h
ADC_DataSinglePeek#
uint32_t ADC_DataSinglePeek (ADC_TypeDef * adc)
Peek single conversion result.
[in] | adc | A pointer to the ADC peripheral register block. |
Note
Check data valid flag before calling this function.
Returns
Single conversion data.
1091
of file platform/emlib/inc/em_adc.h
ADC_DataScanGet#
uint32_t ADC_DataScanGet (ADC_TypeDef * adc)
Get a scan result.
[in] | adc | A pointer to the ADC peripheral register block. |
Note
Check data valid flag before calling this function.
Returns
Scan conversion data.
1109
of file platform/emlib/inc/em_adc.h
ADC_DataScanPeek#
uint32_t ADC_DataScanPeek (ADC_TypeDef * adc)
Peek scan result.
[in] | adc | A pointer to the ADC peripheral register block. |
Note
Check data valid flag before calling this function.
Returns
Scan conversion data.
1127
of file platform/emlib/inc/em_adc.h
ADC_IntClear#
void ADC_IntClear (ADC_TypeDef * adc, uint32_t flags)
Clear one or more pending ADC interrupts.
[in] | adc | A pointer to the ADC peripheral register block. |
[in] | flags | Pending ADC interrupt source to clear. Use a bitwise logic OR combination of valid interrupt flags for the ADC module (ADC_IF_nnn). |
1166
of file platform/emlib/inc/em_adc.h
ADC_IntDisable#
void ADC_IntDisable (ADC_TypeDef * adc, uint32_t flags)
Disable one or more ADC interrupts.
[in] | adc | A pointer to the ADC peripheral register block. |
[in] | flags | ADC interrupt sources to disable. Use a bitwise logic OR combination of valid interrupt flags for the ADC module (ADC_IF_nnn). |
1182
of file platform/emlib/inc/em_adc.h
ADC_IntEnable#
void ADC_IntEnable (ADC_TypeDef * adc, uint32_t flags)
Enable one or more ADC interrupts.
[in] | adc | A pointer to the ADC peripheral register block. |
[in] | flags | ADC interrupt sources to enable. Use a bitwise logic OR combination of valid interrupt flags for the ADC module (ADC_IF_nnn). |
Note
Depending on use, a pending interrupt may already be set prior to enabling the interrupt. Consider using ADC_IntClear() prior to enabling if the pending interrupt should be ignored.
1203
of file platform/emlib/inc/em_adc.h
ADC_IntGet#
uint32_t ADC_IntGet (ADC_TypeDef * adc)
Get pending ADC interrupt flags.
[in] | adc | A pointer to the ADC peripheral register block. |
Note
This function does not clear event bits.
Returns
ADC interrupt sources pending. A bitwise logic OR combination of valid interrupt flags for the ADC module (ADC_IF_nnn).
1222
of file platform/emlib/inc/em_adc.h
ADC_IntGetEnabled#
uint32_t ADC_IntGetEnabled (ADC_TypeDef * adc)
Get enabled and pending ADC interrupt flags.
[in] | adc | A pointer to the ADC peripheral register block. |
Useful for handling more interrupt sources in the same interrupt handler.
Note
This function does not clear interrupt flags.
Returns
Pending and enabled ADC interrupt sources. The return value is the bitwise AND combination of
the OR combination of enabled interrupt sources in ADCx_IEN_nnn register (ADCx_IEN_nnn) and
the OR combination of valid interrupt flags of the ADC module (ADCx_IF_nnn).
1246
of file platform/emlib/inc/em_adc.h
ADC_IntSet#
void ADC_IntSet (ADC_TypeDef * adc, uint32_t flags)
Set one or more pending ADC interrupts from software.
[in] | adc | A pointer to the ADC peripheral register block. |
[in] | flags | ADC interrupt sources to set to pending. Use a bitwise logic OR combination of valid interrupt flags for the ADC module (ADC_IF_nnn). |
1269
of file platform/emlib/inc/em_adc.h
ADC_Start#
void ADC_Start (ADC_TypeDef * adc, ADC_Start_TypeDef cmd)
Start scan sequence and/or single conversion.
[in] | adc | A pointer to the ADC peripheral register block. |
[in] | cmd | A command indicating which type of sampling to start. |
1284
of file platform/emlib/inc/em_adc.h
Macro Definition Documentation#
ADC_CTRLX_VREFSEL_REG#
#define ADC_CTRLX_VREFSEL_REGValue:
0x80UL
Single and scan mode voltage references.
Using unshifted enumerations and or in ADC_CTRLX_VREFSEL_REG to select the extension register CTRLX_VREFSEL.
182
of file platform/emlib/inc/em_adc.h
ADC_SCANINPUTSEL_GROUP_NONE#
#define ADC_SCANINPUTSEL_GROUP_NONEValue:
0xFFU
Define none selected group for ADC_SCANINPUTSEL.
695
of file platform/emlib/inc/em_adc.h
ADC_SCANINPUTSEL_NONE#
#define ADC_SCANINPUTSEL_NONEValue:
Define none selected for ADC_SCANINPUTSEL.
697
of file platform/emlib/inc/em_adc.h
ADC_INIT_DEFAULT#
#define ADC_INIT_DEFAULTValue:
Default configuration for ADC initialization structure.
838
of file platform/emlib/inc/em_adc.h
ADC_INITSCAN_DEFAULT#
#define ADC_INITSCAN_DEFAULTValue:
Default configuration for ADC scan initialization structure.
940
of file platform/emlib/inc/em_adc.h
ADC_INITSINGLE_DEFAULT#
#define ADC_INITSINGLE_DEFAULTValue:
Default configuration for ADC single conversion initialization structure.
1039
of file platform/emlib/inc/em_adc.h