mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
AnnaBridge
Date:
Wed Feb 20 22:31:08 2019 +0000
Revision:
189:f392fc9709a3
Parent:
184:08ed48f1de7f
mbed library release version 165

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