STM8L15x Standard Peripherals Drivers: Initialization and Configuration functions

STM8L15x/16x Standard Peripherals Drivers

STM8L15x Standard Peripherals Drivers

Initialization and Configuration functions

Initialization and Configuration functions. More...

Functions

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_ExternalTrigConfig (ADC_TypeDef *ADCx, ADC_ExtEventSelection_TypeDef ADC_ExtEventSelection, ADC_ExtTRGSensitivity_TypeDef ADC_ExtTRGSensitivity)
 Configures the ADC conversion through external trigger.
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_SoftwareStartConv (ADC_TypeDef *ADCx)
 Starts ADC conversion, by software trigger.

Detailed Description

Initialization and Configuration functions.

 ===============================================================================
                      Initialization and Configuration functions
 ===============================================================================  
  This section provides functions allowing to:
   - Enable or disable the ADC peripheral,
   - Initialize and configure the ADC Prescaler, ADC Conversion Resolution 
     (12bit..6bit), ADC Continuous Conversion Mode (Continuous or Single 
     conversion),
   - Configure External trigger Sensitivity and source,
   - Start ADC conversion, by software trigger.



Function Documentation

void ADC_Cmd ( ADC_TypeDef ADCx,
FunctionalState  NewState 
)

Enables or disables the selected ADC peripheral.

Parameters:
ADCxwhere x can be 1 to select the specified ADC peripheral.
NewState: new state of the specified ADC peripheral. This parameter can be: ENABLE or DISABLE.
Return values:
None

Definition at line 210 of file stm8l15x_adc.c.

References ADC_CR1_ADON, ADC_struct::CR1, DISABLE, and IS_FUNCTIONAL_STATE.

void ADC_ExternalTrigConfig ( ADC_TypeDef ADCx,
ADC_ExtEventSelection_TypeDef  ADC_ExtEventSelection,
ADC_ExtTRGSensitivity_TypeDef  ADC_ExtTRGSensitivity 
)

Configures the ADC conversion through external trigger.

Parameters:
ADCxwhere x can be 1 to select the specified ADC peripheral.
ADC_ExtEventSelection: Specifies the external trigger. This parameter can be one of the following values:
  • ADC_ExtEventSelection_None: Conversion starts only by software start
  • ADC_ExtEventSelection_Trigger1: Trigger 1 Enables conversion
  • ADC_ExtEventSelection_Trigger2: Trigger 2 Enables conversion
  • ADC_ExtEventSelection_Trigger3: Trigger 3 Enables conversion
ADC_ExtTRGSensitivity: Specifies the external trigger sensitivity. This parameter can be one of the following values:
  • ADC_ExtTRGSensitivity_Rising: External Trigger Sensitivity is Rising Edge
  • ADC_ExtTRGSensitivity_Falling: External Trigger Sensitivity is Falling Edge
  • ADC_ExtTRGSensitivity_All: External Trigger Sensitivity is Falling and Rising Edge
Return values:
None

Definition at line 255 of file stm8l15x_adc.c.

References ADC_CR2_EXTSEL, ADC_CR2_TRIGEDGE, ADC_struct::CR2, IS_ADC_EXT_EVENT_SELECTION, and IS_ADC_EXT_TRG_SENSITIVITY.

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.

Parameters:
ADCxwhere x can be 1 to select the specified ADC peripheral.
ADC_ConversionMode: specifies the ADC conversion mode, This parameter can be one of the following values:
  • ADC_ConversionMode_Single: Single Conversion Mode
  • ADC_ConversionMode_Continuous: Continuous Conversion Mode
ADC_Resolution: specifies the ADC Data resolution, This parameter can be one of the following values:
  • ADC_Resolution_12Bit: 12 bit resolution
  • ADC_Resolution_10Bit: 10 bit resolution
  • ADC_Resolution_8Bit: 8 bit resolution
  • ADC_Resolution_6Bit: 6 bit resolution
ADC_Prescaler: specifies the ADC Prescaler, This parameter can be one of the following values:
  • ADC_Prescaler_1: ADC Clock frequency is divided by 1
  • ADC_Prescaler_2: ADC Clock frequency is divided by 2
Return values:
None

Definition at line 180 of file stm8l15x_adc.c.

References ADC_CR1_CONT, ADC_CR1_RES, ADC_CR2_PRESC, ADC_struct::CR1, ADC_struct::CR2, IS_ADC_CONVERSION_MODE, IS_ADC_PRESCALER, and IS_ADC_RESOLUTION.

void ADC_SoftwareStartConv ( ADC_TypeDef ADCx)

Starts ADC conversion, by software trigger.

Parameters:
ADCxwhere x can be 1 to select the specified ADC peripheral.
Return values:
None

Definition at line 233 of file stm8l15x_adc.c.

References ADC_CR1_START, and ADC_struct::CR1.

STM8S Firmware Library: Overview

 

 

 

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