STM32F4xx HAL Documentation
Hardware Abstraction Layer for STM32F4 familiy
Loading...
Searching...
No Matches
IO operation functions

IO operation functions. More...

Collaboration diagram for IO operation functions:

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.
 
void HAL_ADC_ConvCpltCallback (ADC_HandleTypeDef *hadc)
 Regular conversion complete callback in non blocking mode.
 
void HAL_ADC_ConvHalfCpltCallback (ADC_HandleTypeDef *hadc)
 Regular conversion half DMA transfer callback in non blocking mode.
 
void HAL_ADC_LevelOutOfWindowCallback (ADC_HandleTypeDef *hadc)
 Analog watchdog callback in non blocking mode.
 
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

◆ HAL_ADC_Start()

◆ HAL_ADC_Stop()

HAL_StatusTypeDef HAL_ADC_Stop ( ADC_HandleTypeDef * hadc)

#include <stm32f4xx_hal_adc.h>

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 839 of file stm32f4xx_hal_adc.c.

References __HAL_ADC_DISABLE, __HAL_LOCK, __HAL_UNLOCK, ADC_STATE_CLR_SET, assert_param, HAL_ADC_STATE_INJ_BUSY, HAL_ADC_STATE_READY, HAL_ADC_STATE_REG_BUSY, HAL_IS_BIT_CLR, HAL_OK, ADC_HandleTypeDef::Instance, and ADC_HandleTypeDef::State.

◆ HAL_ADC_PollForConversion()

HAL_StatusTypeDef HAL_ADC_PollForConversion ( ADC_HandleTypeDef * hadc,
uint32_t Timeout )

#include <stm32f4xx_hal_adc.h>

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 882 of file stm32f4xx_hal_adc.c.

References __HAL_ADC_CLEAR_FLAG, __HAL_ADC_GET_FLAG, __HAL_UNLOCK, 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_ERROR, HAL_GetTick(), HAL_IS_BIT_CLR, HAL_IS_BIT_SET, HAL_MAX_DELAY, HAL_OK, HAL_TIMEOUT, ADC_HandleTypeDef::Init, ADC_HandleTypeDef::Instance, and ADC_HandleTypeDef::State.

◆ HAL_ADC_PollForEvent()

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

#include <stm32f4xx_hal_adc.h>

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 971 of file stm32f4xx_hal_adc.c.

References __HAL_ADC_CLEAR_FLAG, __HAL_ADC_GET_FLAG, __HAL_UNLOCK, 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(), HAL_MAX_DELAY, HAL_OK, HAL_TIMEOUT, ADC_HandleTypeDef::Instance, IS_ADC_EVENT_TYPE, and ADC_HandleTypeDef::State.

◆ HAL_ADC_Start_IT()

◆ HAL_ADC_Stop_IT()

HAL_StatusTypeDef HAL_ADC_Stop_IT ( ADC_HandleTypeDef * hadc)

#include <stm32f4xx_hal_adc.h>

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 1162 of file stm32f4xx_hal_adc.c.

References __HAL_ADC_DISABLE, __HAL_ADC_DISABLE_IT, __HAL_LOCK, __HAL_UNLOCK, 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, HAL_IS_BIT_CLR, HAL_OK, ADC_HandleTypeDef::Instance, and ADC_HandleTypeDef::State.

◆ HAL_ADC_IRQHandler()

◆ HAL_ADC_Start_DMA()

◆ HAL_ADC_Stop_DMA()

HAL_StatusTypeDef HAL_ADC_Stop_DMA ( ADC_HandleTypeDef * hadc)

#include <stm32f4xx_hal_adc.h>

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 1512 of file stm32f4xx_hal_adc.c.

References __HAL_ADC_DISABLE, __HAL_ADC_DISABLE_IT, __HAL_LOCK, __HAL_UNLOCK, ADC_IT_OVR, ADC_STATE_CLR_SET, assert_param, ADC_HandleTypeDef::DMA_Handle, HAL_ADC_STATE_ERROR_DMA, HAL_ADC_STATE_INJ_BUSY, HAL_ADC_STATE_READY, HAL_ADC_STATE_REG_BUSY, HAL_DMA_Abort(), HAL_DMA_STATE_BUSY, HAL_IS_BIT_CLR, HAL_OK, ADC_HandleTypeDef::Instance, __DMA_HandleTypeDef::State, and ADC_HandleTypeDef::State.

◆ HAL_ADC_GetValue()

uint32_t HAL_ADC_GetValue ( ADC_HandleTypeDef * hadc)

#include <stm32f4xx_hal_adc.h>

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 1568 of file stm32f4xx_hal_adc.c.

References ADC_HandleTypeDef::Instance.

◆ HAL_ADC_ConvCpltCallback()

__weak void HAL_ADC_ConvCpltCallback ( ADC_HandleTypeDef * hadc)

#include <stm32f4xx_hal_adc.h>

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 1580 of file stm32f4xx_hal_adc.c.

References UNUSED.

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

◆ HAL_ADC_ConvHalfCpltCallback()

__weak void HAL_ADC_ConvHalfCpltCallback ( ADC_HandleTypeDef * hadc)

#include <stm32f4xx_hal_adc.h>

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 1595 of file stm32f4xx_hal_adc.c.

References UNUSED.

Referenced by ADC_DMAHalfConvCplt(), ADC_MultiModeDMAHalfConvCplt(), and HAL_ADC_Init().

◆ HAL_ADC_LevelOutOfWindowCallback()

__weak void HAL_ADC_LevelOutOfWindowCallback ( ADC_HandleTypeDef * hadc)

#include <stm32f4xx_hal_adc.h>

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 1610 of file stm32f4xx_hal_adc.c.

References UNUSED.

Referenced by HAL_ADC_Init(), and HAL_ADC_IRQHandler().

◆ HAL_ADC_ErrorCallback()

__weak void HAL_ADC_ErrorCallback ( ADC_HandleTypeDef * hadc)

#include <stm32f4xx_hal_adc.h>

Error ADC callback.

Note
In case of error due to overrun when using ADC with DMA transfer (HAL ADC handle parameter "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 1631 of file stm32f4xx_hal_adc.c.

References UNUSED.

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