Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Input and Output operation functions
[ADC Exported Functions]
IO operation functions. More...
Functions | |
HAL_StatusTypeDef | HAL_ADC_Start (ADC_HandleTypeDef *hadc) |
Enable ADC, start conversion of regular group. | |
HAL_StatusTypeDef | HAL_ADC_Stop (ADC_HandleTypeDef *hadc) |
Stop ADC conversion of regular and injected groups, disable ADC peripheral. | |
HAL_StatusTypeDef | HAL_ADC_PollForConversion (ADC_HandleTypeDef *hadc, uint32_t Timeout) |
Wait for regular group conversion to be completed. | |
HAL_StatusTypeDef | HAL_ADC_PollForEvent (ADC_HandleTypeDef *hadc, uint32_t EventType, uint32_t Timeout) |
Poll for ADC event. | |
HAL_StatusTypeDef | HAL_ADC_Start_IT (ADC_HandleTypeDef *hadc) |
Enable ADC, start conversion of regular group with interruption. | |
HAL_StatusTypeDef | HAL_ADC_Stop_IT (ADC_HandleTypeDef *hadc) |
Stop ADC conversion of regular groups when interruptions are enabled. | |
HAL_StatusTypeDef | HAL_ADC_Start_DMA (ADC_HandleTypeDef *hadc, uint32_t *pData, uint32_t Length) |
Enable ADC, start conversion of regular group and transfer result through DMA. | |
HAL_StatusTypeDef | HAL_ADC_Stop_DMA (ADC_HandleTypeDef *hadc) |
Stop ADC conversion of regular groups and disable ADC DMA transfer. | |
uint32_t | HAL_ADC_GetValue (ADC_HandleTypeDef *hadc) |
Get ADC regular group conversion result. | |
void | HAL_ADC_IRQHandler (ADC_HandleTypeDef *hadc) |
Handle ADC interrupt request. | |
__weak void | HAL_ADC_ConvCpltCallback (ADC_HandleTypeDef *hadc) |
Conversion complete callback in non-blocking mode. | |
__weak void | HAL_ADC_ConvHalfCpltCallback (ADC_HandleTypeDef *hadc) |
Conversion DMA half-transfer callback in non-blocking mode. | |
__weak void | HAL_ADC_LevelOutOfWindowCallback (ADC_HandleTypeDef *hadc) |
Analog watchdog 1 callback in non-blocking mode. | |
__weak void | HAL_ADC_ErrorCallback (ADC_HandleTypeDef *hadc) |
ADC error callback in non-blocking mode (ADC conversion with interruption or transfer by DMA). |
Detailed Description
IO operation functions.
=============================================================================== ##### IO operation functions ##### =============================================================================== [..] This section provides functions allowing to: (+) Start conversion of regular group. (+) Stop conversion of regular group. (+) Poll for conversion complete on regular group. (+) Poll for conversion event. (+) Get result of regular channel conversion. (+) Start conversion of regular group and enable interruptions. (+) Stop conversion of regular group and disable interruptions. (+) Handle ADC interrupt request (+) Start conversion of regular group and enable DMA transfer. (+) Stop conversion of regular group and disable ADC DMA transfer.
Function Documentation
__weak void HAL_ADC_ConvCpltCallback | ( | ADC_HandleTypeDef * | hadc ) |
Conversion complete callback in non-blocking mode.
- Parameters:
-
hadc,: ADC handle
- Return values:
-
None
Definition at line 2002 of file stm32l4xx_hal_adc.c.
__weak void HAL_ADC_ConvHalfCpltCallback | ( | ADC_HandleTypeDef * | hadc ) |
Conversion DMA half-transfer callback in non-blocking mode.
- Parameters:
-
hadc,: ADC handle
- Return values:
-
None
Definition at line 2017 of file stm32l4xx_hal_adc.c.
__weak void HAL_ADC_ErrorCallback | ( | ADC_HandleTypeDef * | hadc ) |
ADC error callback in non-blocking mode (ADC conversion with interruption or transfer by DMA).
- Parameters:
-
hadc,: ADC handle
- Return values:
-
None
Definition at line 2048 of file stm32l4xx_hal_adc.c.
uint32_t HAL_ADC_GetValue | ( | ADC_HandleTypeDef * | hadc ) |
Get ADC regular group conversion result.
- Parameters:
-
hadc,: ADC handle
- Note:
- Reading DR register automatically clears EOC flag. To reset EOS flag, the user must resort to the macro __HAL_ADC_CLEAR_FLAG(hadc, ADC_FLAG_EOS)
- Return values:
-
Converted value
Definition at line 1666 of file stm32l4xx_hal_adc.c.
void HAL_ADC_IRQHandler | ( | ADC_HandleTypeDef * | hadc ) |
Handle ADC interrupt request.
- Parameters:
-
hadc,: ADC handle
- Return values:
-
None
Definition at line 1681 of file stm32l4xx_hal_adc.c.
__weak void HAL_ADC_LevelOutOfWindowCallback | ( | ADC_HandleTypeDef * | hadc ) |
Analog watchdog 1 callback in non-blocking mode.
- Parameters:
-
hadc,: ADC handle
- Return values:
-
None
Definition at line 2032 of file stm32l4xx_hal_adc.c.
HAL_StatusTypeDef HAL_ADC_PollForConversion | ( | ADC_HandleTypeDef * | hadc, |
uint32_t | Timeout | ||
) |
Wait for regular group conversion to be completed.
- Parameters:
-
hadc,: ADC handle Timeout,: Timeout value in millisecond.
- Note:
- Depending on hadc->Init.EOCSelection, EOS or EOC is checked and cleared depending on AUTDLY bit status.
- HAL_ADC_PollForConversion() returns HAL_ERROR if EOC is polled in a DMA-managed conversions configuration: indeed, EOC is immediately reset by the DMA reading the DR register when the converted data is available. Therefore, EOC is set for a too short period to be reliably polled.
- Return values:
-
HAL status
Definition at line 965 of file stm32l4xx_hal_adc.c.
HAL_StatusTypeDef HAL_ADC_PollForEvent | ( | ADC_HandleTypeDef * | hadc, |
uint32_t | EventType, | ||
uint32_t | Timeout | ||
) |
Poll for ADC event.
- Parameters:
-
hadc,: ADC handle EventType,: the ADC event type. This parameter can be one of the following values: - ADC_EOSMP_EVENT ADC End of Sampling event
- ADC_AWD_EVENT ADC Analog watchdog 1 event
- ADC_AWD2_EVENT ADC Analog watchdog 2 event
- ADC_AWD3_EVENT ADC Analog watchdog 3 event
- ADC_OVR_EVENT ADC Overrun event
- ADC_JQOVF_EVENT ADC Injected context queue overflow event
Timeout,: Timeout value in millisecond.
- Note:
- The relevant flag is cleared if found to be set, except for ADC_FLAG_OVR. Indeed, the latter is reset only if hadc->Init.Overrun field is set to ADC_OVR_DATA_OVERWRITTEN. Otherwise, DR may be potentially overwritten by a new converted data as soon as OVR is cleared. To reset OVR flag once the preserved data is retrieved, the user can resort to macro __HAL_ADC_CLEAR_FLAG(hadc, ADC_FLAG_OVR);
- Return values:
-
HAL status
Definition at line 1118 of file stm32l4xx_hal_adc.c.
HAL_StatusTypeDef HAL_ADC_Start | ( | ADC_HandleTypeDef * | hadc ) |
Enable ADC, start conversion of regular group.
- Note:
- Interruptions enabled in this function: None.
- Case of multimode enabled (when multimode feature is available): if ADC is Slave, ADC is enabled but conversion is not started, if ADC is master, ADC is enabled and multimode conversion is started.
- Parameters:
-
hadc,: ADC handle
- Return values:
-
HAL status
Definition at line 810 of file stm32l4xx_hal_adc.c.
HAL_StatusTypeDef HAL_ADC_Start_DMA | ( | ADC_HandleTypeDef * | hadc, |
uint32_t * | pData, | ||
uint32_t | Length | ||
) |
Enable ADC, start conversion of regular group and transfer result through DMA.
- Note:
- Interruptions enabled in this function: overrun (if applicable), DMA half transfer, DMA transfer complete. Each of these interruptions has its dedicated callback function.
- Case of multimode enabled (when multimode feature is available): HAL_ADC_Start_DMA() is designed for single-ADC mode only. For multimode, the dedicated HAL_ADCEx_MultiModeStart_DMA() function must be used.
- Parameters:
-
hadc,: ADC handle pData,: Destination Buffer address. Length,: Length of data to be transferred from ADC peripheral to memory (in bytes)
- Return values:
-
None
Definition at line 1477 of file stm32l4xx_hal_adc.c.
HAL_StatusTypeDef HAL_ADC_Start_IT | ( | ADC_HandleTypeDef * | hadc ) |
Enable ADC, start conversion of regular group with interruption.
- Note:
- Interruptions enabled in this function according to initialization setting : EOC (end of conversion), EOS (end of sequence), OVR overrun. Each of these interruptions has its dedicated callback function.
- Case of multimode enabled (when multimode feature is available): HAL_ADC_Start_IT() must be called for ADC Slave first, then for ADC Master. For ADC Slave, ADC is enabled only (conversion is not started). For ADC Master, ADC is enabled and multimode conversion is started.
- To guarantee a proper reset of all interruptions once all the needed conversions are obtained, HAL_ADC_Stop_IT() must be called to ensure a correct stop of the IT-based conversions.
- By default, HAL_ADC_Start_IT() doesn't enable the End Of Sampling interruption. If required (e.g. in case of oversampling with trigger mode), the user must 1. first clear the EOSMP flag if set with macro __HAL_ADC_CLEAR_FLAG(hadc, ADC_FLAG_EOSMP) 2. then enable the EOSMP interrupt with macro __HAL_ADC_ENABLE_IT(hadc, ADC_IT_EOSMP) before calling HAL_ADC_Start_IT().
- Parameters:
-
hadc,: ADC handle
- Return values:
-
HAL status
Definition at line 1261 of file stm32l4xx_hal_adc.c.
HAL_StatusTypeDef HAL_ADC_Stop | ( | ADC_HandleTypeDef * | hadc ) |
Stop ADC conversion of regular and injected groups, disable ADC peripheral.
- Parameters:
-
hadc,: ADC handle
- Return values:
-
HAL status.
Definition at line 915 of file stm32l4xx_hal_adc.c.
HAL_StatusTypeDef HAL_ADC_Stop_DMA | ( | ADC_HandleTypeDef * | hadc ) |
Stop ADC conversion of regular groups and disable ADC DMA transfer.
- Note:
- Stop as well injected conversions and disable ADC peripheral.
- Case of multimode enabled (when multimode feature is available): HAL_ADC_Stop_DMA() function is dedicated to single-ADC mode only. For multimode, the dedicated HAL_ADCEx_MultiModeStop_DMA() API must be used.
- Parameters:
-
hadc,: ADC handle
- Return values:
-
HAL status.
Definition at line 1595 of file stm32l4xx_hal_adc.c.
HAL_StatusTypeDef HAL_ADC_Stop_IT | ( | ADC_HandleTypeDef * | hadc ) |
Stop ADC conversion of regular groups when interruptions are enabled.
- Note:
- Stop as well injected conversions and disable ADC peripheral.
- Parameters:
-
hadc,: ADC handle
- Return values:
-
HAL status.
Definition at line 1425 of file stm32l4xx_hal_adc.c.
Generated on Tue Jul 12 2022 11:00:03 by
