TUKS MCU Introductory course / TUKS-COURSE-THERMOMETER

Fork of TUKS-COURSE-TIMER by TUKS MCU Introductory course

Committer:
elmot
Date:
Sat Feb 25 09:03:15 2017 +0000
Revision:
3:b69e098b4613
Parent:
1:d0dfbce63a89
Ready

Who changed what in which revision?

UserRevisionLine numberNew contents of line
elmot 1:d0dfbce63a89 1 /**
elmot 1:d0dfbce63a89 2 ******************************************************************************
elmot 1:d0dfbce63a89 3 * @file stm32l4xx_ll_comp.c
elmot 1:d0dfbce63a89 4 * @author MCD Application Team
elmot 1:d0dfbce63a89 5 * @version V1.5.1
elmot 1:d0dfbce63a89 6 * @date 31-May-2016
elmot 1:d0dfbce63a89 7 * @brief COMP LL module driver
elmot 1:d0dfbce63a89 8 ******************************************************************************
elmot 1:d0dfbce63a89 9 * @attention
elmot 1:d0dfbce63a89 10 *
elmot 1:d0dfbce63a89 11 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
elmot 1:d0dfbce63a89 12 *
elmot 1:d0dfbce63a89 13 * Redistribution and use in source and binary forms, with or without modification,
elmot 1:d0dfbce63a89 14 * are permitted provided that the following conditions are met:
elmot 1:d0dfbce63a89 15 * 1. Redistributions of source code must retain the above copyright notice,
elmot 1:d0dfbce63a89 16 * this list of conditions and the following disclaimer.
elmot 1:d0dfbce63a89 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
elmot 1:d0dfbce63a89 18 * this list of conditions and the following disclaimer in the documentation
elmot 1:d0dfbce63a89 19 * and/or other materials provided with the distribution.
elmot 1:d0dfbce63a89 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
elmot 1:d0dfbce63a89 21 * may be used to endorse or promote products derived from this software
elmot 1:d0dfbce63a89 22 * without specific prior written permission.
elmot 1:d0dfbce63a89 23 *
elmot 1:d0dfbce63a89 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
elmot 1:d0dfbce63a89 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
elmot 1:d0dfbce63a89 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
elmot 1:d0dfbce63a89 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
elmot 1:d0dfbce63a89 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
elmot 1:d0dfbce63a89 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
elmot 1:d0dfbce63a89 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
elmot 1:d0dfbce63a89 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
elmot 1:d0dfbce63a89 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
elmot 1:d0dfbce63a89 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
elmot 1:d0dfbce63a89 34 *
elmot 1:d0dfbce63a89 35 ******************************************************************************
elmot 1:d0dfbce63a89 36 */
elmot 1:d0dfbce63a89 37 #if defined(USE_FULL_LL_DRIVER)
elmot 1:d0dfbce63a89 38
elmot 1:d0dfbce63a89 39 /* Includes ------------------------------------------------------------------*/
elmot 1:d0dfbce63a89 40 #include "stm32l4xx_ll_comp.h"
elmot 1:d0dfbce63a89 41
elmot 1:d0dfbce63a89 42 #ifdef USE_FULL_ASSERT
elmot 1:d0dfbce63a89 43 #include "stm32_assert.h"
elmot 1:d0dfbce63a89 44 #else
elmot 1:d0dfbce63a89 45 #define assert_param(expr) ((void)0U)
elmot 1:d0dfbce63a89 46 #endif
elmot 1:d0dfbce63a89 47
elmot 1:d0dfbce63a89 48 /** @addtogroup STM32L4xx_LL_Driver
elmot 1:d0dfbce63a89 49 * @{
elmot 1:d0dfbce63a89 50 */
elmot 1:d0dfbce63a89 51
elmot 1:d0dfbce63a89 52 #if defined (COMP1) || defined (COMP2)
elmot 1:d0dfbce63a89 53
elmot 1:d0dfbce63a89 54 /** @addtogroup COMP_LL COMP
elmot 1:d0dfbce63a89 55 * @{
elmot 1:d0dfbce63a89 56 */
elmot 1:d0dfbce63a89 57
elmot 1:d0dfbce63a89 58 /* Private types -------------------------------------------------------------*/
elmot 1:d0dfbce63a89 59 /* Private variables ---------------------------------------------------------*/
elmot 1:d0dfbce63a89 60 /* Private constants ---------------------------------------------------------*/
elmot 1:d0dfbce63a89 61 /* Private macros ------------------------------------------------------------*/
elmot 1:d0dfbce63a89 62
elmot 1:d0dfbce63a89 63 /** @addtogroup COMP_LL_Private_Macros
elmot 1:d0dfbce63a89 64 * @{
elmot 1:d0dfbce63a89 65 */
elmot 1:d0dfbce63a89 66
elmot 1:d0dfbce63a89 67 /* Check of parameters for configuration of COMP hierarchical scope: */
elmot 1:d0dfbce63a89 68 /* COMP instance. */
elmot 1:d0dfbce63a89 69
elmot 1:d0dfbce63a89 70 #define IS_LL_COMP_POWER_MODE(__POWER_MODE__) \
elmot 1:d0dfbce63a89 71 ( ((__POWER_MODE__) == LL_COMP_POWERMODE_HIGHSPEED) \
elmot 1:d0dfbce63a89 72 || ((__POWER_MODE__) == LL_COMP_POWERMODE_MEDIUMSPEED) \
elmot 1:d0dfbce63a89 73 || ((__POWER_MODE__) == LL_COMP_POWERMODE_ULTRALOWPOWER) \
elmot 1:d0dfbce63a89 74 )
elmot 1:d0dfbce63a89 75
elmot 1:d0dfbce63a89 76 /* Note: On this STM32 serie, comparator input plus parameters are */
elmot 1:d0dfbce63a89 77 /* the same on all COMP instances. */
elmot 1:d0dfbce63a89 78 /* However, comparator instance kept as macro parameter for */
elmot 1:d0dfbce63a89 79 /* compatibility with other STM32 families. */
elmot 1:d0dfbce63a89 80 #if defined(COMP_CSR_INPSEL_1)
elmot 1:d0dfbce63a89 81 #define IS_LL_COMP_INPUT_PLUS(__COMP_INSTANCE__, __INPUT_PLUS__) \
elmot 1:d0dfbce63a89 82 ( ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO1) \
elmot 1:d0dfbce63a89 83 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO2) \
elmot 1:d0dfbce63a89 84 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO3) \
elmot 1:d0dfbce63a89 85 )
elmot 1:d0dfbce63a89 86 #else
elmot 1:d0dfbce63a89 87 #define IS_LL_COMP_INPUT_PLUS(__COMP_INSTANCE__, __INPUT_PLUS__) \
elmot 1:d0dfbce63a89 88 ( ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO1) \
elmot 1:d0dfbce63a89 89 || ((__INPUT_PLUS__) == LL_COMP_INPUT_PLUS_IO2) \
elmot 1:d0dfbce63a89 90 )
elmot 1:d0dfbce63a89 91 #endif
elmot 1:d0dfbce63a89 92
elmot 1:d0dfbce63a89 93 /* Note: On this STM32 serie, comparator input minus parameters are */
elmot 1:d0dfbce63a89 94 /* the same on all COMP instances. */
elmot 1:d0dfbce63a89 95 /* However, comparator instance kept as macro parameter for */
elmot 1:d0dfbce63a89 96 /* compatibility with other STM32 families. */
elmot 1:d0dfbce63a89 97 #if defined(COMP_CSR_INMESEL_1)
elmot 1:d0dfbce63a89 98 #define IS_LL_COMP_INPUT_MINUS(__COMP_INSTANCE__, __INPUT_MINUS__) \
elmot 1:d0dfbce63a89 99 ( ((__INPUT_MINUS__) == LL_COMP_INPUT_MINUS_1_4VREFINT) \
elmot 1:d0dfbce63a89 100 || ((__INPUT_MINUS__) == LL_COMP_INPUT_MINUS_1_2VREFINT) \
elmot 1:d0dfbce63a89 101 || ((__INPUT_MINUS__) == LL_COMP_INPUT_MINUS_3_4VREFINT) \
elmot 1:d0dfbce63a89 102 || ((__INPUT_MINUS__) == LL_COMP_INPUT_MINUS_VREFINT) \
elmot 1:d0dfbce63a89 103 || ((__INPUT_MINUS__) == LL_COMP_INPUT_MINUS_DAC1_CH1) \
elmot 1:d0dfbce63a89 104 || ((__INPUT_MINUS__) == LL_COMP_INPUT_MINUS_DAC1_CH2) \
elmot 1:d0dfbce63a89 105 || ((__INPUT_MINUS__) == LL_COMP_INPUT_MINUS_IO1) \
elmot 1:d0dfbce63a89 106 || ((__INPUT_MINUS__) == LL_COMP_INPUT_MINUS_IO2) \
elmot 1:d0dfbce63a89 107 || ((__INPUT_MINUS__) == LL_COMP_INPUT_MINUS_IO3) \
elmot 1:d0dfbce63a89 108 || ((__INPUT_MINUS__) == LL_COMP_INPUT_MINUS_IO4) \
elmot 1:d0dfbce63a89 109 || ((__INPUT_MINUS__) == LL_COMP_INPUT_MINUS_IO5) \
elmot 1:d0dfbce63a89 110 )
elmot 1:d0dfbce63a89 111 #else
elmot 1:d0dfbce63a89 112 #define IS_LL_COMP_INPUT_MINUS(__COMP_INSTANCE__, __INPUT_MINUS__) \
elmot 1:d0dfbce63a89 113 ( ((__INPUT_MINUS__) == LL_COMP_INPUT_MINUS_1_4VREFINT) \
elmot 1:d0dfbce63a89 114 || ((__INPUT_MINUS__) == LL_COMP_INPUT_MINUS_1_2VREFINT) \
elmot 1:d0dfbce63a89 115 || ((__INPUT_MINUS__) == LL_COMP_INPUT_MINUS_3_4VREFINT) \
elmot 1:d0dfbce63a89 116 || ((__INPUT_MINUS__) == LL_COMP_INPUT_MINUS_VREFINT) \
elmot 1:d0dfbce63a89 117 || ((__INPUT_MINUS__) == LL_COMP_INPUT_MINUS_DAC1_CH1) \
elmot 1:d0dfbce63a89 118 || ((__INPUT_MINUS__) == LL_COMP_INPUT_MINUS_DAC1_CH2) \
elmot 1:d0dfbce63a89 119 || ((__INPUT_MINUS__) == LL_COMP_INPUT_MINUS_IO1) \
elmot 1:d0dfbce63a89 120 || ((__INPUT_MINUS__) == LL_COMP_INPUT_MINUS_IO2) \
elmot 1:d0dfbce63a89 121 )
elmot 1:d0dfbce63a89 122 #endif
elmot 1:d0dfbce63a89 123
elmot 1:d0dfbce63a89 124 #define IS_LL_COMP_INPUT_HYSTERESIS(__INPUT_HYSTERESIS__) \
elmot 1:d0dfbce63a89 125 ( ((__INPUT_HYSTERESIS__) == LL_COMP_HYSTERESIS_NONE) \
elmot 1:d0dfbce63a89 126 || ((__INPUT_HYSTERESIS__) == LL_COMP_HYSTERESIS_LOW) \
elmot 1:d0dfbce63a89 127 || ((__INPUT_HYSTERESIS__) == LL_COMP_HYSTERESIS_MEDIUM) \
elmot 1:d0dfbce63a89 128 || ((__INPUT_HYSTERESIS__) == LL_COMP_HYSTERESIS_HIGH) \
elmot 1:d0dfbce63a89 129 )
elmot 1:d0dfbce63a89 130
elmot 1:d0dfbce63a89 131 #define IS_LL_COMP_OUTPUT_POLARITY(__POLARITY__) \
elmot 1:d0dfbce63a89 132 ( ((__POLARITY__) == LL_COMP_OUTPUTPOL_NONINVERTED) \
elmot 1:d0dfbce63a89 133 || ((__POLARITY__) == LL_COMP_OUTPUTPOL_INVERTED) \
elmot 1:d0dfbce63a89 134 )
elmot 1:d0dfbce63a89 135
elmot 1:d0dfbce63a89 136 #define IS_LL_COMP_OUTPUT_BLANKING_SOURCE(__OUTPUT_BLANKING_SOURCE__) \
elmot 1:d0dfbce63a89 137 ( ((__OUTPUT_BLANKING_SOURCE__) == LL_COMP_BLANKINGSRC_NONE) \
elmot 1:d0dfbce63a89 138 || ((__OUTPUT_BLANKING_SOURCE__) == LL_COMP_BLANKINGSRC_TIM1_OC5_COMP1) \
elmot 1:d0dfbce63a89 139 || ((__OUTPUT_BLANKING_SOURCE__) == LL_COMP_BLANKINGSRC_TIM2_OC3_COMP1) \
elmot 1:d0dfbce63a89 140 || ((__OUTPUT_BLANKING_SOURCE__) == LL_COMP_BLANKINGSRC_TIM3_OC3_COMP1) \
elmot 1:d0dfbce63a89 141 || ((__OUTPUT_BLANKING_SOURCE__) == LL_COMP_BLANKINGSRC_TIM3_OC4_COMP2) \
elmot 1:d0dfbce63a89 142 || ((__OUTPUT_BLANKING_SOURCE__) == LL_COMP_BLANKINGSRC_TIM8_OC5_COMP2) \
elmot 1:d0dfbce63a89 143 || ((__OUTPUT_BLANKING_SOURCE__) == LL_COMP_BLANKINGSRC_TIM15_OC1_COMP2) \
elmot 1:d0dfbce63a89 144 )
elmot 1:d0dfbce63a89 145
elmot 1:d0dfbce63a89 146 /**
elmot 1:d0dfbce63a89 147 * @}
elmot 1:d0dfbce63a89 148 */
elmot 1:d0dfbce63a89 149
elmot 1:d0dfbce63a89 150
elmot 1:d0dfbce63a89 151 /* Private function prototypes -----------------------------------------------*/
elmot 1:d0dfbce63a89 152
elmot 1:d0dfbce63a89 153 /* Exported functions --------------------------------------------------------*/
elmot 1:d0dfbce63a89 154 /** @addtogroup COMP_LL_Exported_Functions
elmot 1:d0dfbce63a89 155 * @{
elmot 1:d0dfbce63a89 156 */
elmot 1:d0dfbce63a89 157
elmot 1:d0dfbce63a89 158 /** @addtogroup COMP_LL_EF_Init
elmot 1:d0dfbce63a89 159 * @{
elmot 1:d0dfbce63a89 160 */
elmot 1:d0dfbce63a89 161
elmot 1:d0dfbce63a89 162 /**
elmot 1:d0dfbce63a89 163 * @brief De-initialize registers of the selected COMP instance
elmot 1:d0dfbce63a89 164 * to their default reset values.
elmot 1:d0dfbce63a89 165 * @note If comparator is locked, de-initialization by software is
elmot 1:d0dfbce63a89 166 * not possible.
elmot 1:d0dfbce63a89 167 * The only way to unlock the comparator is a device hardware reset.
elmot 1:d0dfbce63a89 168 * @param COMPx COMP instance
elmot 1:d0dfbce63a89 169 * @retval An ErrorStatus enumeration value:
elmot 1:d0dfbce63a89 170 * - SUCCESS: COMP registers are de-initialized
elmot 1:d0dfbce63a89 171 * - ERROR: COMP registers are not de-initialized
elmot 1:d0dfbce63a89 172 */
elmot 1:d0dfbce63a89 173 ErrorStatus LL_COMP_DeInit(COMP_TypeDef *COMPx)
elmot 1:d0dfbce63a89 174 {
elmot 1:d0dfbce63a89 175 ErrorStatus status = SUCCESS;
elmot 1:d0dfbce63a89 176
elmot 1:d0dfbce63a89 177 /* Check the parameters */
elmot 1:d0dfbce63a89 178 assert_param(IS_COMP_ALL_INSTANCE(COMPx));
elmot 1:d0dfbce63a89 179
elmot 1:d0dfbce63a89 180 /* Note: Hardware constraint (refer to description of this function): */
elmot 1:d0dfbce63a89 181 /* COMP instance must not be locked. */
elmot 1:d0dfbce63a89 182 if(LL_COMP_IsLocked(COMPx) == 0U)
elmot 1:d0dfbce63a89 183 {
elmot 1:d0dfbce63a89 184 LL_COMP_WriteReg(COMPx, CSR, 0x00000000U);
elmot 1:d0dfbce63a89 185
elmot 1:d0dfbce63a89 186 }
elmot 1:d0dfbce63a89 187 else
elmot 1:d0dfbce63a89 188 {
elmot 1:d0dfbce63a89 189 /* Comparator instance is locked: de-initialization by software is */
elmot 1:d0dfbce63a89 190 /* not possible. */
elmot 1:d0dfbce63a89 191 /* The only way to unlock the comparator is a device hardware reset. */
elmot 1:d0dfbce63a89 192 status = ERROR;
elmot 1:d0dfbce63a89 193 }
elmot 1:d0dfbce63a89 194
elmot 1:d0dfbce63a89 195 return status;
elmot 1:d0dfbce63a89 196 }
elmot 1:d0dfbce63a89 197
elmot 1:d0dfbce63a89 198 /**
elmot 1:d0dfbce63a89 199 * @brief Initialize some features of COMP instance.
elmot 1:d0dfbce63a89 200 * @note This function configures features of the selected COMP instance.
elmot 1:d0dfbce63a89 201 * Some features are also available at scope COMP common instance
elmot 1:d0dfbce63a89 202 * (common to several COMP instances).
elmot 1:d0dfbce63a89 203 * Refer to functions having argument "COMPxy_COMMON" as parameter.
elmot 1:d0dfbce63a89 204 * @param COMPx COMP instance
elmot 1:d0dfbce63a89 205 * @param COMP_InitStruct Pointer to a @ref LL_COMP_InitTypeDef structure
elmot 1:d0dfbce63a89 206 * @retval An ErrorStatus enumeration value:
elmot 1:d0dfbce63a89 207 * - SUCCESS: COMP registers are initialized
elmot 1:d0dfbce63a89 208 * - ERROR: COMP registers are not initialized
elmot 1:d0dfbce63a89 209 */
elmot 1:d0dfbce63a89 210 ErrorStatus LL_COMP_Init(COMP_TypeDef *COMPx, LL_COMP_InitTypeDef *COMP_InitStruct)
elmot 1:d0dfbce63a89 211 {
elmot 1:d0dfbce63a89 212 ErrorStatus status = SUCCESS;
elmot 1:d0dfbce63a89 213
elmot 1:d0dfbce63a89 214 /* Check the parameters */
elmot 1:d0dfbce63a89 215 assert_param(IS_COMP_ALL_INSTANCE(COMPx));
elmot 1:d0dfbce63a89 216 assert_param(IS_LL_COMP_POWER_MODE(COMP_InitStruct->PowerMode));
elmot 1:d0dfbce63a89 217 assert_param(IS_LL_COMP_INPUT_PLUS(COMPx, COMP_InitStruct->InputPlus));
elmot 1:d0dfbce63a89 218 assert_param(IS_LL_COMP_INPUT_MINUS(COMPx, COMP_InitStruct->InputMinus));
elmot 1:d0dfbce63a89 219 assert_param(IS_LL_COMP_INPUT_HYSTERESIS(COMP_InitStruct->InputHysteresis));
elmot 1:d0dfbce63a89 220 assert_param(IS_LL_COMP_OUTPUT_POLARITY(COMP_InitStruct->OutputPolarity));
elmot 1:d0dfbce63a89 221 assert_param(IS_LL_COMP_OUTPUT_BLANKING_SOURCE(COMP_InitStruct->OutputBlankingSource));
elmot 1:d0dfbce63a89 222
elmot 1:d0dfbce63a89 223 /* Note: Hardware constraint (refer to description of this function) */
elmot 1:d0dfbce63a89 224 /* COMP instance must not be locked. */
elmot 1:d0dfbce63a89 225 if(LL_COMP_IsLocked(COMPx) == 0U)
elmot 1:d0dfbce63a89 226 {
elmot 1:d0dfbce63a89 227 /* Configuration of comparator instance : */
elmot 1:d0dfbce63a89 228 /* - PowerMode */
elmot 1:d0dfbce63a89 229 /* - InputPlus */
elmot 1:d0dfbce63a89 230 /* - InputMinus */
elmot 1:d0dfbce63a89 231 /* - InputHysteresis */
elmot 1:d0dfbce63a89 232 /* - OutputPolarity */
elmot 1:d0dfbce63a89 233 /* - OutputBlankingSource */
elmot 1:d0dfbce63a89 234 #if defined(COMP_CSR_INMESEL_1)
elmot 1:d0dfbce63a89 235 MODIFY_REG(COMPx->CSR,
elmot 1:d0dfbce63a89 236 COMP_CSR_PWRMODE
elmot 1:d0dfbce63a89 237 | COMP_CSR_INPSEL
elmot 1:d0dfbce63a89 238 | COMP_CSR_SCALEN
elmot 1:d0dfbce63a89 239 | COMP_CSR_BRGEN
elmot 1:d0dfbce63a89 240 | COMP_CSR_INMESEL
elmot 1:d0dfbce63a89 241 | COMP_CSR_INMSEL
elmot 1:d0dfbce63a89 242 | COMP_CSR_HYST
elmot 1:d0dfbce63a89 243 | COMP_CSR_POLARITY
elmot 1:d0dfbce63a89 244 | COMP_CSR_BLANKING
elmot 1:d0dfbce63a89 245 ,
elmot 1:d0dfbce63a89 246 COMP_InitStruct->PowerMode
elmot 1:d0dfbce63a89 247 | COMP_InitStruct->InputPlus
elmot 1:d0dfbce63a89 248 | COMP_InitStruct->InputMinus
elmot 1:d0dfbce63a89 249 | COMP_InitStruct->InputHysteresis
elmot 1:d0dfbce63a89 250 | COMP_InitStruct->OutputPolarity
elmot 1:d0dfbce63a89 251 | COMP_InitStruct->OutputBlankingSource
elmot 1:d0dfbce63a89 252 );
elmot 1:d0dfbce63a89 253 #else
elmot 1:d0dfbce63a89 254 MODIFY_REG(COMPx->CSR,
elmot 1:d0dfbce63a89 255 COMP_CSR_PWRMODE
elmot 1:d0dfbce63a89 256 | COMP_CSR_INPSEL
elmot 1:d0dfbce63a89 257 | COMP_CSR_SCALEN
elmot 1:d0dfbce63a89 258 | COMP_CSR_BRGEN
elmot 1:d0dfbce63a89 259 | COMP_CSR_INMSEL
elmot 1:d0dfbce63a89 260 | COMP_CSR_HYST
elmot 1:d0dfbce63a89 261 | COMP_CSR_POLARITY
elmot 1:d0dfbce63a89 262 | COMP_CSR_BLANKING
elmot 1:d0dfbce63a89 263 ,
elmot 1:d0dfbce63a89 264 COMP_InitStruct->PowerMode
elmot 1:d0dfbce63a89 265 | COMP_InitStruct->InputPlus
elmot 1:d0dfbce63a89 266 | COMP_InitStruct->InputMinus
elmot 1:d0dfbce63a89 267 | COMP_InitStruct->InputHysteresis
elmot 1:d0dfbce63a89 268 | COMP_InitStruct->OutputPolarity
elmot 1:d0dfbce63a89 269 | COMP_InitStruct->OutputBlankingSource
elmot 1:d0dfbce63a89 270 );
elmot 1:d0dfbce63a89 271 #endif
elmot 1:d0dfbce63a89 272
elmot 1:d0dfbce63a89 273 }
elmot 1:d0dfbce63a89 274 else
elmot 1:d0dfbce63a89 275 {
elmot 1:d0dfbce63a89 276 /* Initialization error: COMP instance is locked. */
elmot 1:d0dfbce63a89 277 status = ERROR;
elmot 1:d0dfbce63a89 278 }
elmot 1:d0dfbce63a89 279
elmot 1:d0dfbce63a89 280 return status;
elmot 1:d0dfbce63a89 281 }
elmot 1:d0dfbce63a89 282
elmot 1:d0dfbce63a89 283 /**
elmot 1:d0dfbce63a89 284 * @brief Set each @ref LL_COMP_InitTypeDef field to default value.
elmot 1:d0dfbce63a89 285 * @param COMP_InitStruct: pointer to a @ref LL_COMP_InitTypeDef structure
elmot 1:d0dfbce63a89 286 * whose fields will be set to default values.
elmot 1:d0dfbce63a89 287 * @retval None
elmot 1:d0dfbce63a89 288 */
elmot 1:d0dfbce63a89 289 void LL_COMP_StructInit(LL_COMP_InitTypeDef *COMP_InitStruct)
elmot 1:d0dfbce63a89 290 {
elmot 1:d0dfbce63a89 291 /* Set COMP_InitStruct fields to default values */
elmot 1:d0dfbce63a89 292 COMP_InitStruct->PowerMode = LL_COMP_POWERMODE_ULTRALOWPOWER;
elmot 1:d0dfbce63a89 293 COMP_InitStruct->InputPlus = LL_COMP_INPUT_PLUS_IO1;
elmot 1:d0dfbce63a89 294 COMP_InitStruct->InputMinus = LL_COMP_INPUT_MINUS_VREFINT;
elmot 1:d0dfbce63a89 295 COMP_InitStruct->InputHysteresis = LL_COMP_HYSTERESIS_NONE;
elmot 1:d0dfbce63a89 296 COMP_InitStruct->OutputPolarity = LL_COMP_OUTPUTPOL_NONINVERTED;
elmot 1:d0dfbce63a89 297 COMP_InitStruct->OutputBlankingSource = LL_COMP_BLANKINGSRC_NONE;
elmot 1:d0dfbce63a89 298 }
elmot 1:d0dfbce63a89 299
elmot 1:d0dfbce63a89 300 /**
elmot 1:d0dfbce63a89 301 * @}
elmot 1:d0dfbce63a89 302 */
elmot 1:d0dfbce63a89 303
elmot 1:d0dfbce63a89 304 /**
elmot 1:d0dfbce63a89 305 * @}
elmot 1:d0dfbce63a89 306 */
elmot 1:d0dfbce63a89 307
elmot 1:d0dfbce63a89 308 /**
elmot 1:d0dfbce63a89 309 * @}
elmot 1:d0dfbce63a89 310 */
elmot 1:d0dfbce63a89 311
elmot 1:d0dfbce63a89 312 #endif /* COMP1 || COMP2 */
elmot 1:d0dfbce63a89 313
elmot 1:d0dfbce63a89 314 /**
elmot 1:d0dfbce63a89 315 * @}
elmot 1:d0dfbce63a89 316 */
elmot 1:d0dfbce63a89 317
elmot 1:d0dfbce63a89 318 #endif /* USE_FULL_LL_DRIVER */
elmot 1:d0dfbce63a89 319
elmot 1:d0dfbce63a89 320 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/