STM32F439xx HAL User Manual
Functions
Configuration of ADC hierarchical scope: group regular
ADC Exported Functions

Functions

__STATIC_INLINE void LL_ADC_REG_SetTriggerSource (ADC_TypeDef *ADCx, uint32_t TriggerSource)
 Set ADC group regular conversion trigger source: internal (SW start) or from external IP (timer event, external interrupt line).
__STATIC_INLINE uint32_t LL_ADC_REG_GetTriggerSource (ADC_TypeDef *ADCx)
 Get ADC group regular conversion trigger source: internal (SW start) or from external IP (timer event, external interrupt line).
__STATIC_INLINE uint32_t LL_ADC_REG_IsTriggerSourceSWStart (ADC_TypeDef *ADCx)
 Get ADC group regular conversion trigger source internal (SW start) or external.
__STATIC_INLINE uint32_t LL_ADC_REG_GetTriggerEdge (ADC_TypeDef *ADCx)
 Get ADC group regular conversion trigger polarity.
__STATIC_INLINE void LL_ADC_REG_SetSequencerLength (ADC_TypeDef *ADCx, uint32_t SequencerNbRanks)
 Set ADC group regular sequencer length and scan direction.
__STATIC_INLINE uint32_t LL_ADC_REG_GetSequencerLength (ADC_TypeDef *ADCx)
 Get ADC group regular sequencer length and scan direction.
__STATIC_INLINE void LL_ADC_REG_SetSequencerDiscont (ADC_TypeDef *ADCx, uint32_t SeqDiscont)
 Set ADC group regular sequencer discontinuous mode: sequence subdivided and scan conversions interrupted every selected number of ranks.
__STATIC_INLINE uint32_t LL_ADC_REG_GetSequencerDiscont (ADC_TypeDef *ADCx)
 Get ADC group regular sequencer discontinuous mode: sequence subdivided and scan conversions interrupted every selected number of ranks.
__STATIC_INLINE void LL_ADC_REG_SetSequencerRanks (ADC_TypeDef *ADCx, uint32_t Rank, uint32_t Channel)
 Set ADC group regular sequence: channel on the selected scan sequence rank.
__STATIC_INLINE uint32_t LL_ADC_REG_GetSequencerRanks (ADC_TypeDef *ADCx, uint32_t Rank)
 Get ADC group regular sequence: channel on the selected scan sequence rank.
__STATIC_INLINE void LL_ADC_REG_SetContinuousMode (ADC_TypeDef *ADCx, uint32_t Continuous)
 Set ADC continuous conversion mode on ADC group regular.
__STATIC_INLINE uint32_t LL_ADC_REG_GetContinuousMode (ADC_TypeDef *ADCx)
 Get ADC continuous conversion mode on ADC group regular.
__STATIC_INLINE void LL_ADC_REG_SetDMATransfer (ADC_TypeDef *ADCx, uint32_t DMATransfer)
 Set ADC group regular conversion data transfer: no transfer or transfer by DMA, and DMA requests mode.
__STATIC_INLINE uint32_t LL_ADC_REG_GetDMATransfer (ADC_TypeDef *ADCx)
 Get ADC group regular conversion data transfer: no transfer or transfer by DMA, and DMA requests mode.
__STATIC_INLINE void LL_ADC_REG_SetFlagEndOfConversion (ADC_TypeDef *ADCx, uint32_t EocSelection)
 Specify which ADC flag between EOC (end of unitary conversion) or EOS (end of sequence conversions) is used to indicate the end of conversion.
__STATIC_INLINE uint32_t LL_ADC_REG_GetFlagEndOfConversion (ADC_TypeDef *ADCx)
 Get which ADC flag between EOC (end of unitary conversion) or EOS (end of sequence conversions) is used to indicate the end of conversion.

Function Documentation

__STATIC_INLINE uint32_t LL_ADC_REG_GetContinuousMode ( ADC_TypeDef *  ADCx)

Get ADC continuous conversion mode on ADC group regular.

Note:
Description of ADC continuous conversion mode:
  • single mode: one conversion per trigger
  • continuous mode: after the first trigger, following conversions launched successively automatically.
Reference Manual to LL API cross reference:
CR2 CONT LL_ADC_REG_GetContinuousMode
Parameters:
ADCxADC instance
Return values:
Returnedvalue can be one of the following values:

Definition at line 2539 of file stm32f4xx_ll_adc.h.

__STATIC_INLINE uint32_t LL_ADC_REG_GetDMATransfer ( ADC_TypeDef *  ADCx)

Get ADC group regular conversion data transfer: no transfer or transfer by DMA, and DMA requests mode.

Note:
If transfer by DMA selected, specifies the DMA requests mode:
  • Limited mode (One shot mode): DMA transfer requests are stopped when number of DMA data transfers (number of ADC conversions) is reached. This ADC mode is intended to be used with DMA mode non-circular.
  • Unlimited mode: DMA transfer requests are unlimited, whatever number of DMA data transfers (number of ADC conversions). This ADC mode is intended to be used with DMA mode circular.
If ADC DMA requests mode is set to unlimited and DMA is set to mode non-circular: when DMA transfers size will be reached, DMA will stop transfers of ADC conversions data ADC will raise an overrun error (overrun flag and interruption if enabled).
For devices with several ADC instances: ADC multimode DMA settings are available using function LL_ADC_GetMultiDMATransfer().
To configure DMA source address (peripheral address), use function LL_ADC_DMA_GetRegAddr().
Reference Manual to LL API cross reference:
CR2 DMA LL_ADC_REG_GetDMATransfer
CR2 DDS LL_ADC_REG_GetDMATransfer
Parameters:
ADCxADC instance
Return values:
Returnedvalue can be one of the following values:

Definition at line 2610 of file stm32f4xx_ll_adc.h.

__STATIC_INLINE uint32_t LL_ADC_REG_GetFlagEndOfConversion ( ADC_TypeDef *  ADCx)

Get which ADC flag between EOC (end of unitary conversion) or EOS (end of sequence conversions) is used to indicate the end of conversion.

Reference Manual to LL API cross reference:
CR2 EOCS LL_ADC_REG_GetFlagEndOfConversion
Parameters:
ADCxADC instance
Return values:
Returnedvalue can be one of the following values:

Definition at line 2647 of file stm32f4xx_ll_adc.h.

__STATIC_INLINE uint32_t LL_ADC_REG_GetSequencerDiscont ( ADC_TypeDef *  ADCx)

Get ADC group regular sequencer discontinuous mode: sequence subdivided and scan conversions interrupted every selected number of ranks.

Reference Manual to LL API cross reference:
CR1 DISCEN LL_ADC_REG_GetSequencerDiscont
CR1 DISCNUM LL_ADC_REG_GetSequencerDiscont
Parameters:
ADCxADC instance
Return values:
Returnedvalue can be one of the following values:

Definition at line 2317 of file stm32f4xx_ll_adc.h.

__STATIC_INLINE uint32_t LL_ADC_REG_GetSequencerLength ( ADC_TypeDef *  ADCx)

Get ADC group regular sequencer length and scan direction.

Note:
Description of ADC group regular sequencer features:
  • For devices with sequencer fully configurable (function "LL_ADC_REG_SetSequencerRanks()" available): sequencer length and each rank affectation to a channel are configurable. This function retrieves:
    • Sequence length: Number of ranks in the scan sequence.
    • Sequence direction: Unless specified in parameters, sequencer scan direction is forward (from rank 1 to rank n). Sequencer ranks are selected using function "LL_ADC_REG_SetSequencerRanks()".
  • For devices with sequencer not fully configurable (function "LL_ADC_REG_SetSequencerChannels()" available): sequencer length and each rank affectation to a channel are defined by channel number. This function retrieves:
    • Sequence length: Number of ranks in the scan sequence is defined by number of channels set in the sequence, rank of each channel is fixed by channel HW number. (channel 0 fixed on rank 0, channel 1 fixed on rank1, ...).
    • Sequence direction: Unless specified in parameters, sequencer scan direction is forward (from lowest channel number to highest channel number). Sequencer ranks are selected using function "LL_ADC_REG_SetSequencerChannels()".
On this STM32 serie, group regular sequencer configuration is conditioned to ADC instance sequencer mode. If ADC instance sequencer mode is disabled, sequencers of all groups (group regular, group injected) can be configured but their execution is disabled (limited to rank 1). Refer to function LL_ADC_SetSequencersScanMode().
Sequencer disabled is equivalent to sequencer of 1 rank: ADC conversion on only 1 channel.
Reference Manual to LL API cross reference:
SQR1 L LL_ADC_REG_SetSequencerLength
Parameters:
ADCxADC instance
Return values:
Returnedvalue can be one of the following values:

Definition at line 2266 of file stm32f4xx_ll_adc.h.

__STATIC_INLINE uint32_t LL_ADC_REG_GetSequencerRanks ( ADC_TypeDef *  ADCx,
uint32_t  Rank 
)

Get ADC group regular sequence: channel on the selected scan sequence rank.

Note:
On this STM32 serie, ADC group regular sequencer is fully configurable: sequencer length and each rank affectation to a channel are configurable. Refer to description of function LL_ADC_REG_SetSequencerLength().
Depending on devices and packages, some channels may not be available. Refer to device datasheet for channels availability.
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().
Reference Manual to LL API cross reference:
SQR3 SQ1 LL_ADC_REG_GetSequencerRanks
SQR3 SQ2 LL_ADC_REG_GetSequencerRanks
SQR3 SQ3 LL_ADC_REG_GetSequencerRanks
SQR3 SQ4 LL_ADC_REG_GetSequencerRanks
SQR3 SQ5 LL_ADC_REG_GetSequencerRanks
SQR3 SQ6 LL_ADC_REG_GetSequencerRanks
SQR2 SQ7 LL_ADC_REG_GetSequencerRanks
SQR2 SQ8 LL_ADC_REG_GetSequencerRanks
SQR2 SQ9 LL_ADC_REG_GetSequencerRanks
SQR2 SQ10 LL_ADC_REG_GetSequencerRanks
SQR2 SQ11 LL_ADC_REG_GetSequencerRanks
SQR2 SQ12 LL_ADC_REG_GetSequencerRanks
SQR1 SQ13 LL_ADC_REG_GetSequencerRanks
SQR1 SQ14 LL_ADC_REG_GetSequencerRanks
SQR1 SQ15 LL_ADC_REG_GetSequencerRanks
SQR1 SQ16 LL_ADC_REG_GetSequencerRanks
Parameters:
ADCxADC instance
RankThis parameter can be one of the following values:
Return values:
Returnedvalue can be one of the following values: (1) On STM32F4, parameter available only on ADC instance: ADC1.
(2) On devices STM32F42x and STM32F43x, limitation: this internal channel is shared between temperature sensor and Vbat, only 1 measurement path must be enabled.
(1) 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 2497 of file stm32f4xx_ll_adc.h.

References __ADC_MASK_SHIFT, __ADC_PTR_REG_OFFSET, ADC_CHANNEL_ID_NUMBER_MASK, ADC_REG_RANK_ID_SQRX_MASK, and ADC_REG_SQRX_REGOFFSET_MASK.

__STATIC_INLINE uint32_t LL_ADC_REG_GetTriggerEdge ( ADC_TypeDef *  ADCx)

Get ADC group regular conversion trigger polarity.

Note:
Applicable only for trigger source set to external trigger.
On this STM32 serie, setting of external trigger edge is performed using function LL_ADC_REG_StartConversionExtTrig().
Reference Manual to LL API cross reference:
CR2 EXTEN LL_ADC_REG_GetTriggerEdge
Parameters:
ADCxADC instance
Return values:
Returnedvalue can be one of the following values:

Definition at line 2144 of file stm32f4xx_ll_adc.h.

__STATIC_INLINE uint32_t LL_ADC_REG_GetTriggerSource ( ADC_TypeDef *  ADCx)

Get ADC group regular conversion trigger source: internal (SW start) or from external IP (timer event, external interrupt line).

Note:
To determine whether group regular trigger source is internal (SW start) or external, without detail of which peripheral is selected as external trigger, (equivalent to "if(LL_ADC_REG_GetTriggerSource(ADC1) == LL_ADC_REG_TRIG_SOFTWARE)") use function LL_ADC_REG_IsTriggerSourceSWStart.
Availability of parameters of trigger sources from timer depends on timers availability on the selected device.
Reference Manual to LL API cross reference:
CR2 EXTSEL LL_ADC_REG_GetTriggerSource
CR2 EXTEN LL_ADC_REG_GetTriggerSource
Parameters:
ADCxADC instance
Return values:
Returnedvalue can be one of the following values:

Definition at line 2100 of file stm32f4xx_ll_adc.h.

References ADC_REG_TRIG_EDGE_MASK, ADC_REG_TRIG_EXTEN_BITOFFSET_POS, and ADC_REG_TRIG_SOURCE_MASK.

__STATIC_INLINE uint32_t LL_ADC_REG_IsTriggerSourceSWStart ( ADC_TypeDef *  ADCx)

Get ADC group regular conversion trigger source internal (SW start) or external.

Note:
In case of group regular trigger source set to external trigger, to determine which peripheral is selected as external trigger, use function LL_ADC_REG_GetTriggerSource().
Reference Manual to LL API cross reference:
CR2 EXTEN LL_ADC_REG_IsTriggerSourceSWStart
Parameters:
ADCxADC instance
Return values:
Value"0" if trigger source external trigger Value "1" if trigger source SW start.

Definition at line 2127 of file stm32f4xx_ll_adc.h.

References LL_ADC_REG_TRIG_SOFTWARE.

__STATIC_INLINE void LL_ADC_REG_SetContinuousMode ( ADC_TypeDef *  ADCx,
uint32_t  Continuous 
)

Set ADC continuous conversion mode on ADC group regular.

Note:
Description of ADC continuous conversion mode:
  • single mode: one conversion per trigger
  • continuous mode: after the first trigger, following conversions launched successively automatically.
It is not possible to enable both ADC group regular continuous mode and sequencer discontinuous mode.
Reference Manual to LL API cross reference:
CR2 CONT LL_ADC_REG_SetContinuousMode
Parameters:
ADCxADC instance
ContinuousThis parameter can be one of the following values:
Return values:
None

Definition at line 2522 of file stm32f4xx_ll_adc.h.

__STATIC_INLINE void LL_ADC_REG_SetDMATransfer ( ADC_TypeDef *  ADCx,
uint32_t  DMATransfer 
)

Set ADC group regular conversion data transfer: no transfer or transfer by DMA, and DMA requests mode.

Note:
If transfer by DMA selected, specifies the DMA requests mode:
  • Limited mode (One shot mode): DMA transfer requests are stopped when number of DMA data transfers (number of ADC conversions) is reached. This ADC mode is intended to be used with DMA mode non-circular.
  • Unlimited mode: DMA transfer requests are unlimited, whatever number of DMA data transfers (number of ADC conversions). This ADC mode is intended to be used with DMA mode circular.
If ADC DMA requests mode is set to unlimited and DMA is set to mode non-circular: when DMA transfers size will be reached, DMA will stop transfers of ADC conversions data ADC will raise an overrun error (overrun flag and interruption if enabled).
For devices with several ADC instances: ADC multimode DMA settings are available using function LL_ADC_SetMultiDMATransfer().
To configure DMA source address (peripheral address), use function LL_ADC_DMA_GetRegAddr().
Reference Manual to LL API cross reference:
CR2 DMA LL_ADC_REG_SetDMATransfer
CR2 DDS LL_ADC_REG_SetDMATransfer
Parameters:
ADCxADC instance
DMATransferThis parameter can be one of the following values:
Return values:
None

Definition at line 2575 of file stm32f4xx_ll_adc.h.

__STATIC_INLINE void LL_ADC_REG_SetFlagEndOfConversion ( ADC_TypeDef *  ADCx,
uint32_t  EocSelection 
)

Specify which ADC flag between EOC (end of unitary conversion) or EOS (end of sequence conversions) is used to indicate the end of conversion.

Note:
This feature is aimed to be set when using ADC with programming model by polling or interruption (programming model by DMA usually uses DMA interruptions to indicate end of conversion and data transfer).
For ADC group injected, end of conversion (flag&IT) is raised only at the end of the sequence.
Reference Manual to LL API cross reference:
CR2 EOCS LL_ADC_REG_SetFlagEndOfConversion
Parameters:
ADCxADC instance
EocSelectionThis parameter can be one of the following values:
Return values:
None

Definition at line 2632 of file stm32f4xx_ll_adc.h.

__STATIC_INLINE void LL_ADC_REG_SetSequencerDiscont ( ADC_TypeDef *  ADCx,
uint32_t  SeqDiscont 
)

Set ADC group regular sequencer discontinuous mode: sequence subdivided and scan conversions interrupted every selected number of ranks.

Note:
It is not possible to enable both ADC group regular continuous mode and sequencer discontinuous mode.
It is not possible to enable both ADC auto-injected mode and ADC group regular sequencer discontinuous mode.
Reference Manual to LL API cross reference:
CR1 DISCEN LL_ADC_REG_SetSequencerDiscont
CR1 DISCNUM LL_ADC_REG_SetSequencerDiscont
Parameters:
ADCxADC instance
SeqDiscontThis parameter can be one of the following values:
Return values:
None

Definition at line 2294 of file stm32f4xx_ll_adc.h.

__STATIC_INLINE void LL_ADC_REG_SetSequencerLength ( ADC_TypeDef *  ADCx,
uint32_t  SequencerNbRanks 
)

Set ADC group regular sequencer length and scan direction.

Note:
Description of ADC group regular sequencer features:
  • For devices with sequencer fully configurable (function "LL_ADC_REG_SetSequencerRanks()" available): sequencer length and each rank affectation to a channel are configurable. This function performs configuration of:
    • Sequence length: Number of ranks in the scan sequence.
    • Sequence direction: Unless specified in parameters, sequencer scan direction is forward (from rank 1 to rank n). Sequencer ranks are selected using function "LL_ADC_REG_SetSequencerRanks()".
  • For devices with sequencer not fully configurable (function "LL_ADC_REG_SetSequencerChannels()" available): sequencer length and each rank affectation to a channel are defined by channel number. This function performs configuration of:
    • Sequence length: Number of ranks in the scan sequence is defined by number of channels set in the sequence, rank of each channel is fixed by channel HW number. (channel 0 fixed on rank 0, channel 1 fixed on rank1, ...).
    • Sequence direction: Unless specified in parameters, sequencer scan direction is forward (from lowest channel number to highest channel number). Sequencer ranks are selected using function "LL_ADC_REG_SetSequencerChannels()".
On this STM32 serie, group regular sequencer configuration is conditioned to ADC instance sequencer mode. If ADC instance sequencer mode is disabled, sequencers of all groups (group regular, group injected) can be configured but their execution is disabled (limited to rank 1). Refer to function LL_ADC_SetSequencersScanMode().
Sequencer disabled is equivalent to sequencer of 1 rank: ADC conversion on only 1 channel.
Reference Manual to LL API cross reference:
SQR1 L LL_ADC_REG_SetSequencerLength
Parameters:
ADCxADC instance
SequencerNbRanksThis parameter can be one of the following values:
Return values:
None

Definition at line 2206 of file stm32f4xx_ll_adc.h.

Referenced by LL_ADC_REG_Init().

__STATIC_INLINE void LL_ADC_REG_SetSequencerRanks ( ADC_TypeDef *  ADCx,
uint32_t  Rank,
uint32_t  Channel 
)

Set ADC group regular sequence: channel on the selected scan sequence rank.

Note:
This function performs configuration of:
  • Channels ordering into each rank of scan sequence: whatever channel can be placed into whatever rank.
On this STM32 serie, ADC group regular sequencer is fully configurable: sequencer length and each rank affectation to a channel are configurable. Refer to description of function LL_ADC_REG_SetSequencerLength().
Depending on devices and packages, some channels may not be available. Refer to device datasheet for channels availability.
On this STM32 serie, to measure internal channels (VrefInt, TempSensor, ...), measurement paths to internal channels must be enabled separately. This can be done using function LL_ADC_SetCommonPathInternalCh().
Reference Manual to LL API cross reference:
SQR3 SQ1 LL_ADC_REG_SetSequencerRanks
SQR3 SQ2 LL_ADC_REG_SetSequencerRanks
SQR3 SQ3 LL_ADC_REG_SetSequencerRanks
SQR3 SQ4 LL_ADC_REG_SetSequencerRanks
SQR3 SQ5 LL_ADC_REG_SetSequencerRanks
SQR3 SQ6 LL_ADC_REG_SetSequencerRanks
SQR2 SQ7 LL_ADC_REG_SetSequencerRanks
SQR2 SQ8 LL_ADC_REG_SetSequencerRanks
SQR2 SQ9 LL_ADC_REG_SetSequencerRanks
SQR2 SQ10 LL_ADC_REG_SetSequencerRanks
SQR2 SQ11 LL_ADC_REG_SetSequencerRanks
SQR2 SQ12 LL_ADC_REG_SetSequencerRanks
SQR1 SQ13 LL_ADC_REG_SetSequencerRanks
SQR1 SQ14 LL_ADC_REG_SetSequencerRanks
SQR1 SQ15 LL_ADC_REG_SetSequencerRanks
SQR1 SQ16 LL_ADC_REG_SetSequencerRanks
Parameters:
ADCxADC instance
RankThis parameter can be one of the following values:
ChannelThis parameter can be one of the following values: (1) On STM32F4, parameter available only on ADC instance: ADC1.
(2) On devices STM32F42x and STM32F43x, limitation: this internal channel is shared between temperature sensor and Vbat, only 1 measurement path must be enabled.
Return values:
None

Definition at line 2400 of file stm32f4xx_ll_adc.h.

References __ADC_MASK_SHIFT, __ADC_PTR_REG_OFFSET, ADC_CHANNEL_ID_NUMBER_MASK, ADC_REG_RANK_ID_SQRX_MASK, and ADC_REG_SQRX_REGOFFSET_MASK.

__STATIC_INLINE void LL_ADC_REG_SetTriggerSource ( ADC_TypeDef *  ADCx,
uint32_t  TriggerSource 
)

Set ADC group regular conversion trigger source: internal (SW start) or from external IP (timer event, external interrupt line).

Note:
On this STM32 serie, setting of external trigger edge is performed using function LL_ADC_REG_StartConversionExtTrig().
Availability of parameters of trigger sources from timer depends on timers availability on the selected device.
Reference Manual to LL API cross reference:
CR2 EXTSEL LL_ADC_REG_SetTriggerSource
CR2 EXTEN LL_ADC_REG_SetTriggerSource
Parameters:
ADCxADC instance
TriggerSourceThis parameter can be one of the following values:
Return values:
None

Definition at line 2056 of file stm32f4xx_ll_adc.h.

Referenced by LL_ADC_DeInit().