Macros | Functions
stm32f30x_adc.c File Reference

This file provides firmware functions to manage the following functionalities of the Analog to Digital Convertor (ADC) peripheral: More...

#include "stm32f30x_adc.h"
#include "stm32f30x_rcc.h"
Include dependency graph for stm32f30x_adc.c:

Go to the source code of this file.

Macros

#define CCR_CLEAR_MASK   ((uint32_t)0xFFFC10E0)
 
#define CFGR_CLEAR_Mask   ((uint32_t)0xFDFFC007)
 
#define JDR_Offset   ((uint8_t)0x80)
 
#define JSQR_CLEAR_Mask   ((uint32_t)0x00000000)
 

Functions

void ADC_AnalogWatchdog1SingleChannelConfig (ADC_TypeDef *ADCx, uint8_t ADC_Channel)
 Configures the analog watchdog 2 guarded single channel. More...
 
void ADC_AnalogWatchdog1ThresholdsConfig (ADC_TypeDef *ADCx, uint16_t HighThreshold, uint16_t LowThreshold)
 Configures the high and low thresholds of the analog watchdog1. More...
 
void ADC_AnalogWatchdog2SingleChannelConfig (ADC_TypeDef *ADCx, uint8_t ADC_Channel)
 Configures the analog watchdog 2 guarded single channel. More...
 
void ADC_AnalogWatchdog2ThresholdsConfig (ADC_TypeDef *ADCx, uint8_t HighThreshold, uint8_t LowThreshold)
 Configures the high and low thresholds of the analog watchdog2. More...
 
void ADC_AnalogWatchdog3SingleChannelConfig (ADC_TypeDef *ADCx, uint8_t ADC_Channel)
 Configures the analog watchdog 3 guarded single channel. More...
 
void ADC_AnalogWatchdog3ThresholdsConfig (ADC_TypeDef *ADCx, uint8_t HighThreshold, uint8_t LowThreshold)
 Configures the high and low thresholds of the analog watchdog3. 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_AutoDelayCmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Selects the ADC Delayed Conversion Mode. 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_ChannelOffset1Cmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the Offset1. More...
 
void ADC_ChannelOffset2Cmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the Offset2. More...
 
void ADC_ChannelOffset3Cmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the Offset3. More...
 
void ADC_ChannelOffset4Cmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the Offset4. More...
 
void ADC_ClearCommonFlag (ADC_TypeDef *ADCx, uint32_t ADC_FLAG)
 Clears the ADCx's pending flags. More...
 
void ADC_ClearFlag (ADC_TypeDef *ADCx, uint32_t ADC_FLAG)
 Clears the ADCx's pending flags. More...
 
void ADC_ClearITPendingBit (ADC_TypeDef *ADCx, uint32_t ADC_IT)
 Clears the ADCx's interrupt pending bits. More...
 
void ADC_Cmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the specified ADC peripheral. More...
 
void ADC_CommonInit (ADC_TypeDef *ADCx, 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_DeInit (ADC_TypeDef *ADCx)
 Deinitializes the ADCx peripheral registers to their default reset values. More...
 
void ADC_DisableCmd (ADC_TypeDef *ADCx)
 ADC Disable Command. 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...
 
void ADC_DMACmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the specified ADC DMA request. More...
 
void ADC_DMAConfig (ADC_TypeDef *ADCx, uint32_t ADC_DMAMode)
 Configure ADC DMA mode. More...
 
void ADC_ExternalTriggerConfig (ADC_TypeDef *ADCx, uint16_t ADC_ExternalTrigConvEvent, uint16_t ADC_ExternalTrigEventEdge)
 External Trigger Enable and Polarity Selection for regular channels. More...
 
FlagStatus ADC_GetCalibrationStatus (ADC_TypeDef *ADCx)
 Gets the selected ADC calibration status. More...
 
uint32_t ADC_GetCalibrationValue (ADC_TypeDef *ADCx)
 Returns the ADCx calibration value. More...
 
FlagStatus ADC_GetCommonFlagStatus (ADC_TypeDef *ADCx, uint32_t ADC_FLAG)
 Checks whether the specified ADC flag is set or not. More...
 
uint16_t ADC_GetConversionValue (ADC_TypeDef *ADCx)
 Returns the last ADCx conversion result data for regular channel. More...
 
FlagStatus ADC_GetDisableCmdStatus (ADC_TypeDef *ADCx)
 Gets the selected ADC disable command Status. More...
 
uint32_t ADC_GetDualModeConversionValue (ADC_TypeDef *ADCx)
 Returns the last ADC1, ADC2, ADC3 and ADC4 regular conversions results data in the selected dual mode. More...
 
FlagStatus ADC_GetFlagStatus (ADC_TypeDef *ADCx, uint32_t ADC_FLAG)
 Checks whether the specified ADC flag is set or not. More...
 
uint16_t ADC_GetInjectedConversionValue (ADC_TypeDef *ADCx, uint8_t ADC_InjectedChannel)
 Returns the ADC injected channel conversion result. More...
 
ITStatus ADC_GetITStatus (ADC_TypeDef *ADCx, uint32_t ADC_IT)
 Checks whether the specified ADC interrupt has occurred or not. More...
 
FlagStatus ADC_GetStartConversionStatus (ADC_TypeDef *ADCx)
 Gets the selected ADC start conversion Status. More...
 
FlagStatus ADC_GetStartInjectedConversionStatus (ADC_TypeDef *ADCx)
 Gets the selected ADC Software start injected conversion Status. 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_InjectedChannelSampleTimeConfig (ADC_TypeDef *ADCx, uint8_t ADC_InjectedChannel, uint8_t ADC_SampleTime)
 Configures for the selected ADC injected channel its corresponding sample time. More...
 
void ADC_InjectedDiscModeCmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the discontinuous mode for injected group channel for the specified ADC. More...
 
void ADC_InjectedInit (ADC_TypeDef *ADCx, ADC_InjectedInitTypeDef *ADC_InjectedInitStruct)
 Initializes the ADCx peripheral according to the specified parameters in the ADC_InitStruct. More...
 
void ADC_InjectedStructInit (ADC_InjectedInitTypeDef *ADC_InjectedInitStruct)
 Fills each ADC_InjectedInitStruct member with its default value. More...
 
void ADC_ITConfig (ADC_TypeDef *ADCx, uint32_t ADC_IT, FunctionalState NewState)
 Enables or disables the specified ADC interrupts. 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_RegularChannelSequencerLengthConfig (ADC_TypeDef *ADCx, uint8_t SequencerLength)
 Sets the ADC regular channel sequence lenght. More...
 
void ADC_SelectCalibrationMode (ADC_TypeDef *ADCx, uint32_t ADC_CalibrationMode)
 Select the ADC calibration mode. More...
 
void ADC_SelectDifferentialMode (ADC_TypeDef *ADCx, uint8_t ADC_Channel, FunctionalState NewState)
 Selectes the differential mode for a specific channel. More...
 
void ADC_SelectQueueOfContextMode (ADC_TypeDef *ADCx, FunctionalState NewState)
 Selects the Queue Of Context Mode for injected channels. More...
 
void ADC_SetCalibrationValue (ADC_TypeDef *ADCx, uint32_t ADC_Calibration)
 Sets the ADCx calibration register. More...
 
void ADC_SetChannelOffset1 (ADC_TypeDef *ADCx, uint8_t ADC_Channel, uint16_t Offset)
 Set the ADC channels conversion value offset1. More...
 
void ADC_SetChannelOffset2 (ADC_TypeDef *ADCx, uint8_t ADC_Channel, uint16_t Offset)
 Set the ADC channels conversion value offset2. More...
 
void ADC_SetChannelOffset3 (ADC_TypeDef *ADCx, uint8_t ADC_Channel, uint16_t Offset)
 Set the ADC channels conversion value offset3. More...
 
void ADC_SetChannelOffset4 (ADC_TypeDef *ADCx, uint8_t ADC_Channel, uint16_t Offset)
 Set the ADC channels conversion value offset4. More...
 
void ADC_StartCalibration (ADC_TypeDef *ADCx)
 Starts the selected ADC calibration process. More...
 
void ADC_StartConversion (ADC_TypeDef *ADCx)
 Enables or disables the selected ADC start conversion . More...
 
void ADC_StartInjectedConversion (ADC_TypeDef *ADCx)
 Enables or disables the selected ADC start of the injected channels conversion. More...
 
void ADC_StopConversion (ADC_TypeDef *ADCx)
 Stops the selected ADC ongoing conversion. More...
 
void ADC_StopInjectedConversion (ADC_TypeDef *ADCx)
 Stops the selected ADC ongoing injected conversion. More...
 
void ADC_StructInit (ADC_InitTypeDef *ADC_InitStruct)
 Fills each ADC_InitStruct member with its default value. More...
 
void ADC_TempSensorCmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the temperature sensor channel. More...
 
void ADC_VbatCmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the Vbat channel. More...
 
void ADC_VoltageRegulatorCmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the specified ADC Voltage Regulator. More...
 
void ADC_VrefintCmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the Vrefint channel. More...
 

Detailed Description

This file provides firmware functions to manage the following functionalities of the Analog to Digital Convertor (ADC) peripheral:

Author
MCD Application Team
Version
V1.1.1
Date
04-April-2014
  • Initialization and Configuration
  • Analog Watchdog configuration
  • Temperature Sensor, Vbat & Vrefint (Internal Reference Voltage) management
  • Regular Channels Configuration
  • Regular Channels DMA Configuration
  • Injected channels Configuration
  • Interrupts and flags management
  • Dual mode configuration
==============================================================================
                           ##### How to use this driver #####
==============================================================================
  [..]
  (#) select the ADC clock using the function RCC_ADCCLKConfig()
  (#) Enable the ADC interface clock using RCC_AHBPeriphClockCmd();
  (#) ADC pins configuration
      (++) Enable the clock for the ADC GPIOs using the following function:
           RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOx, ENABLE);
      (++) Configure these ADC pins in analog mode using GPIO_Init();
  (#) Configure the ADC conversion resolution, data alignment, external
      trigger and edge, sequencer lenght and Enable/Disable the continuous mode
      using the ADC_Init() function.
  (#) Activate the ADC peripheral using ADC_Cmd() function.

  *** ADC channels group configuration ***
  ========================================    
  [..] 
  (+) To configure the ADC channels features, use ADC_Init(), ADC_InjectedInit()
      and/or ADC_RegularChannelConfig() functions.
  (+) To activate the continuous mode, use the ADC_ContinuousModeCmd()
      function.
  (+) To activate the Discontinuous mode, use the ADC_DiscModeCmd() functions. 
  (+) To activate the overrun mode, use the ADC_OverrunModeCmd() functions.
  (+) To activate the calibration mode, use the ADC_StartCalibration() functions.
  (+) To read the ADC converted values, use the ADC_GetConversionValue()
      function.

  *** DMA for ADC channels features configuration ***
  ===================================================     
  [..] 
  (+) To enable the DMA mode for ADC channels group, use the ADC_DMACmd() function.
  (+) To configure the DMA transfer request, use ADC_DMAConfig() function.
Attention

© COPYRIGHT 2014 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.

Definition in file stm32f30x_adc.c.



rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Wed Jul 3 2019 19:59:27