STM32F2 Standard Peripheral bibliotheek  1.0
ST Microelectronics bibliotheek documentatie voor de STM32F2 Standard Peripheral Library
 All Data Structures Files Functions Variables Enumerations Enumerator Groups
stm32f2xx_adc.h File Reference

This file contains all the functions prototypes for the ADC firmware library. More...

#include "stm32f2xx.h"

Go to the source code of this file.

Data Structures

struct  ADC_InitTypeDef
 ADC Init structure definition. More...
 
struct  ADC_CommonInitTypeDef
 ADC Common Init structure definition. More...
 

Macros

#define IS_ADC_ALL_PERIPH(PERIPH)
 
#define ADC_Mode_Independent   ((uint32_t)0x00000000)
 
#define ADC_DualMode_RegSimult_InjecSimult   ((uint32_t)0x00000001)
 
#define ADC_DualMode_RegSimult_AlterTrig   ((uint32_t)0x00000002)
 
#define ADC_DualMode_InjecSimult   ((uint32_t)0x00000005)
 
#define ADC_DualMode_RegSimult   ((uint32_t)0x00000006)
 
#define ADC_DualMode_Interl   ((uint32_t)0x00000007)
 
#define ADC_DualMode_AlterTrig   ((uint32_t)0x00000009)
 
#define ADC_TripleMode_RegSimult_InjecSimult   ((uint32_t)0x00000011)
 
#define ADC_TripleMode_RegSimult_AlterTrig   ((uint32_t)0x00000012)
 
#define ADC_TripleMode_InjecSimult   ((uint32_t)0x00000015)
 
#define ADC_TripleMode_RegSimult   ((uint32_t)0x00000016)
 
#define ADC_TripleMode_Interl   ((uint32_t)0x00000017)
 
#define ADC_TripleMode_AlterTrig   ((uint32_t)0x00000019)
 
#define IS_ADC_MODE(MODE)
 
#define ADC_Prescaler_Div2   ((uint32_t)0x00000000)
 
#define ADC_Prescaler_Div4   ((uint32_t)0x00010000)
 
#define ADC_Prescaler_Div6   ((uint32_t)0x00020000)
 
#define ADC_Prescaler_Div8   ((uint32_t)0x00030000)
 
#define IS_ADC_PRESCALER(PRESCALER)
 
#define ADC_DMAAccessMode_Disabled   ((uint32_t)0x00000000) /* DMA mode disabled */
 
#define ADC_DMAAccessMode_1   ((uint32_t)0x00004000) /* DMA mode 1 enabled (2 / 3 half-words one by one - 1 then 2 then 3)*/
 
#define ADC_DMAAccessMode_2   ((uint32_t)0x00008000) /* DMA mode 2 enabled (2 / 3 half-words by pairs - 2&1 then 1&3 then 3&2)*/
 
#define ADC_DMAAccessMode_3   ((uint32_t)0x0000C000) /* DMA mode 3 enabled (2 / 3 bytes by pairs - 2&1 then 1&3 then 3&2) */
 
#define IS_ADC_DMA_ACCESS_MODE(MODE)
 
#define ADC_TwoSamplingDelay_5Cycles   ((uint32_t)0x00000000)
 
#define ADC_TwoSamplingDelay_6Cycles   ((uint32_t)0x00000100)
 
#define ADC_TwoSamplingDelay_7Cycles   ((uint32_t)0x00000200)
 
#define ADC_TwoSamplingDelay_8Cycles   ((uint32_t)0x00000300)
 
#define ADC_TwoSamplingDelay_9Cycles   ((uint32_t)0x00000400)
 
#define ADC_TwoSamplingDelay_10Cycles   ((uint32_t)0x00000500)
 
#define ADC_TwoSamplingDelay_11Cycles   ((uint32_t)0x00000600)
 
#define ADC_TwoSamplingDelay_12Cycles   ((uint32_t)0x00000700)
 
#define ADC_TwoSamplingDelay_13Cycles   ((uint32_t)0x00000800)
 
#define ADC_TwoSamplingDelay_14Cycles   ((uint32_t)0x00000900)
 
#define ADC_TwoSamplingDelay_15Cycles   ((uint32_t)0x00000A00)
 
#define ADC_TwoSamplingDelay_16Cycles   ((uint32_t)0x00000B00)
 
#define ADC_TwoSamplingDelay_17Cycles   ((uint32_t)0x00000C00)
 
#define ADC_TwoSamplingDelay_18Cycles   ((uint32_t)0x00000D00)
 
#define ADC_TwoSamplingDelay_19Cycles   ((uint32_t)0x00000E00)
 
#define ADC_TwoSamplingDelay_20Cycles   ((uint32_t)0x00000F00)
 
#define IS_ADC_SAMPLING_DELAY(DELAY)
 
#define ADC_Resolution_12b   ((uint32_t)0x00000000)
 
#define ADC_Resolution_10b   ((uint32_t)0x01000000)
 
#define ADC_Resolution_8b   ((uint32_t)0x02000000)
 
#define ADC_Resolution_6b   ((uint32_t)0x03000000)
 
#define IS_ADC_RESOLUTION(RESOLUTION)
 
#define ADC_ExternalTrigConvEdge_None   ((uint32_t)0x00000000)
 
#define ADC_ExternalTrigConvEdge_Rising   ((uint32_t)0x10000000)
 
#define ADC_ExternalTrigConvEdge_Falling   ((uint32_t)0x20000000)
 
#define ADC_ExternalTrigConvEdge_RisingFalling   ((uint32_t)0x30000000)
 
#define IS_ADC_EXT_TRIG_EDGE(EDGE)
 
#define ADC_ExternalTrigConv_T1_CC1   ((uint32_t)0x00000000)
 
#define ADC_ExternalTrigConv_T1_CC2   ((uint32_t)0x01000000)
 
#define ADC_ExternalTrigConv_T1_CC3   ((uint32_t)0x02000000)
 
#define ADC_ExternalTrigConv_T2_CC2   ((uint32_t)0x03000000)
 
#define ADC_ExternalTrigConv_T2_CC3   ((uint32_t)0x04000000)
 
#define ADC_ExternalTrigConv_T2_CC4   ((uint32_t)0x05000000)
 
#define ADC_ExternalTrigConv_T2_TRGO   ((uint32_t)0x06000000)
 
#define ADC_ExternalTrigConv_T3_CC1   ((uint32_t)0x07000000)
 
#define ADC_ExternalTrigConv_T3_TRGO   ((uint32_t)0x08000000)
 
#define ADC_ExternalTrigConv_T4_CC4   ((uint32_t)0x09000000)
 
#define ADC_ExternalTrigConv_T5_CC1   ((uint32_t)0x0A000000)
 
#define ADC_ExternalTrigConv_T5_CC2   ((uint32_t)0x0B000000)
 
#define ADC_ExternalTrigConv_T5_CC3   ((uint32_t)0x0C000000)
 
#define ADC_ExternalTrigConv_T8_CC1   ((uint32_t)0x0D000000)
 
#define ADC_ExternalTrigConv_T8_TRGO   ((uint32_t)0x0E000000)
 
#define ADC_ExternalTrigConv_Ext_IT11   ((uint32_t)0x0F000000)
 
#define IS_ADC_EXT_TRIG(REGTRIG)
 
#define ADC_DataAlign_Right   ((uint32_t)0x00000000)
 
#define ADC_DataAlign_Left   ((uint32_t)0x00000800)
 
#define IS_ADC_DATA_ALIGN(ALIGN)
 
#define ADC_Channel_0   ((uint8_t)0x00)
 
#define ADC_Channel_1   ((uint8_t)0x01)
 
#define ADC_Channel_2   ((uint8_t)0x02)
 
#define ADC_Channel_3   ((uint8_t)0x03)
 
#define ADC_Channel_4   ((uint8_t)0x04)
 
#define ADC_Channel_5   ((uint8_t)0x05)
 
#define ADC_Channel_6   ((uint8_t)0x06)
 
#define ADC_Channel_7   ((uint8_t)0x07)
 
#define ADC_Channel_8   ((uint8_t)0x08)
 
#define ADC_Channel_9   ((uint8_t)0x09)
 
#define ADC_Channel_10   ((uint8_t)0x0A)
 
#define ADC_Channel_11   ((uint8_t)0x0B)
 
#define ADC_Channel_12   ((uint8_t)0x0C)
 
#define ADC_Channel_13   ((uint8_t)0x0D)
 
#define ADC_Channel_14   ((uint8_t)0x0E)
 
#define ADC_Channel_15   ((uint8_t)0x0F)
 
#define ADC_Channel_16   ((uint8_t)0x10)
 
#define ADC_Channel_17   ((uint8_t)0x11)
 
#define ADC_Channel_18   ((uint8_t)0x12)
 
#define ADC_Channel_TempSensor   ((uint8_t)ADC_Channel_16)
 
#define ADC_Channel_Vrefint   ((uint8_t)ADC_Channel_17)
 
#define ADC_Channel_Vbat   ((uint8_t)ADC_Channel_18)
 
#define IS_ADC_CHANNEL(CHANNEL)
 
#define ADC_SampleTime_3Cycles   ((uint8_t)0x00)
 
#define ADC_SampleTime_15Cycles   ((uint8_t)0x01)
 
#define ADC_SampleTime_28Cycles   ((uint8_t)0x02)
 
#define ADC_SampleTime_56Cycles   ((uint8_t)0x03)
 
#define ADC_SampleTime_84Cycles   ((uint8_t)0x04)
 
#define ADC_SampleTime_112Cycles   ((uint8_t)0x05)
 
#define ADC_SampleTime_144Cycles   ((uint8_t)0x06)
 
#define ADC_SampleTime_480Cycles   ((uint8_t)0x07)
 
#define IS_ADC_SAMPLE_TIME(TIME)
 
#define ADC_ExternalTrigInjecConvEdge_None   ((uint32_t)0x00000000)
 
#define ADC_ExternalTrigInjecConvEdge_Rising   ((uint32_t)0x00100000)
 
#define ADC_ExternalTrigInjecConvEdge_Falling   ((uint32_t)0x00200000)
 
#define ADC_ExternalTrigInjecConvEdge_RisingFalling   ((uint32_t)0x00300000)
 
#define IS_ADC_EXT_INJEC_TRIG_EDGE(EDGE)
 
#define ADC_ExternalTrigInjecConv_T1_CC4   ((uint32_t)0x00000000)
 
#define ADC_ExternalTrigInjecConv_T1_TRGO   ((uint32_t)0x00010000)
 
#define ADC_ExternalTrigInjecConv_T2_CC1   ((uint32_t)0x00020000)
 
#define ADC_ExternalTrigInjecConv_T2_TRGO   ((uint32_t)0x00030000)
 
#define ADC_ExternalTrigInjecConv_T3_CC2   ((uint32_t)0x00040000)
 
#define ADC_ExternalTrigInjecConv_T3_CC4   ((uint32_t)0x00050000)
 
#define ADC_ExternalTrigInjecConv_T4_CC1   ((uint32_t)0x00060000)
 
#define ADC_ExternalTrigInjecConv_T4_CC2   ((uint32_t)0x00070000)
 
#define ADC_ExternalTrigInjecConv_T4_CC3   ((uint32_t)0x00080000)
 
#define ADC_ExternalTrigInjecConv_T4_TRGO   ((uint32_t)0x00090000)
 
#define ADC_ExternalTrigInjecConv_T5_CC4   ((uint32_t)0x000A0000)
 
#define ADC_ExternalTrigInjecConv_T5_TRGO   ((uint32_t)0x000B0000)
 
#define ADC_ExternalTrigInjecConv_T8_CC2   ((uint32_t)0x000C0000)
 
#define ADC_ExternalTrigInjecConv_T8_CC3   ((uint32_t)0x000D0000)
 
#define ADC_ExternalTrigInjecConv_T8_CC4   ((uint32_t)0x000E0000)
 
#define ADC_ExternalTrigInjecConv_Ext_IT15   ((uint32_t)0x000F0000)
 
#define IS_ADC_EXT_INJEC_TRIG(INJTRIG)
 
#define ADC_InjectedChannel_1   ((uint8_t)0x14)
 
#define ADC_InjectedChannel_2   ((uint8_t)0x18)
 
#define ADC_InjectedChannel_3   ((uint8_t)0x1C)
 
#define ADC_InjectedChannel_4   ((uint8_t)0x20)
 
#define IS_ADC_INJECTED_CHANNEL(CHANNEL)
 
#define ADC_AnalogWatchdog_SingleRegEnable   ((uint32_t)0x00800200)
 
#define ADC_AnalogWatchdog_SingleInjecEnable   ((uint32_t)0x00400200)
 
#define ADC_AnalogWatchdog_SingleRegOrInjecEnable   ((uint32_t)0x00C00200)
 
#define ADC_AnalogWatchdog_AllRegEnable   ((uint32_t)0x00800000)
 
#define ADC_AnalogWatchdog_AllInjecEnable   ((uint32_t)0x00400000)
 
#define ADC_AnalogWatchdog_AllRegAllInjecEnable   ((uint32_t)0x00C00000)
 
#define ADC_AnalogWatchdog_None   ((uint32_t)0x00000000)
 
#define IS_ADC_ANALOG_WATCHDOG(WATCHDOG)
 
#define ADC_IT_EOC   ((uint16_t)0x0205)
 
#define ADC_IT_AWD   ((uint16_t)0x0106)
 
#define ADC_IT_JEOC   ((uint16_t)0x0407)
 
#define ADC_IT_OVR   ((uint16_t)0x201A)
 
#define IS_ADC_IT(IT)
 
#define ADC_FLAG_AWD   ((uint8_t)0x01)
 
#define ADC_FLAG_EOC   ((uint8_t)0x02)
 
#define ADC_FLAG_JEOC   ((uint8_t)0x04)
 
#define ADC_FLAG_JSTRT   ((uint8_t)0x08)
 
#define ADC_FLAG_STRT   ((uint8_t)0x10)
 
#define ADC_FLAG_OVR   ((uint8_t)0x20)
 
#define IS_ADC_CLEAR_FLAG(FLAG)   ((((FLAG) & (uint8_t)0xC0) == 0x00) && ((FLAG) != 0x00))
 
#define IS_ADC_GET_FLAG(FLAG)
 
#define IS_ADC_THRESHOLD(THRESHOLD)   ((THRESHOLD) <= 0xFFF)
 
#define IS_ADC_OFFSET(OFFSET)   ((OFFSET) <= 0xFFF)
 
#define IS_ADC_INJECTED_LENGTH(LENGTH)   (((LENGTH) >= 0x1) && ((LENGTH) <= 0x4))
 
#define IS_ADC_INJECTED_RANK(RANK)   (((RANK) >= 0x1) && ((RANK) <= 0x4))
 
#define IS_ADC_REGULAR_LENGTH(LENGTH)   (((LENGTH) >= 0x1) && ((LENGTH) <= 0x10))
 
#define IS_ADC_REGULAR_RANK(RANK)   (((RANK) >= 0x1) && ((RANK) <= 0x10))
 
#define IS_ADC_REGULAR_DISC_NUMBER(NUMBER)   (((NUMBER) >= 0x1) && ((NUMBER) <= 0x8))
 

Functions

void ADC_DeInit (void)
 Deinitializes all ADCs peripherals registers to their default reset values. More...
 
void ADC_Init (ADC_TypeDef *ADCx, ADC_InitTypeDef *ADC_InitStruct)
 Initializes the ADCx peripheral according to the specified parameters in the ADC_InitStruct. More...
 
void ADC_StructInit (ADC_InitTypeDef *ADC_InitStruct)
 Fills each ADC_InitStruct member with its default value. More...
 
void ADC_CommonInit (ADC_CommonInitTypeDef *ADC_CommonInitStruct)
 Initializes the ADCs peripherals according to the specified parameters in the ADC_CommonInitStruct. More...
 
void ADC_CommonStructInit (ADC_CommonInitTypeDef *ADC_CommonInitStruct)
 Fills each ADC_CommonInitStruct member with its default value. More...
 
void ADC_Cmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the specified ADC peripheral. More...
 
void ADC_AnalogWatchdogCmd (ADC_TypeDef *ADCx, uint32_t ADC_AnalogWatchdog)
 Enables or disables the analog watchdog on single/all regular or injected channels. More...
 
void ADC_AnalogWatchdogThresholdsConfig (ADC_TypeDef *ADCx, uint16_t HighThreshold, uint16_t LowThreshold)
 Configures the high and low thresholds of the analog watchdog. More...
 
void ADC_AnalogWatchdogSingleChannelConfig (ADC_TypeDef *ADCx, uint8_t ADC_Channel)
 Configures the analog watchdog guarded single channel. More...
 
void ADC_TempSensorVrefintCmd (FunctionalState NewState)
 Enables or disables the temperature sensor and Vrefint channels. More...
 
void ADC_VBATCmd (FunctionalState NewState)
 Enables or disables the VBAT (Voltage Battery) channel. More...
 
void ADC_RegularChannelConfig (ADC_TypeDef *ADCx, uint8_t ADC_Channel, uint8_t Rank, uint8_t ADC_SampleTime)
 Configures for the selected ADC regular channel its corresponding rank in the sequencer and its sample time. More...
 
void ADC_SoftwareStartConv (ADC_TypeDef *ADCx)
 Enables the selected ADC software start conversion of the regular channels. More...
 
FlagStatus ADC_GetSoftwareStartConvStatus (ADC_TypeDef *ADCx)
 Gets the selected ADC Software start regular conversion Status. More...
 
void ADC_EOCOnEachRegularChannelCmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the EOC on each regular channel conversion. More...
 
void ADC_ContinuousModeCmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the ADC continuous conversion mode. More...
 
void ADC_DiscModeChannelCountConfig (ADC_TypeDef *ADCx, uint8_t Number)
 Configures the discontinuous mode for the selected ADC regular group channel. More...
 
void ADC_DiscModeCmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the discontinuous mode on regular group channel for the specified ADC. More...
 
uint16_t ADC_GetConversionValue (ADC_TypeDef *ADCx)
 Returns the last ADCx conversion result data for regular channel. More...
 
uint32_t ADC_GetMultiModeConversionValue (void)
 Returns the last ADC1, ADC2 and ADC3 regular conversions results data in the selected multi mode. More...
 
void ADC_DMACmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the specified ADC DMA request. More...
 
void ADC_DMARequestAfterLastTransferCmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the ADC DMA request after last transfer (Single-ADC mode) More...
 
void ADC_MultiModeDMARequestAfterLastTransferCmd (FunctionalState NewState)
 Enables or disables the ADC DMA request after last transfer in multi ADC mode. More...
 
void ADC_InjectedChannelConfig (ADC_TypeDef *ADCx, uint8_t ADC_Channel, uint8_t Rank, uint8_t ADC_SampleTime)
 Configures for the selected ADC injected channel its corresponding rank in the sequencer and its sample time. More...
 
void ADC_InjectedSequencerLengthConfig (ADC_TypeDef *ADCx, uint8_t Length)
 Configures the sequencer length for injected channels. More...
 
void ADC_SetInjectedOffset (ADC_TypeDef *ADCx, uint8_t ADC_InjectedChannel, uint16_t Offset)
 Set the injected channels conversion value offset. More...
 
void ADC_ExternalTrigInjectedConvConfig (ADC_TypeDef *ADCx, uint32_t ADC_ExternalTrigInjecConv)
 Configures the ADCx external trigger for injected channels conversion. More...
 
void ADC_ExternalTrigInjectedConvEdgeConfig (ADC_TypeDef *ADCx, uint32_t ADC_ExternalTrigInjecConvEdge)
 Configures the ADCx external trigger edge for injected channels conversion. More...
 
void ADC_SoftwareStartInjectedConv (ADC_TypeDef *ADCx)
 Enables the selected ADC software start conversion of the injected channels. More...
 
FlagStatus ADC_GetSoftwareStartInjectedConvCmdStatus (ADC_TypeDef *ADCx)
 Gets the selected ADC Software start injected conversion Status. More...
 
void ADC_AutoInjectedConvCmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the selected ADC automatic injected group conversion after regular one. More...
 
void ADC_InjectedDiscModeCmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the discontinuous mode for injected group channel for the specified ADC. More...
 
uint16_t ADC_GetInjectedConversionValue (ADC_TypeDef *ADCx, uint8_t ADC_InjectedChannel)
 Returns the ADC injected channel conversion result. More...
 
void ADC_ITConfig (ADC_TypeDef *ADCx, uint16_t ADC_IT, FunctionalState NewState)
 Enables or disables the specified ADC interrupts. More...
 
FlagStatus ADC_GetFlagStatus (ADC_TypeDef *ADCx, uint8_t ADC_FLAG)
 Checks whether the specified ADC flag is set or not. More...
 
void ADC_ClearFlag (ADC_TypeDef *ADCx, uint8_t ADC_FLAG)
 Clears the ADCx's pending flags. More...
 
ITStatus ADC_GetITStatus (ADC_TypeDef *ADCx, uint16_t ADC_IT)
 Checks whether the specified ADC interrupt has occurred or not. More...
 
void ADC_ClearITPendingBit (ADC_TypeDef *ADCx, uint16_t ADC_IT)
 Clears the ADCx's interrupt pending bits. More...
 

Detailed Description

This file contains all the functions prototypes for the ADC firmware library.

Author
MCD Application Team
Version
V1.1.2
Date
05-March-2012
Attention

© COPYRIGHT 2012 STMicroelectronics

Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); You may not use this file except in compliance with the License. You may obtain a copy of the License at:

   http://www.st.com/software_license_agreement_liberty_v2

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.