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