SilentSensors / mbed-dev

Fork of mbed-dev by mbed official

Committer:
<>
Date:
Fri Oct 28 11:17:30 2016 +0100
Revision:
149:156823d33999
Child:
184:08ed48f1de7f
This updates the lib to the mbed lib v128

NOTE: This release includes a restructuring of the file and directory locations and thus some
include paths in your code may need updating accordingly.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 149:156823d33999 1 /**
<> 149:156823d33999 2 ******************************************************************************
<> 149:156823d33999 3 * @file stm32l1xx_ll_comp.c
<> 149:156823d33999 4 * @author MCD Application Team
<> 149:156823d33999 5 * @version V1.2.0
<> 149:156823d33999 6 * @date 01-July-2016
<> 149:156823d33999 7 * @brief COMP LL module driver
<> 149:156823d33999 8 ******************************************************************************
<> 149:156823d33999 9 * @attention
<> 149:156823d33999 10 *
<> 149:156823d33999 11 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
<> 149:156823d33999 12 *
<> 149:156823d33999 13 * Redistribution and use in source and binary forms, with or without modification,
<> 149:156823d33999 14 * are permitted provided that the following conditions are met:
<> 149:156823d33999 15 * 1. Redistributions of source code must retain the above copyright notice,
<> 149:156823d33999 16 * this list of conditions and the following disclaimer.
<> 149:156823d33999 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
<> 149:156823d33999 18 * this list of conditions and the following disclaimer in the documentation
<> 149:156823d33999 19 * and/or other materials provided with the distribution.
<> 149:156823d33999 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
<> 149:156823d33999 21 * may be used to endorse or promote products derived from this software
<> 149:156823d33999 22 * without specific prior written permission.
<> 149:156823d33999 23 *
<> 149:156823d33999 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
<> 149:156823d33999 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
<> 149:156823d33999 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
<> 149:156823d33999 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
<> 149:156823d33999 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
<> 149:156823d33999 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
<> 149:156823d33999 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
<> 149:156823d33999 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
<> 149:156823d33999 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
<> 149:156823d33999 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<> 149:156823d33999 34 *
<> 149:156823d33999 35 ******************************************************************************
<> 149:156823d33999 36 */
<> 149:156823d33999 37 #if defined(USE_FULL_LL_DRIVER)
<> 149:156823d33999 38
<> 149:156823d33999 39 /* Includes ------------------------------------------------------------------*/
<> 149:156823d33999 40 #include "stm32l1xx_ll_comp.h"
<> 149:156823d33999 41
<> 149:156823d33999 42 #ifdef USE_FULL_ASSERT
<> 149:156823d33999 43 #include "stm32_assert.h"
<> 149:156823d33999 44 #else
<> 149:156823d33999 45 #define assert_param(expr) ((void)0U)
<> 149:156823d33999 46 #endif
<> 149:156823d33999 47
<> 149:156823d33999 48 /** @addtogroup STM32L1xx_LL_Driver
<> 149:156823d33999 49 * @{
<> 149:156823d33999 50 */
<> 149:156823d33999 51
<> 149:156823d33999 52 #if defined (COMP1) || defined (COMP2)
<> 149:156823d33999 53
<> 149:156823d33999 54 /** @addtogroup COMP_LL COMP
<> 149:156823d33999 55 * @{
<> 149:156823d33999 56 */
<> 149:156823d33999 57
<> 149:156823d33999 58 /* Private types -------------------------------------------------------------*/
<> 149:156823d33999 59 /* Private variables ---------------------------------------------------------*/
<> 149:156823d33999 60 /* Private constants ---------------------------------------------------------*/
<> 149:156823d33999 61 /* Private macros ------------------------------------------------------------*/
<> 149:156823d33999 62
<> 149:156823d33999 63 /** @addtogroup COMP_LL_Private_Macros
<> 149:156823d33999 64 * @{
<> 149:156823d33999 65 */
<> 149:156823d33999 66
<> 149:156823d33999 67 /* Check of parameters for configuration of COMP hierarchical scope: */
<> 149:156823d33999 68 /* COMP instance. */
<> 149:156823d33999 69
<> 149:156823d33999 70 #define IS_LL_COMP_POWER_MODE(__POWER_MODE__) \
<> 149:156823d33999 71 ( ((__POWER_MODE__) == LL_COMP_POWERMODE_MEDIUMSPEED) \
<> 149:156823d33999 72 || ((__POWER_MODE__) == LL_COMP_POWERMODE_ULTRALOWPOWER) \
<> 149:156823d33999 73 )
<> 149:156823d33999 74
<> 149:156823d33999 75 /* Note: On this STM32 serie, comparator input plus parameters are */
<> 149:156823d33999 76 /* the different depending on COMP instances. */
<> 149:156823d33999 77 #if defined(RI_ASCR1_CH_31)
<> 149:156823d33999 78 #define IS_LL_COMP_INPUT_PLUS(__COMP_INSTANCE__, __INPUT_PLUS__) \
<> 149:156823d33999 79 (((__COMP_INSTANCE__) == COMP1) \
<> 149:156823d33999 80 ? ( \
<> 149:156823d33999 81 ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO5) \
<> 149:156823d33999 82 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO6) \
<> 149:156823d33999 83 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO7) \
<> 149:156823d33999 84 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO8) \
<> 149:156823d33999 85 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO9) \
<> 149:156823d33999 86 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO10) \
<> 149:156823d33999 87 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO11) \
<> 149:156823d33999 88 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO12) \
<> 149:156823d33999 89 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO13) \
<> 149:156823d33999 90 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO14) \
<> 149:156823d33999 91 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO15) \
<> 149:156823d33999 92 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO16) \
<> 149:156823d33999 93 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO17) \
<> 149:156823d33999 94 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO18) \
<> 149:156823d33999 95 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO19) \
<> 149:156823d33999 96 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO20) \
<> 149:156823d33999 97 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO21) \
<> 149:156823d33999 98 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO22) \
<> 149:156823d33999 99 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO23) \
<> 149:156823d33999 100 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO24) \
<> 149:156823d33999 101 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO25) \
<> 149:156823d33999 102 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO26) \
<> 149:156823d33999 103 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO27) \
<> 149:156823d33999 104 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO28) \
<> 149:156823d33999 105 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO29) \
<> 149:156823d33999 106 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO30) \
<> 149:156823d33999 107 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO31) \
<> 149:156823d33999 108 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO32) \
<> 149:156823d33999 109 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO33) \
<> 149:156823d33999 110 ) \
<> 149:156823d33999 111 : \
<> 149:156823d33999 112 ( \
<> 149:156823d33999 113 ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO1) \
<> 149:156823d33999 114 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO2) \
<> 149:156823d33999 115 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO3) \
<> 149:156823d33999 116 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO4) \
<> 149:156823d33999 117 ) \
<> 149:156823d33999 118 )
<> 149:156823d33999 119 #else
<> 149:156823d33999 120 #define IS_LL_COMP_INPUT_PLUS(__COMP_INSTANCE__, __INPUT_PLUS__) \
<> 149:156823d33999 121 (((__COMP_INSTANCE__) == COMP1) \
<> 149:156823d33999 122 ? ( \
<> 149:156823d33999 123 ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO5) \
<> 149:156823d33999 124 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO6) \
<> 149:156823d33999 125 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO7) \
<> 149:156823d33999 126 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO8) \
<> 149:156823d33999 127 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO9) \
<> 149:156823d33999 128 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO10) \
<> 149:156823d33999 129 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO11) \
<> 149:156823d33999 130 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO12) \
<> 149:156823d33999 131 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO13) \
<> 149:156823d33999 132 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO14) \
<> 149:156823d33999 133 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO15) \
<> 149:156823d33999 134 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO16) \
<> 149:156823d33999 135 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO17) \
<> 149:156823d33999 136 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO18) \
<> 149:156823d33999 137 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO19) \
<> 149:156823d33999 138 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO20) \
<> 149:156823d33999 139 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO21) \
<> 149:156823d33999 140 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO22) \
<> 149:156823d33999 141 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO23) \
<> 149:156823d33999 142 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO24) \
<> 149:156823d33999 143 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO25) \
<> 149:156823d33999 144 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO26) \
<> 149:156823d33999 145 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO27) \
<> 149:156823d33999 146 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO28) \
<> 149:156823d33999 147 ) \
<> 149:156823d33999 148 : \
<> 149:156823d33999 149 ( \
<> 149:156823d33999 150 ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO1) \
<> 149:156823d33999 151 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO2) \
<> 149:156823d33999 152 ) \
<> 149:156823d33999 153 )
<> 149:156823d33999 154 #endif
<> 149:156823d33999 155
<> 149:156823d33999 156 /* Note: On this STM32 serie, comparator input minus parameters are */
<> 149:156823d33999 157 /* the different depending on COMP instances. */
<> 149:156823d33999 158 #define IS_LL_COMP_INPUT_MINUS(__COMP_INSTANCE__, __INPUT_MINUS__) \
<> 149:156823d33999 159 (((__COMP_INSTANCE__) == COMP1) \
<> 149:156823d33999 160 ? ( \
<> 149:156823d33999 161 ((__INPUT_MINUS__) == LL_COMP_INPUT_MINUS_VREFINT) \
<> 149:156823d33999 162 ) \
<> 149:156823d33999 163 : \
<> 149:156823d33999 164 ( \
<> 149:156823d33999 165 ((__INPUT_MINUS__) == LL_COMP_INPUT_MINUS_1_4VREFINT) \
<> 149:156823d33999 166 || ((__INPUT_MINUS__) == LL_COMP_INPUT_MINUS_1_2VREFINT) \
<> 149:156823d33999 167 || ((__INPUT_MINUS__) == LL_COMP_INPUT_MINUS_3_4VREFINT) \
<> 149:156823d33999 168 || ((__INPUT_MINUS__) == LL_COMP_INPUT_MINUS_VREFINT) \
<> 149:156823d33999 169 || ((__INPUT_MINUS__) == LL_COMP_INPUT_MINUS_DAC1_CH1) \
<> 149:156823d33999 170 || ((__INPUT_MINUS__) == LL_COMP_INPUT_MINUS_DAC1_CH2) \
<> 149:156823d33999 171 || ((__INPUT_MINUS__) == LL_COMP_INPUT_MINUS_IO1) \
<> 149:156823d33999 172 ) \
<> 149:156823d33999 173 )
<> 149:156823d33999 174
<> 149:156823d33999 175 #define IS_LL_COMP_OUTPUT_SELECTION(__OUTPUT_SELECTION__) \
<> 149:156823d33999 176 ( ((__OUTPUT_SELECTION__) == LL_COMP_OUTPUT_NONE) \
<> 149:156823d33999 177 || ((__OUTPUT_SELECTION__) == LL_COMP_OUTPUT_TIM2_IC4) \
<> 149:156823d33999 178 || ((__OUTPUT_SELECTION__) == LL_COMP_OUTPUT_TIM2_OCREFCLR) \
<> 149:156823d33999 179 || ((__OUTPUT_SELECTION__) == LL_COMP_OUTPUT_TIM3_IC4) \
<> 149:156823d33999 180 || ((__OUTPUT_SELECTION__) == LL_COMP_OUTPUT_TIM3_OCREFCLR) \
<> 149:156823d33999 181 || ((__OUTPUT_SELECTION__) == LL_COMP_OUTPUT_TIM4_IC4) \
<> 149:156823d33999 182 || ((__OUTPUT_SELECTION__) == LL_COMP_OUTPUT_TIM4_OCREFCLR) \
<> 149:156823d33999 183 || ((__OUTPUT_SELECTION__) == LL_COMP_OUTPUT_TIM10_IC1) \
<> 149:156823d33999 184 )
<> 149:156823d33999 185
<> 149:156823d33999 186 /**
<> 149:156823d33999 187 * @}
<> 149:156823d33999 188 */
<> 149:156823d33999 189
<> 149:156823d33999 190
<> 149:156823d33999 191 /* Private function prototypes -----------------------------------------------*/
<> 149:156823d33999 192
<> 149:156823d33999 193 /* Exported functions --------------------------------------------------------*/
<> 149:156823d33999 194 /** @addtogroup COMP_LL_Exported_Functions
<> 149:156823d33999 195 * @{
<> 149:156823d33999 196 */
<> 149:156823d33999 197
<> 149:156823d33999 198 /** @addtogroup COMP_LL_EF_Init
<> 149:156823d33999 199 * @{
<> 149:156823d33999 200 */
<> 149:156823d33999 201
<> 149:156823d33999 202 /**
<> 149:156823d33999 203 * @brief De-initialize registers of the selected COMP instance
<> 149:156823d33999 204 * to their default reset values.
<> 149:156823d33999 205 * @note If comparator is locked, de-initialization by software is
<> 149:156823d33999 206 * not possible.
<> 149:156823d33999 207 * The only way to unlock the comparator is a device hardware reset.
<> 149:156823d33999 208 * @param COMPx COMP instance
<> 149:156823d33999 209 * @retval An ErrorStatus enumeration value:
<> 149:156823d33999 210 * - SUCCESS: COMP registers are de-initialized
<> 149:156823d33999 211 * - ERROR: COMP registers are not de-initialized
<> 149:156823d33999 212 */
<> 149:156823d33999 213 ErrorStatus LL_COMP_DeInit(COMP_TypeDef *COMPx)
<> 149:156823d33999 214 {
<> 149:156823d33999 215 ErrorStatus status = SUCCESS;
<> 149:156823d33999 216
<> 149:156823d33999 217 /* Check the parameters */
<> 149:156823d33999 218 assert_param(IS_COMP_ALL_INSTANCE(COMPx));
<> 149:156823d33999 219
<> 149:156823d33999 220 /* Note: On this STM32 serie, only COMP instance COMP2 has */
<> 149:156823d33999 221 /* features settables: power mode, input minus selection */
<> 149:156823d33999 222 /* and output selection. */
<> 149:156823d33999 223 /* Note: On this STM32 serie, setting COMP instance COMP2 input minus */
<> 149:156823d33999 224 /* is enabling the comparator. */
<> 149:156823d33999 225 /* Reset COMP2 input minus also disable the comparator. */
<> 149:156823d33999 226 /* Note: In case of de-initialization of COMP instance COMP1: */
<> 149:156823d33999 227 /* Switch COMP_CSR_SW1 is not modified because can be used */
<> 149:156823d33999 228 /* to connect OPAMP3 to ADC. */
<> 149:156823d33999 229 /* Switches RI_ASCR1_VCOMP, RI_ASCR1_SCM are reset: let routing */
<> 149:156823d33999 230 /* interface under control of ADC. */
<> 149:156823d33999 231 if(COMPx == COMP1)
<> 149:156823d33999 232 {
<> 149:156823d33999 233 CLEAR_BIT(COMP->CSR,
<> 149:156823d33999 234 ( COMP_CSR_CMP1EN
<> 149:156823d33999 235 | COMP_CSR_10KPU
<> 149:156823d33999 236 | COMP_CSR_400KPU
<> 149:156823d33999 237 | COMP_CSR_10KPD
<> 149:156823d33999 238 | COMP_CSR_400KPD
<> 149:156823d33999 239 )
<> 149:156823d33999 240 );
<> 149:156823d33999 241 }
<> 149:156823d33999 242 else
<> 149:156823d33999 243 {
<> 149:156823d33999 244 CLEAR_BIT(COMP->CSR,
<> 149:156823d33999 245 ( COMP_CSR_SPEED
<> 149:156823d33999 246 | COMP_CSR_INSEL
<> 149:156823d33999 247 | COMP_CSR_OUTSEL
<> 149:156823d33999 248 )
<> 149:156823d33999 249 );
<> 149:156823d33999 250 }
<> 149:156823d33999 251
<> 149:156823d33999 252 /* Set comparator input plus */
<> 149:156823d33999 253 LL_COMP_SetInputPlus(COMPx, LL_COMP_INPUT_PLUS_NONE);
<> 149:156823d33999 254
<> 149:156823d33999 255 return status;
<> 149:156823d33999 256 }
<> 149:156823d33999 257
<> 149:156823d33999 258 /**
<> 149:156823d33999 259 * @brief Initialize some features of COMP instance.
<> 149:156823d33999 260 * @note This function configures features of the selected COMP instance.
<> 149:156823d33999 261 * Some features are also available at scope COMP common instance
<> 149:156823d33999 262 * (common to several COMP instances).
<> 149:156823d33999 263 * Refer to functions having argument "COMPxy_COMMON" as parameter.
<> 149:156823d33999 264 * @param COMPx COMP instance
<> 149:156823d33999 265 * @param COMP_InitStruct Pointer to a @ref LL_COMP_InitTypeDef structure
<> 149:156823d33999 266 * @retval An ErrorStatus enumeration value:
<> 149:156823d33999 267 * - SUCCESS: COMP registers are initialized
<> 149:156823d33999 268 * - ERROR: COMP registers are not initialized
<> 149:156823d33999 269 */
<> 149:156823d33999 270 ErrorStatus LL_COMP_Init(COMP_TypeDef *COMPx, LL_COMP_InitTypeDef *COMP_InitStruct)
<> 149:156823d33999 271 {
<> 149:156823d33999 272 ErrorStatus status = SUCCESS;
<> 149:156823d33999 273
<> 149:156823d33999 274 /* Check the parameters */
<> 149:156823d33999 275 assert_param(IS_COMP_ALL_INSTANCE(COMPx));
<> 149:156823d33999 276 if(COMPx == COMP2)
<> 149:156823d33999 277 {
<> 149:156823d33999 278 assert_param(IS_LL_COMP_POWER_MODE(COMP_InitStruct->PowerMode));
<> 149:156823d33999 279 assert_param(IS_LL_COMP_INPUT_MINUS(COMPx, COMP_InitStruct->InputMinus));
<> 149:156823d33999 280 assert_param(IS_LL_COMP_OUTPUT_SELECTION(COMP_InitStruct->OutputSelection));
<> 149:156823d33999 281 }
<> 149:156823d33999 282 assert_param(IS_LL_COMP_INPUT_PLUS(COMPx, COMP_InitStruct->InputPlus));
<> 149:156823d33999 283
<> 149:156823d33999 284 /* Configuration of comparator instance : */
<> 149:156823d33999 285 /* - PowerMode */
<> 149:156823d33999 286 /* - InputPlus */
<> 149:156823d33999 287 /* - InputMinus */
<> 149:156823d33999 288 /* - OutputSelection */
<> 149:156823d33999 289 /* Note: On this STM32 serie, only COMP instance COMP2 has */
<> 149:156823d33999 290 /* features settables: power mode, input minus selection */
<> 149:156823d33999 291 /* and output selection. */
<> 149:156823d33999 292 /* Note: On this STM32 serie, setting COMP instance COMP2 input minus */
<> 149:156823d33999 293 /* is enabling the comparator. */
<> 149:156823d33999 294 if(COMPx == COMP2)
<> 149:156823d33999 295 {
<> 149:156823d33999 296 MODIFY_REG(COMP->CSR,
<> 149:156823d33999 297 COMP_CSR_SPEED
<> 149:156823d33999 298 | COMP_CSR_INSEL
<> 149:156823d33999 299 | COMP_CSR_OUTSEL
<> 149:156823d33999 300 ,
<> 149:156823d33999 301 COMP_InitStruct->PowerMode
<> 149:156823d33999 302 | COMP_InitStruct->InputMinus
<> 149:156823d33999 303 | COMP_InitStruct->OutputSelection
<> 149:156823d33999 304 );
<> 149:156823d33999 305 }
<> 149:156823d33999 306
<> 149:156823d33999 307 /* Set comparator input plus */
<> 149:156823d33999 308 LL_COMP_SetInputPlus(COMPx, COMP_InitStruct->InputPlus);
<> 149:156823d33999 309
<> 149:156823d33999 310 return status;
<> 149:156823d33999 311 }
<> 149:156823d33999 312
<> 149:156823d33999 313 /**
<> 149:156823d33999 314 * @brief Set each @ref LL_COMP_InitTypeDef field to default value.
<> 149:156823d33999 315 * @param COMP_InitStruct: pointer to a @ref LL_COMP_InitTypeDef structure
<> 149:156823d33999 316 * whose fields will be set to default values.
<> 149:156823d33999 317 * @retval None
<> 149:156823d33999 318 */
<> 149:156823d33999 319 void LL_COMP_StructInit(LL_COMP_InitTypeDef *COMP_InitStruct)
<> 149:156823d33999 320 {
<> 149:156823d33999 321 /* Set COMP_InitStruct fields to default values */
<> 149:156823d33999 322 COMP_InitStruct->PowerMode = LL_COMP_POWERMODE_ULTRALOWPOWER;
<> 149:156823d33999 323 COMP_InitStruct->InputPlus = LL_COMP_INPUT_PLUS_IO1;
<> 149:156823d33999 324 COMP_InitStruct->InputMinus = LL_COMP_INPUT_MINUS_VREFINT;
<> 149:156823d33999 325 COMP_InitStruct->OutputSelection = LL_COMP_OUTPUT_NONE;
<> 149:156823d33999 326 }
<> 149:156823d33999 327
<> 149:156823d33999 328 /**
<> 149:156823d33999 329 * @}
<> 149:156823d33999 330 */
<> 149:156823d33999 331
<> 149:156823d33999 332 /**
<> 149:156823d33999 333 * @}
<> 149:156823d33999 334 */
<> 149:156823d33999 335
<> 149:156823d33999 336 /**
<> 149:156823d33999 337 * @}
<> 149:156823d33999 338 */
<> 149:156823d33999 339
<> 149:156823d33999 340 #endif /* COMP1 || COMP2 */
<> 149:156823d33999 341
<> 149:156823d33999 342 /**
<> 149:156823d33999 343 * @}
<> 149:156823d33999 344 */
<> 149:156823d33999 345
<> 149:156823d33999 346 #endif /* USE_FULL_LL_DRIVER */
<> 149:156823d33999 347
<> 149:156823d33999 348 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/