STM8L15x Standard Peripherals Drivers: stm8l15x_adc.c File Reference

STM8L15x/16x Standard Peripherals Drivers

STM8L15x Standard Peripherals Drivers

stm8l15x_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
  • Power saving
  • Analog Watchdog configuration
  • Temperature Sensor & Vrefint (Voltage Reference internal) management
  • Regular Channels Configuration
  • Regular Channels DMA Configuration
  • Injected channels Configuration
  • Interrupts and flags management.
More...
#include "stm8l15x_adc.h"

Go to the source code of this file.

Functions

void ADC_AnalogWatchdogChannelSelect (ADC_TypeDef *ADCx, ADC_AnalogWatchdogSelection_TypeDef ADC_AnalogWatchdogSelection)
 Configures the channel to be checked by the Analog watchdog.
void ADC_AnalogWatchdogConfig (ADC_TypeDef *ADCx, ADC_AnalogWatchdogSelection_TypeDef ADC_AnalogWatchdogSelection, uint16_t HighThreshold, uint16_t LowThreshold)
 Configures the Analog watchdog.
void ADC_AnalogWatchdogThresholdsConfig (ADC_TypeDef *ADCx, uint16_t HighThreshold, uint16_t LowThreshold)
 Configures the high and low thresholds of the Analog watchdog.
void ADC_ChannelCmd (ADC_TypeDef *ADCx, ADC_Channel_TypeDef ADC_Channels, FunctionalState NewState)
 Enables or disables the selected ADC channel(s).
void ADC_ClearFlag (ADC_TypeDef *ADCx, ADC_FLAG_TypeDef ADC_FLAG)
 Clears the ADC's pending flags.
void ADC_ClearITPendingBit (ADC_TypeDef *ADCx, ADC_IT_TypeDef ADC_IT)
 Clears the ADC�s interrupt pending bits.
void ADC_Cmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the selected ADC peripheral.
void ADC_DeInit (ADC_TypeDef *ADCx)
 Deinitializes the ADC peripheral registers to their default reset values.
void ADC_DMACmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the specified ADC DMA request.
void ADC_ExternalTrigConfig (ADC_TypeDef *ADCx, ADC_ExtEventSelection_TypeDef ADC_ExtEventSelection, ADC_ExtTRGSensitivity_TypeDef ADC_ExtTRGSensitivity)
 Configures the ADC conversion through external trigger.
uint16_t ADC_GetConversionValue (ADC_TypeDef *ADCx)
 Returns the last ADC converted data.
FlagStatus ADC_GetFlagStatus (ADC_TypeDef *ADCx, ADC_FLAG_TypeDef ADC_FLAG)
 Checks whether the specified ADC flag is set or not.
ITStatus ADC_GetITStatus (ADC_TypeDef *ADCx, ADC_IT_TypeDef ADC_IT)
 Checks whether the specified ADC interrupt has occurred or not.
void ADC_Init (ADC_TypeDef *ADCx, ADC_ConversionMode_TypeDef ADC_ConversionMode, ADC_Resolution_TypeDef ADC_Resolution, ADC_Prescaler_TypeDef ADC_Prescaler)
 Initializes the specified ADC peripheral according to the specified parameters.
void ADC_ITConfig (ADC_TypeDef *ADCx, ADC_IT_TypeDef ADC_IT, FunctionalState NewState)
 Enables or disables the specified ADC interrupts.
void ADC_SamplingTimeConfig (ADC_TypeDef *ADCx, ADC_Group_TypeDef ADC_GroupChannels, ADC_SamplingTime_TypeDef ADC_SamplingTime)
 Configures the sampling time for the selected ADC channel group.
void ADC_SchmittTriggerConfig (ADC_TypeDef *ADCx, ADC_Channel_TypeDef ADC_Channels, FunctionalState NewState)
 Configures the status of the Schmitt Trigger for the selected ADC channel(s).
void ADC_SoftwareStartConv (ADC_TypeDef *ADCx)
 Starts ADC conversion, by software trigger.
void ADC_TempSensorCmd (FunctionalState NewState)
 Enables or disables the Temperature sensor internal reference.
void ADC_VrefintCmd (FunctionalState NewState)
 Enables or disables the Internal Voltage reference.

Detailed Description

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

  • Initialization and Configuration
  • Power saving
  • Analog Watchdog configuration
  • Temperature Sensor & Vrefint (Voltage Reference internal) management
  • Regular Channels Configuration
  • Regular Channels DMA Configuration
  • Injected channels Configuration
  • Interrupts and flags management.
Author:
MCD Application Team
Version:
V1.5.0
Date:
13-May-2011
  *                               
  *          ===================================================================      
  *                                   How to use this driver
  *          ===================================================================      
  *          1. Enable The ADC controller clock using CLK_PeripheralClockConfig() 
  *            function : CLK_PeripheralClockConfig(CLK_Peripheral_ADC1, ENABLE).
  *
  *            2. Configure the ADC Prescaler, conversion resolution and data 
  *              alignment using the ADC_Init() function.
  * 
  *            3. Activate the ADC peripheral using ADC_Cmd() function.  
  *
  *          Regular channels group configuration
  *          ====================================    
  *            - To configure the ADC regular channels group features, use 
  *              ADC_Init() and ADC_RegularChannelConfig() functions.
  *            - To activate the continuous mode, use the ADC_continuousModeCmd()
  *              function.
  *            - To configure and activate the Discontinuous mode, use the 
  *              ADC_DiscModeChannelCountConfig() and ADC_DiscModeCmd() functions.        
  *            - To read the ADC converted values, use the ADC_GetConversionValue()
  *              function.
  *
  *          DMA for Regular channels group features configuration
  *          ====================================================== 
  *           - To enable the DMA mode for regular channels group, use the 
  *             ADC_DMACmd() function.
  *           - To enable the generation of DMA requests continuously at the end
  *             of the last DMA transfer, use the ADC_DMARequestAfterLastTransferCmd() 
  *             function.    
             
  *          Injected channels group configuration
  *          =====================================    
  *            - To configure the ADC Injected channels group features, use 
  *              ADC_InjectedChannelConfig() and  ADC_InjectedSequencerLengthConfig()
  *              functions.
  *            - To activate the continuous mode, use the ADC_continuousModeCmd()
  *              function.
  *            - To activate the Injected Discontinuous mode, use the 
  *              ADC_InjectedDiscModeCmd() function.  
  *            - To activate the AutoInjected mode, use the ADC_AutoInjectedConvCmd() 
  *              function.        
  *            - To read the ADC converted values, use the ADC_GetInjectedConversionValue() 
  *              function.
  *              
  *  
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 stm8l15x_adc.c.

STM8S Firmware Library: Overview

 

 

 

For complete documentation on STM8L15x 8-bit microcontrollers platform visit www.st.com