HAL ADC Overview ¶
Introducing ADC ¶
- group ADC_Introduction
-
The ADC (analog to digital converter) hardware abstraction layer provides a set of APIs to interface with the STM32 ADC peripheral.
It simplifies the initialization, configuration and process of peripheral features. (including various modes such as polling, interrupt, DMA for efficient data transfer)
This abstraction layer ensures portability and ease of use across different STM32 series.
The HAL ADC driver includes the following features:
Structures and functions organized in subblocks to use only the features needed
Base: ADC instance, groups regular and injected, channels
Optional: analog watchdog, oversampling, offset, post processing, multimode (combine multiple ADC instances)
Supports polling, interrupt, DMA for efficient data transfer
Module and files ¶
The following diagram illustrates the ADC module and its associated files.
Component diagram ¶
The following diagram illustrates the software components involved in the ADC module. It shows the interactions between the user application, HAL drivers, low-level drivers, and the hardware components.
Configuration table ¶
The following table lists the configuration defines for the HAL ADC module, specifying their locations, default values, and descriptions:
- group ADC_Configuration_Table
-
¶
Configuration inside the ADC driver ¶
Config defines
Description
Default value
Note
USE_HAL_ADC_MODULE
from hal_conf.h
1
When set, HAL ADC module is enabled
USE_HAL_ADC_DMA
from hal_conf.h
1
Enable DMA code inside ADC
USE_HAL_ADC_REGISTER_CALLBACKS
from hal_conf.h
0
When defined, enable the register callbacks assert
USE_HAL_ADC_CLK_ENABLE_MODEL
from hal_conf.h
HAL_CLK_ENABLE_NO
Enable gating of the peripheral clock
USE_HAL_CHECK_PARAM
from hal_conf.h
0
Parameters (pointers or sizes) are checked in runtime
USE_HAL_CHECK_PROCESS_STATE
from hal_conf.h
0
When set, enable atomic access to process state check
USE_ASSERT_DBG_PARAM
from PreProcessor env
None
When defined, enable the params assert
USE_ASSERT_DBG_STATE
from PreProcessor env
None
When defined, enable the state assert
ADC_INST_IN_COMMON_COUNT
from CMSIS
None
When defined and value > 2, multiple ADC handles can be linked
ADC_MULTIMODE_SUPPORT
from CMSIS
None
When defined, multimode features available