At ADC end of conversion HAL_ADC_ConvCpltCallback() function is executed and
user can add his own code by customization of function pointer
HAL_ADC_ConvCpltCallback
In case of ADC Error, HAL_ADC_ErrorCallback() function is executed and user can
add his own code by customization of function pointer HAL_ADC_ErrorCallback
Stop the ADC peripheral using HAL_ADC_Stop_IT()
DMA mode IO operation
Start the ADC peripheral using HAL_ADC_Start_DMA(), at this stage the user specify
the length of data to be transferred at each end of conversion
At The end of data transfer by HAL_ADC_ConvCpltCallback() function is executed
and user can add his own code by customization of function pointer
HAL_ADC_ConvCpltCallback
In case of transfer Error, HAL_ADC_ErrorCallback() function is executed and user can
add his own code by customization of function pointer HAL_ADC_ErrorCallback
Stop the ADC peripheral using HAL_ADC_Stop_DMA()
ADC HAL driver macros list
Below the list of most used macros in ADC HAL driver.
__HAL_ADC_ENABLE : Enable the ADC peripheral
__HAL_ADC_DISABLE : Disable the ADC peripheral
__HAL_ADC_ENABLE_IT: Enable the ADC end of conversion interrupt
__HAL_ADC_DISABLE_IT: Disable the ADC end of conversion interrupt
__HAL_ADC_GET_IT_SOURCE: Check if the specified ADC interrupt source is
enabled or disabled
__HAL_ADC_CLEAR_FLAG: Clear the ADC's pending flags
__HAL_ADC_GET_FLAG: Get the selected ADC's flag status
ADC_GET_RESOLUTION: Return resolution bits in CR1 register
You can refer to the ADC HAL driver header file for more useful macros
Deinitialization of ADC
1. Disable the ADC interface
ADC clock can be hard reset and disabled at RCC top level.
Hard reset of ADC peripherals using macro
__HAL_RCC_ADC_FORCE_RESET(), __HAL_RCC_ADC_RELEASE_RESET().
ADC clock disable using the equivalent macro/functions as configuration step.
Example: Into HAL_ADC_MspDeInit() (recommended code location) or with
other device clock parameters configuration:
HAL_RCC_GetOscConfig(&RCC_OscInitStructure);
RCC_OscInitStructure.OscillatorType = RCC_OSCILLATORTYPE_HSI;
RCC_OscInitStructure.HSIState = RCC_HSI_OFF; (if not used for system
clock)
HAL_RCC_OscConfig(&RCC_OscInitStructure);
2. ADC pins configuration
Disable the clock for the ADC GPIOs using macro
__HAL_RCC_GPIOx_CLK_DISABLE()
3. Optionally, in case of usage of ADC with interruptions: