2 ******************************************************************************
\r
3 * @file stm32l1xx_comp.h
\r
4 * @author MCD Application Team
\r
6 * @date 31-December-2010
\r
7 * @brief This file contains all the functions prototypes for the COMP firmware
\r
9 ******************************************************************************
\r
12 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
\r
13 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
\r
14 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
\r
15 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
\r
16 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
\r
17 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
\r
19 * <h2><center>© COPYRIGHT 2010 STMicroelectronics</center></h2>
\r
20 ******************************************************************************
\r
23 /* Define to prevent recursive inclusion -------------------------------------*/
\r
24 #ifndef __STM32L1xx_COMP_H
\r
25 #define __STM32L1xx_COMP_H
\r
31 /* Includes ------------------------------------------------------------------*/
\r
32 #include "stm32l1xx.h"
\r
34 /** @addtogroup STM32L1xx_StdPeriph_Driver
\r
38 /** @addtogroup COMP
\r
42 /* Exported types ------------------------------------------------------------*/
\r
45 * @brief COMP Init structure definition
\r
50 uint32_t COMP_Speed; /*!< Defines the speed of comparator 2.
\r
51 This parameter can be a value of @ref COMP_Speed */
\r
52 uint32_t COMP_InvertingInput; /*!< Selects the inverting input of the comparator 2.
\r
53 This parameter can be a value of @ref COMP_InvertingInput */
\r
54 uint32_t COMP_OutputSelect; /*!< Selects the output redirection of the comparator 2.
\r
55 This parameter can be a value of @ref COMP_OutputSelect */
\r
59 /* Exported constants --------------------------------------------------------*/
\r
61 /** @defgroup COMP_Exported_Constants
\r
65 #define COMP_OutputLevel_High ((uint32_t)0x00000001)
\r
66 #define COMP_OutputLevel_Low ((uint32_t)0x00000000)
\r
68 /** @defgroup COMP_Selection
\r
72 #define COMP_Selection_COMP1 ((uint32_t)0x00000001)
\r
73 #define COMP_Selection_COMP2 ((uint32_t)0x00000002)
\r
75 #define IS_COMP_ALL_PERIPH(PERIPH) (((PERIPH) == COMP_Selection_COMP1) || \
\r
76 ((PERIPH) == COMP_Selection_COMP2))
\r
82 /** @defgroup COMP_InvertingInput
\r
86 #define COMP_InvertingInput_None ((uint32_t)0x00000000) /* COMP2 is disabled when this parameter is selected */
\r
87 #define COMP_InvertingInput_IO ((uint32_t)0x00040000)
\r
88 #define COMP_InvertingInput_VREFINT ((uint32_t)0x00080000)
\r
89 #define COMP_InvertingInput_3_4VREFINT ((uint32_t)0x000C0000)
\r
90 #define COMP_InvertingInput_1_2VREFINT ((uint32_t)0x00100000)
\r
91 #define COMP_InvertingInput_1_4VREFINT ((uint32_t)0x00140000)
\r
92 #define COMP_InvertingInput_DAC1 ((uint32_t)0x00180000)
\r
93 #define COMP_InvertingInput_DAC2 ((uint32_t)0x001C0000)
\r
95 #define IS_COMP_INVERTING_INPUT(INPUT) (((INPUT) == COMP_InvertingInput_None) || \
\r
96 ((INPUT) == COMP_InvertingInput_IO) || \
\r
97 ((INPUT) == COMP_InvertingInput_VREFINT) || \
\r
98 ((INPUT) == COMP_InvertingInput_3_4VREFINT) || \
\r
99 ((INPUT) == COMP_InvertingInput_1_2VREFINT) || \
\r
100 ((INPUT) == COMP_InvertingInput_1_4VREFINT) || \
\r
101 ((INPUT) == COMP_InvertingInput_DAC1) || \
\r
102 ((INPUT) == COMP_InvertingInput_DAC2))
\r
107 /** @defgroup COMP_OutputSelect
\r
111 #define COMP_OutputSelect_TIM2IC4 ((uint32_t)0x00000000)
\r
112 #define COMP_OutputSelect_TIM2OCREFCLR ((uint32_t)0x00200000)
\r
113 #define COMP_OutputSelect_TIM3IC4 ((uint32_t)0x00400000)
\r
114 #define COMP_OutputSelect_TIM3OCREFCLR ((uint32_t)0x00600000)
\r
115 #define COMP_OutputSelect_TIM4IC4 ((uint32_t)0x00800000)
\r
116 #define COMP_OutputSelect_TIM4OCREFCLR ((uint32_t)0x00A00000)
\r
117 #define COMP_OutputSelect_TIM10IC1 ((uint32_t)0x00C00000)
\r
118 #define COMP_OutputSelect_None ((uint32_t)0x00E00000)
\r
120 #define IS_COMP_OUTPUT(OUTPUT) (((OUTPUT) == COMP_OutputSelect_TIM2IC4) || \
\r
121 ((OUTPUT) == COMP_OutputSelect_TIM2OCREFCLR) || \
\r
122 ((OUTPUT) == COMP_OutputSelect_TIM3IC4) || \
\r
123 ((OUTPUT) == COMP_OutputSelect_TIM3OCREFCLR) || \
\r
124 ((OUTPUT) == COMP_OutputSelect_TIM4IC4) || \
\r
125 ((OUTPUT) == COMP_OutputSelect_TIM4OCREFCLR) || \
\r
126 ((OUTPUT) == COMP_OutputSelect_TIM10IC1) || \
\r
127 ((OUTPUT) == COMP_OutputSelect_None))
\r
132 /** @defgroup COMP_Speed
\r
136 #define COMP_Speed_Slow ((uint32_t)0x00000000)
\r
137 #define COMP_Speed_Fast ((uint32_t)0x00001000)
\r
139 #define IS_COMP_SPEED(SPEED) (((SPEED) == COMP_Speed_Slow) || \
\r
140 ((SPEED) == COMP_Speed_Fast))
\r
149 /* Exported macro ------------------------------------------------------------*/
\r
150 /* Exported functions ------------------------------------------------------- */
\r
152 /* Function used to set the COMP configuration to the default reset state ****/
\r
153 void COMP_DeInit(void);
\r
155 /* Initialization and Configuration functions *********************************/
\r
156 void COMP_Init(COMP_InitTypeDef* COMP_InitStruct);
\r
157 void COMP_Cmd(FunctionalState NewState);
\r
158 uint8_t COMP_GetOutputLevel(uint32_t COMP_Selection);
\r
160 /* Window mode control function ***********************************************/
\r
161 void COMP_WindowCmd(FunctionalState NewState);
\r
163 /* Internal Reference Voltage (VREFINT) output function ***********************/
\r
164 void COMP_VrefintOutputCmd(FunctionalState NewState);
\r
170 #endif /*__STM32L1xx_COMP_H */
\r
180 /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/
\r