]> git.gag.com Git - fw/stlink/blobdiff - example/libs_stm/inc/stm32l1xx/stm32l1xx_comp.h
Restructure libs source to support multi platform
[fw/stlink] / example / libs_stm / inc / stm32l1xx / stm32l1xx_comp.h
diff --git a/example/libs_stm/inc/stm32l1xx/stm32l1xx_comp.h b/example/libs_stm/inc/stm32l1xx/stm32l1xx_comp.h
new file mode 100644 (file)
index 0000000..1fcc9f9
--- /dev/null
@@ -0,0 +1,180 @@
+/**\r
+  ******************************************************************************\r
+  * @file    stm32l1xx_comp.h\r
+  * @author  MCD Application Team\r
+  * @version V1.0.0\r
+  * @date    31-December-2010\r
+  * @brief   This file contains all the functions prototypes for the COMP firmware \r
+  *          library.\r
+  ******************************************************************************\r
+  * @attention\r
+  *\r
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE\r
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY\r
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING\r
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE\r
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+  *\r
+  * <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>\r
+  ******************************************************************************  \r
+  */ \r
+\r
+/* Define to prevent recursive inclusion -------------------------------------*/\r
+#ifndef __STM32L1xx_COMP_H\r
+#define __STM32L1xx_COMP_H\r
+\r
+#ifdef __cplusplus\r
+ extern "C" {\r
+#endif\r
+\r
+/* Includes ------------------------------------------------------------------*/\r
+#include "stm32l1xx.h"\r
+\r
+/** @addtogroup STM32L1xx_StdPeriph_Driver\r
+  * @{\r
+  */\r
+\r
+/** @addtogroup COMP\r
+  * @{\r
+  */\r
+\r
+/* Exported types ------------------------------------------------------------*/\r
+\r
+/** \r
+  * @brief  COMP Init structure definition  \r
+  */\r
+  \r
+typedef struct\r
+{\r
+  uint32_t COMP_Speed;               /*!< Defines the speed of comparator 2.\r
+                                          This parameter can be a value of @ref COMP_Speed */\r
+  uint32_t COMP_InvertingInput;      /*!< Selects the inverting input of the comparator 2.\r
+                                          This parameter can be a value of @ref COMP_InvertingInput */\r
+  uint32_t COMP_OutputSelect;        /*!< Selects the output redirection of the comparator 2.\r
+                                          This parameter can be a value of @ref COMP_OutputSelect */\r
+   \r
+}COMP_InitTypeDef;\r
+\r
+/* Exported constants --------------------------------------------------------*/\r
+   \r
+/** @defgroup COMP_Exported_Constants\r
+  * @{\r
+  */ \r
+\r
+#define COMP_OutputLevel_High                   ((uint32_t)0x00000001)\r
+#define COMP_OutputLevel_Low                    ((uint32_t)0x00000000)\r
+\r
+/** @defgroup COMP_Selection\r
+  * @{\r
+  */\r
+\r
+#define COMP_Selection_COMP1                    ((uint32_t)0x00000001)\r
+#define COMP_Selection_COMP2                    ((uint32_t)0x00000002)\r
+\r
+#define IS_COMP_ALL_PERIPH(PERIPH) (((PERIPH) == COMP_Selection_COMP1) || \\r
+                                    ((PERIPH) == COMP_Selection_COMP2))\r
\r
+/**\r
+  * @}\r
+  */ \r
+\r
+/** @defgroup COMP_InvertingInput\r
+  * @{\r
+  */\r
+\r
+#define COMP_InvertingInput_None                ((uint32_t)0x00000000) /* COMP2 is disabled when this parameter is selected */\r
+#define COMP_InvertingInput_IO                  ((uint32_t)0x00040000)\r
+#define COMP_InvertingInput_VREFINT             ((uint32_t)0x00080000)\r
+#define COMP_InvertingInput_3_4VREFINT          ((uint32_t)0x000C0000)\r
+#define COMP_InvertingInput_1_2VREFINT          ((uint32_t)0x00100000)\r
+#define COMP_InvertingInput_1_4VREFINT          ((uint32_t)0x00140000)\r
+#define COMP_InvertingInput_DAC1                ((uint32_t)0x00180000)\r
+#define COMP_InvertingInput_DAC2                ((uint32_t)0x001C0000)\r
+\r
+#define IS_COMP_INVERTING_INPUT(INPUT) (((INPUT) == COMP_InvertingInput_None) || \\r
+                                        ((INPUT) == COMP_InvertingInput_IO) || \\r
+                                        ((INPUT) == COMP_InvertingInput_VREFINT) || \\r
+                                        ((INPUT) == COMP_InvertingInput_3_4VREFINT) || \\r
+                                        ((INPUT) == COMP_InvertingInput_1_2VREFINT) || \\r
+                                        ((INPUT) == COMP_InvertingInput_1_4VREFINT) || \\r
+                                        ((INPUT) == COMP_InvertingInput_DAC1) || \\r
+                                        ((INPUT) == COMP_InvertingInput_DAC2))\r
+/**\r
+  * @}\r
+  */ \r
+\r
+/** @defgroup COMP_OutputSelect\r
+  * @{\r
+  */\r
+\r
+#define COMP_OutputSelect_TIM2IC4               ((uint32_t)0x00000000)\r
+#define COMP_OutputSelect_TIM2OCREFCLR          ((uint32_t)0x00200000)\r
+#define COMP_OutputSelect_TIM3IC4               ((uint32_t)0x00400000)\r
+#define COMP_OutputSelect_TIM3OCREFCLR          ((uint32_t)0x00600000)\r
+#define COMP_OutputSelect_TIM4IC4               ((uint32_t)0x00800000)\r
+#define COMP_OutputSelect_TIM4OCREFCLR          ((uint32_t)0x00A00000)\r
+#define COMP_OutputSelect_TIM10IC1              ((uint32_t)0x00C00000)\r
+#define COMP_OutputSelect_None                  ((uint32_t)0x00E00000)\r
+\r
+#define IS_COMP_OUTPUT(OUTPUT) (((OUTPUT) == COMP_OutputSelect_TIM2IC4) || \\r
+                                ((OUTPUT) == COMP_OutputSelect_TIM2OCREFCLR) || \\r
+                                ((OUTPUT) == COMP_OutputSelect_TIM3IC4) || \\r
+                                ((OUTPUT) == COMP_OutputSelect_TIM3OCREFCLR) || \\r
+                                ((OUTPUT) == COMP_OutputSelect_TIM4IC4) || \\r
+                                ((OUTPUT) == COMP_OutputSelect_TIM4OCREFCLR) || \\r
+                                ((OUTPUT) == COMP_OutputSelect_TIM10IC1) || \\r
+                                ((OUTPUT) == COMP_OutputSelect_None))\r
+/**\r
+  * @}\r
+  */ \r
+  \r
+/** @defgroup COMP_Speed\r
+  * @{\r
+  */\r
+\r
+#define COMP_Speed_Slow                         ((uint32_t)0x00000000)\r
+#define COMP_Speed_Fast                         ((uint32_t)0x00001000)\r
+\r
+#define IS_COMP_SPEED(SPEED)    (((SPEED) == COMP_Speed_Slow) || \\r
+                                 ((SPEED) == COMP_Speed_Fast))\r
+/**\r
+  * @}\r
+  */\r
+  \r
+/**\r
+  * @}\r
+  */ \r
+\r
+/* Exported macro ------------------------------------------------------------*/\r
+/* Exported functions ------------------------------------------------------- */\r
+\r
+/*  Function used to set the COMP configuration to the default reset state ****/\r
+void COMP_DeInit(void);\r
+\r
+/* Initialization and Configuration functions *********************************/\r
+void COMP_Init(COMP_InitTypeDef* COMP_InitStruct);\r
+void COMP_Cmd(FunctionalState NewState);\r
+uint8_t COMP_GetOutputLevel(uint32_t COMP_Selection);\r
+\r
+/* Window mode control function ***********************************************/\r
+void COMP_WindowCmd(FunctionalState NewState);\r
+\r
+/* Internal Reference Voltage (VREFINT) output function ***********************/\r
+void COMP_VrefintOutputCmd(FunctionalState NewState);\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#endif /*__STM32L1xx_COMP_H */\r
+\r
+/**\r
+  * @}\r
+  */ \r
+\r
+/**\r
+  * @}\r
+  */\r
+\r
+/******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/\r