STM32F10x Standard Peripherals Library  3.5.0
/opt/STM32F10x_StdPeriph_Lib_V3.5.0/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_adc.c File Reference

This file provides all the ADC firmware functions. More...

#include "stm32f10x_adc.h"
#include "stm32f10x_rcc.h"

Go to the source code of this file.

Defines

#define CR1_DISCNUM_Reset   ((uint32_t)0xFFFF1FFF)
#define CR1_DISCEN_Set   ((uint32_t)0x00000800)
#define CR1_DISCEN_Reset   ((uint32_t)0xFFFFF7FF)
#define CR1_JAUTO_Set   ((uint32_t)0x00000400)
#define CR1_JAUTO_Reset   ((uint32_t)0xFFFFFBFF)
#define CR1_JDISCEN_Set   ((uint32_t)0x00001000)
#define CR1_JDISCEN_Reset   ((uint32_t)0xFFFFEFFF)
#define CR1_AWDCH_Reset   ((uint32_t)0xFFFFFFE0)
#define CR1_AWDMode_Reset   ((uint32_t)0xFF3FFDFF)
#define CR1_CLEAR_Mask   ((uint32_t)0xFFF0FEFF)
#define CR2_ADON_Set   ((uint32_t)0x00000001)
#define CR2_ADON_Reset   ((uint32_t)0xFFFFFFFE)
#define CR2_DMA_Set   ((uint32_t)0x00000100)
#define CR2_DMA_Reset   ((uint32_t)0xFFFFFEFF)
#define CR2_RSTCAL_Set   ((uint32_t)0x00000008)
#define CR2_CAL_Set   ((uint32_t)0x00000004)
#define CR2_SWSTART_Set   ((uint32_t)0x00400000)
#define CR2_EXTTRIG_Set   ((uint32_t)0x00100000)
#define CR2_EXTTRIG_Reset   ((uint32_t)0xFFEFFFFF)
#define CR2_EXTTRIG_SWSTART_Set   ((uint32_t)0x00500000)
#define CR2_EXTTRIG_SWSTART_Reset   ((uint32_t)0xFFAFFFFF)
#define CR2_JEXTSEL_Reset   ((uint32_t)0xFFFF8FFF)
#define CR2_JEXTTRIG_Set   ((uint32_t)0x00008000)
#define CR2_JEXTTRIG_Reset   ((uint32_t)0xFFFF7FFF)
#define CR2_JSWSTART_Set   ((uint32_t)0x00200000)
#define CR2_JEXTTRIG_JSWSTART_Set   ((uint32_t)0x00208000)
#define CR2_JEXTTRIG_JSWSTART_Reset   ((uint32_t)0xFFDF7FFF)
#define CR2_TSVREFE_Set   ((uint32_t)0x00800000)
#define CR2_TSVREFE_Reset   ((uint32_t)0xFF7FFFFF)
#define CR2_CLEAR_Mask   ((uint32_t)0xFFF1F7FD)
#define SQR3_SQ_Set   ((uint32_t)0x0000001F)
#define SQR2_SQ_Set   ((uint32_t)0x0000001F)
#define SQR1_SQ_Set   ((uint32_t)0x0000001F)
#define SQR1_CLEAR_Mask   ((uint32_t)0xFF0FFFFF)
#define JSQR_JSQ_Set   ((uint32_t)0x0000001F)
#define JSQR_JL_Set   ((uint32_t)0x00300000)
#define JSQR_JL_Reset   ((uint32_t)0xFFCFFFFF)
#define SMPR1_SMP_Set   ((uint32_t)0x00000007)
#define SMPR2_SMP_Set   ((uint32_t)0x00000007)
#define JDR_Offset   ((uint8_t)0x28)
#define DR_ADDRESS   ((uint32_t)0x4001244C)

Functions

void ADC_DeInit (ADC_TypeDef *ADCx)
 Deinitializes the ADCx peripheral registers to their default reset values.
void ADC_Init (ADC_TypeDef *ADCx, ADC_InitTypeDef *ADC_InitStruct)
 Initializes the ADCx peripheral according to the specified parameters in the ADC_InitStruct.
void ADC_StructInit (ADC_InitTypeDef *ADC_InitStruct)
 Fills each ADC_InitStruct member with its default value.
void ADC_Cmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the specified ADC peripheral.
void ADC_DMACmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the specified ADC DMA request.
void ADC_ITConfig (ADC_TypeDef *ADCx, uint16_t ADC_IT, FunctionalState NewState)
 Enables or disables the specified ADC interrupts.
void ADC_ResetCalibration (ADC_TypeDef *ADCx)
 Resets the selected ADC calibration registers.
FlagStatus ADC_GetResetCalibrationStatus (ADC_TypeDef *ADCx)
 Gets the selected ADC reset calibration registers status.
void ADC_StartCalibration (ADC_TypeDef *ADCx)
 Starts the selected ADC calibration process.
FlagStatus ADC_GetCalibrationStatus (ADC_TypeDef *ADCx)
 Gets the selected ADC calibration status.
void ADC_SoftwareStartConvCmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the selected ADC software start conversion .
FlagStatus ADC_GetSoftwareStartConvStatus (ADC_TypeDef *ADCx)
 Gets the selected ADC Software start conversion Status.
void ADC_DiscModeChannelCountConfig (ADC_TypeDef *ADCx, uint8_t Number)
 Configures the discontinuous mode for the selected ADC regular group channel.
void ADC_DiscModeCmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the discontinuous mode on regular group channel for the specified ADC.
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.
void ADC_ExternalTrigConvCmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the ADCx conversion through external trigger.
uint16_t ADC_GetConversionValue (ADC_TypeDef *ADCx)
 Returns the last ADCx conversion result data for regular channel.
uint32_t ADC_GetDualModeConversionValue (void)
 Returns the last ADC1 and ADC2 conversion result data in dual mode.
void ADC_AutoInjectedConvCmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the selected ADC automatic injected group conversion after regular one.
void ADC_InjectedDiscModeCmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the discontinuous mode for injected group channel for the specified ADC.
void ADC_ExternalTrigInjectedConvConfig (ADC_TypeDef *ADCx, uint32_t ADC_ExternalTrigInjecConv)
 Configures the ADCx external trigger for injected channels conversion.
void ADC_ExternalTrigInjectedConvCmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the ADCx injected channels conversion through external trigger.
void ADC_SoftwareStartInjectedConvCmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the selected ADC start of the injected channels conversion.
FlagStatus ADC_GetSoftwareStartInjectedConvCmdStatus (ADC_TypeDef *ADCx)
 Gets the selected ADC Software start injected conversion Status.
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.
void ADC_InjectedSequencerLengthConfig (ADC_TypeDef *ADCx, uint8_t Length)
 Configures the sequencer length for injected channels.
void ADC_SetInjectedOffset (ADC_TypeDef *ADCx, uint8_t ADC_InjectedChannel, uint16_t Offset)
 Set the injected channels conversion value offset.
uint16_t ADC_GetInjectedConversionValue (ADC_TypeDef *ADCx, uint8_t ADC_InjectedChannel)
 Returns the ADC injected channel conversion result.
void ADC_AnalogWatchdogCmd (ADC_TypeDef *ADCx, uint32_t ADC_AnalogWatchdog)
 Enables or disables the analog watchdog on single/all regular or injected channels.
void ADC_AnalogWatchdogThresholdsConfig (ADC_TypeDef *ADCx, uint16_t HighThreshold, uint16_t LowThreshold)
 Configures the high and low thresholds of the analog watchdog.
void ADC_AnalogWatchdogSingleChannelConfig (ADC_TypeDef *ADCx, uint8_t ADC_Channel)
 Configures the analog watchdog guarded single channel.
void ADC_TempSensorVrefintCmd (FunctionalState NewState)
 Enables or disables the temperature sensor and Vrefint channel.
FlagStatus ADC_GetFlagStatus (ADC_TypeDef *ADCx, uint8_t ADC_FLAG)
 Checks whether the specified ADC flag is set or not.
void ADC_ClearFlag (ADC_TypeDef *ADCx, uint8_t ADC_FLAG)
 Clears the ADCx's pending flags.
ITStatus ADC_GetITStatus (ADC_TypeDef *ADCx, uint16_t ADC_IT)
 Checks whether the specified ADC interrupt has occurred or not.
void ADC_ClearITPendingBit (ADC_TypeDef *ADCx, uint16_t ADC_IT)
 Clears the ADCx's interrupt pending bits.

Detailed Description

This file provides all the ADC firmware functions.

Author:
MCD Application Team
Version:
V3.5.0
Date:
11-March-2011
Attention:

THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.

© COPYRIGHT 2011 STMicroelectronics

Definition in file stm32f10x_adc.c.