Dma Mode Io Operation; Adc Hal Driver Macros List; Deinitialization Of Adc - ST STM32F2 User Manual

Description of stm32f2 hal and low layer drivers
Hide thumbs Also See for STM32F2:
Table of Contents

Advertisement

HAL ADC Generic Driver
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

Deinitialization of ADC

1.
Disable the ADC interface
2.
ADC pins configuration
3.
Optionally, in case of usage of ADC with interruptions:
82/1371
You can refer to the ADC HAL driver header file for more useful macros
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);
Disable the clock for the ADC GPIOs using macro
__HAL_RCC_GPIOx_CLK_DISABLE()
DocID028236 Rev 2
UM1940

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32F2 and is the answer not in the manual?

Questions and answers

Table of Contents

Save PDF