TUKS MCU Introductory course / TUKS-COURSE-THERMOMETER

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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers stm32l4xx_ll_comp.h Source File

stm32l4xx_ll_comp.h

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32l4xx_ll_comp.h
00004   * @author  MCD Application Team
00005   * @version V1.5.1
00006   * @date    31-May-2016
00007   * @brief   Header file of COMP LL module.
00008   ******************************************************************************
00009   * @attention
00010   *
00011   * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
00012   *
00013   * Redistribution and use in source and binary forms, with or without modification,
00014   * are permitted provided that the following conditions are met:
00015   *   1. Redistributions of source code must retain the above copyright notice,
00016   *      this list of conditions and the following disclaimer.
00017   *   2. Redistributions in binary form must reproduce the above copyright notice,
00018   *      this list of conditions and the following disclaimer in the documentation
00019   *      and/or other materials provided with the distribution.
00020   *   3. Neither the name of STMicroelectronics nor the names of its contributors
00021   *      may be used to endorse or promote products derived from this software
00022   *      without specific prior written permission.
00023   *
00024   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00025   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00026   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00027   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00028   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00029   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00030   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00031   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00032   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00033   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00034   *
00035   ******************************************************************************
00036   */
00037 
00038 /* Define to prevent recursive inclusion -------------------------------------*/
00039 #ifndef __STM32L4xx_LL_COMP_H
00040 #define __STM32L4xx_LL_COMP_H
00041 
00042 #ifdef __cplusplus
00043 extern "C" {
00044 #endif
00045 
00046 /* Includes ------------------------------------------------------------------*/
00047 #include "stm32l4xx.h"
00048 
00049 /** @addtogroup STM32L4xx_LL_Driver
00050   * @{
00051   */
00052 
00053 #if defined (COMP1) || defined (COMP2)
00054 
00055 /** @defgroup COMP_LL COMP
00056   * @{
00057   */
00058 
00059 /* Private types -------------------------------------------------------------*/
00060 /* Private variables ---------------------------------------------------------*/
00061 /* Private constants ---------------------------------------------------------*/
00062 /** @defgroup COMP_LL_Private_Constants COMP Private Constants
00063   * @{
00064   */
00065 
00066 /* COMP registers bits positions */
00067 #define LL_COMP_OUTPUT_LEVEL_BITOFFSET_POS ((uint32_t)30U) /* Value equivalent to POSITION_VAL(COMP_CSR_VALUE) */
00068 
00069 /**
00070   * @}
00071   */
00072 
00073 /* Private macros ------------------------------------------------------------*/
00074 /* Exported types ------------------------------------------------------------*/
00075 #if defined(USE_FULL_LL_DRIVER)
00076 /** @defgroup COMP_LL_ES_INIT COMP Exported Init structure
00077   * @{
00078   */
00079 
00080 /**
00081   * @brief  Structure definition of some features of COMP instance.
00082   */
00083 typedef struct
00084 {
00085   uint32_t PowerMode;                   /*!< Set comparator operating mode to adjust power and speed.
00086                                              This parameter can be a value of @ref COMP_LL_EC_POWERMODE
00087                                              
00088                                              This feature can be modified afterwards using unitary function @ref LL_COMP_SetPowerMode(). */
00089 
00090   uint32_t InputPlus;                   /*!< Set comparator input plus (non-inverting input).
00091                                              This parameter can be a value of @ref COMP_LL_EC_INPUT_PLUS
00092                                              
00093                                              This feature can be modified afterwards using unitary function @ref LL_COMP_SetInputPlus(). */
00094 
00095   uint32_t InputMinus;                  /*!< Set comparator input minus (inverting input).
00096                                              This parameter can be a value of @ref COMP_LL_EC_INPUT_MINUS
00097                                              
00098                                              This feature can be modified afterwards using unitary function @ref LL_COMP_SetInputMinus(). */
00099 
00100   uint32_t InputHysteresis;             /*!< Set comparator hysteresis mode of the input minus.
00101                                              This parameter can be a value of @ref COMP_LL_EC_INPUT_HYSTERESIS
00102                                              
00103                                              This feature can be modified afterwards using unitary function @ref LL_COMP_SetInputHysteresis(). */
00104 
00105   uint32_t OutputPolarity;              /*!< Set comparator output polarity.
00106                                              This parameter can be a value of @ref COMP_LL_EC_OUTPUT_POLARITY
00107                                              
00108                                              This feature can be modified afterwards using unitary function @ref LL_COMP_SetOutputPolarity(). */
00109 
00110   uint32_t OutputBlankingSource;        /*!< Set comparator blanking source.
00111                                              This parameter can be a value of @ref COMP_LL_EC_OUTPUT_BLANKING_SOURCE
00112                                              
00113                                              This feature can be modified afterwards using unitary function @ref LL_COMP_SetOutputBlankingSource(). */
00114 
00115 } LL_COMP_InitTypeDef;
00116 
00117 /**
00118   * @}
00119   */
00120 #endif /* USE_FULL_LL_DRIVER */
00121 
00122 /* Exported constants --------------------------------------------------------*/
00123 /** @defgroup COMP_LL_Exported_Constants COMP Exported Constants
00124   * @{
00125   */
00126 
00127 /** @defgroup COMP_LL_EC_COMMON_WINDOWMODE Comparator common modes - Window mode
00128   * @{
00129   */
00130 #define LL_COMP_WINDOWMODE_DISABLE                 ((uint32_t)0x00000000U) /*!< Window mode disable: Comparators 1 and 2 are independent */
00131 #define LL_COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON (COMP_CSR_WINMODE)      /*!< Window mode enable: Comparators instances pair COMP1 and COMP2 have their input plus connected together. The common input is COMP1 input plus (COMP2 input plus is no more accessible). */
00132 /**
00133   * @}
00134   */
00135 
00136 /** @defgroup COMP_LL_EC_POWERMODE Comparator modes - Power mode
00137   * @{
00138   */
00139 #define LL_COMP_POWERMODE_HIGHSPEED     ((uint32_t)0x00000000U)                   /*!< COMP power mode to high speed */
00140 #define LL_COMP_POWERMODE_MEDIUMSPEED   (COMP_CSR_PWRMODE_0)                      /*!< COMP power mode to medium speed */
00141 #define LL_COMP_POWERMODE_ULTRALOWPOWER (COMP_CSR_PWRMODE_1 | COMP_CSR_PWRMODE_0) /*!< COMP power mode to ultra-low power */
00142 /**
00143   * @}
00144   */
00145 
00146 /** @defgroup COMP_LL_EC_INPUT_PLUS Comparator inputs - Input plus (input non-inverting) selection
00147   * @{
00148   */
00149 #define LL_COMP_INPUT_PLUS_IO1          ((uint32_t)0x00000000U)                 /*!< Comparator input plus connected to IO1 (pin PC5 for COMP1, pin PB4 for COMP2) */
00150 #define LL_COMP_INPUT_PLUS_IO2          (COMP_CSR_INPSEL_0)                     /*!< Comparator input plus connected to IO2 (pin PB2 for COMP1, pin PB6 for COMP2) */
00151 #if defined(COMP_CSR_INPSEL_1)
00152 #define LL_COMP_INPUT_PLUS_IO3          (COMP_CSR_INPSEL_1 | COMP_CSR_INPSEL_0) /*!< Comparator input plus connected to IO3 (pin PA1 for COMP1, pin PA3 for COMP2) */
00153 #endif
00154 /**
00155   * @}
00156   */
00157 
00158 /** @defgroup COMP_LL_EC_INPUT_MINUS Comparator inputs - Input minus (input inverting) selection
00159   * @{
00160   */
00161 #define LL_COMP_INPUT_MINUS_1_4VREFINT  (                                                            COMP_CSR_SCALEN | COMP_CSR_BRGEN)        /*!< Comparator input minus connected to 1/4 VrefInt  */
00162 #define LL_COMP_INPUT_MINUS_1_2VREFINT  (                                        COMP_CSR_INMSEL_0 | COMP_CSR_SCALEN | COMP_CSR_BRGEN)        /*!< Comparator input minus connected to 1/2 VrefInt  */
00163 #define LL_COMP_INPUT_MINUS_3_4VREFINT  (                    COMP_CSR_INMSEL_1                     | COMP_CSR_SCALEN | COMP_CSR_BRGEN)        /*!< Comparator input minus connected to 3/4 VrefInt  */
00164 #define LL_COMP_INPUT_MINUS_VREFINT     (                    COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0 | COMP_CSR_SCALEN                 )        /*!< Comparator input minus connected to VrefInt */
00165 #define LL_COMP_INPUT_MINUS_DAC1_CH1    (COMP_CSR_INMSEL_2                                        )                                           /*!< Comparator input minus connected to DAC1 channel 1 (DAC_OUT1)  */
00166 #define LL_COMP_INPUT_MINUS_DAC1_CH2    (COMP_CSR_INMSEL_2                     | COMP_CSR_INMSEL_0)                                           /*!< Comparator input minus connected to DAC1 channel 2 (DAC_OUT2)  */
00167 #define LL_COMP_INPUT_MINUS_IO1         (COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_1                    )                                           /*!< Comparator input minus connected to IO1 (pin PB1 for COMP1, pin PB3 for COMP2) */
00168 #define LL_COMP_INPUT_MINUS_IO2         (COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0)                                           /*!< Comparator input minus connected to IO2 (pin PC4 for COMP1, pin PB7 for COMP2) */
00169 #if defined(COMP_CSR_INMESEL_1)
00170 #define LL_COMP_INPUT_MINUS_IO3         (                     COMP_CSR_INMESEL_0 | COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0) /*!< Comparator input minus connected to IO3 (pin PA0 for COMP1, pin PA2 for COMP2) */
00171 #define LL_COMP_INPUT_MINUS_IO4         (COMP_CSR_INMESEL_1                      | COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0) /*!< Comparator input minus connected to IO4 (pin PA4 for COMP1, pin PA4 for COMP2) */
00172 #define LL_COMP_INPUT_MINUS_IO5         (COMP_CSR_INMESEL_1 | COMP_CSR_INMESEL_0 | COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0) /*!< Comparator input minus connected to IO5 (pin PA5 for COMP1, pin PA5 for COMP2) */
00173 #endif
00174 /**
00175   * @}
00176   */
00177 
00178 /** @defgroup COMP_LL_EC_INPUT_LEGACY Comparator inputs legacy literals name
00179   * @{
00180   */
00181 #define LL_COMP_WINDOWMODE_ENABLE         LL_COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON
00182 
00183 #define LL_COMP_INVERTINGINPUT_1_4VREFINT LL_COMP_INPUT_MINUS_1_4VREFINT
00184 #define LL_COMP_INVERTINGINPUT_1_2VREFINT LL_COMP_INPUT_MINUS_1_2VREFINT
00185 #define LL_COMP_INVERTINGINPUT_3_4VREFINT LL_COMP_INPUT_MINUS_3_4VREFINT
00186 #define LL_COMP_INVERTINGINPUT_VREFINT    LL_COMP_INPUT_MINUS_VREFINT
00187 #define LL_COMP_INVERTINGINPUT_DAC1       LL_COMP_INPUT_MINUS_DAC1_CH1
00188 #define LL_COMP_INVERTINGINPUT_DAC2       LL_COMP_INPUT_MINUS_DAC1_CH2
00189 #define LL_COMP_INVERTINGINPUT_IO1        LL_COMP_INPUT_MINUS_IO1
00190 #define LL_COMP_INVERTINGINPUT_IO2        LL_COMP_INPUT_MINUS_IO2
00191 #if defined(COMP_CSR_INMESEL_1)
00192 #define LL_COMP_INVERTINGINPUT_IO3        LL_COMP_INPUT_MINUS_IO3
00193 #define LL_COMP_INVERTINGINPUT_IO4        LL_COMP_INPUT_MINUS_IO4
00194 #define LL_COMP_INVERTINGINPUT_IO5        LL_COMP_INPUT_MINUS_IO5
00195 #endif
00196 
00197 #define LL_COMP_NONINVERTINGINPUT_IO1     LL_COMP_INPUT_PLUS_IO1
00198 #define LL_COMP_NONINVERTINGINPUT_IO2     LL_COMP_INPUT_PLUS_IO2
00199 #if defined(COMP_CSR_INPSEL_1)
00200 #define LL_COMP_NONINVERTINGINPUT_IO3     LL_COMP_INPUT_PLUS_IO3
00201 #endif
00202 /**
00203   * @}
00204   */
00205 
00206 /** @defgroup COMP_LL_EC_INPUT_HYSTERESIS Comparator input - Hysteresis
00207   * @{
00208   */
00209 #define LL_COMP_HYSTERESIS_NONE         ((uint32_t)0x00000000U)             /*!< No hysteresis */
00210 #define LL_COMP_HYSTERESIS_LOW          (                  COMP_CSR_HYST_0) /*!< Hysteresis level low */
00211 #define LL_COMP_HYSTERESIS_MEDIUM       (COMP_CSR_HYST_1                  ) /*!< Hysteresis level medium */
00212 #define LL_COMP_HYSTERESIS_HIGH         (COMP_CSR_HYST_1 | COMP_CSR_HYST_0) /*!< Hysteresis level high */
00213 /**
00214   * @}
00215   */
00216 
00217 /** @defgroup COMP_LL_EC_OUTPUT_POLARITY Comparator output - Output polarity
00218   * @{
00219   */
00220 #define LL_COMP_OUTPUTPOL_NONINVERTED   ((uint32_t)0x00000000U) /*!< COMP output polarity is not inverted: comparator output is high when the plus (non-inverting) input is at a higher voltage than the minus (inverting) input */
00221 #define LL_COMP_OUTPUTPOL_INVERTED      (COMP_CSR_POLARITY)     /*!< COMP output polarity is inverted: comparator output is low when the plus (non-inverting) input is at a lower voltage than the minus (inverting) input */
00222 /**
00223   * @}
00224   */
00225 
00226 /** @defgroup COMP_LL_EC_OUTPUT_BLANKING_SOURCE Comparator output - Blanking source
00227   * @{
00228   */
00229 #define LL_COMP_BLANKINGSRC_NONE        ((uint32_t)0x00000000U) /*!<Comparator output without blanking */
00230 #define LL_COMP_BLANKINGSRC_TIM1_OC5_COMP1  (COMP_CSR_BLANKING_0)   /*!< Comparator output blanking source TIM1 OC5 (specific to COMP instance: COMP1) */
00231 #define LL_COMP_BLANKINGSRC_TIM2_OC3_COMP1  (COMP_CSR_BLANKING_1)   /*!< Comparator output blanking source TIM2 OC3 (specific to COMP instance: COMP1) */
00232 #define LL_COMP_BLANKINGSRC_TIM3_OC3_COMP1  (COMP_CSR_BLANKING_2)   /*!< Comparator output blanking source TIM3 OC3 (specific to COMP instance: COMP1) */
00233 #define LL_COMP_BLANKINGSRC_TIM3_OC4_COMP2  (COMP_CSR_BLANKING_0)   /*!< Comparator output blanking source TIM3 OC4 (specific to COMP instance: COMP2) */
00234 #define LL_COMP_BLANKINGSRC_TIM8_OC5_COMP2  (COMP_CSR_BLANKING_1)   /*!< Comparator output blanking source TIM8 OC5 (specific to COMP instance: COMP2) */
00235 #define LL_COMP_BLANKINGSRC_TIM15_OC1_COMP2 (COMP_CSR_BLANKING_2)   /*!< Comparator output blanking source TIM15 OC1 (specific to COMP instance: COMP2) */
00236 /**
00237   * @}
00238   */
00239 
00240 /** @defgroup COMP_LL_EC_OUTPUT_BLANKING_SOURCE_LEGACY Comparator output blanking source legacy literals name
00241   * @{
00242   */
00243 #define LL_COMP_BLANKINGSRC_TIM1_OC5    (LL_COMP_BLANKINGSRC_TIM1_OC5_COMP1)
00244 #define LL_COMP_BLANKINGSRC_TIM2_OC3    (LL_COMP_BLANKINGSRC_TIM2_OC3_COMP1)
00245 #define LL_COMP_BLANKINGSRC_TIM3_OC3    (LL_COMP_BLANKINGSRC_TIM3_OC3_COMP1)
00246 
00247 #define LL_COMP_BLANKINGSRC_TIM3_OC4    (LL_COMP_BLANKINGSRC_TIM3_OC4_COMP2)
00248 #define LL_COMP_BLANKINGSRC_TIM8_OC5    (LL_COMP_BLANKINGSRC_TIM8_OC5_COMP2)
00249 #define LL_COMP_BLANKINGSRC_TIM15_OC1   (LL_COMP_BLANKINGSRC_TIM15_OC1_COMP2)
00250 /**
00251   * @}
00252   */
00253 
00254 /** @defgroup COMP_LL_EC_OUTPUT_LEVEL Comparator output - Output level
00255   * @{
00256   */
00257 #define LL_COMP_OUTPUT_LEVEL_LOW        ((uint32_t)0x00000000U) /*!< Comparator output level low (if the polarity is not inverted, otherwise to be complemented) */
00258 #define LL_COMP_OUTPUT_LEVEL_HIGH       ((uint32_t)0x00000001U) /*!< Comparator output level high (if the polarity is not inverted, otherwise to be complemented) */
00259 /**
00260   * @}
00261   */
00262 
00263 /** @defgroup COMP_LL_EC_HW_DELAYS  Definitions of COMP hardware constraints delays
00264   * @note   Only COMP IP HW delays are defined in COMP LL driver driver,
00265   *         not timeout values.
00266   *         For details on delays values, refer to descriptions in source code
00267   *         above each literal definition.
00268   * @{
00269   */
00270 
00271 /* Delay for comparator startup time.                                         */
00272 /* Note: Delay required to reach propagation delay specification.             */
00273 /* Literal set to maximum value (refer to device datasheet,                   */
00274 /* parameter "tSTART").                                                       */
00275 /* Unit: us                                                                   */
00276 #define LL_COMP_DELAY_STARTUP_US          ((uint32_t) 80U)  /*!< Delay for COMP startup time */
00277 
00278 /* Delay for comparator voltage scaler stabilization time.                    */
00279 /* Note: Voltage scaler is used when selecting comparator input               */
00280 /*       based on VrefInt: VrefInt or subdivision of VrefInt.                 */
00281 /* Literal set to maximum value (refer to device datasheet,                   */
00282 /* parameter "tSTART_SCALER").                                                */
00283 /* Unit: us                                                                   */
00284 #define LL_COMP_DELAY_VOLTAGE_SCALER_STAB_US ((uint32_t) 200U)  /*!< Delay for COMP voltage scaler stabilization time */
00285 
00286 /**
00287   * @}
00288   */
00289 
00290 /**
00291   * @}
00292   */
00293 
00294 /* Exported macro ------------------------------------------------------------*/
00295 /** @defgroup COMP_LL_Exported_Macros COMP Exported Macros
00296   * @{
00297   */
00298 /** @defgroup COMP_LL_EM_WRITE_READ Common write and read registers macro
00299   * @{
00300   */
00301 
00302 /**
00303   * @brief  Write a value in COMP register
00304   * @param  __INSTANCE__ comparator instance
00305   * @param  __REG__ Register to be written
00306   * @param  __VALUE__ Value to be written in the register
00307   * @retval None
00308   */
00309 #define LL_COMP_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
00310 
00311 /**
00312   * @brief  Read a value in COMP register
00313   * @param  __INSTANCE__ comparator instance
00314   * @param  __REG__ Register to be read
00315   * @retval Register value
00316   */
00317 #define LL_COMP_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
00318 /**
00319   * @}
00320   */
00321 
00322 /** @defgroup COMP_LL_EM_HELPER_MACRO COMP helper macro
00323   * @{
00324   */
00325 
00326 /**
00327   * @brief  Helper macro to select the COMP common instance
00328   *         to which is belonging the selected COMP instance.
00329   * @note   COMP common register instance can be used to
00330   *         set parameters common to several COMP instances.
00331   *         Refer to functions having argument "COMPxy_COMMON" as parameter.
00332   * @param  __COMPx__ COMP instance
00333   * @retval COMP common instance or value "0" if there is no COMP common instance.
00334   */
00335 #define __LL_COMP_COMMON_INSTANCE(__COMPx__)                                   \
00336   (COMP12_COMMON)
00337 
00338 /**
00339   * @}
00340   */
00341 
00342 /**
00343   * @}
00344   */
00345 
00346 /* Exported functions --------------------------------------------------------*/
00347 /** @defgroup COMP_LL_Exported_Functions COMP Exported Functions
00348   * @{
00349   */
00350 
00351 /** @defgroup COMP_LL_EF_Configuration_comparator_common Configuration of COMP hierarchical scope: common to several COMP instances
00352   * @{
00353   */
00354 
00355 /**
00356   * @brief  Set window mode of a pair of comparators instances
00357   *         (2 consecutive COMP instances odd and even COMP<x> and COMP<x+1>).
00358   * @rmtoll CSR      WINMODE        LL_COMP_SetCommonWindowMode
00359   * @param  COMPxy_COMMON Comparator common instance
00360   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_COMP_COMMON_INSTANCE() )
00361   * @param  WindowMode This parameter can be one of the following values:
00362   *         @arg @ref LL_COMP_WINDOWMODE_DISABLE
00363   *         @arg @ref LL_COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON
00364   * @retval None
00365   */
00366 __STATIC_INLINE void LL_COMP_SetCommonWindowMode(COMP_Common_TypeDef *COMPxy_COMMON, uint32_t WindowMode)
00367 {
00368   /* Note: On this STM32 serie, window mode can be set only                   */
00369   /*       from COMP instance: COMP2.                                         */
00370   MODIFY_REG(COMPxy_COMMON->CSR, COMP_CSR_WINMODE, WindowMode);
00371 }
00372 
00373 /**
00374   * @brief  Get window mode of a pair of comparators instances
00375   *         (2 consecutive COMP instances odd and even COMP<x> and COMP<x+1>).
00376   * @rmtoll CSR      WINMODE        LL_COMP_GetCommonWindowMode
00377   * @param  COMPxy_COMMON Comparator common instance
00378   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_COMP_COMMON_INSTANCE() )
00379   * @retval Returned value can be one of the following values:
00380   *         @arg @ref LL_COMP_WINDOWMODE_DISABLE
00381   *         @arg @ref LL_COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON
00382   */
00383 __STATIC_INLINE uint32_t LL_COMP_GetCommonWindowMode(COMP_Common_TypeDef *COMPxy_COMMON)
00384 {
00385   return (uint32_t)(READ_BIT(COMPxy_COMMON->CSR, COMP_CSR_WINMODE));
00386 }
00387 
00388 /**
00389   * @}
00390   */
00391 
00392 /** @defgroup COMP_LL_EF_Configuration_comparator_modes Configuration of comparator modes
00393   * @{
00394   */
00395 
00396 /**
00397   * @brief  Set comparator instance operating mode to adjust power and speed.
00398   * @rmtoll CSR      PWRMODE        LL_COMP_SetPowerMode
00399   * @param  COMPx Comparator instance
00400   * @param  PowerMode This parameter can be one of the following values:
00401   *         @arg @ref LL_COMP_POWERMODE_HIGHSPEED
00402   *         @arg @ref LL_COMP_POWERMODE_MEDIUMSPEED
00403   *         @arg @ref LL_COMP_POWERMODE_ULTRALOWPOWER
00404   * @retval None
00405   */
00406 __STATIC_INLINE void LL_COMP_SetPowerMode(COMP_TypeDef *COMPx, uint32_t PowerMode)
00407 {
00408   MODIFY_REG(COMPx->CSR, COMP_CSR_PWRMODE, PowerMode);
00409 }
00410 
00411 /**
00412   * @brief  Get comparator instance operating mode to adjust power and speed.
00413   * @rmtoll CSR      PWRMODE        LL_COMP_GetPowerMode
00414   * @param  COMPx Comparator instance
00415   * @retval Returned value can be one of the following values:
00416   *         @arg @ref LL_COMP_POWERMODE_HIGHSPEED
00417   *         @arg @ref LL_COMP_POWERMODE_MEDIUMSPEED
00418   *         @arg @ref LL_COMP_POWERMODE_ULTRALOWPOWER
00419   */
00420 __STATIC_INLINE uint32_t LL_COMP_GetPowerMode(COMP_TypeDef *COMPx)
00421 {
00422   return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_PWRMODE));
00423 }
00424 
00425 /**
00426   * @}
00427   */
00428 
00429 /** @defgroup COMP_LL_EF_Configuration_comparator_inputs Configuration of comparator inputs
00430   * @{
00431   */
00432 
00433 /**
00434   * @brief  Set comparator inputs minus (inverting) and plus (non-inverting).
00435   * @note   In case of comparator input selected to be connected to IO:
00436   *         GPIO pins are specific to each comparator instance.
00437   *         Refer to description of parameters or to reference manual.
00438   * @note   On this STM32 serie, scaler bridge is configurable:
00439   *         to optimize power consumption, this function enables the
00440   *         voltage scaler bridge only when required
00441   *         (when selecting comparator input based on VrefInt: VrefInt or
00442   *         subdivision of VrefInt).
00443   *         - For scaler bridge power consumption values, 
00444   *           refer to device datasheet, parameter "IDDA(SCALER)".
00445   *         - Voltage scaler requires a delay for voltage stabilization.
00446   *           Refer to device datasheet, parameter "tSTART_SCALER".
00447   *         - Scaler bridge is common for all comparator instances,
00448   *           therefore if at least one of the comparator instance
00449   *           is requiring the scaler bridge, it remains enabled.
00450   * @rmtoll CSR      INMSEL         LL_COMP_ConfigInputs\n
00451   *         CSR      INPSEL         LL_COMP_ConfigInputs\n
00452   *         CSR      BRGEN          LL_COMP_ConfigInputs\n
00453   *         CSR      SCALEN         LL_COMP_ConfigInputs
00454   * @param  COMPx Comparator instance
00455   * @param  InputMinus This parameter can be one of the following values:
00456   *         @arg @ref LL_COMP_INPUT_MINUS_1_4VREFINT
00457   *         @arg @ref LL_COMP_INPUT_MINUS_1_2VREFINT
00458   *         @arg @ref LL_COMP_INPUT_MINUS_3_4VREFINT
00459   *         @arg @ref LL_COMP_INPUT_MINUS_VREFINT
00460   *         @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH1
00461   *         @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH2
00462   *         @arg @ref LL_COMP_INPUT_MINUS_IO1
00463   *         @arg @ref LL_COMP_INPUT_MINUS_IO2
00464   *         @arg @ref LL_COMP_INPUT_MINUS_IO3 (*)
00465   *         @arg @ref LL_COMP_INPUT_MINUS_IO4 (*)
00466   *         @arg @ref LL_COMP_INPUT_MINUS_IO5 (*)
00467   *         
00468   *         (*) Parameter not available on all devices.
00469   * @param  InputPlus This parameter can be one of the following values:
00470   *         @arg @ref LL_COMP_INPUT_PLUS_IO1
00471   *         @arg @ref LL_COMP_INPUT_PLUS_IO2
00472   *         @arg @ref LL_COMP_INPUT_PLUS_IO3 (*)
00473   *         
00474   *         (*) Parameter not available on all devices.
00475   * @retval None
00476   */
00477 __STATIC_INLINE void LL_COMP_ConfigInputs(COMP_TypeDef *COMPx, uint32_t InputMinus, uint32_t InputPlus)
00478 {
00479 #if defined(COMP_CSR_INMESEL_1)
00480   MODIFY_REG(COMPx->CSR,
00481              COMP_CSR_INMESEL | COMP_CSR_INMSEL | COMP_CSR_INPSEL | COMP_CSR_SCALEN | COMP_CSR_BRGEN,
00482              InputMinus | InputPlus);
00483 #else
00484   MODIFY_REG(COMPx->CSR,
00485              COMP_CSR_INMSEL | COMP_CSR_INPSEL | COMP_CSR_SCALEN | COMP_CSR_BRGEN,
00486              InputMinus | InputPlus);
00487 #endif
00488 }
00489 
00490 /**
00491   * @brief  Set comparator input plus (non-inverting).
00492   * @note   In case of comparator input selected to be connected to IO:
00493   *         GPIO pins are specific to each comparator instance.
00494   *         Refer to description of parameters or to reference manual.
00495   * @rmtoll CSR      INPSEL         LL_COMP_SetInputPlus
00496   * @param  COMPx Comparator instance
00497   * @param  InputPlus This parameter can be one of the following values:
00498   *         @arg @ref LL_COMP_INPUT_PLUS_IO1
00499   *         @arg @ref LL_COMP_INPUT_PLUS_IO2
00500   *         @arg @ref LL_COMP_INPUT_PLUS_IO3 (*)
00501   *         
00502   *         (*) Parameter not available on all devices.
00503   * @retval None
00504   */
00505 __STATIC_INLINE void LL_COMP_SetInputPlus(COMP_TypeDef *COMPx, uint32_t InputPlus)
00506 {
00507   MODIFY_REG(COMPx->CSR, COMP_CSR_INPSEL, InputPlus);
00508 }
00509 
00510 /**
00511   * @brief  Get comparator input plus (non-inverting).
00512   * @note   In case of comparator input selected to be connected to IO:
00513   *         GPIO pins are specific to each comparator instance.
00514   *         Refer to description of parameters or to reference manual.
00515   * @rmtoll CSR      INPSEL         LL_COMP_GetInputPlus
00516   * @param  COMPx Comparator instance
00517   * @retval Returned value can be one of the following values:
00518   *         @arg @ref LL_COMP_INPUT_PLUS_IO1
00519   *         @arg @ref LL_COMP_INPUT_PLUS_IO2
00520   *         @arg @ref LL_COMP_INPUT_PLUS_IO3 (*)
00521   *         
00522   *         (*) Parameter not available on all devices.
00523   */
00524 __STATIC_INLINE uint32_t LL_COMP_GetInputPlus(COMP_TypeDef *COMPx)
00525 {
00526   return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_INPSEL));
00527 }
00528 
00529 /**
00530   * @brief  Set comparator input minus (inverting).
00531   * @note   In case of comparator input selected to be connected to IO:
00532   *         GPIO pins are specific to each comparator instance.
00533   *         Refer to description of parameters or to reference manual.
00534   * @note   On this STM32 serie, scaler bridge is configurable:
00535   *         to optimize power consumption, this function enables the
00536   *         voltage scaler bridge only when required
00537   *         (when selecting comparator input based on VrefInt: VrefInt or
00538   *         subdivision of VrefInt).
00539   *         - For scaler bridge power consumption values, 
00540   *           refer to device datasheet, parameter "IDDA(SCALER)".
00541   *         - Voltage scaler requires a delay for voltage stabilization.
00542   *           Refer to device datasheet, parameter "tSTART_SCALER".
00543   *         - Scaler bridge is common for all comparator instances,
00544   *           therefore if at least one of the comparator instance
00545   *           is requiring the scaler bridge, it remains enabled.
00546   * @rmtoll CSR      INMSEL         LL_COMP_SetInputMinus\n
00547   *         CSR      BRGEN          LL_COMP_SetInputMinus\n
00548   *         CSR      SCALEN         LL_COMP_SetInputMinus
00549   * @param  COMPx Comparator instance
00550   * @param  InputMinus This parameter can be one of the following values:
00551   *         @arg @ref LL_COMP_INPUT_MINUS_1_4VREFINT
00552   *         @arg @ref LL_COMP_INPUT_MINUS_1_2VREFINT
00553   *         @arg @ref LL_COMP_INPUT_MINUS_3_4VREFINT
00554   *         @arg @ref LL_COMP_INPUT_MINUS_VREFINT
00555   *         @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH1
00556   *         @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH2
00557   *         @arg @ref LL_COMP_INPUT_MINUS_IO1
00558   *         @arg @ref LL_COMP_INPUT_MINUS_IO2
00559   *         @arg @ref LL_COMP_INPUT_MINUS_IO3 (*)
00560   *         @arg @ref LL_COMP_INPUT_MINUS_IO4 (*)
00561   *         @arg @ref LL_COMP_INPUT_MINUS_IO5 (*)
00562   *         
00563   *         (*) Parameter not available on all devices.
00564   * @retval None
00565   */
00566 __STATIC_INLINE void LL_COMP_SetInputMinus(COMP_TypeDef *COMPx, uint32_t InputMinus)
00567 {
00568 #if defined(COMP_CSR_INMESEL_1)
00569   MODIFY_REG(COMPx->CSR, COMP_CSR_INMESEL | COMP_CSR_INMSEL | COMP_CSR_SCALEN | COMP_CSR_BRGEN, InputMinus);
00570 #else
00571   MODIFY_REG(COMPx->CSR, COMP_CSR_INMSEL | COMP_CSR_SCALEN | COMP_CSR_BRGEN, InputMinus);
00572 #endif
00573 }
00574 
00575 /**
00576   * @brief  Get comparator input minus (inverting).
00577   * @note   In case of comparator input selected to be connected to IO:
00578   *         GPIO pins are specific to each comparator instance.
00579   *         Refer to description of parameters or to reference manual.
00580   * @rmtoll CSR      INMSEL         LL_COMP_GetInputMinus\n
00581   *         CSR      BRGEN          LL_COMP_GetInputMinus\n
00582   *         CSR      SCALEN         LL_COMP_GetInputMinus
00583   * @param  COMPx Comparator instance
00584   * @retval Returned value can be one of the following values:
00585   *         @arg @ref LL_COMP_INPUT_MINUS_1_4VREFINT
00586   *         @arg @ref LL_COMP_INPUT_MINUS_1_2VREFINT
00587   *         @arg @ref LL_COMP_INPUT_MINUS_3_4VREFINT
00588   *         @arg @ref LL_COMP_INPUT_MINUS_VREFINT
00589   *         @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH1
00590   *         @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH2
00591   *         @arg @ref LL_COMP_INPUT_MINUS_IO1
00592   *         @arg @ref LL_COMP_INPUT_MINUS_IO2
00593   *         @arg @ref LL_COMP_INPUT_MINUS_IO3 (*)
00594   *         @arg @ref LL_COMP_INPUT_MINUS_IO4 (*)
00595   *         @arg @ref LL_COMP_INPUT_MINUS_IO5 (*)
00596   *         
00597   *         (*) Parameter not available on all devices.
00598   */
00599 __STATIC_INLINE uint32_t LL_COMP_GetInputMinus(COMP_TypeDef *COMPx)
00600 {
00601 #if defined(COMP_CSR_INMESEL_1)
00602   return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_INMESEL | COMP_CSR_INMSEL | COMP_CSR_SCALEN | COMP_CSR_BRGEN));
00603 #else
00604   return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_INMSEL | COMP_CSR_SCALEN | COMP_CSR_BRGEN));
00605 #endif
00606 }
00607 
00608 /**
00609   * @brief  Set comparator instance hysteresis mode of the input minus (inverting input).
00610   * @rmtoll CSR      HYST           LL_COMP_SetInputHysteresis
00611   * @param  COMPx Comparator instance
00612   * @param  InputHysteresis This parameter can be one of the following values:
00613   *         @arg @ref LL_COMP_HYSTERESIS_NONE
00614   *         @arg @ref LL_COMP_HYSTERESIS_LOW
00615   *         @arg @ref LL_COMP_HYSTERESIS_MEDIUM
00616   *         @arg @ref LL_COMP_HYSTERESIS_HIGH
00617   * @retval None
00618   */
00619 __STATIC_INLINE void LL_COMP_SetInputHysteresis(COMP_TypeDef *COMPx, uint32_t InputHysteresis)
00620 {
00621   MODIFY_REG(COMPx->CSR, COMP_CSR_HYST, InputHysteresis);
00622 }
00623 
00624 /**
00625   * @brief  Get comparator instance hysteresis mode of the minus (inverting) input.
00626   * @rmtoll CSR      HYST           LL_COMP_GetInputHysteresis
00627   * @param  COMPx Comparator instance
00628   * @retval Returned value can be one of the following values:
00629   *         @arg @ref LL_COMP_HYSTERESIS_NONE
00630   *         @arg @ref LL_COMP_HYSTERESIS_LOW
00631   *         @arg @ref LL_COMP_HYSTERESIS_MEDIUM
00632   *         @arg @ref LL_COMP_HYSTERESIS_HIGH
00633   */
00634 __STATIC_INLINE uint32_t LL_COMP_GetInputHysteresis(COMP_TypeDef *COMPx)
00635 {
00636   return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_HYST));
00637 }
00638 
00639 /**
00640   * @}
00641   */
00642 
00643 /** @defgroup COMP_LL_EF_Configuration_comparator_output Configuration of comparator output
00644   * @{
00645   */
00646 
00647 /**
00648   * @brief  Set comparator instance output polarity.
00649   * @rmtoll CSR      POLARITY       LL_COMP_SetOutputPolarity
00650   * @param  COMPx Comparator instance
00651   * @param  OutputPolarity This parameter can be one of the following values:
00652   *         @arg @ref LL_COMP_OUTPUTPOL_NONINVERTED
00653   *         @arg @ref LL_COMP_OUTPUTPOL_INVERTED
00654   * @retval None
00655   */
00656 __STATIC_INLINE void LL_COMP_SetOutputPolarity(COMP_TypeDef *COMPx, uint32_t OutputPolarity)
00657 {
00658   MODIFY_REG(COMPx->CSR, COMP_CSR_POLARITY, OutputPolarity);
00659 }
00660 
00661 /**
00662   * @brief  Get comparator instance output polarity.
00663   * @rmtoll CSR      POLARITY       LL_COMP_GetOutputPolarity
00664   * @param  COMPx Comparator instance
00665   * @retval Returned value can be one of the following values:
00666   *         @arg @ref LL_COMP_OUTPUTPOL_NONINVERTED
00667   *         @arg @ref LL_COMP_OUTPUTPOL_INVERTED
00668   */
00669 __STATIC_INLINE uint32_t LL_COMP_GetOutputPolarity(COMP_TypeDef *COMPx)
00670 {
00671   return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_POLARITY));
00672 }
00673 
00674 /**
00675   * @brief  Set comparator instance blanking source.
00676   * @note   Blanking source may be specific to each comparator instance.
00677   *         Refer to description of parameters or to reference manual.
00678   * @note   Availability of parameters of blanking source from timer
00679   *         depends on timers availability on the selected device.
00680   * @rmtoll CSR      BLANKING       LL_COMP_SetOutputBlankingSource
00681   * @param  COMPx Comparator instance
00682   * @param  BlankingSource This parameter can be one of the following values:
00683   *         @arg @ref LL_COMP_BLANKINGSRC_NONE
00684   *         @arg @ref LL_COMP_BLANKINGSRC_TIM1_OC5_COMP1  (1)(2)
00685   *         @arg @ref LL_COMP_BLANKINGSRC_TIM2_OC3_COMP1  (1)(2)
00686   *         @arg @ref LL_COMP_BLANKINGSRC_TIM3_OC3_COMP1  (1)(2)
00687   *         @arg @ref LL_COMP_BLANKINGSRC_TIM3_OC4_COMP2  (1)(3)
00688   *         @arg @ref LL_COMP_BLANKINGSRC_TIM8_OC5_COMP2  (1)(3)
00689   *         @arg @ref LL_COMP_BLANKINGSRC_TIM15_OC1_COMP2 (1)(3)
00690   *         
00691   *         (1) Parameter availability depending on timer availability
00692   *             on the selected device.
00693   *         (2) On STM32L4, parameter available only on comparator instance: COMP1.
00694   *         (3) On STM32L4, parameter available only on comparator instance: COMP2.
00695   * @retval None
00696   */
00697 __STATIC_INLINE void LL_COMP_SetOutputBlankingSource(COMP_TypeDef *COMPx, uint32_t BlankingSource)
00698 {
00699   MODIFY_REG(COMPx->CSR, COMP_CSR_BLANKING, BlankingSource);
00700 }
00701 
00702 /**
00703   * @brief  Get comparator instance blanking source.
00704   * @note   Availability of parameters of blanking source from timer
00705   *         depends on timers availability on the selected device.
00706   * @note   Blanking source may be specific to each comparator instance.
00707   *         Refer to description of parameters or to reference manual.
00708   * @rmtoll CSR      BLANKING       LL_COMP_GetOutputBlankingSource
00709   * @param  COMPx Comparator instance
00710   * @retval Returned value can be one of the following values:
00711   *         @arg @ref LL_COMP_BLANKINGSRC_NONE
00712   *         @arg @ref LL_COMP_BLANKINGSRC_TIM1_OC5_COMP1  (1)(2)
00713   *         @arg @ref LL_COMP_BLANKINGSRC_TIM2_OC3_COMP1  (1)(2)
00714   *         @arg @ref LL_COMP_BLANKINGSRC_TIM3_OC3_COMP1  (1)(2)
00715   *         @arg @ref LL_COMP_BLANKINGSRC_TIM3_OC4_COMP2  (1)(3)
00716   *         @arg @ref LL_COMP_BLANKINGSRC_TIM8_OC5_COMP2  (1)(3)
00717   *         @arg @ref LL_COMP_BLANKINGSRC_TIM15_OC1_COMP2 (1)(3)
00718   *         
00719   *         (1) Parameter availability depending on timer availability
00720   *             on the selected device.
00721   *         (2) On STM32L4, parameter available only on comparator instance: COMP1.
00722   *         (3) On STM32L4, parameter available only on comparator instance: COMP2.
00723   */
00724 __STATIC_INLINE uint32_t LL_COMP_GetOutputBlankingSource(COMP_TypeDef *COMPx)
00725 {
00726   return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_BLANKING));
00727 }
00728 
00729 /**
00730   * @}
00731   */
00732 
00733 /** @defgroup COMP_LL_EF_Configuration_Legacy_Functions Configuration of COMP, legacy functions name
00734   * @{
00735   */
00736 /* Old functions name kept for legacy purpose, to be replaced by the          */
00737 /* current functions name.                                                    */
00738 __STATIC_INLINE void LL_COMP_SetInputNonInverting(COMP_TypeDef *COMPx, uint32_t InputNonInverting)
00739 {
00740   LL_COMP_SetInputPlus(COMPx, InputNonInverting);
00741 }
00742 __STATIC_INLINE uint32_t LL_COMP_GetInputNonInverting(COMP_TypeDef *COMPx)
00743 {
00744   return LL_COMP_GetInputPlus(COMPx);
00745 }
00746 
00747 __STATIC_INLINE void LL_COMP_SetInputInverting(COMP_TypeDef *COMPx, uint32_t InputInverting)
00748 {
00749   LL_COMP_SetInputMinus(COMPx, InputInverting);
00750 }
00751 __STATIC_INLINE uint32_t LL_COMP_GetInputInverting(COMP_TypeDef *COMPx)
00752 {
00753   return LL_COMP_GetInputMinus(COMPx);
00754 }
00755 
00756 /**
00757   * @}
00758   */
00759 
00760 /** @defgroup COMP_LL_EF_Operation Operation on comparator instance
00761   * @{
00762   */
00763 
00764 /**
00765   * @brief  Enable comparator instance.
00766   * @note   After enable from off state, comparator requires a delay
00767   *         to reach reach propagation delay specification.
00768   *         Refer to device datasheet, parameter "tSTART".
00769   * @rmtoll CSR      EN             LL_COMP_Enable
00770   * @param  COMPx Comparator instance
00771   * @retval None
00772   */
00773 __STATIC_INLINE void LL_COMP_Enable(COMP_TypeDef *COMPx)
00774 {
00775   SET_BIT(COMPx->CSR, COMP_CSR_EN);
00776 }
00777 
00778 /**
00779   * @brief  Disable comparator instance.
00780   * @rmtoll CSR      EN             LL_COMP_Disable
00781   * @param  COMPx Comparator instance
00782   * @retval None
00783   */
00784 __STATIC_INLINE void LL_COMP_Disable(COMP_TypeDef *COMPx)
00785 {
00786   CLEAR_BIT(COMPx->CSR, COMP_CSR_EN);
00787 }
00788 
00789 /**
00790   * @brief  Get comparator enable state
00791   *         (0: COMP is disabled, 1: COMP is enabled)
00792   * @rmtoll CSR      EN             LL_COMP_IsEnabled
00793   * @param  COMPx Comparator instance
00794   * @retval State of bit (1 or 0).
00795   */
00796 __STATIC_INLINE uint32_t LL_COMP_IsEnabled(COMP_TypeDef *COMPx)
00797 {
00798   return (READ_BIT(COMPx->CSR, COMP_CSR_EN) == (COMP_CSR_EN));
00799 }
00800 
00801 /**
00802   * @brief  Lock comparator instance.
00803   * @note   Once locked, comparator configuration can be accessed in read-only.
00804   * @note   The only way to unlock the comparator is a device hardware reset.
00805   * @rmtoll CSR      LOCK           LL_COMP_Lock
00806   * @param  COMPx Comparator instance
00807   * @retval None
00808   */
00809 __STATIC_INLINE void LL_COMP_Lock(COMP_TypeDef *COMPx)
00810 {
00811   SET_BIT(COMPx->CSR, COMP_CSR_LOCK);
00812 }
00813 
00814 /**
00815   * @brief  Get comparator lock state
00816   *         (0: COMP is unlocked, 1: COMP is locked).
00817   * @note   Once locked, comparator configuration can be accessed in read-only.
00818   * @note   The only way to unlock the comparator is a device hardware reset.
00819   * @rmtoll CSR      LOCK           LL_COMP_IsLocked
00820   * @param  COMPx Comparator instance
00821   * @retval State of bit (1 or 0).
00822   */
00823 __STATIC_INLINE uint32_t LL_COMP_IsLocked(COMP_TypeDef *COMPx)
00824 {
00825   return (READ_BIT(COMPx->CSR, COMP_CSR_LOCK) == (COMP_CSR_LOCK));
00826 }
00827 
00828 /**
00829   * @brief  Read comparator instance output level.
00830   * @note   The comparator output level depends on the selected polarity
00831   *         (Refer to function @ref LL_COMP_SetOutputPolarity()).
00832   *         If the comparator polarity is not inverted:
00833   *          - Comparator output is low when the input plus
00834   *            is at a lower voltage than the input minus
00835   *          - Comparator output is high when the input plus
00836   *            is at a higher voltage than the input minus
00837   *         If the comparator polarity is inverted:
00838   *          - Comparator output is high when the input plus
00839   *            is at a lower voltage than the input minus
00840   *          - Comparator output is low when the input plus
00841   *            is at a higher voltage than the input minus
00842   * @rmtoll CSR      VALUE          LL_COMP_ReadOutputLevel
00843   * @param  COMPx Comparator instance
00844   * @retval Returned value can be one of the following values:
00845   *         @arg @ref LL_COMP_OUTPUT_LEVEL_LOW
00846   *         @arg @ref LL_COMP_OUTPUT_LEVEL_HIGH
00847   */
00848 __STATIC_INLINE uint32_t LL_COMP_ReadOutputLevel(COMP_TypeDef *COMPx)
00849 {
00850   return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_VALUE)
00851                     >> LL_COMP_OUTPUT_LEVEL_BITOFFSET_POS);
00852 }
00853 
00854 /**
00855   * @}
00856   */
00857 
00858 #if defined(USE_FULL_LL_DRIVER)
00859 /** @defgroup COMP_LL_EF_Init Initialization and de-initialization functions
00860   * @{
00861   */
00862 
00863 ErrorStatus LL_COMP_DeInit(COMP_TypeDef *COMPx);
00864 ErrorStatus LL_COMP_Init(COMP_TypeDef *COMPx, LL_COMP_InitTypeDef *COMP_InitStruct);
00865 void        LL_COMP_StructInit(LL_COMP_InitTypeDef *COMP_InitStruct);
00866 
00867 /**
00868   * @}
00869   */
00870 #endif /* USE_FULL_LL_DRIVER */
00871 
00872 /**
00873   * @}
00874   */
00875 
00876 /**
00877   * @}
00878   */
00879 
00880 #endif /* COMP1 || COMP2 */
00881 
00882 /**
00883   * @}
00884   */
00885 
00886 #ifdef __cplusplus
00887 }
00888 #endif
00889 
00890 #endif /* __STM32L4xx_LL_COMP_H */
00891 
00892 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/