STM32F439xx HAL User Manual
Functions
IO operation functions
ADC Exported Functions

IO operation functions. More...

Functions

HAL_StatusTypeDef HAL_ADC_Start (ADC_HandleTypeDef *hadc)
 Enables ADC and starts conversion of the regular channels.
HAL_StatusTypeDef HAL_ADC_Stop (ADC_HandleTypeDef *hadc)
 Disables ADC and stop conversion of regular channels.
HAL_StatusTypeDef HAL_ADC_PollForConversion (ADC_HandleTypeDef *hadc, uint32_t Timeout)
 Poll for regular conversion complete.
HAL_StatusTypeDef HAL_ADC_PollForEvent (ADC_HandleTypeDef *hadc, uint32_t EventType, uint32_t Timeout)
 Poll for conversion event.
HAL_StatusTypeDef HAL_ADC_Start_IT (ADC_HandleTypeDef *hadc)
 Enables the interrupt and starts ADC conversion of regular channels.
HAL_StatusTypeDef HAL_ADC_Stop_IT (ADC_HandleTypeDef *hadc)
 Disables the interrupt and stop ADC conversion of regular channels.
void HAL_ADC_IRQHandler (ADC_HandleTypeDef *hadc)
 Handles ADC interrupt request.
HAL_StatusTypeDef HAL_ADC_Start_DMA (ADC_HandleTypeDef *hadc, uint32_t *pData, uint32_t Length)
 Enables ADC DMA request after last transfer (Single-ADC mode) and enables ADC peripheral.
HAL_StatusTypeDef HAL_ADC_Stop_DMA (ADC_HandleTypeDef *hadc)
 Disables ADC DMA (Single-ADC mode) and disables ADC peripheral.
uint32_t HAL_ADC_GetValue (ADC_HandleTypeDef *hadc)
 Gets the converted value from data register of regular channel.
__weak void HAL_ADC_ConvCpltCallback (ADC_HandleTypeDef *hadc)
 Regular conversion complete callback in non blocking mode.
__weak void HAL_ADC_ConvHalfCpltCallback (ADC_HandleTypeDef *hadc)
 Regular conversion half DMA transfer callback in non blocking mode.
__weak void HAL_ADC_LevelOutOfWindowCallback (ADC_HandleTypeDef *hadc)
 Analog watchdog callback in non blocking mode.
__weak void HAL_ADC_ErrorCallback (ADC_HandleTypeDef *hadc)
 Error ADC callback.

Detailed Description

IO operation functions.

 ===============================================================================
             ##### IO operation functions #####
 ===============================================================================  
    [..]  This section provides functions allowing to:
      (+) Start conversion of regular channel.
      (+) Stop conversion of regular channel.
      (+) Start conversion of regular channel and enable interrupt.
      (+) Stop conversion of regular channel and disable interrupt.
      (+) Start conversion of regular channel and enable DMA transfer.
      (+) Stop conversion of regular channel and disable DMA transfer.
      (+) Handle ADC interrupt request. 
               

Function Documentation

Regular conversion complete callback in non blocking mode.

Parameters:
hadcpointer to a ADC_HandleTypeDef structure that contains the configuration information for the specified ADC.
Return values:
None

Definition at line 1206 of file stm32f4xx_hal_adc.c.

Referenced by ADC_DMAConvCplt(), ADC_MultiModeDMAConvCplt(), and HAL_ADC_IRQHandler().

Regular conversion half DMA transfer callback in non blocking mode.

Parameters:
hadcpointer to a ADC_HandleTypeDef structure that contains the configuration information for the specified ADC.
Return values:
None

Definition at line 1221 of file stm32f4xx_hal_adc.c.

Referenced by ADC_DMAHalfConvCplt(), and ADC_MultiModeDMAHalfConvCplt().

Error ADC callback.

Note:
In case of error due to overrun when using ADC with DMA transfer (HAL ADC handle paramater "ErrorCode" to state "HAL_ADC_ERROR_OVR"):
  • Reinitialize the DMA using function "HAL_ADC_Stop_DMA()".
  • If needed, restart a new ADC conversion using function "HAL_ADC_Start_DMA()" (this function is also clearing overrun flag)
Parameters:
hadcpointer to a ADC_HandleTypeDef structure that contains the configuration information for the specified ADC.
Return values:
None

Definition at line 1257 of file stm32f4xx_hal_adc.c.

Referenced by ADC_DMAError(), ADC_MultiModeDMAError(), and HAL_ADC_IRQHandler().

uint32_t HAL_ADC_GetValue ( ADC_HandleTypeDef hadc)

Gets the converted value from data register of regular channel.

Parameters:
hadcpointer to a ADC_HandleTypeDef structure that contains the configuration information for the specified ADC.
Return values:
Convertedvalue

Definition at line 1194 of file stm32f4xx_hal_adc.c.

References ADC_HandleTypeDef::Instance.

Analog watchdog callback in non blocking mode.

Parameters:
hadcpointer to a ADC_HandleTypeDef structure that contains the configuration information for the specified ADC.
Return values:
None

Definition at line 1236 of file stm32f4xx_hal_adc.c.

Referenced by HAL_ADC_IRQHandler().

HAL_StatusTypeDef HAL_ADC_PollForConversion ( ADC_HandleTypeDef hadc,
uint32_t  Timeout 
)

Poll for regular conversion complete.

Note:
ADC conversion flags EOS (end of sequence) and EOC (end of conversion) are cleared by this function.
This function cannot be used in a particular setup: ADC configured in DMA mode and polling for end of each conversion (ADC init parameter "EOCSelection" set to ADC_EOC_SINGLE_CONV). In this case, DMA resets the flag EOC and polling cannot be performed on each conversion. Nevertheless, polling can still be performed on the complete sequence.
Parameters:
hadcpointer to a ADC_HandleTypeDef structure that contains the configuration information for the specified ADC.
TimeoutTimeout value in millisecond.
Return values:
HALstatus

Definition at line 585 of file stm32f4xx_hal_adc.c.

References __HAL_ADC_CLEAR_FLAG, __HAL_ADC_GET_FLAG, ADC_FLAG_EOC, ADC_FLAG_STRT, ADC_IS_SOFTWARE_START_REGULAR, ADC_InitTypeDef::ContinuousConvMode, HAL_ADC_STATE_ERROR_CONFIG, HAL_ADC_STATE_INJ_BUSY, HAL_ADC_STATE_READY, HAL_ADC_STATE_REG_BUSY, HAL_ADC_STATE_REG_EOC, HAL_ADC_STATE_TIMEOUT, HAL_GetTick(), ADC_HandleTypeDef::Init, ADC_HandleTypeDef::Instance, and ADC_HandleTypeDef::State.

HAL_StatusTypeDef HAL_ADC_PollForEvent ( ADC_HandleTypeDef hadc,
uint32_t  EventType,
uint32_t  Timeout 
)

Poll for conversion event.

Parameters:
hadcpointer to a ADC_HandleTypeDef structure that contains the configuration information for the specified ADC.
EventTypethe ADC event type. This parameter can be one of the following values:
  • ADC_AWD_EVENT: ADC Analog watch Dog event.
  • ADC_OVR_EVENT: ADC Overrun event.
TimeoutTimeout value in millisecond.
Return values:
HALstatus

Definition at line 670 of file stm32f4xx_hal_adc.c.

References __HAL_ADC_CLEAR_FLAG, __HAL_ADC_GET_FLAG, ADC_AWD_EVENT, ADC_FLAG_AWD, ADC_FLAG_OVR, assert_param, ADC_HandleTypeDef::ErrorCode, HAL_ADC_ERROR_OVR, HAL_ADC_STATE_AWD1, HAL_ADC_STATE_REG_OVR, HAL_ADC_STATE_TIMEOUT, HAL_GetTick(), ADC_HandleTypeDef::Instance, IS_ADC_EVENT_TYPE, and ADC_HandleTypeDef::State.

HAL_StatusTypeDef HAL_ADC_Start ( ADC_HandleTypeDef hadc)
HAL_StatusTypeDef HAL_ADC_Start_DMA ( ADC_HandleTypeDef hadc,
uint32_t *  pData,
uint32_t  Length 
)
HAL_StatusTypeDef HAL_ADC_Start_IT ( ADC_HandleTypeDef hadc)
HAL_StatusTypeDef HAL_ADC_Stop ( ADC_HandleTypeDef hadc)

Disables ADC and stop conversion of regular channels.

Note:
Caution: This function will stop also injected channels.
Parameters:
hadcpointer to a ADC_HandleTypeDef structure that contains the configuration information for the specified ADC.
Return values:
HALstatus.

Definition at line 542 of file stm32f4xx_hal_adc.c.

References __HAL_ADC_DISABLE, ADC_STATE_CLR_SET, assert_param, HAL_ADC_STATE_INJ_BUSY, HAL_ADC_STATE_READY, HAL_ADC_STATE_REG_BUSY, ADC_HandleTypeDef::Instance, and ADC_HandleTypeDef::State.

HAL_StatusTypeDef HAL_ADC_Stop_DMA ( ADC_HandleTypeDef hadc)

Disables ADC DMA (Single-ADC mode) and disables ADC peripheral.

Parameters:
hadcpointer to a ADC_HandleTypeDef structure that contains the configuration information for the specified ADC.
Return values:
HALstatus

Definition at line 1148 of file stm32f4xx_hal_adc.c.

References __HAL_ADC_DISABLE, __HAL_ADC_DISABLE_IT, ADC_IT_OVR, ADC_STATE_CLR_SET, assert_param, ADC_HandleTypeDef::DMA_Handle, HAL_ADC_STATE_INJ_BUSY, HAL_ADC_STATE_READY, HAL_ADC_STATE_REG_BUSY, HAL_DMA_Abort(), ADC_HandleTypeDef::Instance, and ADC_HandleTypeDef::State.

HAL_StatusTypeDef HAL_ADC_Stop_IT ( ADC_HandleTypeDef hadc)

Disables the interrupt and stop ADC conversion of regular channels.

Note:
Caution: This function will stop also injected channels.
Parameters:
hadcpointer to a ADC_HandleTypeDef structure that contains the configuration information for the specified ADC.
Return values:
HALstatus.

Definition at line 841 of file stm32f4xx_hal_adc.c.

References __HAL_ADC_DISABLE, __HAL_ADC_DISABLE_IT, ADC_IT_EOC, ADC_IT_OVR, ADC_STATE_CLR_SET, assert_param, HAL_ADC_STATE_INJ_BUSY, HAL_ADC_STATE_READY, HAL_ADC_STATE_REG_BUSY, ADC_HandleTypeDef::Instance, and ADC_HandleTypeDef::State.