STM32L4xx_HAL_Driver  1.14.0
Configuration of ADC transversal scope: oversampling

Functions

__STATIC_INLINE void LL_ADC_SetOverSamplingScope (ADC_TypeDef *ADCx, uint32_t OvsScope)
 Set ADC oversampling scope: ADC groups regular and-or injected (availability of ADC group injected depends on STM32 families). More...
 
__STATIC_INLINE uint32_t LL_ADC_GetOverSamplingScope (ADC_TypeDef *ADCx)
 Get ADC oversampling scope: ADC groups regular and-or injected (availability of ADC group injected depends on STM32 families). More...
 
__STATIC_INLINE void LL_ADC_SetOverSamplingDiscont (ADC_TypeDef *ADCx, uint32_t OverSamplingDiscont)
 Set ADC oversampling discontinuous mode (triggered mode) on the selected ADC group. More...
 
__STATIC_INLINE uint32_t LL_ADC_GetOverSamplingDiscont (ADC_TypeDef *ADCx)
 Get ADC oversampling discontinuous mode (triggered mode) on the selected ADC group. More...
 
__STATIC_INLINE void LL_ADC_ConfigOverSamplingRatioShift (ADC_TypeDef *ADCx, uint32_t Ratio, uint32_t Shift)
 Set ADC oversampling (impacting both ADC groups regular and injected) More...
 
__STATIC_INLINE uint32_t LL_ADC_GetOverSamplingRatio (ADC_TypeDef *ADCx)
 Get ADC oversampling ratio (impacting both ADC groups regular and injected) CFGR2 OVSR LL_ADC_GetOverSamplingRatio. More...
 
__STATIC_INLINE uint32_t LL_ADC_GetOverSamplingShift (ADC_TypeDef *ADCx)
 Get ADC oversampling shift (impacting both ADC groups regular and injected) CFGR2 OVSS LL_ADC_GetOverSamplingShift. More...
 

Detailed Description

Function Documentation

◆ LL_ADC_ConfigOverSamplingRatioShift()

__STATIC_INLINE void LL_ADC_ConfigOverSamplingRatioShift ( ADC_TypeDef *  ADCx,
uint32_t  Ratio,
uint32_t  Shift 
)

Set ADC oversampling (impacting both ADC groups regular and injected)

Note
This function set the 2 items of oversampling configuration:
  • ratio
  • shift
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. CFGR2 OVSS LL_ADC_ConfigOverSamplingRatioShift
CFGR2 OVSR LL_ADC_ConfigOverSamplingRatioShift
Parameters
ADCxADC instance
RatioThis parameter can be one of the following values:
  • LL_ADC_OVS_RATIO_2
  • LL_ADC_OVS_RATIO_4
  • LL_ADC_OVS_RATIO_8
  • LL_ADC_OVS_RATIO_16
  • LL_ADC_OVS_RATIO_32
  • LL_ADC_OVS_RATIO_64
  • LL_ADC_OVS_RATIO_128
  • LL_ADC_OVS_RATIO_256
ShiftThis parameter can be one of the following values:
  • LL_ADC_OVS_SHIFT_NONE
  • LL_ADC_OVS_SHIFT_RIGHT_1
  • LL_ADC_OVS_SHIFT_RIGHT_2
  • LL_ADC_OVS_SHIFT_RIGHT_3
  • LL_ADC_OVS_SHIFT_RIGHT_4
  • LL_ADC_OVS_SHIFT_RIGHT_5
  • LL_ADC_OVS_SHIFT_RIGHT_6
  • LL_ADC_OVS_SHIFT_RIGHT_7
  • LL_ADC_OVS_SHIFT_RIGHT_8
Return values
None

Definition at line 5512 of file stm32l4xx_ll_adc.h.

5513 {
5514  MODIFY_REG(ADCx->CFGR2, (ADC_CFGR2_OVSS | ADC_CFGR2_OVSR), (Shift | Ratio));
5515 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_ADC_GetOverSamplingDiscont()

__STATIC_INLINE uint32_t LL_ADC_GetOverSamplingDiscont ( ADC_TypeDef *  ADCx)

Get ADC oversampling discontinuous mode (triggered mode) on the selected ADC group.

Note
Number of oversampled conversions are done either in:
  • continuous mode (all conversions of oversampling ratio are done from 1 trigger)
  • discontinuous mode (each conversion of oversampling ratio needs a trigger) CFGR2 TROVS LL_ADC_GetOverSamplingDiscont
Parameters
ADCxADC instance
Return values
Returnedvalue can be one of the following values:
  • LL_ADC_OVS_REG_CONT
  • LL_ADC_OVS_REG_DISCONT

Definition at line 5473 of file stm32l4xx_ll_adc.h.

5474 {
5475  return (uint32_t)(READ_BIT(ADCx->CFGR2, ADC_CFGR2_TROVS));
5476 }

◆ LL_ADC_GetOverSamplingRatio()

__STATIC_INLINE uint32_t LL_ADC_GetOverSamplingRatio ( ADC_TypeDef *  ADCx)

Get ADC oversampling ratio (impacting both ADC groups regular and injected) CFGR2 OVSR LL_ADC_GetOverSamplingRatio.

Parameters
ADCxADC instance
Return values
RatioThis parameter can be one of the following values:
  • LL_ADC_OVS_RATIO_2
  • LL_ADC_OVS_RATIO_4
  • LL_ADC_OVS_RATIO_8
  • LL_ADC_OVS_RATIO_16
  • LL_ADC_OVS_RATIO_32
  • LL_ADC_OVS_RATIO_64
  • LL_ADC_OVS_RATIO_128
  • LL_ADC_OVS_RATIO_256

Definition at line 5532 of file stm32l4xx_ll_adc.h.

5533 {
5534  return (uint32_t)(READ_BIT(ADCx->CFGR2, ADC_CFGR2_OVSR));
5535 }

◆ LL_ADC_GetOverSamplingScope()

__STATIC_INLINE uint32_t LL_ADC_GetOverSamplingScope ( ADC_TypeDef *  ADCx)

Get ADC oversampling scope: ADC groups regular and-or injected (availability of ADC group injected depends on STM32 families).

Note
If both groups regular and injected are selected, specify behavior of ADC group injected interrupting group regular: when ADC group injected is triggered, the oversampling on ADC group regular is either temporary stopped and continued, or resumed from start (oversampler buffer reset). CFGR2 ROVSE LL_ADC_GetOverSamplingScope
CFGR2 JOVSE LL_ADC_GetOverSamplingScope
CFGR2 ROVSM LL_ADC_GetOverSamplingScope
Parameters
ADCxADC instance
Return values
Returnedvalue can be one of the following values:
  • LL_ADC_OVS_DISABLE
  • LL_ADC_OVS_GRP_REGULAR_CONTINUED
  • LL_ADC_OVS_GRP_REGULAR_RESUMED
  • LL_ADC_OVS_GRP_INJECTED
  • LL_ADC_OVS_GRP_INJ_REG_RESUMED

Definition at line 5427 of file stm32l4xx_ll_adc.h.

5428 {
5429  return (uint32_t)(READ_BIT(ADCx->CFGR2, ADC_CFGR2_ROVSE | ADC_CFGR2_JOVSE | ADC_CFGR2_ROVSM));
5430 }

◆ LL_ADC_GetOverSamplingShift()

__STATIC_INLINE uint32_t LL_ADC_GetOverSamplingShift ( ADC_TypeDef *  ADCx)

Get ADC oversampling shift (impacting both ADC groups regular and injected) CFGR2 OVSS LL_ADC_GetOverSamplingShift.

Parameters
ADCxADC instance
Return values
ShiftThis parameter can be one of the following values:
  • LL_ADC_OVS_SHIFT_NONE
  • LL_ADC_OVS_SHIFT_RIGHT_1
  • LL_ADC_OVS_SHIFT_RIGHT_2
  • LL_ADC_OVS_SHIFT_RIGHT_3
  • LL_ADC_OVS_SHIFT_RIGHT_4
  • LL_ADC_OVS_SHIFT_RIGHT_5
  • LL_ADC_OVS_SHIFT_RIGHT_6
  • LL_ADC_OVS_SHIFT_RIGHT_7
  • LL_ADC_OVS_SHIFT_RIGHT_8

Definition at line 5553 of file stm32l4xx_ll_adc.h.

5554 {
5555  return (uint32_t)(READ_BIT(ADCx->CFGR2, ADC_CFGR2_OVSS));
5556 }

◆ LL_ADC_SetOverSamplingDiscont()

__STATIC_INLINE void LL_ADC_SetOverSamplingDiscont ( ADC_TypeDef *  ADCx,
uint32_t  OverSamplingDiscont 
)

Set ADC oversampling discontinuous mode (triggered mode) on the selected ADC group.

Note
Number of oversampled conversions are done either in:
  • continuous mode (all conversions of oversampling ratio are done from 1 trigger)
  • discontinuous mode (each conversion of oversampling ratio needs a 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.
On this STM32 serie, oversampling discontinuous mode (triggered mode) can be used only when oversampling is set on group regular only and in resumed mode. CFGR2 TROVS LL_ADC_SetOverSamplingDiscont
Parameters
ADCxADC instance
OverSamplingDiscontThis parameter can be one of the following values:
  • LL_ADC_OVS_REG_CONT
  • LL_ADC_OVS_REG_DISCONT
Return values
None

Definition at line 5454 of file stm32l4xx_ll_adc.h.

5455 {
5456  MODIFY_REG(ADCx->CFGR2, ADC_CFGR2_TROVS, OverSamplingDiscont);
5457 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_ADC_SetOverSamplingScope()

__STATIC_INLINE void LL_ADC_SetOverSamplingScope ( ADC_TypeDef *  ADCx,
uint32_t  OvsScope 
)

Set ADC oversampling scope: ADC groups regular and-or injected (availability of ADC group injected depends on STM32 families).

Note
If both groups regular and injected are selected, specify behavior of ADC group injected interrupting group regular: when ADC group injected is triggered, the oversampling on ADC group regular is either temporary stopped and continued, or resumed from start (oversampler buffer reset).
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. CFGR2 ROVSE LL_ADC_SetOverSamplingScope
CFGR2 JOVSE LL_ADC_SetOverSamplingScope
CFGR2 ROVSM LL_ADC_SetOverSamplingScope
Parameters
ADCxADC instance
OvsScopeThis parameter can be one of the following values:
  • LL_ADC_OVS_DISABLE
  • LL_ADC_OVS_GRP_REGULAR_CONTINUED
  • LL_ADC_OVS_GRP_REGULAR_RESUMED
  • LL_ADC_OVS_GRP_INJECTED
  • LL_ADC_OVS_GRP_INJ_REG_RESUMED
Return values
None

Definition at line 5402 of file stm32l4xx_ll_adc.h.

5403 {
5404  MODIFY_REG(ADCx->CFGR2, ADC_CFGR2_ROVSE | ADC_CFGR2_JOVSE | ADC_CFGR2_ROVSM, OvsScope);
5405 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)