STM32L4xx_HAL_Driver  1.14.0
Configuration of ADC hierarchical scope: group regular

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 peripheral (timer event, external interrupt line). More...
 
__STATIC_INLINE uint32_t LL_ADC_REG_GetTriggerSource (ADC_TypeDef *ADCx)
 Get ADC group regular conversion trigger source: internal (SW start) or from external peripheral (timer event, external interrupt line). More...
 
__STATIC_INLINE uint32_t LL_ADC_REG_IsTriggerSourceSWStart (ADC_TypeDef *ADCx)
 Get ADC group regular conversion trigger source internal (SW start) or external. More...
 
__STATIC_INLINE void LL_ADC_REG_SetTriggerEdge (ADC_TypeDef *ADCx, uint32_t ExternalTriggerEdge)
 Set ADC group regular conversion trigger polarity. More...
 
__STATIC_INLINE uint32_t LL_ADC_REG_GetTriggerEdge (ADC_TypeDef *ADCx)
 Get ADC group regular conversion trigger polarity. More...
 
__STATIC_INLINE void LL_ADC_REG_SetSequencerLength (ADC_TypeDef *ADCx, uint32_t SequencerNbRanks)
 Set ADC group regular sequencer length and scan direction. More...
 
__STATIC_INLINE uint32_t LL_ADC_REG_GetSequencerLength (ADC_TypeDef *ADCx)
 Get ADC group regular sequencer length and scan direction. More...
 
__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. More...
 
__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. CFGR DISCEN LL_ADC_REG_GetSequencerDiscont
CFGR DISCNUM LL_ADC_REG_GetSequencerDiscont. More...
 
__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. More...
 
__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. More...
 
__STATIC_INLINE void LL_ADC_REG_SetContinuousMode (ADC_TypeDef *ADCx, uint32_t Continuous)
 Set ADC continuous conversion mode on ADC group regular. More...
 
__STATIC_INLINE uint32_t LL_ADC_REG_GetContinuousMode (ADC_TypeDef *ADCx)
 Get ADC continuous conversion mode on ADC group regular. More...
 
__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. More...
 
__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. More...
 
__STATIC_INLINE void LL_ADC_REG_SetDFSDMTransfer (ADC_TypeDef *ADCx, uint32_t DFSDMTransfer)
 Set ADC group regular conversion data transfer to DFSDM. More...
 
__STATIC_INLINE uint32_t LL_ADC_REG_GetDFSDMTransfer (ADC_TypeDef *ADCx)
 Get ADC group regular conversion data transfer to DFSDM. CFGR DFSDMCFG LL_ADC_REG_GetDFSDMTransfer. More...
 
__STATIC_INLINE void LL_ADC_REG_SetOverrun (ADC_TypeDef *ADCx, uint32_t Overrun)
 Set ADC group regular behavior in case of overrun: data preserved or overwritten. More...
 
__STATIC_INLINE uint32_t LL_ADC_REG_GetOverrun (ADC_TypeDef *ADCx)
 Get ADC group regular behavior in case of overrun: data preserved or overwritten. CFGR OVRMOD LL_ADC_REG_GetOverrun. More...
 

Detailed Description

Function Documentation

◆ LL_ADC_REG_GetContinuousMode()

__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. CFGR CONT LL_ADC_REG_GetContinuousMode
Parameters
ADCxADC instance
Return values
Returnedvalue can be one of the following values:
  • LL_ADC_REG_CONV_SINGLE
  • LL_ADC_REG_CONV_CONTINUOUS

Definition at line 3631 of file stm32l4xx_ll_adc.h.

3632 {
3633  return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_CONT));
3634 }

◆ LL_ADC_REG_GetDFSDMTransfer()

__STATIC_INLINE uint32_t LL_ADC_REG_GetDFSDMTransfer ( ADC_TypeDef *  ADCx)

Get ADC group regular conversion data transfer to DFSDM. CFGR DFSDMCFG LL_ADC_REG_GetDFSDMTransfer.

Parameters
ADCxADC instance
Return values
Returnedvalue can be one of the following values:
  • LL_ADC_REG_DFSDM_TRANSFER_NONE
  • LL_ADC_REG_DFSDM_TRANSFER_ENABLE

Definition at line 3742 of file stm32l4xx_ll_adc.h.

3743 {
3744  return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_DFSDMCFG));
3745 }

◆ LL_ADC_REG_GetDMATransfer()

__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(). CFGR DMAEN LL_ADC_REG_GetDMATransfer
CFGR DMACFG LL_ADC_REG_GetDMATransfer
Parameters
ADCxADC instance
Return values
Returnedvalue can be one of the following values:
  • LL_ADC_REG_DMA_TRANSFER_NONE
  • LL_ADC_REG_DMA_TRANSFER_LIMITED
  • LL_ADC_REG_DMA_TRANSFER_UNLIMITED

Definition at line 3706 of file stm32l4xx_ll_adc.h.

3707 {
3708  return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_DMAEN | ADC_CFGR_DMACFG));
3709 }

◆ LL_ADC_REG_GetOverrun()

__STATIC_INLINE uint32_t LL_ADC_REG_GetOverrun ( ADC_TypeDef *  ADCx)

Get ADC group regular behavior in case of overrun: data preserved or overwritten. CFGR OVRMOD LL_ADC_REG_GetOverrun.

Parameters
ADCxADC instance
Return values
Returnedvalue can be one of the following values:
  • LL_ADC_REG_OVR_DATA_PRESERVED
  • LL_ADC_REG_OVR_DATA_OVERWRITTEN

Definition at line 3782 of file stm32l4xx_ll_adc.h.

3783 {
3784  return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_OVRMOD));
3785 }

◆ LL_ADC_REG_GetSequencerDiscont()

__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. CFGR DISCEN LL_ADC_REG_GetSequencerDiscont
CFGR DISCNUM LL_ADC_REG_GetSequencerDiscont.

Parameters
ADCxADC instance
Return values
Returnedvalue can be one of the following values:
  • LL_ADC_REG_SEQ_DISCONT_DISABLE
  • LL_ADC_REG_SEQ_DISCONT_1RANK
  • LL_ADC_REG_SEQ_DISCONT_2RANKS
  • LL_ADC_REG_SEQ_DISCONT_3RANKS
  • LL_ADC_REG_SEQ_DISCONT_4RANKS
  • LL_ADC_REG_SEQ_DISCONT_5RANKS
  • LL_ADC_REG_SEQ_DISCONT_6RANKS
  • LL_ADC_REG_SEQ_DISCONT_7RANKS
  • LL_ADC_REG_SEQ_DISCONT_8RANKS

Definition at line 3377 of file stm32l4xx_ll_adc.h.

3378 {
3379  return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_DISCEN | ADC_CFGR_DISCNUM));
3380 }

◆ LL_ADC_REG_GetSequencerLength()

__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()".
Sequencer disabled is equivalent to sequencer of 1 rank: ADC conversion on only 1 channel. SQR1 L LL_ADC_REG_GetSequencerLength
Parameters
ADCxADC instance
Return values
Returnedvalue can be one of the following values:
  • LL_ADC_REG_SEQ_SCAN_DISABLE
  • LL_ADC_REG_SEQ_SCAN_ENABLE_2RANKS
  • LL_ADC_REG_SEQ_SCAN_ENABLE_3RANKS
  • LL_ADC_REG_SEQ_SCAN_ENABLE_4RANKS
  • LL_ADC_REG_SEQ_SCAN_ENABLE_5RANKS
  • LL_ADC_REG_SEQ_SCAN_ENABLE_6RANKS
  • LL_ADC_REG_SEQ_SCAN_ENABLE_7RANKS
  • LL_ADC_REG_SEQ_SCAN_ENABLE_8RANKS
  • LL_ADC_REG_SEQ_SCAN_ENABLE_9RANKS
  • LL_ADC_REG_SEQ_SCAN_ENABLE_10RANKS
  • LL_ADC_REG_SEQ_SCAN_ENABLE_11RANKS
  • LL_ADC_REG_SEQ_SCAN_ENABLE_12RANKS
  • LL_ADC_REG_SEQ_SCAN_ENABLE_13RANKS
  • LL_ADC_REG_SEQ_SCAN_ENABLE_14RANKS
  • LL_ADC_REG_SEQ_SCAN_ENABLE_15RANKS
  • LL_ADC_REG_SEQ_SCAN_ENABLE_16RANKS

Definition at line 3322 of file stm32l4xx_ll_adc.h.

3323 {
3324  return (uint32_t)(READ_BIT(ADCx->SQR1, ADC_SQR1_L));
3325 }

◆ LL_ADC_REG_GetSequencerRanks()

__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(). SQR1 SQ1 LL_ADC_REG_GetSequencerRanks
    SQR1 SQ2 LL_ADC_REG_GetSequencerRanks
    SQR1 SQ3 LL_ADC_REG_GetSequencerRanks
    SQR1 SQ4 LL_ADC_REG_GetSequencerRanks
    SQR2 SQ5 LL_ADC_REG_GetSequencerRanks
    SQR2 SQ6 LL_ADC_REG_GetSequencerRanks
    SQR2 SQ7 LL_ADC_REG_GetSequencerRanks
    SQR2 SQ8 LL_ADC_REG_GetSequencerRanks
    SQR2 SQ9 LL_ADC_REG_GetSequencerRanks
    SQR3 SQ10 LL_ADC_REG_GetSequencerRanks
    SQR3 SQ11 LL_ADC_REG_GetSequencerRanks
    SQR3 SQ12 LL_ADC_REG_GetSequencerRanks
    SQR3 SQ13 LL_ADC_REG_GetSequencerRanks
    SQR3 SQ14 LL_ADC_REG_GetSequencerRanks
    SQR4 SQ15 LL_ADC_REG_GetSequencerRanks
    SQR4 SQ16 LL_ADC_REG_GetSequencerRanks
Parameters
ADCxADC instance
RankThis parameter can be one of the following values:
  • LL_ADC_REG_RANK_1
  • LL_ADC_REG_RANK_2
  • LL_ADC_REG_RANK_3
  • LL_ADC_REG_RANK_4
  • LL_ADC_REG_RANK_5
  • LL_ADC_REG_RANK_6
  • LL_ADC_REG_RANK_7
  • LL_ADC_REG_RANK_8
  • LL_ADC_REG_RANK_9
  • LL_ADC_REG_RANK_10
  • LL_ADC_REG_RANK_11
  • LL_ADC_REG_RANK_12
  • LL_ADC_REG_RANK_13
  • LL_ADC_REG_RANK_14
  • LL_ADC_REG_RANK_15
  • LL_ADC_REG_RANK_16
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 3585 of file stm32l4xx_ll_adc.h.

3586 {
3587  register const __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->SQR1, ((Rank & ADC_REG_SQRX_REGOFFSET_MASK) >> ADC_SQRX_REGOFFSET_POS));
3588 
3589  return (uint32_t)((READ_BIT(*preg,
3590  ADC_CHANNEL_ID_NUMBER_MASK_POSBIT0 << (Rank & ADC_REG_RANK_ID_SQRX_MASK))
3591  >> (Rank & ADC_REG_RANK_ID_SQRX_MASK)) << ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS
3592  );
3593 }

◆ LL_ADC_REG_GetTriggerEdge()

__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. CFGR EXTEN LL_ADC_REG_GetTriggerEdge
Parameters
ADCxADC instance
Return values
Returnedvalue can be one of the following values:
  • LL_ADC_REG_TRIG_EXT_RISING
  • LL_ADC_REG_TRIG_EXT_FALLING
  • LL_ADC_REG_TRIG_EXT_RISINGFALLING

Definition at line 3209 of file stm32l4xx_ll_adc.h.

3210 {
3211  return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_EXTEN));
3212 }

◆ LL_ADC_REG_GetTriggerSource()

__STATIC_INLINE uint32_t LL_ADC_REG_GetTriggerSource ( ADC_TypeDef *  ADCx)

Get ADC group regular conversion trigger source: internal (SW start) or from external peripheral (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. CFGR EXTSEL LL_ADC_REG_GetTriggerSource
CFGR EXTEN LL_ADC_REG_GetTriggerSource
Parameters
ADCxADC instance
Return values
Returnedvalue can be one of the following values:
  • LL_ADC_REG_TRIG_SOFTWARE
  • LL_ADC_REG_TRIG_EXT_TIM1_TRGO
  • LL_ADC_REG_TRIG_EXT_TIM1_TRGO2
  • LL_ADC_REG_TRIG_EXT_TIM1_CH1
  • LL_ADC_REG_TRIG_EXT_TIM1_CH2
  • LL_ADC_REG_TRIG_EXT_TIM1_CH3
  • LL_ADC_REG_TRIG_EXT_TIM2_TRGO
  • LL_ADC_REG_TRIG_EXT_TIM2_CH2
  • LL_ADC_REG_TRIG_EXT_TIM3_TRGO
  • LL_ADC_REG_TRIG_EXT_TIM3_CH4
  • LL_ADC_REG_TRIG_EXT_TIM4_TRGO
  • LL_ADC_REG_TRIG_EXT_TIM4_CH4
  • LL_ADC_REG_TRIG_EXT_TIM6_TRGO
  • LL_ADC_REG_TRIG_EXT_TIM8_TRGO
  • LL_ADC_REG_TRIG_EXT_TIM8_TRGO2
  • LL_ADC_REG_TRIG_EXT_TIM15_TRGO
  • LL_ADC_REG_TRIG_EXT_EXTI_LINE11

Definition at line 3147 of file stm32l4xx_ll_adc.h.

3148 {
3149  register __IO uint32_t TriggerSource = READ_BIT(ADCx->CFGR, ADC_CFGR_EXTSEL | ADC_CFGR_EXTEN);
3150 
3151  /* Value for shift of {0; 4; 8; 12} depending on value of bitfield */
3152  /* corresponding to ADC_CFGR_EXTEN {0; 1; 2; 3}. */
3153  register uint32_t ShiftExten = ((TriggerSource & ADC_CFGR_EXTEN) >> (ADC_REG_TRIG_EXTEN_BITOFFSET_POS - 2UL));
3154 
3155  /* Set bitfield corresponding to ADC_CFGR_EXTEN and ADC_CFGR_EXTSEL */
3156  /* to match with triggers literals definition. */
3157  return ((TriggerSource
3158  & (ADC_REG_TRIG_SOURCE_MASK >> ShiftExten) & ADC_CFGR_EXTSEL)
3159  | ((ADC_REG_TRIG_EDGE_MASK >> ShiftExten) & ADC_CFGR_EXTEN)
3160  );
3161 }

◆ LL_ADC_REG_IsTriggerSourceSWStart()

__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(). CFGR 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 3174 of file stm32l4xx_ll_adc.h.

3175 {
3176  return ((READ_BIT(ADCx->CFGR, ADC_CFGR_EXTEN) == (LL_ADC_REG_TRIG_SOFTWARE & ADC_CFGR_EXTEN)) ? 1UL : 0UL);
3177 }

◆ LL_ADC_REG_SetContinuousMode()

__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.
On this STM32 serie, setting of this feature is conditioned to ADC state: ADC must be disabled or enabled without conversion on going on group regular. CFGR CONT LL_ADC_REG_SetContinuousMode
Parameters
ADCxADC instance
ContinuousThis parameter can be one of the following values:
  • LL_ADC_REG_CONV_SINGLE
  • LL_ADC_REG_CONV_CONTINUOUS
Return values
None

Definition at line 3614 of file stm32l4xx_ll_adc.h.

3615 {
3616  MODIFY_REG(ADCx->CFGR, ADC_CFGR_CONT, Continuous);
3617 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_ADC_REG_SetDFSDMTransfer()

__STATIC_INLINE void LL_ADC_REG_SetDFSDMTransfer ( ADC_TypeDef *  ADCx,
uint32_t  DFSDMTransfer 
)

Set ADC group regular conversion data transfer to DFSDM.

Note
DFSDM transfer cannot be used if DMA transfer is enabled.
To configure DFSDM source address (peripheral address), use the same function as for DMA transfer: function LL_ADC_DMA_GetRegAddr().
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 DFSDMCFG LL_ADC_REG_GetDFSDMTransfer
Parameters
ADCxADC instance
DFSDMTransferThis parameter can be one of the following values:
  • LL_ADC_REG_DFSDM_TRANSFER_NONE
  • LL_ADC_REG_DFSDM_TRANSFER_ENABLE
Return values
None

Definition at line 3729 of file stm32l4xx_ll_adc.h.

3730 {
3731  MODIFY_REG(ADCx->CFGR, ADC_CFGR_DFSDMCFG, DFSDMTransfer);
3732 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_ADC_REG_SetDMATransfer()

__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().
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 DMAEN LL_ADC_REG_SetDMATransfer
CFGR DMACFG LL_ADC_REG_SetDMATransfer
Parameters
ADCxADC instance
DMATransferThis parameter can be one of the following values:
  • LL_ADC_REG_DMA_TRANSFER_NONE
  • LL_ADC_REG_DMA_TRANSFER_LIMITED
  • LL_ADC_REG_DMA_TRANSFER_UNLIMITED
Return values
None

Definition at line 3671 of file stm32l4xx_ll_adc.h.

3672 {
3673  MODIFY_REG(ADCx->CFGR, ADC_CFGR_DMAEN | ADC_CFGR_DMACFG, DMATransfer);
3674 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_ADC_REG_SetOverrun()

__STATIC_INLINE void LL_ADC_REG_SetOverrun ( ADC_TypeDef *  ADCx,
uint32_t  Overrun 
)

Set ADC group regular behavior in case of overrun: data preserved or overwritten.

Note
Compatibility with devices without feature overrun: other devices without this feature have a behavior equivalent to data overwritten. The default setting of overrun is data preserved. Therefore, for compatibility with all devices, parameter overrun should be set to data overwritten.
On this STM32 serie, setting of this feature is conditioned to ADC state: ADC must be disabled or enabled without conversion on going on group regular. CFGR OVRMOD LL_ADC_REG_SetOverrun
Parameters
ADCxADC instance
OverrunThis parameter can be one of the following values:
  • LL_ADC_REG_OVR_DATA_PRESERVED
  • LL_ADC_REG_OVR_DATA_OVERWRITTEN
Return values
None

Definition at line 3768 of file stm32l4xx_ll_adc.h.

3769 {
3770  MODIFY_REG(ADCx->CFGR, ADC_CFGR_OVRMOD, Overrun);
3771 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_ADC_REG_SetSequencerDiscont()

__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.
On this STM32 serie, setting of this feature is conditioned to ADC state: ADC must be disabled or enabled without conversion on going on group regular. CFGR DISCEN LL_ADC_REG_SetSequencerDiscont
CFGR DISCNUM LL_ADC_REG_SetSequencerDiscont
Parameters
ADCxADC instance
SeqDiscontThis parameter can be one of the following values:
  • LL_ADC_REG_SEQ_DISCONT_DISABLE
  • LL_ADC_REG_SEQ_DISCONT_1RANK
  • LL_ADC_REG_SEQ_DISCONT_2RANKS
  • LL_ADC_REG_SEQ_DISCONT_3RANKS
  • LL_ADC_REG_SEQ_DISCONT_4RANKS
  • LL_ADC_REG_SEQ_DISCONT_5RANKS
  • LL_ADC_REG_SEQ_DISCONT_6RANKS
  • LL_ADC_REG_SEQ_DISCONT_7RANKS
  • LL_ADC_REG_SEQ_DISCONT_8RANKS
Return values
None

Definition at line 3354 of file stm32l4xx_ll_adc.h.

3355 {
3356  MODIFY_REG(ADCx->CFGR, ADC_CFGR_DISCEN | ADC_CFGR_DISCNUM, SeqDiscont);
3357 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_ADC_REG_SetSequencerLength()

__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()".
Sequencer disabled is equivalent to sequencer of 1 rank: ADC conversion on only 1 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 group regular. SQR1 L LL_ADC_REG_SetSequencerLength
Parameters
ADCxADC instance
SequencerNbRanksThis parameter can be one of the following values:
  • LL_ADC_REG_SEQ_SCAN_DISABLE
  • LL_ADC_REG_SEQ_SCAN_ENABLE_2RANKS
  • LL_ADC_REG_SEQ_SCAN_ENABLE_3RANKS
  • LL_ADC_REG_SEQ_SCAN_ENABLE_4RANKS
  • LL_ADC_REG_SEQ_SCAN_ENABLE_5RANKS
  • LL_ADC_REG_SEQ_SCAN_ENABLE_6RANKS
  • LL_ADC_REG_SEQ_SCAN_ENABLE_7RANKS
  • LL_ADC_REG_SEQ_SCAN_ENABLE_8RANKS
  • LL_ADC_REG_SEQ_SCAN_ENABLE_9RANKS
  • LL_ADC_REG_SEQ_SCAN_ENABLE_10RANKS
  • LL_ADC_REG_SEQ_SCAN_ENABLE_11RANKS
  • LL_ADC_REG_SEQ_SCAN_ENABLE_12RANKS
  • LL_ADC_REG_SEQ_SCAN_ENABLE_13RANKS
  • LL_ADC_REG_SEQ_SCAN_ENABLE_14RANKS
  • LL_ADC_REG_SEQ_SCAN_ENABLE_15RANKS
  • LL_ADC_REG_SEQ_SCAN_ENABLE_16RANKS
Return values
None

Definition at line 3268 of file stm32l4xx_ll_adc.h.

3269 {
3270  MODIFY_REG(ADCx->SQR1, ADC_SQR1_L, SequencerNbRanks);
3271 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_ADC_REG_SetSequencerRanks()

__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().
On this STM32 serie, setting of this feature is conditioned to ADC state: ADC must be disabled or enabled without conversion on going on group regular. SQR1 SQ1 LL_ADC_REG_SetSequencerRanks
SQR1 SQ2 LL_ADC_REG_SetSequencerRanks
SQR1 SQ3 LL_ADC_REG_SetSequencerRanks
SQR1 SQ4 LL_ADC_REG_SetSequencerRanks
SQR2 SQ5 LL_ADC_REG_SetSequencerRanks
SQR2 SQ6 LL_ADC_REG_SetSequencerRanks
SQR2 SQ7 LL_ADC_REG_SetSequencerRanks
SQR2 SQ8 LL_ADC_REG_SetSequencerRanks
SQR2 SQ9 LL_ADC_REG_SetSequencerRanks
SQR3 SQ10 LL_ADC_REG_SetSequencerRanks
SQR3 SQ11 LL_ADC_REG_SetSequencerRanks
SQR3 SQ12 LL_ADC_REG_SetSequencerRanks
SQR3 SQ13 LL_ADC_REG_SetSequencerRanks
SQR3 SQ14 LL_ADC_REG_SetSequencerRanks
SQR4 SQ15 LL_ADC_REG_SetSequencerRanks
SQR4 SQ16 LL_ADC_REG_SetSequencerRanks
Parameters
ADCxADC instance
RankThis parameter can be one of the following values:
  • LL_ADC_REG_RANK_1
  • LL_ADC_REG_RANK_2
  • LL_ADC_REG_RANK_3
  • LL_ADC_REG_RANK_4
  • LL_ADC_REG_RANK_5
  • LL_ADC_REG_RANK_6
  • LL_ADC_REG_RANK_7
  • LL_ADC_REG_RANK_8
  • LL_ADC_REG_RANK_9
  • LL_ADC_REG_RANK_10
  • LL_ADC_REG_RANK_11
  • LL_ADC_REG_RANK_12
  • LL_ADC_REG_RANK_13
  • LL_ADC_REG_RANK_14
  • LL_ADC_REG_RANK_15
  • LL_ADC_REG_RANK_16
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)).
Return values
None

Definition at line 3476 of file stm32l4xx_ll_adc.h.

3477 {
3478  /* Set bits with content of parameter "Channel" with bits position */
3479  /* in register and register position depending on parameter "Rank". */
3480  /* Parameters "Rank" and "Channel" are used with masks because containing */
3481  /* other bits reserved for other purpose. */
3482  register __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->SQR1, ((Rank & ADC_REG_SQRX_REGOFFSET_MASK) >> ADC_SQRX_REGOFFSET_POS));
3483 
3484  MODIFY_REG(*preg,
3485  ADC_CHANNEL_ID_NUMBER_MASK_POSBIT0 << (Rank & ADC_REG_RANK_ID_SQRX_MASK),
3486  ((Channel & ADC_CHANNEL_ID_NUMBER_MASK) >> ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS) << (Rank & ADC_REG_RANK_ID_SQRX_MASK));
3487 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_ADC_REG_SetTriggerEdge()

__STATIC_INLINE void LL_ADC_REG_SetTriggerEdge ( ADC_TypeDef *  ADCx,
uint32_t  ExternalTriggerEdge 
)

Set ADC group regular conversion trigger polarity.

Note
Applicable only for trigger source set to external trigger.
On this STM32 serie, setting of this feature is conditioned to ADC state: ADC must be disabled or enabled without conversion on going on group regular. CFGR EXTEN LL_ADC_REG_SetTriggerEdge
Parameters
ADCxADC instance
ExternalTriggerEdgeThis parameter can be one of the following values:
  • LL_ADC_REG_TRIG_EXT_RISING
  • LL_ADC_REG_TRIG_EXT_FALLING
  • LL_ADC_REG_TRIG_EXT_RISINGFALLING
Return values
None

Definition at line 3194 of file stm32l4xx_ll_adc.h.

3195 {
3196  MODIFY_REG(ADCx->CFGR, ADC_CFGR_EXTEN, ExternalTriggerEdge);
3197 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_ADC_REG_SetTriggerSource()

__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 peripheral (timer event, external interrupt line).

Note
On this STM32 serie, setting trigger source to external trigger also set trigger polarity to rising edge (default setting for compatibility with some ADC on other STM32 families having this setting set by HW default value). In case of need to modify trigger edge, use function LL_ADC_REG_SetTriggerEdge().
Availability of parameters of trigger sources from timer depends on timers availability on the selected device.
On this STM32 serie, setting of this feature is conditioned to ADC state: ADC must be disabled or enabled without conversion on going on group regular. CFGR EXTSEL LL_ADC_REG_SetTriggerSource
CFGR EXTEN LL_ADC_REG_SetTriggerSource
Parameters
ADCxADC instance
TriggerSourceThis parameter can be one of the following values:
  • LL_ADC_REG_TRIG_SOFTWARE
  • LL_ADC_REG_TRIG_EXT_TIM1_TRGO
  • LL_ADC_REG_TRIG_EXT_TIM1_TRGO2
  • LL_ADC_REG_TRIG_EXT_TIM1_CH1
  • LL_ADC_REG_TRIG_EXT_TIM1_CH2
  • LL_ADC_REG_TRIG_EXT_TIM1_CH3
  • LL_ADC_REG_TRIG_EXT_TIM2_TRGO
  • LL_ADC_REG_TRIG_EXT_TIM2_CH2
  • LL_ADC_REG_TRIG_EXT_TIM3_TRGO
  • LL_ADC_REG_TRIG_EXT_TIM3_CH4
  • LL_ADC_REG_TRIG_EXT_TIM4_TRGO
  • LL_ADC_REG_TRIG_EXT_TIM4_CH4
  • LL_ADC_REG_TRIG_EXT_TIM6_TRGO
  • LL_ADC_REG_TRIG_EXT_TIM8_TRGO
  • LL_ADC_REG_TRIG_EXT_TIM8_TRGO2
  • LL_ADC_REG_TRIG_EXT_TIM15_TRGO
  • LL_ADC_REG_TRIG_EXT_EXTI_LINE11
Return values
None

Definition at line 3108 of file stm32l4xx_ll_adc.h.

3109 {
3110  MODIFY_REG(ADCx->CFGR, ADC_CFGR_EXTEN | ADC_CFGR_EXTSEL, TriggerSource);
3111 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)