Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Space_Invaders_Demo neopixels gpio_test_stm32f3_discovery gpio_test_systimer ... more
stm32f30x_adc.c File Reference
This file provides firmware functions to manage the following functionalities of the Analog to Digital Convertor (ADC) peripheral: + 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. More...
Go to the source code of this file.
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_InjectedInit (ADC_TypeDef *ADCx, ADC_InjectedInitTypeDef *ADC_InjectedInitStruct) |
| Initializes the ADCx peripheral according to the specified parameters in the ADC_InitStruct. | |
| void | ADC_InjectedStructInit (ADC_InjectedInitTypeDef *ADC_InjectedInitStruct) |
| Fills each ADC_InjectedInitStruct member with its default value. | |
| void | ADC_CommonInit (ADC_TypeDef *ADCx, ADC_CommonInitTypeDef *ADC_CommonInitStruct) |
| Initializes the ADCs peripherals according to the specified parameters in the ADC_CommonInitStruct. | |
| void | ADC_CommonStructInit (ADC_CommonInitTypeDef *ADC_CommonInitStruct) |
| Fills each ADC_CommonInitStruct member with its default value. | |
| void | ADC_Cmd (ADC_TypeDef *ADCx, FunctionalState NewState) |
| Enables or disables the specified ADC peripheral. | |
| void | ADC_StartCalibration (ADC_TypeDef *ADCx) |
| Starts the selected ADC calibration process. | |
| uint32_t | ADC_GetCalibrationValue (ADC_TypeDef *ADCx) |
| Returns the ADCx calibration value. | |
| void | ADC_SetCalibrationValue (ADC_TypeDef *ADCx, uint32_t ADC_Calibration) |
| Sets the ADCx calibration register. | |
| void | ADC_SelectCalibrationMode (ADC_TypeDef *ADCx, uint32_t ADC_CalibrationMode) |
| Select the ADC calibration mode. | |
| FlagStatus | ADC_GetCalibrationStatus (ADC_TypeDef *ADCx) |
| Gets the selected ADC calibration status. | |
| void | ADC_DisableCmd (ADC_TypeDef *ADCx) |
| ADC Disable Command. | |
| FlagStatus | ADC_GetDisableCmdStatus (ADC_TypeDef *ADCx) |
| Gets the selected ADC disable command Status. | |
| void | ADC_VoltageRegulatorCmd (ADC_TypeDef *ADCx, FunctionalState NewState) |
| Enables or disables the specified ADC Voltage Regulator. | |
| void | ADC_SelectDifferentialMode (ADC_TypeDef *ADCx, uint8_t ADC_Channel, FunctionalState NewState) |
| Selects the differential mode for a specific channel. | |
| void | ADC_SelectQueueOfContextMode (ADC_TypeDef *ADCx, FunctionalState NewState) |
| Selects the Queue Of Context Mode for injected channels. | |
| void | ADC_AutoDelayCmd (ADC_TypeDef *ADCx, FunctionalState NewState) |
| Selects the ADC Delayed Conversion Mode. | |
| 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_AnalogWatchdog1ThresholdsConfig (ADC_TypeDef *ADCx, uint16_t HighThreshold, uint16_t LowThreshold) |
| Configures the high and low thresholds of the analog watchdog1. | |
| void | ADC_AnalogWatchdog2ThresholdsConfig (ADC_TypeDef *ADCx, uint8_t HighThreshold, uint8_t LowThreshold) |
| Configures the high and low thresholds of the analog watchdog2. | |
| void | ADC_AnalogWatchdog3ThresholdsConfig (ADC_TypeDef *ADCx, uint8_t HighThreshold, uint8_t LowThreshold) |
| Configures the high and low thresholds of the analog watchdog3. | |
| void | ADC_AnalogWatchdog1SingleChannelConfig (ADC_TypeDef *ADCx, uint8_t ADC_Channel) |
| Configures the analog watchdog 2 guarded single channel. | |
| void | ADC_AnalogWatchdog2SingleChannelConfig (ADC_TypeDef *ADCx, uint8_t ADC_Channel) |
| Configures the analog watchdog 2 guarded single channel. | |
| void | ADC_AnalogWatchdog3SingleChannelConfig (ADC_TypeDef *ADCx, uint8_t ADC_Channel) |
| Configures the analog watchdog 3 guarded single channel. | |
| void | ADC_TempSensorCmd (ADC_TypeDef *ADCx, FunctionalState NewState) |
| Enables or disables the temperature sensor channel. | |
| void | ADC_VrefintCmd (ADC_TypeDef *ADCx, FunctionalState NewState) |
| Enables or disables the Vrefint channel. | |
| void | ADC_VbatCmd (ADC_TypeDef *ADCx, FunctionalState NewState) |
| Enables or disables the Vbat channel. | |
| 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_RegularChannelSequencerLengthConfig (ADC_TypeDef *ADCx, uint8_t SequencerLength) |
| Sets the ADC regular channel sequence lenght. | |
| void | ADC_ExternalTriggerConfig (ADC_TypeDef *ADCx, uint16_t ADC_ExternalTrigConvEvent, uint16_t ADC_ExternalTrigEventEdge) |
| External Trigger Enable and Polarity Selection for regular channels. | |
| void | ADC_StartConversion (ADC_TypeDef *ADCx) |
| Enables or disables the selected ADC start conversion . | |
| FlagStatus | ADC_GetStartConversionStatus (ADC_TypeDef *ADCx) |
| Gets the selected ADC start conversion Status. | |
| void | ADC_StopConversion (ADC_TypeDef *ADCx) |
| Stops the selected ADC ongoing conversion. | |
| 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. | |
| uint16_t | ADC_GetConversionValue (ADC_TypeDef *ADCx) |
| Returns the last ADCx conversion result data for regular channel. | |
| uint32_t | ADC_GetDualModeConversionValue (ADC_TypeDef *ADCx) |
| Returns the last ADC1, ADC2, ADC3 and ADC4 regular conversions results data in the selected dual mode. | |
| void | ADC_SetChannelOffset1 (ADC_TypeDef *ADCx, uint8_t ADC_Channel, uint16_t Offset) |
| Set the ADC channels conversion value offset1. | |
| void | ADC_SetChannelOffset2 (ADC_TypeDef *ADCx, uint8_t ADC_Channel, uint16_t Offset) |
| Set the ADC channels conversion value offset2. | |
| void | ADC_SetChannelOffset3 (ADC_TypeDef *ADCx, uint8_t ADC_Channel, uint16_t Offset) |
| Set the ADC channels conversion value offset3. | |
| void | ADC_SetChannelOffset4 (ADC_TypeDef *ADCx, uint8_t ADC_Channel, uint16_t Offset) |
| Set the ADC channels conversion value offset4. | |
| void | ADC_ChannelOffset1Cmd (ADC_TypeDef *ADCx, FunctionalState NewState) |
| Enables or disables the Offset1. | |
| void | ADC_ChannelOffset2Cmd (ADC_TypeDef *ADCx, FunctionalState NewState) |
| Enables or disables the Offset2. | |
| void | ADC_ChannelOffset3Cmd (ADC_TypeDef *ADCx, FunctionalState NewState) |
| Enables or disables the Offset3. | |
| void | ADC_ChannelOffset4Cmd (ADC_TypeDef *ADCx, FunctionalState NewState) |
| Enables or disables the Offset4. | |
| void | ADC_DMACmd (ADC_TypeDef *ADCx, FunctionalState NewState) |
| Enables or disables the specified ADC DMA request. | |
| void | ADC_DMAConfig (ADC_TypeDef *ADCx, uint32_t ADC_DMAMode) |
| Configure ADC DMA mode. | |
| 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. | |
| void | ADC_StartInjectedConversion (ADC_TypeDef *ADCx) |
| Enables or disables the selected ADC start of the injected channels conversion. | |
| void | ADC_StopInjectedConversion (ADC_TypeDef *ADCx) |
| Stops the selected ADC ongoing injected conversion. | |
| FlagStatus | ADC_GetStartInjectedConversionStatus (ADC_TypeDef *ADCx) |
| Gets the selected ADC Software start injected conversion Status. | |
| 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. | |
| uint16_t | ADC_GetInjectedConversionValue (ADC_TypeDef *ADCx, uint8_t ADC_InjectedSequence) |
| Returns the ADC injected channel conversion result. | |
| void | ADC_ITConfig (ADC_TypeDef *ADCx, uint32_t ADC_IT, FunctionalState NewState) |
| Enables or disables the specified ADC interrupts. | |
| FlagStatus | ADC_GetFlagStatus (ADC_TypeDef *ADCx, uint32_t ADC_FLAG) |
| Checks whether the specified ADC flag is set or not. | |
| void | ADC_ClearFlag (ADC_TypeDef *ADCx, uint32_t ADC_FLAG) |
| Clears the ADCx's pending flags. | |
| FlagStatus | ADC_GetCommonFlagStatus (ADC_TypeDef *ADCx, uint32_t ADC_FLAG) |
| Checks whether the specified ADC flag is set or not. | |
| void | ADC_ClearCommonFlag (ADC_TypeDef *ADCx, uint32_t ADC_FLAG) |
| Clears the ADCx's pending flags. | |
| ITStatus | ADC_GetITStatus (ADC_TypeDef *ADCx, uint32_t ADC_IT) |
| Checks whether the specified ADC interrupt has occurred or not. | |
| void | ADC_ClearITPendingBit (ADC_TypeDef *ADCx, uint32_t ADC_IT) |
| Clears the ADCx's interrupt pending bits. | |
Detailed Description
This file provides firmware functions to manage the following functionalities of the Analog to Digital Convertor (ADC) peripheral: + 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.
- Version:
- V1.2.3
- Date:
- 10-July-2015
============================================================================== ##### 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 2015 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.
Generated on Tue Jul 12 2022 17:34:45 by
1.7.2