STM32L4xx_HAL_Driver  1.14.0
Configuration of ADC hierarchical scope: ADC instance

Functions

__STATIC_INLINE void LL_ADC_SetCalibrationFactor (ADC_TypeDef *ADCx, uint32_t SingleDiff, uint32_t CalibrationFactor)
 Set ADC calibration factor in the mode single-ended or differential (for devices with differential mode available). More...
 
__STATIC_INLINE uint32_t LL_ADC_GetCalibrationFactor (ADC_TypeDef *ADCx, uint32_t SingleDiff)
 Get ADC calibration factor in the mode single-ended or differential (for devices with differential mode available). More...
 
__STATIC_INLINE void LL_ADC_SetResolution (ADC_TypeDef *ADCx, uint32_t Resolution)
 Set ADC resolution. Refer to reference manual for alignments formats dependencies to ADC resolutions. More...
 
__STATIC_INLINE uint32_t LL_ADC_GetResolution (ADC_TypeDef *ADCx)
 Get ADC resolution. Refer to reference manual for alignments formats dependencies to ADC resolutions. CFGR RES LL_ADC_GetResolution. More...
 
__STATIC_INLINE void LL_ADC_SetDataAlignment (ADC_TypeDef *ADCx, uint32_t DataAlignment)
 Set ADC conversion data alignment. More...
 
__STATIC_INLINE uint32_t LL_ADC_GetDataAlignment (ADC_TypeDef *ADCx)
 Get ADC conversion data alignment. More...
 
__STATIC_INLINE void LL_ADC_SetLowPowerMode (ADC_TypeDef *ADCx, uint32_t LowPowerMode)
 Set ADC low power mode. More...
 
__STATIC_INLINE uint32_t LL_ADC_GetLowPowerMode (ADC_TypeDef *ADCx)
 Get ADC low power mode: More...
 
__STATIC_INLINE void LL_ADC_SetOffset (ADC_TypeDef *ADCx, uint32_t Offsety, uint32_t Channel, uint32_t OffsetLevel)
 Set ADC selected offset number 1, 2, 3 or 4. More...
 
__STATIC_INLINE uint32_t LL_ADC_GetOffsetChannel (ADC_TypeDef *ADCx, uint32_t Offsety)
 Get for the ADC selected offset number 1, 2, 3 or 4: Channel to which the offset programmed will be applied (independently of channel mapped on ADC group regular or group injected) More...
 
__STATIC_INLINE uint32_t LL_ADC_GetOffsetLevel (ADC_TypeDef *ADCx, uint32_t Offsety)
 Get for the ADC selected offset number 1, 2, 3 or 4: Offset level (offset to be subtracted from the raw converted data). More...
 
__STATIC_INLINE void LL_ADC_SetOffsetState (ADC_TypeDef *ADCx, uint32_t Offsety, uint32_t OffsetState)
 Set for the ADC selected offset number 1, 2, 3 or 4: force offset state disable or enable without modifying offset channel or offset value. More...
 
__STATIC_INLINE uint32_t LL_ADC_GetOffsetState (ADC_TypeDef *ADCx, uint32_t Offsety)
 Get for the ADC selected offset number 1, 2, 3 or 4: offset state disabled or enabled. OFR1 OFFSET1_EN LL_ADC_GetOffsetState
OFR2 OFFSET2_EN LL_ADC_GetOffsetState
OFR3 OFFSET3_EN LL_ADC_GetOffsetState
OFR4 OFFSET4_EN LL_ADC_GetOffsetState. More...
 
__STATIC_INLINE void LL_ADC_SetSamplingTimeCommonConfig (ADC_TypeDef *ADCx, uint32_t SamplingTimeCommonConfig)
 Set ADC sampling time common configuration impacting settings of sampling time channel wise. More...
 
__STATIC_INLINE uint32_t LL_ADC_GetSamplingTimeCommonConfig (ADC_TypeDef *ADCx)
 Get ADC sampling time common configuration impacting settings of sampling time channel wise. SMPR1 SMPPLUS LL_ADC_GetSamplingTimeCommonConfig. More...
 

Detailed Description

Function Documentation

◆ LL_ADC_GetCalibrationFactor()

__STATIC_INLINE uint32_t LL_ADC_GetCalibrationFactor ( ADC_TypeDef *  ADCx,
uint32_t  SingleDiff 
)

Get ADC calibration factor in the mode single-ended or differential (for devices with differential mode available).

Note
Calibration factors are set by hardware after performing a calibration run using function LL_ADC_StartCalibration().
For devices with differential mode available: Calibration of offset is specific to each of single-ended and differential modes CALFACT CALFACT_S LL_ADC_GetCalibrationFactor
CALFACT CALFACT_D LL_ADC_GetCalibrationFactor
Parameters
ADCxADC instance
SingleDiffThis parameter can be one of the following values:
  • LL_ADC_SINGLE_ENDED
  • LL_ADC_DIFFERENTIAL_ENDED
Return values
Valuebetween Min_Data=0x00 and Max_Data=0x7F

Definition at line 2591 of file stm32l4xx_ll_adc.h.

2592 {
2593  /* Retrieve bits with position in register depending on parameter */
2594  /* "SingleDiff". */
2595  /* Parameter used with mask "ADC_SINGLEDIFF_CALIB_FACTOR_MASK" because */
2596  /* containing other bits reserved for other purpose. */
2597  return (uint32_t)(READ_BIT(ADCx->CALFACT, (SingleDiff & ADC_SINGLEDIFF_CALIB_FACTOR_MASK)) >> ((SingleDiff & ADC_SINGLEDIFF_CALIB_F_BIT_D_MASK) >> ADC_SINGLEDIFF_CALIB_F_BIT_D_SHIFT4));
2598 }

◆ LL_ADC_GetDataAlignment()

__STATIC_INLINE uint32_t LL_ADC_GetDataAlignment ( ADC_TypeDef *  ADCx)

Get ADC conversion data alignment.

Note
Refer to reference manual for alignments formats dependencies to ADC resolutions. CFGR ALIGN LL_ADC_GetDataAlignment
Parameters
ADCxADC instance
Return values
Returnedvalue can be one of the following values:
  • LL_ADC_DATA_ALIGN_RIGHT
  • LL_ADC_DATA_ALIGN_LEFT

Definition at line 2669 of file stm32l4xx_ll_adc.h.

2670 {
2671  return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_ALIGN));
2672 }

◆ LL_ADC_GetLowPowerMode()

__STATIC_INLINE uint32_t LL_ADC_GetLowPowerMode ( ADC_TypeDef *  ADCx)

Get ADC low power mode:

Note
Description of ADC low power modes:
  • ADC low power mode "auto wait": Dynamic low power mode, ADC conversions occurrences are limited to the minimum necessary in order to reduce power consumption. New ADC conversion starts only when the previous unitary conversion data (for ADC group regular) or previous sequence conversions data (for ADC group injected) has been retrieved by user software. In the meantime, ADC remains idle: does not performs any other conversion. This mode allows to automatically adapt the ADC conversions triggers to the speed of the software that reads the data. Moreover, this avoids risk of overrun for low frequency applications. How to use this low power mode:
    • Do not use with interruption or DMA since these modes have to clear immediately the EOC flag to free the IRQ vector sequencer.
    • Do use with polling: 1. Start conversion,
      1. Later on, when conversion data is needed: poll for end of conversion to ensure that conversion is completed and retrieve ADC conversion data. This will trig another ADC conversion start.
  • ADC low power mode "auto power-off" (feature available on this device if parameter LL_ADC_LP_AUTOPOWEROFF is available): the ADC automatically powers-off after a conversion and automatically wakes up when a new conversion is triggered (with startup time between trigger and start of sampling). This feature can be combined with low power mode "auto wait".
With ADC low power mode "auto wait", the ADC conversion data read is corresponding to previous ADC conversion start, independently of delay during which ADC was idle. Therefore, the ADC conversion data may be outdated: does not correspond to the current voltage level on the selected ADC channel. CFGR AUTDLY LL_ADC_GetLowPowerMode
Parameters
ADCxADC instance
Return values
Returnedvalue can be one of the following values:
  • LL_ADC_LP_MODE_NONE
  • LL_ADC_LP_AUTOWAIT

Definition at line 2770 of file stm32l4xx_ll_adc.h.

2771 {
2772  return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_AUTDLY));
2773 }

◆ LL_ADC_GetOffsetChannel()

__STATIC_INLINE uint32_t LL_ADC_GetOffsetChannel ( ADC_TypeDef *  ADCx,
uint32_t  Offsety 
)

Get for the ADC selected offset number 1, 2, 3 or 4: Channel to which the offset programmed will be applied (independently of channel mapped on ADC group regular or group injected)

Note
Usage of the returned channel number:
  • To reinject this channel into another function LL_ADC_xxx: the returned channel number is only partly formatted on definition of literals LL_ADC_CHANNEL_x. Therefore, it has to be compared with parts of literals LL_ADC_CHANNEL_x or using helper macro __LL_ADC_CHANNEL_TO_DECIMAL_NB(). Then the selected literal LL_ADC_CHANNEL_x can be used as parameter for another function.
  • To get the channel number in decimal format: process the returned value with the helper macro __LL_ADC_CHANNEL_TO_DECIMAL_NB().
On STM32L4, some fast channels are available: fast analog inputs coming from GPIO pads (ADC_IN1..5). OFR1 OFFSET1_CH LL_ADC_GetOffsetChannel
OFR2 OFFSET2_CH LL_ADC_GetOffsetChannel
OFR3 OFFSET3_CH LL_ADC_GetOffsetChannel
OFR4 OFFSET4_CH LL_ADC_GetOffsetChannel
Parameters
ADCxADC instance
OffsetyThis parameter can be one of the following values:
  • LL_ADC_OFFSET_1
  • LL_ADC_OFFSET_2
  • LL_ADC_OFFSET_3
  • LL_ADC_OFFSET_4
Return values
Returnedvalue can be one of the following values:
  • LL_ADC_CHANNEL_0
  • LL_ADC_CHANNEL_1 (7)
  • LL_ADC_CHANNEL_2 (7)
  • LL_ADC_CHANNEL_3 (7)
  • LL_ADC_CHANNEL_4 (7)
  • LL_ADC_CHANNEL_5 (7)
  • LL_ADC_CHANNEL_6
  • LL_ADC_CHANNEL_7
  • LL_ADC_CHANNEL_8
  • LL_ADC_CHANNEL_9
  • LL_ADC_CHANNEL_10
  • LL_ADC_CHANNEL_11
  • LL_ADC_CHANNEL_12
  • LL_ADC_CHANNEL_13
  • LL_ADC_CHANNEL_14
  • LL_ADC_CHANNEL_15
  • LL_ADC_CHANNEL_16
  • LL_ADC_CHANNEL_17
  • LL_ADC_CHANNEL_18
  • LL_ADC_CHANNEL_VREFINT (1)
  • LL_ADC_CHANNEL_TEMPSENSOR (4)
  • LL_ADC_CHANNEL_VBAT (4)
  • LL_ADC_CHANNEL_DAC1CH1 (5)
  • LL_ADC_CHANNEL_DAC1CH2 (5)
  • LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
  • LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
  • LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
  • LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
(1) On STM32L4, parameter available only on ADC instance: ADC1.
(2) On STM32L4, parameter available only on ADC instance: ADC2.
(3) On STM32L4, parameter available only on ADC instance: ADC3.
(4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.
(5) On STM32L4, parameter available on devices with only 1 ADC instance.
(6) On STM32L4, parameter available on devices with several ADC instances.
(7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)). Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).
(1, 2, 3, 4) For ADC channel read back from ADC register, comparison with internal channel parameter to be done using helper macro __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL().

Definition at line 2934 of file stm32l4xx_ll_adc.h.

2935 {
2936  register const __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->OFR1, Offsety);
2937 
2938  return (uint32_t) READ_BIT(*preg, ADC_OFR1_OFFSET1_CH);
2939 }

◆ LL_ADC_GetOffsetLevel()

__STATIC_INLINE uint32_t LL_ADC_GetOffsetLevel ( ADC_TypeDef *  ADCx,
uint32_t  Offsety 
)

Get for the ADC selected offset number 1, 2, 3 or 4: Offset level (offset to be subtracted from the raw converted data).

Note
Caution: Offset format is dependent to ADC resolution: offset has to be left-aligned on bit 11, the LSB (right bits) are set to 0. OFR1 OFFSET1 LL_ADC_GetOffsetLevel
OFR2 OFFSET2 LL_ADC_GetOffsetLevel
OFR3 OFFSET3 LL_ADC_GetOffsetLevel
OFR4 OFFSET4 LL_ADC_GetOffsetLevel
Parameters
ADCxADC instance
OffsetyThis parameter can be one of the following values:
  • LL_ADC_OFFSET_1
  • LL_ADC_OFFSET_2
  • LL_ADC_OFFSET_3
  • LL_ADC_OFFSET_4
Return values
Valuebetween Min_Data=0x000 and Max_Data=0xFFF

Definition at line 2960 of file stm32l4xx_ll_adc.h.

2961 {
2962  register const __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->OFR1, Offsety);
2963 
2964  return (uint32_t) READ_BIT(*preg, ADC_OFR1_OFFSET1);
2965 }

◆ LL_ADC_GetOffsetState()

__STATIC_INLINE uint32_t LL_ADC_GetOffsetState ( ADC_TypeDef *  ADCx,
uint32_t  Offsety 
)

Get for the ADC selected offset number 1, 2, 3 or 4: offset state disabled or enabled. OFR1 OFFSET1_EN LL_ADC_GetOffsetState
OFR2 OFFSET2_EN LL_ADC_GetOffsetState
OFR3 OFFSET3_EN LL_ADC_GetOffsetState
OFR4 OFFSET4_EN LL_ADC_GetOffsetState.

Parameters
ADCxADC instance
OffsetyThis parameter can be one of the following values:
  • LL_ADC_OFFSET_1
  • LL_ADC_OFFSET_2
  • LL_ADC_OFFSET_3
  • LL_ADC_OFFSET_4
Return values
Returnedvalue can be one of the following values:
  • LL_ADC_OFFSET_DISABLE
  • LL_ADC_OFFSET_ENABLE

Definition at line 3019 of file stm32l4xx_ll_adc.h.

3020 {
3021  register const __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->OFR1, Offsety);
3022 
3023  return (uint32_t) READ_BIT(*preg, ADC_OFR1_OFFSET1_EN);
3024 }

◆ LL_ADC_GetResolution()

__STATIC_INLINE uint32_t LL_ADC_GetResolution ( ADC_TypeDef *  ADCx)

Get ADC resolution. Refer to reference manual for alignments formats dependencies to ADC resolutions. CFGR RES LL_ADC_GetResolution.

Parameters
ADCxADC instance
Return values
Returnedvalue can be one of the following values:
  • LL_ADC_RESOLUTION_12B
  • LL_ADC_RESOLUTION_10B
  • LL_ADC_RESOLUTION_8B
  • LL_ADC_RESOLUTION_6B

Definition at line 2634 of file stm32l4xx_ll_adc.h.

2635 {
2636  return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_RES));
2637 }

◆ LL_ADC_GetSamplingTimeCommonConfig()

__STATIC_INLINE uint32_t LL_ADC_GetSamplingTimeCommonConfig ( ADC_TypeDef *  ADCx)

Get ADC sampling time common configuration impacting settings of sampling time channel wise. SMPR1 SMPPLUS LL_ADC_GetSamplingTimeCommonConfig.

Parameters
ADCxADC instance
Return values
Returnedvalue can be one of the following values:
  • LL_ADC_SAMPLINGTIME_COMMON_DEFAULT
  • LL_ADC_SAMPLINGTIME_COMMON_3C5_REPL_2C5

Definition at line 3055 of file stm32l4xx_ll_adc.h.

3056 {
3057  return (uint32_t)(READ_BIT(ADCx->SMPR1, ADC_SMPR1_SMPPLUS));
3058 }

◆ LL_ADC_SetCalibrationFactor()

__STATIC_INLINE void LL_ADC_SetCalibrationFactor ( ADC_TypeDef *  ADCx,
uint32_t  SingleDiff,
uint32_t  CalibrationFactor 
)

Set ADC calibration factor in the mode single-ended or differential (for devices with differential mode available).

Note
This function is intended to set calibration parameters without having to perform a new calibration using LL_ADC_StartCalibration().
For devices with differential mode available: Calibration of offset is specific to each of single-ended and differential modes (calibration factor must be specified for each of these differential modes, if used afterwards and if the application requires their calibration).
In case of setting calibration factors of both modes single ended and differential (parameter LL_ADC_BOTH_SINGLE_DIFF_ENDED): both calibration factors must be concatenated. To perform this processing, use helper macro __LL_ADC_CALIB_FACTOR_SINGLE_DIFF().
On this STM32 serie, setting of this feature is conditioned to ADC state: ADC must be enabled, without calibration on going, without conversion on going on group regular. CALFACT CALFACT_S LL_ADC_SetCalibrationFactor
CALFACT CALFACT_D LL_ADC_SetCalibrationFactor
Parameters
ADCxADC instance
SingleDiffThis parameter can be one of the following values:
  • LL_ADC_SINGLE_ENDED
  • LL_ADC_DIFFERENTIAL_ENDED
  • LL_ADC_BOTH_SINGLE_DIFF_ENDED
CalibrationFactorValue between Min_Data=0x00 and Max_Data=0x7F
Return values
None

Definition at line 2568 of file stm32l4xx_ll_adc.h.

2569 {
2570  MODIFY_REG(ADCx->CALFACT,
2571  SingleDiff & ADC_SINGLEDIFF_CALIB_FACTOR_MASK,
2572  CalibrationFactor << (((SingleDiff & ADC_SINGLEDIFF_CALIB_F_BIT_D_MASK) >> ADC_SINGLEDIFF_CALIB_F_BIT_D_SHIFT4) & ~(SingleDiff & ADC_CALFACT_CALFACT_S)));
2573 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_ADC_SetDataAlignment()

__STATIC_INLINE void LL_ADC_SetDataAlignment ( ADC_TypeDef *  ADCx,
uint32_t  DataAlignment 
)

Set ADC conversion data alignment.

Note
Refer to reference manual for alignments formats dependencies to ADC resolutions.
On this STM32 serie, setting of this feature is conditioned to ADC state: ADC must be disabled or enabled without conversion on going on either groups regular or injected. CFGR ALIGN LL_ADC_SetDataAlignment
Parameters
ADCxADC instance
DataAlignmentThis parameter can be one of the following values:
  • LL_ADC_DATA_ALIGN_RIGHT
  • LL_ADC_DATA_ALIGN_LEFT
Return values
None

Definition at line 2654 of file stm32l4xx_ll_adc.h.

2655 {
2656  MODIFY_REG(ADCx->CFGR, ADC_CFGR_ALIGN, DataAlignment);
2657 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_ADC_SetLowPowerMode()

__STATIC_INLINE void LL_ADC_SetLowPowerMode ( ADC_TypeDef *  ADCx,
uint32_t  LowPowerMode 
)

Set ADC low power mode.

Note
Description of ADC low power modes:
  • ADC low power mode "auto wait": Dynamic low power mode, ADC conversions occurrences are limited to the minimum necessary in order to reduce power consumption. New ADC conversion starts only when the previous unitary conversion data (for ADC group regular) or previous sequence conversions data (for ADC group injected) has been retrieved by user software. In the meantime, ADC remains idle: does not performs any other conversion. This mode allows to automatically adapt the ADC conversions triggers to the speed of the software that reads the data. Moreover, this avoids risk of overrun for low frequency applications. How to use this low power mode:
    • Do not use with interruption or DMA since these modes have to clear immediately the EOC flag to free the IRQ vector sequencer.
    • Do use with polling: 1. Start conversion,
      1. Later on, when conversion data is needed: poll for end of conversion to ensure that conversion is completed and retrieve ADC conversion data. This will trig another ADC conversion start.
  • ADC low power mode "auto power-off" (feature available on this device if parameter LL_ADC_LP_AUTOPOWEROFF is available): the ADC automatically powers-off after a conversion and automatically wakes up when a new conversion is triggered (with startup time between trigger and start of sampling). This feature can be combined with low power mode "auto wait".
With ADC low power mode "auto wait", the ADC conversion data read is corresponding to previous ADC conversion start, independently of delay during which ADC was idle. Therefore, the ADC conversion data may be outdated: does not correspond to the current voltage level on the selected ADC channel.
On this STM32 serie, setting of this feature is conditioned to ADC state: ADC must be disabled or enabled without conversion on going on either groups regular or injected. CFGR AUTDLY LL_ADC_SetLowPowerMode
Parameters
ADCxADC instance
LowPowerModeThis parameter can be one of the following values:
  • LL_ADC_LP_MODE_NONE
  • LL_ADC_LP_AUTOWAIT
Return values
None

Definition at line 2722 of file stm32l4xx_ll_adc.h.

2723 {
2724  MODIFY_REG(ADCx->CFGR, ADC_CFGR_AUTDLY, LowPowerMode);
2725 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_ADC_SetOffset()

__STATIC_INLINE void LL_ADC_SetOffset ( ADC_TypeDef *  ADCx,
uint32_t  Offsety,
uint32_t  Channel,
uint32_t  OffsetLevel 
)

Set ADC selected offset number 1, 2, 3 or 4.

Note
This function set the 2 items of offset configuration:
  • ADC channel to which the offset programmed will be applied (independently of channel mapped on ADC group regular or group injected)
  • Offset level (offset to be subtracted from the raw converted data).
Caution: Offset format is dependent to ADC resolution: offset has to be left-aligned on bit 11, the LSB (right bits) are set to 0.
This function enables the offset, by default. It can be forced to disable state using function LL_ADC_SetOffsetState().
If a channel is mapped on several offsets numbers, only the offset with the lowest value is considered for the subtraction.
On this STM32 serie, setting of this feature is conditioned to ADC state: ADC must be disabled or enabled without conversion on going on either groups regular or injected.
On STM32L4, some fast channels are available: fast analog inputs coming from GPIO pads (ADC_IN1..5). OFR1 OFFSET1_CH LL_ADC_SetOffset
OFR1 OFFSET1 LL_ADC_SetOffset
OFR1 OFFSET1_EN LL_ADC_SetOffset
OFR2 OFFSET2_CH LL_ADC_SetOffset
OFR2 OFFSET2 LL_ADC_SetOffset
OFR2 OFFSET2_EN LL_ADC_SetOffset
OFR3 OFFSET3_CH LL_ADC_SetOffset
OFR3 OFFSET3 LL_ADC_SetOffset
OFR3 OFFSET3_EN LL_ADC_SetOffset
OFR4 OFFSET4_CH LL_ADC_SetOffset
OFR4 OFFSET4 LL_ADC_SetOffset
OFR4 OFFSET4_EN LL_ADC_SetOffset
Parameters
ADCxADC instance
OffsetyThis parameter can be one of the following values:
  • LL_ADC_OFFSET_1
  • LL_ADC_OFFSET_2
  • LL_ADC_OFFSET_3
  • LL_ADC_OFFSET_4
ChannelThis parameter can be one of the following values:
  • LL_ADC_CHANNEL_0
  • LL_ADC_CHANNEL_1 (7)
  • LL_ADC_CHANNEL_2 (7)
  • LL_ADC_CHANNEL_3 (7)
  • LL_ADC_CHANNEL_4 (7)
  • LL_ADC_CHANNEL_5 (7)
  • LL_ADC_CHANNEL_6
  • LL_ADC_CHANNEL_7
  • LL_ADC_CHANNEL_8
  • LL_ADC_CHANNEL_9
  • LL_ADC_CHANNEL_10
  • LL_ADC_CHANNEL_11
  • LL_ADC_CHANNEL_12
  • LL_ADC_CHANNEL_13
  • LL_ADC_CHANNEL_14
  • LL_ADC_CHANNEL_15
  • LL_ADC_CHANNEL_16
  • LL_ADC_CHANNEL_17
  • LL_ADC_CHANNEL_18
  • LL_ADC_CHANNEL_VREFINT (1)
  • LL_ADC_CHANNEL_TEMPSENSOR (4)
  • LL_ADC_CHANNEL_VBAT (4)
  • LL_ADC_CHANNEL_DAC1CH1 (5)
  • LL_ADC_CHANNEL_DAC1CH2 (5)
  • LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
  • LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
  • LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
  • LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
(1) On STM32L4, parameter available only on ADC instance: ADC1.
(2) On STM32L4, parameter available only on ADC instance: ADC2.
(3) On STM32L4, parameter available only on ADC instance: ADC3.
(4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.
(5) On STM32L4, parameter available on devices with only 1 ADC instance.
(6) On STM32L4, parameter available on devices with several ADC instances.
(7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)). Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).
OffsetLevelValue between Min_Data=0x000 and Max_Data=0xFFF
Return values
None

Definition at line 2855 of file stm32l4xx_ll_adc.h.

2856 {
2857  register __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->OFR1, Offsety);
2858 
2859  MODIFY_REG(*preg,
2860  ADC_OFR1_OFFSET1_EN | ADC_OFR1_OFFSET1_CH | ADC_OFR1_OFFSET1,
2861  ADC_OFR1_OFFSET1_EN | (Channel & ADC_CHANNEL_ID_NUMBER_MASK) | OffsetLevel);
2862 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_ADC_SetOffsetState()

__STATIC_INLINE void LL_ADC_SetOffsetState ( ADC_TypeDef *  ADCx,
uint32_t  Offsety,
uint32_t  OffsetState 
)

Set for the ADC selected offset number 1, 2, 3 or 4: force offset state disable or enable without modifying offset channel or offset value.

Note
This function should be needed only in case of offset to be enabled-disabled dynamically, and should not be needed in other cases: function LL_ADC_SetOffset() automatically enables the offset.
On this STM32 serie, setting of this feature is conditioned to ADC state: ADC must be disabled or enabled without conversion on going on either groups regular or injected. OFR1 OFFSET1_EN LL_ADC_SetOffsetState
OFR2 OFFSET2_EN LL_ADC_SetOffsetState
OFR3 OFFSET3_EN LL_ADC_SetOffsetState
OFR4 OFFSET4_EN LL_ADC_SetOffsetState
Parameters
ADCxADC instance
OffsetyThis parameter can be one of the following values:
  • LL_ADC_OFFSET_1
  • LL_ADC_OFFSET_2
  • LL_ADC_OFFSET_3
  • LL_ADC_OFFSET_4
OffsetStateThis parameter can be one of the following values:
  • LL_ADC_OFFSET_DISABLE
  • LL_ADC_OFFSET_ENABLE
Return values
None

Definition at line 2993 of file stm32l4xx_ll_adc.h.

2994 {
2995  register __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->OFR1, Offsety);
2996 
2997  MODIFY_REG(*preg,
2998  ADC_OFR1_OFFSET1_EN,
2999  OffsetState);
3000 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_ADC_SetResolution()

__STATIC_INLINE void LL_ADC_SetResolution ( ADC_TypeDef *  ADCx,
uint32_t  Resolution 
)

Set ADC resolution. Refer to reference manual for alignments formats dependencies to ADC resolutions.

Note
On this STM32 serie, setting of this feature is conditioned to ADC state: ADC must be disabled or enabled without conversion on going on either groups regular or injected. CFGR RES LL_ADC_SetResolution
Parameters
ADCxADC instance
ResolutionThis parameter can be one of the following values:
  • LL_ADC_RESOLUTION_12B
  • LL_ADC_RESOLUTION_10B
  • LL_ADC_RESOLUTION_8B
  • LL_ADC_RESOLUTION_6B
Return values
None

Definition at line 2617 of file stm32l4xx_ll_adc.h.

2618 {
2619  MODIFY_REG(ADCx->CFGR, ADC_CFGR_RES, Resolution);
2620 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_ADC_SetSamplingTimeCommonConfig()

__STATIC_INLINE void LL_ADC_SetSamplingTimeCommonConfig ( ADC_TypeDef *  ADCx,
uint32_t  SamplingTimeCommonConfig 
)

Set ADC sampling time common configuration impacting settings of sampling time channel wise.

Note
On this STM32 serie, setting of this feature is conditioned to ADC state: ADC must be disabled or enabled without conversion on going on either groups regular or injected. SMPR1 SMPPLUS LL_ADC_SetSamplingTimeCommonConfig
Parameters
ADCxADC instance
SamplingTimeCommonConfigThis parameter can be one of the following values:
  • LL_ADC_SAMPLINGTIME_COMMON_DEFAULT
  • LL_ADC_SAMPLINGTIME_COMMON_3C5_REPL_2C5
Return values
None

Definition at line 3041 of file stm32l4xx_ll_adc.h.

3042 {
3043  MODIFY_REG(ADCx->SMPR1, ADC_SMPR1_SMPPLUS, SamplingTimeCommonConfig);
3044 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)