version_2.0

Dependents:   cc3000_ping_demo_try_2

Fork of mbed by mbed official

Committer:
erezi
Date:
Wed Jun 25 06:08:49 2014 +0000
Revision:
86:4f9a848d74c7
Parent:
81:7d30d6019079
version_2.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emilmont 77:869cf507173a 1 /**
emilmont 77:869cf507173a 2 ******************************************************************************
emilmont 77:869cf507173a 3 * @file stm32l1xx_comp.h
emilmont 77:869cf507173a 4 * @author MCD Application Team
emilmont 77:869cf507173a 5 * @version V1.3.0
emilmont 77:869cf507173a 6 * @date 31-January-2014
emilmont 77:869cf507173a 7 * @brief This file contains all the functions prototypes for the COMP firmware
emilmont 77:869cf507173a 8 * library.
emilmont 77:869cf507173a 9 ******************************************************************************
emilmont 77:869cf507173a 10 * @attention
emilmont 77:869cf507173a 11 *
bogdanm 81:7d30d6019079 12 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
emilmont 77:869cf507173a 13 *
bogdanm 81:7d30d6019079 14 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 81:7d30d6019079 15 * are permitted provided that the following conditions are met:
bogdanm 81:7d30d6019079 16 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 81:7d30d6019079 17 * this list of conditions and the following disclaimer.
bogdanm 81:7d30d6019079 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 81:7d30d6019079 19 * this list of conditions and the following disclaimer in the documentation
bogdanm 81:7d30d6019079 20 * and/or other materials provided with the distribution.
bogdanm 81:7d30d6019079 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 81:7d30d6019079 22 * may be used to endorse or promote products derived from this software
bogdanm 81:7d30d6019079 23 * without specific prior written permission.
emilmont 77:869cf507173a 24 *
bogdanm 81:7d30d6019079 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 81:7d30d6019079 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 81:7d30d6019079 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 81:7d30d6019079 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 81:7d30d6019079 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 81:7d30d6019079 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 81:7d30d6019079 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 81:7d30d6019079 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 81:7d30d6019079 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 81:7d30d6019079 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
emilmont 77:869cf507173a 35 *
emilmont 77:869cf507173a 36 ******************************************************************************
emilmont 77:869cf507173a 37 */
emilmont 77:869cf507173a 38
emilmont 77:869cf507173a 39 /* Define to prevent recursive inclusion -------------------------------------*/
emilmont 77:869cf507173a 40 #ifndef __STM32L1xx_COMP_H
emilmont 77:869cf507173a 41 #define __STM32L1xx_COMP_H
emilmont 77:869cf507173a 42
emilmont 77:869cf507173a 43 #ifdef __cplusplus
emilmont 77:869cf507173a 44 extern "C" {
emilmont 77:869cf507173a 45 #endif
emilmont 77:869cf507173a 46
emilmont 77:869cf507173a 47 /* Includes ------------------------------------------------------------------*/
emilmont 77:869cf507173a 48 #include "stm32l1xx.h"
emilmont 77:869cf507173a 49
emilmont 77:869cf507173a 50 /** @addtogroup STM32L1xx_StdPeriph_Driver
emilmont 77:869cf507173a 51 * @{
emilmont 77:869cf507173a 52 */
emilmont 77:869cf507173a 53
emilmont 77:869cf507173a 54 /** @addtogroup COMP
emilmont 77:869cf507173a 55 * @{
emilmont 77:869cf507173a 56 */
emilmont 77:869cf507173a 57
emilmont 77:869cf507173a 58 /* Exported types ------------------------------------------------------------*/
emilmont 77:869cf507173a 59
emilmont 77:869cf507173a 60 /**
emilmont 77:869cf507173a 61 * @brief COMP Init structure definition
emilmont 77:869cf507173a 62 */
emilmont 77:869cf507173a 63
emilmont 77:869cf507173a 64 typedef struct
emilmont 77:869cf507173a 65 {
emilmont 77:869cf507173a 66 uint32_t COMP_Speed; /*!< Defines the speed of comparator 2.
emilmont 77:869cf507173a 67 This parameter can be a value of @ref COMP_Speed */
emilmont 77:869cf507173a 68 uint32_t COMP_InvertingInput; /*!< Selects the inverting input of the comparator 2.
emilmont 77:869cf507173a 69 This parameter can be a value of @ref COMP_InvertingInput */
emilmont 77:869cf507173a 70 uint32_t COMP_OutputSelect; /*!< Selects the output redirection of the comparator 2.
emilmont 77:869cf507173a 71 This parameter can be a value of @ref COMP_OutputSelect */
emilmont 77:869cf507173a 72
emilmont 77:869cf507173a 73 }COMP_InitTypeDef;
emilmont 77:869cf507173a 74
emilmont 77:869cf507173a 75 /* Exported constants --------------------------------------------------------*/
emilmont 77:869cf507173a 76
emilmont 77:869cf507173a 77 /** @defgroup COMP_Exported_Constants
emilmont 77:869cf507173a 78 * @{
emilmont 77:869cf507173a 79 */
emilmont 77:869cf507173a 80
emilmont 77:869cf507173a 81 #define COMP_OutputLevel_High ((uint32_t)0x00000001)
emilmont 77:869cf507173a 82 #define COMP_OutputLevel_Low ((uint32_t)0x00000000)
emilmont 77:869cf507173a 83
emilmont 77:869cf507173a 84 /** @defgroup COMP_Selection
emilmont 77:869cf507173a 85 * @{
emilmont 77:869cf507173a 86 */
emilmont 77:869cf507173a 87
emilmont 77:869cf507173a 88 #define COMP_Selection_COMP1 ((uint32_t)0x00000001)
emilmont 77:869cf507173a 89 #define COMP_Selection_COMP2 ((uint32_t)0x00000002)
emilmont 77:869cf507173a 90
emilmont 77:869cf507173a 91 #define IS_COMP_ALL_PERIPH(PERIPH) (((PERIPH) == COMP_Selection_COMP1) || \
emilmont 77:869cf507173a 92 ((PERIPH) == COMP_Selection_COMP2))
emilmont 77:869cf507173a 93
emilmont 77:869cf507173a 94 /**
emilmont 77:869cf507173a 95 * @}
emilmont 77:869cf507173a 96 */
emilmont 77:869cf507173a 97
emilmont 77:869cf507173a 98 /** @defgroup COMP_InvertingInput
emilmont 77:869cf507173a 99 * @{
emilmont 77:869cf507173a 100 */
emilmont 77:869cf507173a 101
emilmont 77:869cf507173a 102 #define COMP_InvertingInput_None ((uint32_t)0x00000000) /* COMP2 is disabled when this parameter is selected */
emilmont 77:869cf507173a 103 #define COMP_InvertingInput_IO ((uint32_t)0x00040000)
emilmont 77:869cf507173a 104 #define COMP_InvertingInput_VREFINT ((uint32_t)0x00080000)
emilmont 77:869cf507173a 105 #define COMP_InvertingInput_3_4VREFINT ((uint32_t)0x000C0000)
emilmont 77:869cf507173a 106 #define COMP_InvertingInput_1_2VREFINT ((uint32_t)0x00100000)
emilmont 77:869cf507173a 107 #define COMP_InvertingInput_1_4VREFINT ((uint32_t)0x00140000)
emilmont 77:869cf507173a 108 #define COMP_InvertingInput_DAC1 ((uint32_t)0x00180000)
emilmont 77:869cf507173a 109 #define COMP_InvertingInput_DAC2 ((uint32_t)0x001C0000)
emilmont 77:869cf507173a 110
emilmont 77:869cf507173a 111 #define IS_COMP_INVERTING_INPUT(INPUT) (((INPUT) == COMP_InvertingInput_None) || \
emilmont 77:869cf507173a 112 ((INPUT) == COMP_InvertingInput_IO) || \
emilmont 77:869cf507173a 113 ((INPUT) == COMP_InvertingInput_VREFINT) || \
emilmont 77:869cf507173a 114 ((INPUT) == COMP_InvertingInput_3_4VREFINT) || \
emilmont 77:869cf507173a 115 ((INPUT) == COMP_InvertingInput_1_2VREFINT) || \
emilmont 77:869cf507173a 116 ((INPUT) == COMP_InvertingInput_1_4VREFINT) || \
emilmont 77:869cf507173a 117 ((INPUT) == COMP_InvertingInput_DAC1) || \
emilmont 77:869cf507173a 118 ((INPUT) == COMP_InvertingInput_DAC2))
emilmont 77:869cf507173a 119 /**
emilmont 77:869cf507173a 120 * @}
emilmont 77:869cf507173a 121 */
emilmont 77:869cf507173a 122
emilmont 77:869cf507173a 123 /** @defgroup COMP_OutputSelect
emilmont 77:869cf507173a 124 * @{
emilmont 77:869cf507173a 125 */
emilmont 77:869cf507173a 126
emilmont 77:869cf507173a 127 #define COMP_OutputSelect_TIM2IC4 ((uint32_t)0x00000000)
emilmont 77:869cf507173a 128 #define COMP_OutputSelect_TIM2OCREFCLR ((uint32_t)0x00200000)
emilmont 77:869cf507173a 129 #define COMP_OutputSelect_TIM3IC4 ((uint32_t)0x00400000)
emilmont 77:869cf507173a 130 #define COMP_OutputSelect_TIM3OCREFCLR ((uint32_t)0x00600000)
emilmont 77:869cf507173a 131 #define COMP_OutputSelect_TIM4IC4 ((uint32_t)0x00800000)
emilmont 77:869cf507173a 132 #define COMP_OutputSelect_TIM4OCREFCLR ((uint32_t)0x00A00000)
emilmont 77:869cf507173a 133 #define COMP_OutputSelect_TIM10IC1 ((uint32_t)0x00C00000)
emilmont 77:869cf507173a 134 #define COMP_OutputSelect_None ((uint32_t)0x00E00000)
emilmont 77:869cf507173a 135
emilmont 77:869cf507173a 136 #define IS_COMP_OUTPUT(OUTPUT) (((OUTPUT) == COMP_OutputSelect_TIM2IC4) || \
emilmont 77:869cf507173a 137 ((OUTPUT) == COMP_OutputSelect_TIM2OCREFCLR) || \
emilmont 77:869cf507173a 138 ((OUTPUT) == COMP_OutputSelect_TIM3IC4) || \
emilmont 77:869cf507173a 139 ((OUTPUT) == COMP_OutputSelect_TIM3OCREFCLR) || \
emilmont 77:869cf507173a 140 ((OUTPUT) == COMP_OutputSelect_TIM4IC4) || \
emilmont 77:869cf507173a 141 ((OUTPUT) == COMP_OutputSelect_TIM4OCREFCLR) || \
emilmont 77:869cf507173a 142 ((OUTPUT) == COMP_OutputSelect_TIM10IC1) || \
emilmont 77:869cf507173a 143 ((OUTPUT) == COMP_OutputSelect_None))
emilmont 77:869cf507173a 144 /**
emilmont 77:869cf507173a 145 * @}
emilmont 77:869cf507173a 146 */
emilmont 77:869cf507173a 147
emilmont 77:869cf507173a 148 /** @defgroup COMP_Speed
emilmont 77:869cf507173a 149 * @{
emilmont 77:869cf507173a 150 */
emilmont 77:869cf507173a 151
emilmont 77:869cf507173a 152 #define COMP_Speed_Slow ((uint32_t)0x00000000)
emilmont 77:869cf507173a 153 #define COMP_Speed_Fast ((uint32_t)0x00001000)
emilmont 77:869cf507173a 154
emilmont 77:869cf507173a 155 #define IS_COMP_SPEED(SPEED) (((SPEED) == COMP_Speed_Slow) || \
emilmont 77:869cf507173a 156 ((SPEED) == COMP_Speed_Fast))
emilmont 77:869cf507173a 157 /**
emilmont 77:869cf507173a 158 * @}
emilmont 77:869cf507173a 159 */
emilmont 77:869cf507173a 160
emilmont 77:869cf507173a 161 /**
emilmont 77:869cf507173a 162 * @}
emilmont 77:869cf507173a 163 */
emilmont 77:869cf507173a 164
emilmont 77:869cf507173a 165 /* Exported macro ------------------------------------------------------------*/
emilmont 77:869cf507173a 166 /* Exported functions ------------------------------------------------------- */
emilmont 77:869cf507173a 167
emilmont 77:869cf507173a 168 /* Function used to set the COMP configuration to the default reset state ****/
emilmont 77:869cf507173a 169 void COMP_DeInit(void);
emilmont 77:869cf507173a 170
emilmont 77:869cf507173a 171 /* Initialization and Configuration functions *********************************/
emilmont 77:869cf507173a 172 void COMP_Init(COMP_InitTypeDef* COMP_InitStruct);
emilmont 77:869cf507173a 173 void COMP_Cmd(FunctionalState NewState);
emilmont 77:869cf507173a 174 uint8_t COMP_GetOutputLevel(uint32_t COMP_Selection);
emilmont 77:869cf507173a 175 void COMP_SW1SwitchConfig(FunctionalState NewState);
emilmont 77:869cf507173a 176
emilmont 77:869cf507173a 177 /* Window mode control function ***********************************************/
emilmont 77:869cf507173a 178 void COMP_WindowCmd(FunctionalState NewState);
emilmont 77:869cf507173a 179
emilmont 77:869cf507173a 180 /* Internal Reference Voltage (VREFINT) output function ***********************/
emilmont 77:869cf507173a 181 void COMP_VrefintOutputCmd(FunctionalState NewState);
emilmont 77:869cf507173a 182
emilmont 77:869cf507173a 183 #ifdef __cplusplus
emilmont 77:869cf507173a 184 }
emilmont 77:869cf507173a 185 #endif
emilmont 77:869cf507173a 186
emilmont 77:869cf507173a 187 #endif /*__STM32L1xx_COMP_H */
emilmont 77:869cf507173a 188
emilmont 77:869cf507173a 189 /**
emilmont 77:869cf507173a 190 * @}
emilmont 77:869cf507173a 191 */
emilmont 77:869cf507173a 192
emilmont 77:869cf507173a 193 /**
emilmont 77:869cf507173a 194 * @}
emilmont 77:869cf507173a 195 */
emilmont 77:869cf507173a 196
emilmont 77:869cf507173a 197 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/