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 COMP_DeInit (void)
 Deinitializes the COMPx peripheral registers to their default reset values.
void COMP_EdgeConfig (COMP_Selection_TypeDef COMP_Selection, COMP_Edge_TypeDef COMP_Edge)
 Configures the COMP edge detection.
COMP_OutputLevel_TypeDef COMP_GetOutputLevel (COMP_Selection_TypeDef COMP_Selection)
 Returns the output level of the comparator.
void COMP_Init (COMP_InvertingInput_Typedef COMP_InvertingInput, COMP_OutputSelect_Typedef COMP_OutputSelect, COMP_Speed_TypeDef COMP_Speed)
 Initializes the comparator inverting input, output and speed.
void COMP_VrefintToCOMP1Connect (FunctionalState NewState)
 Enables or disables connection between VREFINT and COMP1 inverting input.

Detailed Description

Initialization and Configuration functions.

 ===============================================================================
                        Initialization and Configuration functions
 ===============================================================================  


Function Documentation

void COMP_DeInit ( void  )

Deinitializes the COMPx peripheral registers to their default reset values.

Parameters:
None.
Return values:
None.

Definition at line 105 of file stm8l15x_comp.c.

References COMP, COMP_CSR1_RESET_VALUE, COMP_CSR2_RESET_VALUE, COMP_CSR3_RESET_VALUE, COMP_CSR4_RESET_VALUE, and COMP_CSR5_RESET_VALUE.

void COMP_EdgeConfig ( COMP_Selection_TypeDef  COMP_Selection,
COMP_Edge_TypeDef  COMP_Edge 
)

Configures the COMP edge detection.

Parameters:
COMP_Selection,:selects the comparator. This parameter can be one of the following values:
  • COMP_Selection_COMP1: Selection of Comparator 1
  • COMP_Selection_COMP2: Selection of Comparator 2
COMP_Edge,:This parameter can be one of the following values:
  • COMP_Edge_Falling: Falling edge selection
  • COMP_Edge_Rising: Rising edge selection
  • COMP_Edge_Rising_Falling: Rising and Falling edge selection
Return values:
None.

Definition at line 206 of file stm8l15x_comp.c.

References COMP, COMP_CSR1_CMP1, COMP_CSR2_CMP2, COMP_Selection_COMP1, IS_COMP_ALL_PERIPH, and IS_COMP_EDGE.

COMP_OutputLevel_TypeDef COMP_GetOutputLevel ( COMP_Selection_TypeDef  COMP_Selection)

Returns the output level of the comparator.

Note:
Comparators outputs aren't available on GPIO (outputs levels are only internal).
Parameters:
COMP_Selection,:selects the comparator. This parameter can be one of the following values:
  • COMP_Selection_COMP1: Selection of Comparator 1
  • COMP_Selection_COMP2: Selection of Comparator 2
Return values:
Returnsthe comparator output level This value can be one of the following:
  • COMP_OutputLevel_Low: Comparator output level is low
  • COMP_OutputLevel_High: Comparator output level is high

Definition at line 245 of file stm8l15x_comp.c.

References COMP, COMP_CSR1_CMP1OUT, COMP_CSR2_CMP2OUT, COMP_OutputLevel_High, COMP_OutputLevel_Low, COMP_Selection_COMP1, IS_COMP_ALL_PERIPH, and RESET.

void COMP_Init ( COMP_InvertingInput_Typedef  COMP_InvertingInput,
COMP_OutputSelect_Typedef  COMP_OutputSelect,
COMP_Speed_TypeDef  COMP_Speed 
)

Initializes the comparator inverting input, output and speed.

Note:
This function configures only COMP2.
Parameters:
COMP_InvertingInput: selects the comparator inverting input. This parameter can be one of the following values:
  • COMP_InvertingInput_IO: Input/Output on comparator inverting input enable
  • COMP_InvertingInput_VREFINT: VREFINT on comparator inverting input enable
  • COMP_InvertingInput_3_4VREFINT: 3/4 VREFINT on comparator inverting input enable
  • COMP_InvertingInput_1_2VREFINT: 1/2 VREFINT on comparator inverting input enable
  • COMP_InvertingInput_1_4VREFINT: 1/4 VREFINT on comparator inverting input enable
  • COMP_InvertingInput_DAC1: DAC1 output on comparator inverting input enable
  • COMP_InvertingInput_DAC2: DAC2 output on comparator inverting input enable
COMP_OutputSelect: selects the comparator output This parameter can be one of the following values:
  • COMP_OutputSelect_TIM2IC2: COMP2 output connected to TIM2 Input Capture 2
  • COMP_OutputSelect_TIM3IC2: COMP2 output connected to TIM3 Input Capture 2
  • COMP_OutputSelect_TIM1BRK: COMP2 output connected to TIM1 Break Input
  • COMP_OutputSelect_TIM1OCREFCLR: COMP2 output connected to TIM1 OCREF Clear
COMP_Speedselects the comparator speed This parameter can be one of the following values:
  • COMP_Speed_Slow: Comparator speed: slow
  • COMP_Speed_Fast: Comparator speed: fast
Return values:
None.

Definition at line 147 of file stm8l15x_comp.c.

References COMP, COMP_CSR2_SPEED, COMP_CSR3_INSEL, COMP_CSR3_OUTSEL, IS_COMP_INVERTING_INPUT, IS_COMP_OUTPUT, and IS_COMP_SPEED.

void COMP_VrefintToCOMP1Connect ( FunctionalState  NewState)

Enables or disables connection between VREFINT and COMP1 inverting input.

Parameters:
NewStatenew state of the VREFINT connection to COMP1 inverting input. This parameter can be ENABLE or DISABLE.
Return values:
None

Definition at line 177 of file stm8l15x_comp.c.

References COMP, COMP_CSR3_VREFEN, DISABLE, and IS_FUNCTIONAL_STATE.

STM8S Firmware Library: Overview

 

 

 

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