Configure a channel to be assigned to ADC group regular.
2701 HAL_StatusTypeDef tmp_hal_status =
HAL_OK;
2702 uint32_t tmpOffsetShifted;
2703 uint32_t tmp_config_internal_channel;
2704 __IO uint32_t wait_loop_index = 0;
2705 uint32_t tmp_adc_is_conversion_on_going_regular;
2706 uint32_t tmp_adc_is_conversion_on_going_injected;
2721 if (sConfig->
SingleDiff != ADC_DIFFERENTIAL_ENDED)
2740 #if !defined (USE_FULL_ASSERT) 2746 if (sConfig->
Rank <= 5U)
2748 switch (sConfig->
Rank)
2750 case 2U: sConfig->
Rank = ADC_REGULAR_RANK_2;
break;
2751 case 3U: sConfig->
Rank = ADC_REGULAR_RANK_3;
break;
2752 case 4U: sConfig->
Rank = ADC_REGULAR_RANK_4;
break;
2753 case 5U: sConfig->
Rank = ADC_REGULAR_RANK_5;
break;
2755 default: sConfig->
Rank = ADC_REGULAR_RANK_1;
break;
2770 if ((tmp_adc_is_conversion_on_going_regular == 0UL)
2771 && (tmp_adc_is_conversion_on_going_injected == 0UL)
2774 #if defined(ADC_SMPR1_SMPPLUS) 2801 tmpOffsetShifted = ADC_OFFSET_SHIFT_RESOLUTION(hadc, (uint32_t)sConfig->
Offset);
2841 if (sConfig->
SingleDiff == ADC_DIFFERENTIAL_ENDED)
2846 (uint32_t)(__LL_ADC_DECIMAL_NB_TO_CHANNEL((__LL_ADC_CHANNEL_TO_DECIMAL_NB((uint32_t)sConfig->
Channel) + 1UL) & 0x1FUL)),
2858 if (__LL_ADC_IS_CHANNEL_INTERNAL(sConfig->
Channel))
2864 if ((sConfig->
Channel == ADC_CHANNEL_TEMPSENSOR) && ((tmp_config_internal_channel & LL_ADC_PATH_INTERNAL_TEMPSENSOR) == 0UL))
2866 if (ADC_TEMPERATURE_SENSOR_INSTANCE(hadc))
2869 LL_ADC_PATH_INTERNAL_TEMPSENSOR | tmp_config_internal_channel);
2876 wait_loop_index = ((LL_ADC_DELAY_TEMPSENSOR_STAB_US / 10UL) * (SystemCoreClock / (100000UL * 2UL)));
2877 while (wait_loop_index != 0UL)
2883 else if ((sConfig->
Channel == ADC_CHANNEL_VBAT) && ((tmp_config_internal_channel & LL_ADC_PATH_INTERNAL_VBAT) == 0UL))
2885 if (ADC_BATTERY_VOLTAGE_INSTANCE(hadc))
2888 LL_ADC_PATH_INTERNAL_VBAT | tmp_config_internal_channel);
2891 else if ((sConfig->
Channel == ADC_CHANNEL_VREFINT)
2892 && ((tmp_config_internal_channel & LL_ADC_PATH_INTERNAL_VREFINT) == 0UL))
2894 if (ADC_VREFINT_INSTANCE(hadc))
2897 LL_ADC_PATH_INTERNAL_VREFINT | tmp_config_internal_channel);
2913 SET_BIT(hadc->State, HAL_ADC_STATE_ERROR_CONFIG);
2915 tmp_hal_status = HAL_ERROR;
2922 return tmp_hal_status;
__STATIC_INLINE uint32_t LL_ADC_IsEnabled(ADC_TypeDef *ADCx)
Get the selected ADC instance enable state.
__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_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 a...
__STATIC_INLINE void LL_ADC_SetChannelSingleDiff(ADC_TypeDef *ADCx, uint32_t Channel, uint32_t SingleDiff)
Set mode single-ended or differential input of the selected ADC channel.
__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 mod...
__STATIC_INLINE void LL_ADC_SetChannelSamplingTime(ADC_TypeDef *ADCx, uint32_t Channel, uint32_t SamplingTime)
Set sampling time of the selected ADC channel Unit: ADC clock cycles.
__STATIC_INLINE uint32_t LL_ADC_INJ_IsConversionOngoing(ADC_TypeDef *ADCx)
Get ADC group injected conversion state. CR JADSTART LL_ADC_INJ_IsConversionOngoing.
__STATIC_INLINE uint32_t LL_ADC_GetCommonPathInternalCh(ADC_Common_TypeDef *ADCxy_COMMON)
Get parameter common to several ADC: measurement path to internal channels (VrefInt, temperature sensor, ...).
__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.
__STATIC_INLINE uint32_t LL_ADC_REG_IsConversionOngoing(ADC_TypeDef *ADCx)
Get ADC group regular conversion state. CR ADSTART LL_ADC_REG_IsConversionOngoing.
__STATIC_INLINE void LL_ADC_SetCommonPathInternalCh(ADC_Common_TypeDef *ADCxy_COMMON, uint32_t PathInternal)
Set parameter common to several ADC: measurement path to internal channels (VrefInt, temperature sensor, ...).
__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...
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))