libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.

Defined Constants and Types for the STM32L4xx Analog to Digital Converter More...

Collaboration diagram for ADC Defines:

Modules

 ADC register base addresses
 
 ADC Channel Numbers
 
 ADC Sample Time Selection values
 
 ADC registers
 
 ISR ADC interrupt status register
 
 IER ADC interrupt enable register
 
 CR ADC control register
 
 CFGR1 ADC configuration register 1
 
 SMPR ADC sample time register
 
 CFGR2 ADC configuration register 2
 
 TR1 ADC watchdog threshold register 1
 
 CCR ADC common configuration register
 

Macros

#define ADC_ISR_JQOVF   (1 << 10)
 
#define ADC_ISR_AWD3   (1 << 9)
 
#define ADC_ISR_AWD2   (1 << 8)
 
#define ADC_ISR_JEOS   (1 << 6)
 
#define ADC_ISR_JEOC   (1 << 5)
 
#define ADC_IER_JQOVFIE   (1 << 10)
 
#define ADC_IER_AWD3IE   (1 << 9)
 
#define ADC_IER_AWD2IE   (1 << 8)
 
#define ADC_IER_JEOSIE   (1 << 6)
 
#define ADC_IER_JEOCIE   (1 << 5)
 
#define ADC_CR_ADCALDIF   (1 << 30)
 
#define ADC_CR_JADSTP   (1 << 5)
 
#define ADC_CR_JADSTART   (1 << 3)
 
#define ADC_CFGR1_JAUTO   (1 << 25)
 
#define ADC_CFGR1_JAWD1EN   (1 << 24)
 
#define ADC_CFGR1_JQM   (1 << 21)
 
#define ADC_CFGR1_JDISCEN   (1 << 20)
 
#define ADC_CFGR1_DISCNUM_SHIFT   17
 
#define ADC_CFGR1_DISCNUM_MASK   (0x7 << ADC_CFGR1_DISCNUM_SHIFT)
 
#define ADC_CFGR1_DISCNUM_VAL(x)   (((x) - 1) << ADC_CFGR1_DISCNUM_SHIFT)
 
#define ADC_SQR1_L_SHIFT   0
 
#define ADC_SQR1_L_MASK   0xf
 
#define ADC_SQRx_SQx_MASK   0x1f
 
#define ADC_SQR1_SQ1_SHIFT   6
 
#define ADC_SQR1_SQ2_SHIFT   12
 
#define ADC_SQR1_SQ3_SHIFT   18
 
#define ADC_SQR1_SQ4_SHIFT   24
 
#define ADC_SQR2_SQ5_SHIFT   0
 
#define ADC_SQR2_SQ6_SHIFT   6
 
#define ADC_SQR2_SQ7_SHIFT   12
 
#define ADC_SQR2_SQ8_SHIFT   18
 
#define ADC_SQR2_SQ9_SHIFT   24
 
#define ADC_SQR3_SQ10_SHIFT   0
 
#define ADC_SQR3_SQ11_SHIFT   6
 
#define ADC_SQR3_SQ12_SHIFT   12
 
#define ADC_SQR3_SQ13_SHIFT   18
 
#define ADC_SQR3_SQ14_SHIFT   24
 
#define ADC_SQR4_SQ15_SHIFT   0
 
#define ADC_SQR4_SQ16_SHIFT   6
 

Functions

void adc_power_on_async (uint32_t adc)
 Turn on the ADC (async) More...
 
void adc_power_on (uint32_t adc)
 Turn on the ADC. More...
 
bool adc_is_power_on (uint32_t adc)
 Is the ADC powered up and ready? More...
 
void adc_power_off_async (uint32_t adc)
 Turn off the ADC (async) This will actually block if it needs to turn off a currently running conversion, as per ref man. More...
 
void adc_power_off (uint32_t adc)
 Turn off the ADC This will actually block if it needs to turn off a currently running conversion, as per ref man. More...
 
bool adc_is_power_off (uint32_t adc)
 Is the ADC powered down? More...
 
void adc_calibrate_async (uint32_t adc)
 Start the ADC calibration and immediately return. More...
 
bool adc_is_calibrating (uint32_t adc)
 Is the ADC Calibrating? More...
 
void adc_calibrate (uint32_t adc)
 Start ADC calibration and wait for it to finish. More...
 
void adc_set_continuous_conversion_mode (uint32_t adc)
 Enable Continuous Conversion Mode In this mode the ADC starts a new conversion of a single channel or a channel group immediately following completion of the previous channel group conversion. More...
 
void adc_set_single_conversion_mode (uint32_t adc)
 Enable Single Conversion Mode In this mode the ADC performs a conversion of one channel or a channel group and stops. More...
 
void adc_set_regular_sequence (uint32_t adc, uint8_t length, uint8_t channel[])
 ADC Set a Regular Channel Conversion Sequence. More...
 
void adc_set_sample_time_on_all_channels (uint32_t adc, uint8_t time)
 ADC Set the Sample Time for All Channels. More...
 
void adc_enable_temperature_sensor (void)
 Enable the temperature sensor (only) The channel this is available on is unfortunately not consistent, even though the bit used to enable it is. More...
 
void adc_disable_temperature_sensor (void)
 Disable the temperature sensor (only) More...
 
void adc_enable_vrefint (void)
 Enable the internal voltage reference (only) The channel this is available on is unfortunately not consistent, even though the bit used to enable it is. More...
 
void adc_disable_vrefint (void)
 Disable the internal voltage reference (only) More...
 
void adc_set_resolution (uint32_t adc, uint16_t resolution)
 ADC Set Resolution. More...
 
void adc_set_left_aligned (uint32_t adc)
 ADC Set the Data as Left Aligned. More...
 
void adc_set_right_aligned (uint32_t adc)
 ADC Set the Data as Right Aligned. More...
 
void adc_enable_dma (uint32_t adc)
 ADC Enable DMA Transfers. More...
 
void adc_disable_dma (uint32_t adc)
 ADC Disable DMA Transfers. More...
 
bool adc_eoc (uint32_t adc)
 ADC Read the End-of-Conversion Flag. More...
 
bool adc_eos (uint32_t adc)
 ADC Read the End-of-Sequence Flag for Regular Conversions. More...
 
void adc_enable_eoc_interrupt (uint32_t adc)
 ADC Enable Regular End-Of-Conversion Interrupt. More...
 
void adc_disable_eoc_interrupt (uint32_t adc)
 ADC Disable Regular End-Of-Conversion Interrupt. More...
 
void adc_enable_overrun_interrupt (uint32_t adc)
 ADC Enable the Overrun Interrupt. More...
 
void adc_disable_overrun_interrupt (uint32_t adc)
 ADC Disable the Overrun Interrupt. More...
 
bool adc_get_overrun_flag (uint32_t adc)
 ADC Read the Overrun Flag. More...
 
void adc_clear_overrun_flag (uint32_t adc)
 ADC Clear Overrun Flags. More...
 
uint32_t adc_read_regular (uint32_t adc)
 ADC Read from the Regular Conversion Result Register. More...
 
void adc_start_conversion_regular (uint32_t adc)
 ADC Software Triggered Conversion on Regular Channels. More...
 
void adc_enable_dma_circular_mode (uint32_t adc)
 Enable circular mode for DMA transfers. More...
 
void adc_disable_dma_circular_mode (uint32_t adc)
 Disable circular mode for DMA transfers. More...
 
void adc_enable_delayed_conversion_mode (uint32_t adc)
 Enable Delayed Conversion Mode. More...
 
void adc_disable_delayed_conversion_mode (uint32_t adc)
 Enable Delayed Conversion Mode. More...
 
void adc_set_sample_time (uint32_t adc, uint8_t channel, uint8_t time)
 ADC Set the Sample Time for a Single Channel. More...
 
void adc_enable_regulator (uint32_t adc)
 Enable the ADC Voltage regulator Before any use of the ADC, the ADC Voltage regulator must be enabled. More...
 
void adc_disable_regulator (uint32_t adc)
 Disable the ADC Voltage regulator You can disable the adc vreg when not in use to save power. More...
 

Detailed Description

Defined Constants and Types for the STM32L4xx Analog to Digital Converter

Version
1.0.0
Date
24 Oct 2015

LGPL License Terms libopencm3 License

Author
© 2015 Karl Palsson karlp.nosp@m.@twe.nosp@m.ak.ne.nosp@m.t.au

Macro Definition Documentation

◆ ADC_CFGR1_DISCNUM_MASK

#define ADC_CFGR1_DISCNUM_MASK   (0x7 << ADC_CFGR1_DISCNUM_SHIFT)

Definition at line 143 of file adc_common_v2_multi.h.

◆ ADC_CFGR1_DISCNUM_SHIFT

#define ADC_CFGR1_DISCNUM_SHIFT   17

Definition at line 142 of file adc_common_v2_multi.h.

◆ ADC_CFGR1_DISCNUM_VAL

#define ADC_CFGR1_DISCNUM_VAL (   x)    (((x) - 1) << ADC_CFGR1_DISCNUM_SHIFT)

Definition at line 144 of file adc_common_v2_multi.h.

◆ ADC_CFGR1_JAUTO

#define ADC_CFGR1_JAUTO   (1 << 25)

Definition at line 130 of file adc_common_v2_multi.h.

◆ ADC_CFGR1_JAWD1EN

#define ADC_CFGR1_JAWD1EN   (1 << 24)

Definition at line 133 of file adc_common_v2_multi.h.

◆ ADC_CFGR1_JDISCEN

#define ADC_CFGR1_JDISCEN   (1 << 20)

Definition at line 139 of file adc_common_v2_multi.h.

◆ ADC_CFGR1_JQM

#define ADC_CFGR1_JQM   (1 << 21)

Definition at line 136 of file adc_common_v2_multi.h.

◆ ADC_CR_ADCALDIF

#define ADC_CR_ADCALDIF   (1 << 30)

Definition at line 121 of file adc_common_v2_multi.h.

◆ ADC_CR_JADSTART

#define ADC_CR_JADSTART   (1 << 3)

Definition at line 125 of file adc_common_v2_multi.h.

◆ ADC_CR_JADSTP

#define ADC_CR_JADSTP   (1 << 5)

Definition at line 123 of file adc_common_v2_multi.h.

◆ ADC_IER_AWD2IE

#define ADC_IER_AWD2IE   (1 << 8)

Definition at line 112 of file adc_common_v2_multi.h.

◆ ADC_IER_AWD3IE

#define ADC_IER_AWD3IE   (1 << 9)

Definition at line 110 of file adc_common_v2_multi.h.

◆ ADC_IER_JEOCIE

#define ADC_IER_JEOCIE   (1 << 5)

Definition at line 116 of file adc_common_v2_multi.h.

◆ ADC_IER_JEOSIE

#define ADC_IER_JEOSIE   (1 << 6)

Definition at line 114 of file adc_common_v2_multi.h.

◆ ADC_IER_JQOVFIE

#define ADC_IER_JQOVFIE   (1 << 10)

Definition at line 108 of file adc_common_v2_multi.h.

◆ ADC_ISR_AWD2

#define ADC_ISR_AWD2   (1 << 8)

Definition at line 99 of file adc_common_v2_multi.h.

◆ ADC_ISR_AWD3

#define ADC_ISR_AWD3   (1 << 9)

Definition at line 97 of file adc_common_v2_multi.h.

◆ ADC_ISR_JEOC

#define ADC_ISR_JEOC   (1 << 5)

Definition at line 103 of file adc_common_v2_multi.h.

◆ ADC_ISR_JEOS

#define ADC_ISR_JEOS   (1 << 6)

Definition at line 101 of file adc_common_v2_multi.h.

◆ ADC_ISR_JQOVF

#define ADC_ISR_JQOVF   (1 << 10)

Definition at line 95 of file adc_common_v2_multi.h.

◆ ADC_SQR1_L_MASK

#define ADC_SQR1_L_MASK   0xf

Definition at line 149 of file adc_common_v2_multi.h.

◆ ADC_SQR1_L_SHIFT

#define ADC_SQR1_L_SHIFT   0

Definition at line 148 of file adc_common_v2_multi.h.

◆ ADC_SQR1_SQ1_SHIFT

#define ADC_SQR1_SQ1_SHIFT   6

Definition at line 151 of file adc_common_v2_multi.h.

◆ ADC_SQR1_SQ2_SHIFT

#define ADC_SQR1_SQ2_SHIFT   12

Definition at line 152 of file adc_common_v2_multi.h.

◆ ADC_SQR1_SQ3_SHIFT

#define ADC_SQR1_SQ3_SHIFT   18

Definition at line 153 of file adc_common_v2_multi.h.

◆ ADC_SQR1_SQ4_SHIFT

#define ADC_SQR1_SQ4_SHIFT   24

Definition at line 154 of file adc_common_v2_multi.h.

◆ ADC_SQR2_SQ5_SHIFT

#define ADC_SQR2_SQ5_SHIFT   0

Definition at line 155 of file adc_common_v2_multi.h.

◆ ADC_SQR2_SQ6_SHIFT

#define ADC_SQR2_SQ6_SHIFT   6

Definition at line 156 of file adc_common_v2_multi.h.

◆ ADC_SQR2_SQ7_SHIFT

#define ADC_SQR2_SQ7_SHIFT   12

Definition at line 157 of file adc_common_v2_multi.h.

◆ ADC_SQR2_SQ8_SHIFT

#define ADC_SQR2_SQ8_SHIFT   18

Definition at line 158 of file adc_common_v2_multi.h.

◆ ADC_SQR2_SQ9_SHIFT

#define ADC_SQR2_SQ9_SHIFT   24

Definition at line 159 of file adc_common_v2_multi.h.

◆ ADC_SQR3_SQ10_SHIFT

#define ADC_SQR3_SQ10_SHIFT   0

Definition at line 160 of file adc_common_v2_multi.h.

◆ ADC_SQR3_SQ11_SHIFT

#define ADC_SQR3_SQ11_SHIFT   6

Definition at line 161 of file adc_common_v2_multi.h.

◆ ADC_SQR3_SQ12_SHIFT

#define ADC_SQR3_SQ12_SHIFT   12

Definition at line 162 of file adc_common_v2_multi.h.

◆ ADC_SQR3_SQ13_SHIFT

#define ADC_SQR3_SQ13_SHIFT   18

Definition at line 163 of file adc_common_v2_multi.h.

◆ ADC_SQR3_SQ14_SHIFT

#define ADC_SQR3_SQ14_SHIFT   24

Definition at line 164 of file adc_common_v2_multi.h.

◆ ADC_SQR4_SQ15_SHIFT

#define ADC_SQR4_SQ15_SHIFT   0

Definition at line 165 of file adc_common_v2_multi.h.

◆ ADC_SQR4_SQ16_SHIFT

#define ADC_SQR4_SQ16_SHIFT   6

Definition at line 166 of file adc_common_v2_multi.h.

◆ ADC_SQRx_SQx_MASK

#define ADC_SQRx_SQx_MASK   0x1f

Definition at line 150 of file adc_common_v2_multi.h.

Function Documentation

◆ adc_calibrate()

void adc_calibrate ( uint32_t  adc)

Start ADC calibration and wait for it to finish.

Parameters
adcADC Block register address base ADC register base addresses

Definition at line 175 of file adc_common_v2.c.

References adc_calibrate_async(), and adc_is_calibrating().

Here is the call graph for this function:

◆ adc_calibrate_async()

void adc_calibrate_async ( uint32_t  adc)

Start the ADC calibration and immediately return.

See also
adc_calibrate
adc_is_calibrating
Parameters
adcADC Block register address base ADC register base addresses

Definition at line 156 of file adc_common_v2.c.

References ADC_CR, and ADC_CR_ADCAL.

Referenced by adc_calibrate().

Here is the caller graph for this function:

◆ adc_clear_overrun_flag()

void adc_clear_overrun_flag ( uint32_t  adc)

ADC Clear Overrun Flags.

The overrun flag is cleared. Note that if an overrun occurs, DMA is terminated. The flag must be cleared and the DMA stream and ADC reinitialised to resume conversions (see the reference manual).

Parameters
[in]adcUnsigned int32. ADC base address (ADC register base addresses)

Definition at line 299 of file adc_common_v2.c.

References ADC_ISR, and ADC_ISR_OVR.

◆ adc_disable_delayed_conversion_mode()

void adc_disable_delayed_conversion_mode ( uint32_t  adc)

Enable Delayed Conversion Mode.

Parameters
[in]adcADC block register address base ADC register base addresses

Definition at line 425 of file adc_common_v2.c.

References ADC_CFGR1.

◆ adc_disable_dma()

void adc_disable_dma ( uint32_t  adc)

ADC Disable DMA Transfers.

Parameters
[in]adcUnsigned int32. ADC base address (ADC register base addresses)

Definition at line 250 of file adc_common_v2.c.

References ADC_CFGR1.

◆ adc_disable_dma_circular_mode()

void adc_disable_dma_circular_mode ( uint32_t  adc)

Disable circular mode for DMA transfers.

Parameters
[in]adcUnsigned int32. ADC base address (ADC register base addresses)

Definition at line 407 of file adc_common_v2.c.

References ADC_CFGR1.

◆ adc_disable_eoc_interrupt()

void adc_disable_eoc_interrupt ( uint32_t  adc)

ADC Disable Regular End-Of-Conversion Interrupt.

Parameters
[in]adcUnsigned int32. ADC base address (ADC register base addresses)

Definition at line 317 of file adc_common_v2.c.

References ADC_IER.

◆ adc_disable_overrun_interrupt()

void adc_disable_overrun_interrupt ( uint32_t  adc)

ADC Disable the Overrun Interrupt.

Parameters
[in]adcUnsigned int32. ADC base address (ADC register base addresses)

Definition at line 272 of file adc_common_v2.c.

References ADC_IER.

◆ adc_disable_regulator()

void adc_disable_regulator ( uint32_t  adc)

Disable the ADC Voltage regulator You can disable the adc vreg when not in use to save power.

Parameters
[in]adcADC block register address base
See also
adc_enable_regulator

Definition at line 50 of file adc.c.

References ADC_CR.

◆ adc_disable_temperature_sensor()

void adc_disable_temperature_sensor ( void  )

Disable the temperature sensor (only)

See also
adc_enable_temperature_sensor

Definition at line 351 of file adc_common_v2.c.

References ADC1, and ADC_CCR.

◆ adc_disable_vrefint()

void adc_disable_vrefint ( void  )

Disable the internal voltage reference (only)

See also
adc_enable_vrefint

Definition at line 372 of file adc_common_v2.c.

References ADC1, and ADC_CCR.

◆ adc_enable_delayed_conversion_mode()

void adc_enable_delayed_conversion_mode ( uint32_t  adc)

Enable Delayed Conversion Mode.

Parameters
[in]adcADC block register address base ADC register base addresses

Definition at line 416 of file adc_common_v2.c.

References ADC_CFGR1, and ADC_CFGR1_AUTDLY.

◆ adc_enable_dma()

void adc_enable_dma ( uint32_t  adc)

ADC Enable DMA Transfers.

Parameters
[in]adcUnsigned int32. ADC base address (ADC register base addresses)

Definition at line 241 of file adc_common_v2.c.

References ADC_CFGR1, and ADC_CFGR1_DMAEN.

◆ adc_enable_dma_circular_mode()

void adc_enable_dma_circular_mode ( uint32_t  adc)

Enable circular mode for DMA transfers.

For this to work it needs to be ebabled on the DMA side as well.

Parameters
[in]adcUnsigned int32. ADC base address (ADC register base addresses)

Definition at line 398 of file adc_common_v2.c.

References ADC_CFGR1, and ADC_CFGR1_DMACFG.

◆ adc_enable_eoc_interrupt()

void adc_enable_eoc_interrupt ( uint32_t  adc)

ADC Enable Regular End-Of-Conversion Interrupt.

Parameters
[in]adcUnsigned int32. ADC base address (ADC register base addresses)

Definition at line 308 of file adc_common_v2.c.

References ADC_IER, and ADC_IER_EOCIE.

◆ adc_enable_overrun_interrupt()

void adc_enable_overrun_interrupt ( uint32_t  adc)

ADC Enable the Overrun Interrupt.

The overrun interrupt is generated when data is not read from a result register before the next conversion is written. If DMA is enabled, all transfers are terminated and any conversion sequence is aborted.

Parameters
[in]adcUnsigned int32. ADC base address (ADC register base addresses)

Definition at line 263 of file adc_common_v2.c.

References ADC_IER, and ADC_IER_OVRIE.

◆ adc_enable_regulator()

void adc_enable_regulator ( uint32_t  adc)

Enable the ADC Voltage regulator Before any use of the ADC, the ADC Voltage regulator must be enabled.

You must wait up to 10uSecs afterwards before trying anything else.

Parameters
[in]adcADC block register address base
See also
adc_disable_regulator

Definition at line 39 of file adc.c.

References ADC_CR, and ADC_CR_ADVREGEN.

◆ adc_enable_temperature_sensor()

void adc_enable_temperature_sensor ( void  )

Enable the temperature sensor (only) The channel this is available on is unfortunately not consistent, even though the bit used to enable it is.

See also
adc_disable_temperature_sensor

Definition at line 342 of file adc_common_v2.c.

References ADC1, ADC_CCR, and ADC_CCR_TSEN.

◆ adc_enable_vrefint()

void adc_enable_vrefint ( void  )

Enable the internal voltage reference (only) The channel this is available on is unfortunately not consistent, even though the bit used to enable it is.

FIXME - on f3, you can actually have it on ADC34 as well!

See also
adc_disable_vrefint

Definition at line 363 of file adc_common_v2.c.

References ADC1, ADC_CCR, and ADC_CCR_VREFEN.

◆ adc_eoc()

bool adc_eoc ( uint32_t  adc)

ADC Read the End-of-Conversion Flag.

This flag is set by hardware at the end of each regular conversion of a channel when a new data is available in the ADCx_DR register.

Parameters
[in]adcUnsigned int32. ADC block register address base ADC register base addresses
Returns
bool. End of conversion flag.

Definition at line 49 of file adc_common_v2.c.

References ADC_ISR, and ADC_ISR_EOC.

◆ adc_eos()

bool adc_eos ( uint32_t  adc)

ADC Read the End-of-Sequence Flag for Regular Conversions.

This flag is set after all channels of an regular group have been converted.

Parameters
[in]adcUnsigned int32. ADC block register address base ADC register base addresses
Returns
bool. End of conversion flag.

Definition at line 63 of file adc_common_v2.c.

References ADC_ISR, and ADC_ISR_EOS.

◆ adc_get_overrun_flag()

bool adc_get_overrun_flag ( uint32_t  adc)

ADC Read the Overrun Flag.

The overrun flag is set when data is not read from a result register before the next conversion is written. If DMA is enabled, all transfers are terminated and any conversion sequence is aborted.

Parameters
[in]adcUnsigned int32. ADC base address (ADC register base addresses)

Definition at line 285 of file adc_common_v2.c.

References ADC_ISR, and ADC_ISR_OVR.

◆ adc_is_calibrating()

bool adc_is_calibrating ( uint32_t  adc)

Is the ADC Calibrating?

Parameters
adcADC Block register address base ADC register base addresses
Returns
true if the adc is currently calibrating

Definition at line 166 of file adc_common_v2.c.

References ADC_CR, and ADC_CR_ADCAL.

Referenced by adc_calibrate().

Here is the caller graph for this function:

◆ adc_is_power_off()

bool adc_is_power_off ( uint32_t  adc)

Is the ADC powered down?

See also
adc_power_off_async
Parameters
adcADC Block register address base ADC register base addresses

Definition at line 132 of file adc_common_v2.c.

References ADC_CR, and ADC_CR_ADEN.

Referenced by adc_power_off(), and adc_power_off_async().

Here is the caller graph for this function:

◆ adc_is_power_on()

bool adc_is_power_on ( uint32_t  adc)

Is the ADC powered up and ready?

See also
adc_power_on_async
Parameters
adcADC Block register address base ADC register base addresses
Returns
true if adc is ready for use

Definition at line 84 of file adc_common_v2.c.

References ADC_ISR, and ADC_ISR_ADRDY.

Referenced by adc_power_on().

Here is the caller graph for this function:

◆ adc_power_off()

void adc_power_off ( uint32_t  adc)

Turn off the ADC This will actually block if it needs to turn off a currently running conversion, as per ref man.

See also
adc_power_off_async
Parameters
adcADC Block register address base ADC register base addresses

Definition at line 144 of file adc_common_v2.c.

References adc_is_power_off(), and adc_power_off_async().

Here is the call graph for this function:

◆ adc_power_off_async()

void adc_power_off_async ( uint32_t  adc)

Turn off the ADC (async) This will actually block if it needs to turn off a currently running conversion, as per ref man.

(Handles injected on hardware that supports injected conversions.

See also
adc_wait_power_off
Parameters
adcADC Block register address base ADC register base addresses

Definition at line 108 of file adc_common_v2.c.

References ADC_CR, ADC_CR_ADDIS, ADC_CR_ADSTART, ADC_CR_ADSTP, ADC_CR_JADSTART, ADC_CR_JADSTP, and adc_is_power_off().

Referenced by adc_power_off().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ adc_power_on()

void adc_power_on ( uint32_t  adc)

Turn on the ADC.

See also
adc_power_on_async
Parameters
adcADC Block register address base ADC register base addresses

Definition at line 94 of file adc_common_v2.c.

References adc_is_power_on(), and adc_power_on_async().

Here is the call graph for this function:

◆ adc_power_on_async()

void adc_power_on_async ( uint32_t  adc)

Turn on the ADC (async)

See also
adc_wait_power_on
Parameters
adcADC Block register address base ADC register base addresses

Definition at line 73 of file adc_common_v2.c.

References ADC_CR, and ADC_CR_ADEN.

Referenced by adc_power_on().

Here is the caller graph for this function:

◆ adc_read_regular()

uint32_t adc_read_regular ( uint32_t  adc)

ADC Read from the Regular Conversion Result Register.

The result read back is 12 bits, right or left aligned within the first 16 bits.

Parameters
[in]adcUnsigned int32. ADC block register address base ADC register base addresses
Returns
Unsigned int32 conversion result.

Definition at line 331 of file adc_common_v2.c.

References ADC_DR.

◆ adc_set_continuous_conversion_mode()

void adc_set_continuous_conversion_mode ( uint32_t  adc)

Enable Continuous Conversion Mode In this mode the ADC starts a new conversion of a single channel or a channel group immediately following completion of the previous channel group conversion.

Parameters
[in]adcADC block register address base ADC register base addresses

Definition at line 189 of file adc_common_v2.c.

References ADC_CFGR1, and ADC_CFGR1_CONT.

◆ adc_set_left_aligned()

void adc_set_left_aligned ( uint32_t  adc)

ADC Set the Data as Left Aligned.

Parameters
[in]adcUnsigned int32. ADC base address (ADC register base addresses)

Definition at line 223 of file adc_common_v2.c.

References ADC_CFGR1, and ADC_CFGR1_ALIGN.

◆ adc_set_regular_sequence()

void adc_set_regular_sequence ( uint32_t  adc,
uint8_t  length,
uint8_t  channel[] 
)

ADC Set a Regular Channel Conversion Sequence.

Define a sequence of channels to be converted as a regular group with a length from 1 to 16 channels. If this is called during conversion, the current conversion is reset and conversion begins again with the newly defined group.

Parameters
[in]adcADC block register address base ADC register base addresses
[in]lengthNumber of channels in the group, range 0..16
[in]channelSet of channels in sequence, range ADC Channel Numbers

Definition at line 100 of file adc_common_v2_multi.c.

References ADC_SQR1, ADC_SQR1_L_SHIFT, ADC_SQR2, ADC_SQR3, and ADC_SQR4.

◆ adc_set_resolution()

void adc_set_resolution ( uint32_t  adc,
uint16_t  resolution 
)

ADC Set Resolution.

ADC Resolution can be reduced from 12 bits to 10, 8 or 6 bits for a corresponding reduction in conversion time.

Parameters
[in]adcUnsigned int32. ADC base address (ADC register base addresses)
[in]resolutionUnsigned int16. Resolution value (adc_api_res)

Definition at line 214 of file adc_common_v2.c.

References ADC_CFGR1.

◆ adc_set_right_aligned()

void adc_set_right_aligned ( uint32_t  adc)

ADC Set the Data as Right Aligned.

Parameters
[in]adcUnsigned int32. ADC base address (ADC register base addresses)

Definition at line 232 of file adc_common_v2.c.

References ADC_CFGR1.

◆ adc_set_sample_time()

void adc_set_sample_time ( uint32_t  adc,
uint8_t  channel,
uint8_t  time 
)

ADC Set the Sample Time for a Single Channel.

The sampling time can be selected in ADC clock cycles, exact values depend on the device.

Parameters
[in]adcADC block register address base ADC register base addresses
[in]channelADC Channel integer ADC Channel Numbers
[in]timeSampling time selection from ADC Sample Time Selection values

Definition at line 47 of file adc_common_v2_multi.c.

References ADC_SMPR1, and ADC_SMPR2.

◆ adc_set_sample_time_on_all_channels()

void adc_set_sample_time_on_all_channels ( uint32_t  adc,
uint8_t  time 
)

ADC Set the Sample Time for All Channels.

The sampling time can be selected in ADC clock cycles, exact values depend on the device.

Parameters
[in]adcADC block register address base ADC register base addresses
[in]timeSampling time selection from ADC Sample Time Selection values

Definition at line 72 of file adc_common_v2_multi.c.

References ADC_SMPR1, and ADC_SMPR2.

◆ adc_set_single_conversion_mode()

void adc_set_single_conversion_mode ( uint32_t  adc)

Enable Single Conversion Mode In this mode the ADC performs a conversion of one channel or a channel group and stops.

Parameters
[in]adcADC block register address base ADC register base addresses

Definition at line 201 of file adc_common_v2.c.

References ADC_CFGR1.

◆ adc_start_conversion_regular()

void adc_start_conversion_regular ( uint32_t  adc)

ADC Software Triggered Conversion on Regular Channels.

This starts conversion on a set of defined regular channels. Depending on the configuration bits EXTEN, a conversion will start immediately (software trigger configuration) or once a regular hardware trigger event occurs (hardware trigger configuration)

Parameters
[in]adcADC block register address base ADC register base addresses

Definition at line 386 of file adc_common_v2.c.

References ADC_CR, and ADC_CR_ADSTART.