44#ifdef HAL_ADC_MODULE_ENABLED
53#define ADC_JSQR_FIELDS ((ADC_JSQR_JL | ADC_JSQR_JEXTSEL | ADC_JSQR_JEXTEN |\
54 ADC_JSQR_JSQ1 | ADC_JSQR_JSQ2 |\
55 ADC_JSQR_JSQ3 | ADC_JSQR_JSQ4 ))
67#define ADC_CALIBRATION_TIMEOUT (633600000U)
129 __IO uint32_t wait_loop_index = 0UL;
144 if (tmp_hal_status ==
HAL_OK)
152 LL_ADC_StartCalibration(hadc->
Instance, CalibrationMode, SingleDiff);
155 while (LL_ADC_IsCalibrationOnGoing(hadc->
Instance) != 0UL)
158 if (wait_loop_index >= ADC_CALIBRATION_TIMEOUT)
189 return tmp_hal_status;
207 return LL_ADC_GetCalibrationOffsetFactor(hadc->
Instance, SingleDiff);
220 uint32_t temp_REG_IsConversionOngoing = 0UL;
226 if (LL_ADC_IsEnabled(hadc->
Instance) == 0UL)
231 if (tmp_hal_status ==
HAL_OK)
233 if (LL_ADC_REG_IsConversionOngoing(hadc->
Instance) != 0UL)
235 LL_ADC_REG_StopConversion(hadc->
Instance);
236 temp_REG_IsConversionOngoing = 1UL;
238 for (cnt = ADC_LINEAR_CALIB_REG_COUNT; cnt > 0UL; cnt--)
240 LinearCalib_Buffer[cnt - 1U] = LL_ADC_GetCalibrationLinearFactor(hadc->
Instance,
ADC_CR_LINCALRDYW6 >> (ADC_LINEAR_CALIB_REG_COUNT - cnt));
242 if (temp_REG_IsConversionOngoing != 0UL)
244 LL_ADC_REG_StartConversion(hadc->
Instance);
248 return tmp_hal_status;
266 uint32_t tmp_adc_is_conversion_on_going_regular;
267 uint32_t tmp_adc_is_conversion_on_going_injected;
273#if defined(ADC_VER_V5_V90)
291 tmp_adc_is_conversion_on_going_regular = LL_ADC_REG_IsConversionOngoing(hadc->
Instance);
292 tmp_adc_is_conversion_on_going_injected = LL_ADC_INJ_IsConversionOngoing(hadc->
Instance);
294 if ((LL_ADC_IsEnabled(hadc->
Instance) != 0UL)
295 && (tmp_adc_is_conversion_on_going_regular == 0UL)
296 && (tmp_adc_is_conversion_on_going_injected == 0UL)
300 LL_ADC_SetCalibrationOffsetFactor(hadc->
Instance, SingleDiff, CalibrationFactor);
317 return tmp_hal_status;
329 __IO uint32_t wait_loop_index = 0;
330 uint32_t temp_REG_IsConversionOngoing = 0UL;
357 while (wait_loop_index != 0UL)
378 if (LL_ADC_IsEnabled(hadc->
Instance) == 0UL)
386 for (cnt = ADC_LINEAR_CALIB_REG_COUNT; cnt > 0UL ; cnt--)
388 LL_ADC_SetCalibrationLinearFactor(hadc->
Instance,
ADC_CR_LINCALRDYW6 >> (ADC_LINEAR_CALIB_REG_COUNT - cnt), LinearCalib_Buffer[cnt - 1U]);
395 if (LL_ADC_REG_IsConversionOngoing(hadc->
Instance) != 0UL)
397 LL_ADC_REG_StopConversion(hadc->
Instance);
398 temp_REG_IsConversionOngoing = 1UL;
400 for (cnt = ADC_LINEAR_CALIB_REG_COUNT; cnt > 0UL ; cnt--)
402 LL_ADC_SetCalibrationLinearFactor(hadc->
Instance,
ADC_CR_LINCALRDYW6 >> (ADC_LINEAR_CALIB_REG_COUNT - cnt), LinearCalib_Buffer[cnt - 1U]);
404 if (temp_REG_IsConversionOngoing != 0UL)
406 LL_ADC_REG_StartConversion(hadc->
Instance);
420 uint32_t cnt, FactorOffset;
421 uint32_t LinearCalib_Buffer[ADC_LINEAR_CALIB_REG_COUNT];
440 for (cnt = 0UL; cnt < ADC_LINEAR_CALIB_REG_COUNT; cnt++)
442 LinearCalib_Buffer[cnt] = *(uint32_t *)(ADC_LINEAR_CALIB_REG_1_ADDR + FactorOffset + cnt);
449 return tmp_hal_status;
466 uint32_t tmp_config_injected_queue;
467 uint32_t tmp_multimode_config = LL_ADC_GetMultimode(__LL_ADC_COMMON_INSTANCE(hadc->
Instance));
472 if (LL_ADC_INJ_IsConversionOngoing(hadc->
Instance) != 0UL)
488 && (tmp_config_injected_queue == 0UL)
502 if (tmp_hal_status ==
HAL_OK)
527 || (tmp_multimode_config == LL_ADC_MULTI_INDEPENDENT)
555 || (tmp_multimode_config == LL_ADC_MULTI_INDEPENDENT)
556 || (tmp_multimode_config == LL_ADC_MULTI_DUAL_REG_SIMULT)
557 || (tmp_multimode_config == LL_ADC_MULTI_DUAL_REG_INTERL)
561 if (LL_ADC_INJ_GetTrigAuto(hadc->
Instance) == LL_ADC_INJ_TRIG_INDEPENDENT)
563 LL_ADC_INJ_StartConversion(hadc->
Instance);
580 return tmp_hal_status;
615 if (tmp_hal_status ==
HAL_OK)
617 if (LL_ADC_REG_IsConversionOngoing(hadc->
Instance) == 0UL)
623 if (tmp_hal_status ==
HAL_OK)
644 return tmp_hal_status;
658 uint32_t tmp_Flag_End;
659 uint32_t tmp_adc_inj_is_trigger_source_sw_start;
660 uint32_t tmp_adc_reg_is_trigger_source_sw_start;
663 uint32_t tmp_multimode_config = LL_ADC_GetMultimode(__LL_ADC_COMMON_INSTANCE(hadc->
Instance));
682 while ((hadc->
Instance->
ISR & tmp_Flag_End) == 0UL)
687 if (((
HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0UL))
704 tmp_adc_inj_is_trigger_source_sw_start = LL_ADC_INJ_IsTriggerSourceSWStart(hadc->
Instance);
705 tmp_adc_reg_is_trigger_source_sw_start = LL_ADC_REG_IsTriggerSourceSWStart(hadc->
Instance);
710 || (tmp_multimode_config == LL_ADC_MULTI_INDEPENDENT)
711 || (tmp_multimode_config == LL_ADC_MULTI_DUAL_REG_SIMULT)
712 || (tmp_multimode_config == LL_ADC_MULTI_DUAL_REG_INTERL)
719 tmpADC_Master = __LL_ADC_MULTI_INSTANCE_MASTER(hadc->
Instance);
729 if ((tmp_adc_inj_is_trigger_source_sw_start != 0UL) ||
731 ((tmp_adc_reg_is_trigger_source_sw_start != 0UL) &&
792 uint32_t tmp_config_injected_queue;
793 uint32_t tmp_multimode_config = LL_ADC_GetMultimode(__LL_ADC_COMMON_INSTANCE(hadc->
Instance));
798 if (LL_ADC_INJ_IsConversionOngoing(hadc->
Instance) != 0UL)
814 && (tmp_config_injected_queue == 0UL)
828 if (tmp_hal_status ==
HAL_OK)
853 || (tmp_multimode_config == LL_ADC_MULTI_INDEPENDENT)
902 || (tmp_multimode_config == LL_ADC_MULTI_INDEPENDENT)
903 || (tmp_multimode_config == LL_ADC_MULTI_DUAL_REG_SIMULT)
904 || (tmp_multimode_config == LL_ADC_MULTI_DUAL_REG_INTERL)
908 if (LL_ADC_INJ_GetTrigAuto(hadc->
Instance) == LL_ADC_INJ_TRIG_INDEPENDENT)
910 LL_ADC_INJ_StartConversion(hadc->
Instance);
927 return tmp_hal_status;
966 if (tmp_hal_status ==
HAL_OK)
971 if (LL_ADC_REG_IsConversionOngoing(hadc->
Instance) == 0UL)
977 if (tmp_hal_status ==
HAL_OK)
998 return tmp_hal_status;
1030 if (LL_ADC_REG_IsConversionOngoing(hadc->
Instance) != 0UL)
1067 if (tmp_hal_status ==
HAL_OK)
1074 if (tmp_hal_status ==
HAL_OK)
1119 tmpADC_Common = __LL_ADC_COMMON_INSTANCE(hadc->
Instance);
1129 LL_ADC_REG_StartConversion(hadc->
Instance);
1139 return tmp_hal_status;
1161 uint32_t tmphadcSlave_conversion_on_going;
1175 if (tmp_hal_status ==
HAL_OK)
1200 tmphadcSlave_conversion_on_going = LL_ADC_REG_IsConversionOngoing((&tmphadcSlave)->Instance);
1201 while ((LL_ADC_REG_IsConversionOngoing(hadc->
Instance) == 1UL)
1202 || (tmphadcSlave_conversion_on_going == 1UL)
1208 tmphadcSlave_conversion_on_going = LL_ADC_REG_IsConversionOngoing((&tmphadcSlave)->Instance);
1210 if((LL_ADC_REG_IsConversionOngoing(hadc->
Instance) == 1UL)
1211 || (tmphadcSlave_conversion_on_going == 1UL)
1224 tmphadcSlave_conversion_on_going = LL_ADC_REG_IsConversionOngoing((&tmphadcSlave)->Instance);
1246 if (tmp_hal_status ==
HAL_OK)
1248 tmphadcSlave_disable_status =
ADC_Disable(&tmphadcSlave);
1250 (tmphadcSlave_disable_status ==
HAL_OK))
1272 return tmp_hal_status;
1292 tmpADC_Common = __LL_ADC_COMMON_INSTANCE(hadc->
Instance);
1295 return tmpADC_Common->
CDR;
1335 switch (InjectedRank)
1458 if (tmp_hal_status ==
HAL_OK)
1463 if (LL_ADC_INJ_IsConversionOngoing(hadc->
Instance) == 0UL)
1469 if (tmp_hal_status ==
HAL_OK)
1489 return tmp_hal_status;
1516 if (tmp_hal_status ==
HAL_OK)
1525 if (LL_ADC_INJ_IsConversionOngoing(hadc->
Instance) == 0UL)
1529 if (tmp_hal_status ==
HAL_OK)
1547 return tmp_hal_status;
1576 if (tmp_hal_status ==
HAL_OK)
1589 if (tmp_hal_status !=
HAL_OK)
1601 if (LL_ADC_INJ_IsConversionOngoing(hadc->
Instance) == 0UL)
1603 if (tmp_hal_status ==
HAL_OK)
1613 if (tmp_hal_status ==
HAL_OK)
1631 return tmp_hal_status;
1652 uint32_t tmphadcSlave_conversion_on_going;
1665 if (tmp_hal_status ==
HAL_OK)
1693 tmphadcSlave_conversion_on_going = LL_ADC_REG_IsConversionOngoing((&tmphadcSlave)->Instance);
1694 while ((LL_ADC_REG_IsConversionOngoing(hadc->
Instance) == 1UL)
1695 || (tmphadcSlave_conversion_on_going == 1UL)
1701 tmphadcSlave_conversion_on_going = LL_ADC_REG_IsConversionOngoing((&tmphadcSlave)->Instance);
1703 if((LL_ADC_REG_IsConversionOngoing(hadc->
Instance) == 1UL)
1704 || (tmphadcSlave_conversion_on_going == 1UL)
1717 tmphadcSlave_conversion_on_going = LL_ADC_REG_IsConversionOngoing((&tmphadcSlave)->Instance);
1727 if (tmp_hal_status !=
HAL_OK)
1740 if (tmp_hal_status ==
HAL_OK)
1742 if (LL_ADC_INJ_IsConversionOngoing(hadc->
Instance) == 0UL)
1745 if (tmp_hal_status ==
HAL_OK)
1747 if (LL_ADC_INJ_IsConversionOngoing((&tmphadcSlave)->Instance) == 0UL)
1754 if (tmp_hal_status ==
HAL_OK)
1772 return tmp_hal_status;
1834 uint32_t tmpOffsetShifted;
1835 uint32_t tmp_config_internal_channel;
1836 uint32_t tmp_adc_is_conversion_on_going_regular;
1837 uint32_t tmp_adc_is_conversion_on_going_injected;
1838 __IO uint32_t wait_loop_index = 0;
1840 uint32_t tmp_JSQR_ContextQueueBeingBuilt = 0U;
1852#if defined(ADC_VER_V5_V90)
1856 assert_param(IS_ADC3_OFFSET_SIGN(sConfigInjected->InjectedOffsetSign));
1881#if defined(ADC_VER_V5_V90)
2054 if (LL_ADC_INJ_IsConversionOngoing(hadc->
Instance) == 0UL)
2056 if (!(__LL_ADC_IS_CHANNEL_INTERNAL(sConfigInjected->
InjectedChannel)))
2058#if defined(ADC_VER_V5_V90)
2066 hadc->
Instance->PCSEL |= (1UL << (__LL_ADC_CHANNEL_TO_DECIMAL_NB(sConfigInjected->
InjectedChannel) & 0x1FUL));
2096 tmp_adc_is_conversion_on_going_regular = LL_ADC_REG_IsConversionOngoing(hadc->
Instance);
2097 tmp_adc_is_conversion_on_going_injected = LL_ADC_INJ_IsConversionOngoing(hadc->
Instance);
2099 if ((tmp_adc_is_conversion_on_going_regular == 0UL)
2100 && (tmp_adc_is_conversion_on_going_injected == 0UL)
2136#if defined(ADC_VER_V5_V90)
2158#if defined(ADC_VER_V5_V90)
2205#if defined(ADC_VER_V5_V90)
2208 tmpOffsetShifted = ADC3_OFFSET_SHIFT_RESOLUTION(hadc, sConfigInjected->
InjectedOffset);
2221#if defined(ADC_VER_V5_V90)
2226 LL_ADC_SetOffsetSaturation(hadc->
Instance, sConfigInjected->
InjectedOffsetNumber, (sConfigInjected->InjectedOffsetSaturation ==
ENABLE) ? LL_ADC_OFFSET_SATURATION_ENABLE : LL_ADC_OFFSET_SATURATION_DISABLE);
2238#if defined(ADC_VER_V5_V90)
2243 if (__LL_ADC_CHANNEL_TO_DECIMAL_NB(LL_ADC_GetOffsetChannel(hadc->
Instance, LL_ADC_OFFSET_1)) == __LL_ADC_CHANNEL_TO_DECIMAL_NB(sConfigInjected->
InjectedChannel))
2245 LL_ADC_SetOffsetState(hadc->
Instance, LL_ADC_OFFSET_1, LL_ADC_OFFSET_DISABLE);
2247 if (__LL_ADC_CHANNEL_TO_DECIMAL_NB(LL_ADC_GetOffsetChannel(hadc->
Instance, LL_ADC_OFFSET_2)) == __LL_ADC_CHANNEL_TO_DECIMAL_NB(sConfigInjected->
InjectedChannel))
2249 LL_ADC_SetOffsetState(hadc->
Instance, LL_ADC_OFFSET_2, LL_ADC_OFFSET_DISABLE);
2251 if (__LL_ADC_CHANNEL_TO_DECIMAL_NB(LL_ADC_GetOffsetChannel(hadc->
Instance, LL_ADC_OFFSET_3)) == __LL_ADC_CHANNEL_TO_DECIMAL_NB(sConfigInjected->
InjectedChannel))
2253 LL_ADC_SetOffsetState(hadc->
Instance, LL_ADC_OFFSET_3, LL_ADC_OFFSET_DISABLE);
2255 if (__LL_ADC_CHANNEL_TO_DECIMAL_NB(LL_ADC_GetOffsetChannel(hadc->
Instance, LL_ADC_OFFSET_4)) == __LL_ADC_CHANNEL_TO_DECIMAL_NB(sConfigInjected->
InjectedChannel))
2257 LL_ADC_SetOffsetState(hadc->
Instance, LL_ADC_OFFSET_4, LL_ADC_OFFSET_DISABLE);
2265 if (__LL_ADC_CHANNEL_TO_DECIMAL_NB(LL_ADC_GetOffsetChannel(hadc->
Instance, LL_ADC_OFFSET_1)) == __LL_ADC_CHANNEL_TO_DECIMAL_NB(sConfigInjected->
InjectedChannel))
2267 LL_ADC_SetOffset(hadc->
Instance, LL_ADC_OFFSET_1, sConfigInjected->
InjectedChannel, LL_ADC_OFFSET_SIGNED_SATURATION_DISABLE);
2269 if (__LL_ADC_CHANNEL_TO_DECIMAL_NB(LL_ADC_GetOffsetChannel(hadc->
Instance, LL_ADC_OFFSET_2)) == __LL_ADC_CHANNEL_TO_DECIMAL_NB(sConfigInjected->
InjectedChannel))
2271 LL_ADC_SetOffset(hadc->
Instance, LL_ADC_OFFSET_2, sConfigInjected->
InjectedChannel, LL_ADC_OFFSET_SIGNED_SATURATION_DISABLE);
2273 if (__LL_ADC_CHANNEL_TO_DECIMAL_NB(LL_ADC_GetOffsetChannel(hadc->
Instance, LL_ADC_OFFSET_3)) == __LL_ADC_CHANNEL_TO_DECIMAL_NB(sConfigInjected->
InjectedChannel))
2275 LL_ADC_SetOffset(hadc->
Instance, LL_ADC_OFFSET_4, sConfigInjected->
InjectedChannel, LL_ADC_OFFSET_SIGNED_SATURATION_DISABLE);
2277 if (__LL_ADC_CHANNEL_TO_DECIMAL_NB(LL_ADC_GetOffsetChannel(hadc->
Instance, LL_ADC_OFFSET_4)) == __LL_ADC_CHANNEL_TO_DECIMAL_NB(sConfigInjected->
InjectedChannel))
2279 LL_ADC_SetOffset(hadc->
Instance, LL_ADC_OFFSET_4, sConfigInjected->
InjectedChannel, LL_ADC_OFFSET_SIGNED_SATURATION_DISABLE);
2290 if (LL_ADC_IsEnabled(hadc->
Instance) == 0UL)
2314 if (__LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE(__LL_ADC_COMMON_INSTANCE(hadc->
Instance)) == 0UL)
2316 tmp_config_internal_channel = LL_ADC_GetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE(hadc->
Instance));
2324 LL_ADC_SetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE(hadc->
Instance), LL_ADC_PATH_INTERNAL_TEMPSENSOR | tmp_config_internal_channel);
2331 wait_loop_index = ((LL_ADC_DELAY_TEMPSENSOR_STAB_US / 10UL) * ((
SystemCoreClock / (100000UL * 2UL)) + 1UL));
2332 while (wait_loop_index != 0UL)
2342 LL_ADC_SetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE(hadc->
Instance), LL_ADC_PATH_INTERNAL_VBAT | tmp_config_internal_channel);
2349 LL_ADC_SetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE(hadc->
Instance), LL_ADC_PATH_INTERNAL_VREFINT | tmp_config_internal_channel);
2375 return tmp_hal_status;
2399 uint32_t tmphadcSlave_conversion_on_going;
2433 tmphadcSlave_conversion_on_going = LL_ADC_REG_IsConversionOngoing((&tmphadcSlave)->Instance);
2434 if ((LL_ADC_REG_IsConversionOngoing(hadc->
Instance) == 0UL)
2435 && (tmphadcSlave_conversion_on_going == 0UL))
2438 tmpADC_Common = __LL_ADC_COMMON_INSTANCE(hadc->
Instance);
2458 if (__LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE(__LL_ADC_COMMON_INSTANCE(hadc->
Instance)) == 0UL)
2475 if (__LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE(__LL_ADC_COMMON_INSTANCE(hadc->
Instance)) == 0UL)
2495 return tmp_hal_status;
2510 uint32_t tmp_adc_is_conversion_on_going_regular;
2511 uint32_t tmp_adc_is_conversion_on_going_injected;
2516 tmp_adc_is_conversion_on_going_regular = LL_ADC_REG_IsConversionOngoing(hadc->
Instance);
2517 tmp_adc_is_conversion_on_going_injected = LL_ADC_INJ_IsConversionOngoing(hadc->
Instance);
2520 if ((tmp_adc_is_conversion_on_going_regular == 0UL)
2521 && (tmp_adc_is_conversion_on_going_injected == 0UL)
2536 return tmp_hal_status;
2551 uint32_t tmp_adc_is_conversion_on_going_regular;
2552 uint32_t tmp_adc_is_conversion_on_going_injected;
2557 tmp_adc_is_conversion_on_going_regular = LL_ADC_REG_IsConversionOngoing(hadc->
Instance);
2558 tmp_adc_is_conversion_on_going_injected = LL_ADC_INJ_IsConversionOngoing(hadc->
Instance);
2561 if ((tmp_adc_is_conversion_on_going_regular == 0UL)
2562 && (tmp_adc_is_conversion_on_going_injected == 0UL)
2565 LL_ADC_INJ_SetQueueMode(hadc->
Instance, LL_ADC_INJ_QUEUE_DISABLE);
2573 return tmp_hal_status;
2593 if (LL_ADC_IsEnabled(hadc->
Instance) == 0UL)
2595 LL_ADC_DisableInternalRegulator(hadc->
Instance);
2603 return tmp_hal_status;
2630 if (LL_ADC_IsEnabled(hadc->
Instance) == 0UL)
2632 LL_ADC_EnableDeepPowerDown(hadc->
Instance);
2640 return tmp_hal_status;
#define __IO
Defines 'read / write' permissions.
HAL_StatusTypeDef HAL_ADCEx_RegularStop(ADC_HandleTypeDef *hadc)
void HAL_ADCEx_InjectedQueueOverflowCallback(ADC_HandleTypeDef *hadc)
void HAL_ADCEx_EndOfSamplingCallback(ADC_HandleTypeDef *hadc)
HAL_StatusTypeDef HAL_ADCEx_RegularStop_DMA(ADC_HandleTypeDef *hadc)
HAL_StatusTypeDef HAL_ADCEx_LinearCalibration_SetValue(ADC_HandleTypeDef *hadc, uint32_t *LinearCalib_Buffer)
uint32_t HAL_ADCEx_MultiModeGetValue(const ADC_HandleTypeDef *hadc)
HAL_StatusTypeDef HAL_ADCEx_InjectedPollForConversion(ADC_HandleTypeDef *hadc, uint32_t Timeout)
uint32_t HAL_ADCEx_Calibration_GetValue(const ADC_HandleTypeDef *hadc, uint32_t SingleDiff)
HAL_StatusTypeDef HAL_ADCEx_MultiModeStop_DMA(ADC_HandleTypeDef *hadc)
HAL_StatusTypeDef HAL_ADCEx_Calibration_SetValue(ADC_HandleTypeDef *hadc, uint32_t SingleDiff, uint32_t CalibrationFactor)
HAL_StatusTypeDef HAL_ADCEx_InjectedStop(ADC_HandleTypeDef *hadc)
void HAL_ADCEx_LevelOutOfWindow3Callback(ADC_HandleTypeDef *hadc)
HAL_StatusTypeDef HAL_ADCEx_Calibration_Start(ADC_HandleTypeDef *hadc, uint32_t CalibrationMode, uint32_t SingleDiff)
HAL_StatusTypeDef HAL_ADCEx_InjectedStart(ADC_HandleTypeDef *hadc)
HAL_StatusTypeDef HAL_ADCEx_RegularMultiModeStop_DMA(ADC_HandleTypeDef *hadc)
HAL_StatusTypeDef HAL_ADCEx_MultiModeStart_DMA(ADC_HandleTypeDef *hadc, const uint32_t *pData, uint32_t Length)
HAL_StatusTypeDef HAL_ADCEx_LinearCalibration_FactorLoad(ADC_HandleTypeDef *hadc)
void HAL_ADCEx_LevelOutOfWindow2Callback(ADC_HandleTypeDef *hadc)
HAL_StatusTypeDef HAL_ADCEx_InjectedStop_IT(ADC_HandleTypeDef *hadc)
HAL_StatusTypeDef HAL_ADCEx_RegularStop_IT(ADC_HandleTypeDef *hadc)
void HAL_ADCEx_InjectedConvCpltCallback(ADC_HandleTypeDef *hadc)
HAL_StatusTypeDef HAL_ADCEx_LinearCalibration_GetValue(ADC_HandleTypeDef *hadc, uint32_t *LinearCalib_Buffer)
HAL_StatusTypeDef HAL_ADCEx_InjectedStart_IT(ADC_HandleTypeDef *hadc)
uint32_t HAL_ADCEx_InjectedGetValue(const ADC_HandleTypeDef *hadc, uint32_t InjectedRank)
HAL_StatusTypeDef HAL_ADCEx_EnterADCDeepPowerDownMode(ADC_HandleTypeDef *hadc)
HAL_StatusTypeDef HAL_ADCEx_DisableVoltageRegulator(ADC_HandleTypeDef *hadc)
HAL_StatusTypeDef HAL_ADCEx_InjectedConfigChannel(ADC_HandleTypeDef *hadc, ADC_InjectionConfTypeDef *sConfigInjected)
HAL_StatusTypeDef HAL_ADCEx_EnableInjectedQueue(ADC_HandleTypeDef *hadc)
HAL_StatusTypeDef HAL_ADCEx_DisableInjectedQueue(ADC_HandleTypeDef *hadc)
HAL_StatusTypeDef HAL_ADCEx_MultiModeConfigChannel(ADC_HandleTypeDef *hadc, ADC_MultiModeTypeDef *multimode)
#define ADC_VREFINT_INSTANCE(__HANDLE__)
Verify the ADC instance connected to the internal voltage reference VREFINT.
#define IS_ADC_CALFACT(__CALIBRATION_FACTOR__)
Calibration factor size verification (11 bits maximum).
#define IS_ADC_OVERSAMPLING_RATIO(RATIO)
Verify the ADC oversampling ratio.
#define ADC_CHANNEL_DIFF_NEG_INPUT(__HANDLE__, __CHANNEL__)
Helper macro to determine the selected channel corresponding negative input on the ADC instance selec...
#define IS_ADC_INJECTED_NB_CONV(__LENGTH__)
Verify the length of scheduled injected conversions group.
#define IS_ADC3_DIFF_CHANNEL(__CHANNEL__)
Verify the ADC channel setting in differential mode for ADC3.
#define IS_ADC_EXTTRIGINJEC_EDGE(__EDGE__)
Verify the ADC edge trigger setting for injected group.
#define ADC_TEMPERATURE_SENSOR_INSTANCE(__HANDLE__)
Verify the ADC instance connected to the temperature sensor.
#define ADC_BATTERY_VOLTAGE_INSTANCE(__HANDLE__)
Verify the ADC instance connected to the battery voltage VBAT.
#define IS_ADC_SAMPLING_DELAY(__DELAY__)
Verify the ADC multimode delay setting.
#define ADC_OFFSET_SHIFT_RESOLUTION(__HANDLE__, __OFFSET__)
Shift the offset in function of the selected ADC resolution.
#define IS_ADC_DUAL_DATA_MODE(MODE)
Verify the ADC dual data mode setting.
#define IS_ADC_INJECTED_RANK(__CHANNEL__)
Verify the ADC injected channel setting.
#define ADC_MULTI_SLAVE(__HANDLE_MASTER__, __HANDLE_SLAVE__)
Set handle instance of the ADC slave associated to the ADC master.
#define ADC_CFGR_INJECT_DISCCONTINUOUS(__INJECT_DISCONTINUOUS_MODE__)
Configure ADC discontinuous conversion mode for injected group.
#define ADC_JSQR_RK(__CHANNELNB__, __RANKNB__)
Set the selected injected Channel rank.
#define ADC_CFGR_INJECT_CONTEXT_QUEUE(__INJECT_CONTEXT_QUEUE_MODE__)
Configure ADC injected context queue.
#define IS_ADC_EXTTRIGINJEC(__INJTRIG__)
Verify the ADC injected conversions external trigger.
#define IS_ADC_SINGLE_DIFFERENTIAL(__SING_DIFF__)
Verify the ADC single-ended input or differential mode setting.
#define IS_ADC_MULTIMODE(__MODE__)
Verify the ADC multimode setting.
#define IS_ADC2_DIFF_CHANNEL(__CHANNEL__)
Verify the ADC channel setting in differential mode for ADC2.
#define IS_ADC1_DIFF_CHANNEL(__CHANNEL__)
Verify the ADC channel setting in differential mode for ADC1.
#define IS_ADC_OFFSET_NUMBER(__OFFSET_NUMBER__)
Verify the ADC offset management setting.
#define IS_ADC_RIGHT_BIT_SHIFT(__SHIFT__)
Verify the ADC oversampling shift.
#define IS_ADC_CHANNEL(__CHANNEL__)
Verify the ADC channel setting.
#define ADC_EOC_SEQ_CONV
End of sequence conversions flag.
#define HAL_ADC_ERROR_INTERNAL
ADC peripheral internal error (problem of clocking, enable/disable, erroneous state,...
#define HAL_ADC_ERROR_JQOVF
Injected context queue overflow error.
#define HAL_ADC_ERROR_NONE
No error.
#define ADC_DIFFERENTIAL_ENDED
ADC channel ending set to differential (literal also used to set calibration mode).
#define ADC_CHANNEL_VREFINT
ADC internal channel connected to VrefInt: Internal voltage reference, channel specific to ADC3.
#define ADC_CHANNEL_VBAT
ADC internal channel connected to Vbat/4: Vbat voltage through a divider ladder of factor 1/4 to have...
#define ADC_CHANNEL_TEMPSENSOR
ADC internal channel connected to Temperature sensor, channel specific to ADC3.
#define ADC_REGULAR_INJECTED_GROUP
ADC both groups regular and injected.
#define ADC_REGULAR_GROUP
ADC group regular (available on all STM32 devices).
#define ADC_INJECTED_GROUP
ADC group injected (not available on all STM32 devices).
#define ADC_MODE_INDEPENDENT
ADC dual mode disabled (ADC independent mode).
#define ADC_OFFSET_NONE
ADC offset disabled: no offset correction for the selected ADC channel.
#define __HAL_ADC_ENABLE_IT(__HANDLE__, __INTERRUPT__)
Enable ADC interrupt.
#define __HAL_ADC_DISABLE_IT(__HANDLE__, __INTERRUPT__)
Disable ADC interrupt.
#define __HAL_ADC_CLEAR_FLAG(__HANDLE__, __FLAG__)
Clear the specified ADC flag.
#define __HAL_ADC_GET_FLAG(__HANDLE__, __FLAG__)
Check whether the specified ADC flag is set or not.
#define ADC_INJECTED_RANK_3
ADC group injected sequencer rank 3.
#define ADC_INJECTED_RANK_1
ADC group injected sequencer rank 1.
#define ADC_INJECTED_RANK_2
ADC group injected sequencer rank 2.
#define ADC_INJECTED_RANK_4
ADC group injected sequencer rank 4.
#define ADC_STOP_CONVERSION_TIMEOUT
ADC stop time-out value.
#define ADC_STAB_DELAY_US
ADC voltage regulator startup time.
HAL_StatusTypeDef ADC_Enable(ADC_HandleTypeDef *hadc)
void ADC_DMAConvCplt(DMA_HandleTypeDef *hdma)
void ADC_DMAHalfConvCplt(DMA_HandleTypeDef *hdma)
HAL_StatusTypeDef ADC_ConversionStop(ADC_HandleTypeDef *hadc, uint32_t ConversionGroup)
void ADC_DMAError(DMA_HandleTypeDef *hdma)
HAL_StatusTypeDef ADC_Disable(ADC_HandleTypeDef *hadc)
#define IS_ADC_RANGE(__RESOLUTION__, __ADC_VALUE__)
Verify that a given value is aligned with the ADC resolution range.
#define IS_ADC_EXTTRIG_EDGE(__EDGE__)
Verify the ADC edge trigger setting for regular group.
#define ADC_STATE_CLR_SET
Simultaneously clear and set specific bits of the handle State.
#define ADC_CLEAR_ERRORCODE(__HANDLE__)
Clear ADC error code (set it to no error code "HAL_ADC_ERROR_NONE").
#define IS_ADC_SAMPLE_TIME(__TIME__)
Verify the ADC conversions sampling time.
#define ADC_GET_RESOLUTION(__HANDLE__)
Return resolution bits in CFGR register RES[1:0] field.
#define ADC_SCAN_DISABLE
Scan mode disabled.
#define HAL_ADC_STATE_INJ_BUSY
A conversion on ADC group injected is ongoing or can occur (either by auto-injection mode,...
#define HAL_ADC_STATE_INJ_JQOVF
Injected queue overflow occurrence.
#define HAL_ADC_STATE_REG_OVR
Overrun occurrence.
#define HAL_ADC_STATE_ERROR_CONFIG
Configuration error occurrence.
#define HAL_ADC_STATE_MULTIMODE_SLAVE
ADC in multimode slave state, controlled by another ADC master (when feature available).
#define HAL_ADC_STATE_REG_EOSMP
Not available on this STM32 series: End Of Sampling flag raised.
#define HAL_ADC_STATE_RESET
HAL ADC state machine: ADC states definition (bitfields).
#define HAL_ADC_STATE_REG_BUSY
A conversion on ADC group regular is ongoing or can occur (either by continuous mode,...
#define HAL_ADC_STATE_ERROR_DMA
DMA error occurrence.
#define HAL_ADC_STATE_ERROR_INTERNAL
Internal error occurrence.
#define HAL_ADC_STATE_BUSY_INTERNAL
ADC is busy due to an internal process (initialization, calibration).
#define HAL_ADC_STATE_TIMEOUT
TimeOut occurrence.
#define HAL_ADC_STATE_READY
ADC peripheral ready for use.
#define HAL_ADC_STATE_REG_EOC
Conversion data available on group regular.
#define HAL_ADC_STATE_INJ_EOC
Conversion data available on group injected.
#define ADC_FLAG_JEOC
ADC End of Injected Conversion flag.
#define ADC_FLAG_JQOVF
ADC Injected Context Queue Overflow flag.
#define ADC_FLAG_OVR
ADC overrun flag.
#define ADC_FLAG_EOS
ADC End of Regular sequence of Conversions flag.
#define ADC_FLAG_JEOS
ADC End of Injected sequence of Conversions flag.
#define ADC_FLAG_EOC
ADC End of Regular Conversion flag.
#define ADC_EXTERNALTRIGINJECCONV_EDGE_NONE
Injected conversions hardware trigger detection disabled.
#define ADC_INJECTED_SOFTWARE_START
Software triggers injected group conversion start.
#define ADC_IT_EOC
ADC End of regular conversion interrupt source.
#define ADC_IT_JEOS
ADC End of injected sequence of conversions interrupt source.
#define ADC_IT_OVR
ADC overrun interrupt source.
#define ADC_IT_JEOC
ADC End of injected conversion interrupt source.
#define ADC_IT_EOS
ADC End of regular sequence of conversions interrupt source.
HAL_StatusTypeDef HAL_DMA_Abort(DMA_HandleTypeDef *hdma)
HAL_StatusTypeDef HAL_DMA_Start_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength)
#define CLEAR_BIT(REG, BIT)
#define IS_ADC_ALL_INSTANCE(INSTANCE)
#define SET_BIT(REG, BIT)
#define IS_ADC_MULTIMODE_MASTER_INSTANCE(INSTANCE)
#define MODIFY_REG(REG, CLEARMASK, SETMASK)
#define READ_BIT(REG, BIT)
#define IS_FUNCTIONAL_STATE(STATE)
uint32_t HAL_GetTick(void)
Provides a tick value in millisecond.
#define ADC_CFGR_DMNGT_1
0x00000002
#define ADC_CFGR_JAUTO
ADC Automatic injected group conversion.
#define ADC_SQR3_SQ10
ADC 10th conversion in regular sequence.
#define ADC_CFGR2_TROVS
ADC Triggered regular Oversampling.
#define ADC3_CFGR2_OVSR
ADC oversampling ratio.
#define ADC_CR_LINCALRDYW6
ADC Linearity calibration ready Word 6.
#define ADC_CR_ADVREGEN
ADC Voltage regulator Enable.
#define ADC_CFGR2_OVSR_Pos
#define ADC_CFGR2_OVSS
ADC Regular Oversampling shift.
#define ADC_CR_DEEPPWD
ADC Deep power down Enable.
#define ADC_CFGR2_ROVSE
ADC Regular group oversampler enable.
#define ADC_CFGR2_JOVSE
ADC Injected group oversampler enable.
#define ADC_CFGR2_OVSR
ADC oversampling Ratio.
#define ADC_CFGR_AUTDLY
ADC Delayed conversion mode.
#define ADC_CFGR_JQDIS
ADC Injected queue disable.
#define ADC_JSQR_JEXTSEL
ADC external trigger selection for injected group.
#define ADC_CFGR_CONT
ADC Single/continuous conversion mode for regular conversion.
#define ADC_CCR_DELAY
Delay between 2 sampling phases.
#define ADC_CCR_DAMDF
Dual ADC mode Data format.
#define ADC_JSQR_JEXTEN
ADC external trigger enable and polarity selection for injected channels.
#define ADC_CFGR_JQM
ADC JSQR Queue mode.
#define ADC_CCR_DUAL
Dual ADC mode selection.
#define ADC_CFGR_DMNGT_0
0x00000001
#define ADC_CFGR_JDISCEN
ADC Discontinuous mode on injected channels.
uint32_t SystemCoreClock
System Domain1 Clock Frequency.
This file contains all the functions prototypes for the HAL module driver.
#define assert_param(expr)
Uncomment the line below to expanse the "assert_param" macro in the HAL drivers code.
#define HAL_IS_BIT_SET(REG, BIT)
HAL_StatusTypeDef
HAL Status structures definition.
#define __HAL_UNLOCK(__HANDLE__)
#define HAL_IS_BIT_CLR(REG, BIT)
#define __HAL_LOCK(__HANDLE__)
__IO uint32_t CDR
ADC common regular data register for dual Address offset: ADC1/3 base address + 0x30C.
__IO uint32_t CCR
ADC common control register, Address offset: ADC1/3 base address + 0x308.
ADC handle Structure definition.
ADC_InjectionConfigTypeDef InjectionConfig
ADC injected channel configuration build-up structure.
DMA_HandleTypeDef * DMA_Handle
Pointer DMA Handler.
ADC_TypeDef * Instance
Register base address.
ADC_InitTypeDef Init
ADC initialization parameters and regular conversions setting.
__IO uint32_t ErrorCode
ADC Error code.
__IO uint32_t State
ADC communication state (bitmap of ADC states).
FunctionalState ContinuousConvMode
Specify whether the conversion is performed in single mode (one conversion) or continuous mode for AD...
uint32_t ScanConvMode
Configure the sequencer of ADC groups regular and injected.
FunctionalState OversamplingMode
Specify whether the oversampling feature is enabled or disabled.
uint32_t EOCSelection
Specify which EOC (End Of Conversion) flag is used for conversion by polling and interruption: end of...
uint32_t ExternalTrigConvEdge
Select the external event edge used to trigger ADC group regular conversion start.
ADC_OversamplingTypeDef Oversampling
Specify the Oversampling parameters.
FunctionalState DiscontinuousConvMode
Specify whether the conversions sequence of ADC group regular is performed in Complete-sequence/Disco...
uint32_t Ratio
Configures the oversampling ratio.
uint32_t RightBitShift
Configures the division coefficient for the Oversampler.
Structure definition of ADC group injected and ADC channel affected to ADC group injected.
uint32_t InjectedOffsetNumber
Selects the offset number.
uint32_t InjectedSingleDiff
Selection of single-ended or differential input.
FunctionalState AutoInjectedConv
Enables or disables the selected ADC group injected automatic conversion after regular one This param...
uint32_t InjectedSamplingTime
Sampling time value to be set for the selected channel.
FunctionalState InjectedOffsetSignedSaturation
Specifies whether the Signed saturation feature is used or not.
uint32_t ExternalTrigInjecConvEdge
Selects the external trigger edge of injected group.
FunctionalState QueueInjectedContext
Specifies whether the context queue feature is enabled.
ADC_InjOversamplingTypeDef InjecOversampling
Specifies the Oversampling parameters.
uint32_t InjectedChannel
Specifies the channel to configure into ADC group injected.
FunctionalState InjectedDiscontinuousConvMode
Specifies whether the conversions sequence of ADC group injected is performed in Complete-sequence/Di...
uint32_t ExternalTrigInjecConv
Selects the external event used to trigger the conversion start of injected group.
uint32_t InjectedNbrOfConversion
Specifies the number of ranks that will be converted within the ADC group injected sequencer.
uint32_t InjectedOffset
Defines the offset to be subtracted from the raw converted data.
FunctionalState InjecOversamplingMode
Specifies whether the oversampling feature is enabled or disabled.
uint32_t InjectedRank
Specifies the rank in the ADC group injected sequencer.
uint32_t ChannelCount
Number of channels in the injected sequence.
uint32_t ContextQueue
Injected channel configuration context: build-up over each HAL_ADCEx_InjectedConfigChannel() call to ...
Structure definition of ADC multimode.
uint32_t Mode
Configures the ADC to operate in independent or multimode.
uint32_t TwoSamplingDelay
Configures the Delay between 2 sampling phases.
uint32_t DualModeData
Configures the Dual ADC Mode Data Format: This parameter can be a value of ADC Extended Dual Mode Dat...
uint32_t Ratio
Configures the oversampling ratio.
Analog to Digital Converter.
__IO uint32_t CFGR2
ADC Configuration register 2, Address offset: 0x10.
__IO uint32_t JDR3
ADC injected data register 3, Address offset: 0x88.
__IO uint32_t CFGR
ADC Configuration register, Address offset: 0x0C.
__IO uint32_t JSQR
ADC injected sequence register, Address offset: 0x4C.
__IO uint32_t CR
ADC control register, Address offset: 0x08.
__IO uint32_t DR
ADC regular data register, Address offset: 0x40.
__IO uint32_t JDR2
ADC injected data register 2, Address offset: 0x84.
__IO uint32_t JDR1
ADC injected data register 1, Address offset: 0x80.
__IO uint32_t JDR4
ADC injected data register 4, Address offset: 0x8C.
__IO uint32_t PCSEL_RES0
Reserved for ADC3, ADC1/2 pre-channel selection, Address offset: 0x1C.
__IO uint32_t ISR
ADC Interrupt and Status Register, Address offset: 0x00.
void(* XferCpltCallback)(struct __DMA_HandleTypeDef *hdma)
DMA transfer complete callback.
void(* XferErrorCallback)(struct __DMA_HandleTypeDef *hdma)
DMA transfer error callback.
void(* XferHalfCpltCallback)(struct __DMA_HandleTypeDef *hdma)
DMA Half transfer complete callback.