1 /**
2   ******************************************************************************
3   * @file    stm32l4xx_ll_comp.h
4   * @author  MCD Application Team
5   * @brief   Header file of COMP LL module.
6   ******************************************************************************
7   * @attention
8   *
9   * Copyright (c) 2017 STMicroelectronics.
10   * All rights reserved.
11   *
12   * This software is licensed under terms that can be found in the LICENSE file
13   * in the root directory of this software component.
14   * If no LICENSE file comes with this software, it is provided AS-IS.
15   *
16   ******************************************************************************
17   */
18 
19 /* Define to prevent recursive inclusion -------------------------------------*/
20 #ifndef STM32L4xx_LL_COMP_H
21 #define STM32L4xx_LL_COMP_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /* Includes ------------------------------------------------------------------*/
28 #include "stm32l4xx.h"
29 
30 /** @addtogroup STM32L4xx_LL_Driver
31   * @{
32   */
33 
34 #if defined (COMP1) || defined (COMP2)
35 
36 /** @defgroup COMP_LL COMP
37   * @{
38   */
39 
40 /* Private types -------------------------------------------------------------*/
41 /* Private variables ---------------------------------------------------------*/
42 /* Private constants ---------------------------------------------------------*/
43 /** @defgroup COMP_LL_Private_Constants COMP Private Constants
44   * @{
45   */
46 
47 /* COMP registers bits positions */
48 #define LL_COMP_OUTPUT_LEVEL_BITOFFSET_POS (30UL) /* Value equivalent to POSITION_VAL(COMP_CSR_VALUE) */
49 
50 /**
51   * @}
52   */
53 
54 /* Private macros ------------------------------------------------------------*/
55 /** @defgroup COMP_LL_Private_Macros COMP Private Macros
56   * @{
57   */
58 
59 /**
60   * @}
61   */
62 
63 /* Exported types ------------------------------------------------------------*/
64 #if defined(USE_FULL_LL_DRIVER)
65 /** @defgroup COMP_LL_ES_INIT COMP Exported Init structure
66   * @{
67   */
68 
69 /**
70   * @brief  Structure definition of some features of COMP instance.
71   */
72 typedef struct
73 {
74   uint32_t PowerMode;                   /*!< Set comparator operating mode to adjust power and speed.
75                                              This parameter can be a value of @ref COMP_LL_EC_POWERMODE
76 
77                                              This feature can be modified afterwards using unitary function @ref LL_COMP_SetPowerMode(). */
78 
79   uint32_t InputPlus;                   /*!< Set comparator input plus (non-inverting input).
80                                              This parameter can be a value of @ref COMP_LL_EC_INPUT_PLUS
81 
82                                              This feature can be modified afterwards using unitary function @ref LL_COMP_SetInputPlus(). */
83 
84   uint32_t InputMinus;                  /*!< Set comparator input minus (inverting input).
85                                              This parameter can be a value of @ref COMP_LL_EC_INPUT_MINUS
86 
87                                              This feature can be modified afterwards using unitary function @ref LL_COMP_SetInputMinus(). */
88 
89   uint32_t InputHysteresis;             /*!< Set comparator hysteresis mode of the input minus.
90                                              This parameter can be a value of @ref COMP_LL_EC_INPUT_HYSTERESIS
91 
92                                              This feature can be modified afterwards using unitary function @ref LL_COMP_SetInputHysteresis(). */
93 
94   uint32_t OutputPolarity;              /*!< Set comparator output polarity.
95                                              This parameter can be a value of @ref COMP_LL_EC_OUTPUT_POLARITY
96 
97                                              This feature can be modified afterwards using unitary function @ref LL_COMP_SetOutputPolarity(). */
98 
99   uint32_t OutputBlankingSource;        /*!< Set comparator blanking source.
100                                              This parameter can be a value of @ref COMP_LL_EC_OUTPUT_BLANKING_SOURCE
101 
102                                              This feature can be modified afterwards using unitary function @ref LL_COMP_SetOutputBlankingSource(). */
103 
104 } LL_COMP_InitTypeDef;
105 
106 /**
107   * @}
108   */
109 #endif /* USE_FULL_LL_DRIVER */
110 
111 /* Exported constants --------------------------------------------------------*/
112 /** @defgroup COMP_LL_Exported_Constants COMP Exported Constants
113   * @{
114   */
115 
116 /** @defgroup COMP_LL_EC_COMMON_WINDOWMODE Comparator common modes - Window mode
117   * @{
118   */
119 #if defined(COMP2)
120 #define LL_COMP_WINDOWMODE_DISABLE                 (0x00000000UL)          /*!< Window mode disable: Comparators 1 and 2 are independent */
121 #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). */
122 #endif /* COMP2 */
123 /**
124   * @}
125   */
126 
127 /** @defgroup COMP_LL_EC_POWERMODE Comparator modes - Power mode
128   * @{
129   */
130 #define LL_COMP_POWERMODE_HIGHSPEED     (0x00000000UL)                            /*!< COMP power mode to high speed */
131 #define LL_COMP_POWERMODE_MEDIUMSPEED   (COMP_CSR_PWRMODE_0)                      /*!< COMP power mode to medium speed */
132 #define LL_COMP_POWERMODE_ULTRALOWPOWER (COMP_CSR_PWRMODE_1 | COMP_CSR_PWRMODE_0) /*!< COMP power mode to ultra-low power */
133 /**
134   * @}
135   */
136 
137 /** @defgroup COMP_LL_EC_INPUT_PLUS Comparator inputs - Input plus (input non-inverting) selection
138   * @{
139   */
140 #define LL_COMP_INPUT_PLUS_IO1          (0x00000000UL)                          /*!< Comparator input plus connected to IO1 (pin PC5 for COMP1, pin PB4 for COMP2) */
141 #define LL_COMP_INPUT_PLUS_IO2          (COMP_CSR_INPSEL_0)                     /*!< Comparator input plus connected to IO2 (pin PB2 for COMP1, pin PB6 for COMP2) */
142 #if defined(COMP_CSR_INPSEL_1)
143 #define LL_COMP_INPUT_PLUS_IO3          (COMP_CSR_INPSEL_1)                     /*!< Comparator input plus connected to IO3 (pin PA1 for COMP1, pin PA3 for COMP2) */
144 #endif /* COMP_CSR_INPSEL_1 */
145 /**
146   * @}
147   */
148 
149 /** @defgroup COMP_LL_EC_INPUT_MINUS Comparator inputs - Input minus (input inverting) selection
150   * @{
151   */
152 #define LL_COMP_INPUT_MINUS_1_4VREFINT  (                                                            COMP_CSR_SCALEN | COMP_CSR_BRGEN)        /*!< Comparator input minus connected to 1/4 VrefInt  */
153 #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  */
154 #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  */
155 #define LL_COMP_INPUT_MINUS_VREFINT     (                    COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0 | COMP_CSR_SCALEN                 )        /*!< Comparator input minus connected to VrefInt */
156 #define LL_COMP_INPUT_MINUS_DAC1_CH1    (COMP_CSR_INMSEL_2                                        )                                           /*!< Comparator input minus connected to DAC1 channel 1 (DAC_OUT1)  */
157 #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)  */
158 #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) */
159 #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) */
160 #if defined(COMP_CSR_INMESEL_1)
161 #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) */
162 #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) */
163 #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) */
164 #endif
165 /**
166   * @}
167   */
168 
169 /** @defgroup COMP_LL_EC_INPUT_LEGACY Comparator inputs legacy literals name
170   * @{
171   */
172 #define LL_COMP_WINDOWMODE_ENABLE         LL_COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON
173 
174 #define LL_COMP_INVERTINGINPUT_1_4VREFINT LL_COMP_INPUT_MINUS_1_4VREFINT
175 #define LL_COMP_INVERTINGINPUT_1_2VREFINT LL_COMP_INPUT_MINUS_1_2VREFINT
176 #define LL_COMP_INVERTINGINPUT_3_4VREFINT LL_COMP_INPUT_MINUS_3_4VREFINT
177 #define LL_COMP_INVERTINGINPUT_VREFINT    LL_COMP_INPUT_MINUS_VREFINT
178 #define LL_COMP_INVERTINGINPUT_DAC1       LL_COMP_INPUT_MINUS_DAC1_CH1
179 #define LL_COMP_INVERTINGINPUT_DAC2       LL_COMP_INPUT_MINUS_DAC1_CH2
180 #define LL_COMP_INVERTINGINPUT_IO1        LL_COMP_INPUT_MINUS_IO1
181 #define LL_COMP_INVERTINGINPUT_IO2        LL_COMP_INPUT_MINUS_IO2
182 #if defined(COMP_CSR_INMESEL_1)
183 #define LL_COMP_INVERTINGINPUT_IO3        LL_COMP_INPUT_MINUS_IO3
184 #define LL_COMP_INVERTINGINPUT_IO4        LL_COMP_INPUT_MINUS_IO4
185 #define LL_COMP_INVERTINGINPUT_IO5        LL_COMP_INPUT_MINUS_IO5
186 #endif /* COMP_CSR_INMESEL_1 */
187 
188 #define LL_COMP_NONINVERTINGINPUT_IO1     LL_COMP_INPUT_PLUS_IO1
189 #define LL_COMP_NONINVERTINGINPUT_IO2     LL_COMP_INPUT_PLUS_IO2
190 #if defined(COMP_CSR_INPSEL_1)
191 #define LL_COMP_NONINVERTINGINPUT_IO3     LL_COMP_INPUT_PLUS_IO3
192 #endif /* COMP_CSR_INPSEL_1 */
193 /**
194   * @}
195   */
196 
197 /** @defgroup COMP_LL_EC_INPUT_HYSTERESIS Comparator input - Hysteresis
198   * @{
199   */
200 #define LL_COMP_HYSTERESIS_NONE         (0x00000000UL)                      /*!< No hysteresis */
201 #define LL_COMP_HYSTERESIS_LOW          (                  COMP_CSR_HYST_0) /*!< Hysteresis level low */
202 #define LL_COMP_HYSTERESIS_MEDIUM       (COMP_CSR_HYST_1                  ) /*!< Hysteresis level medium */
203 #define LL_COMP_HYSTERESIS_HIGH         (COMP_CSR_HYST_1 | COMP_CSR_HYST_0) /*!< Hysteresis level high */
204 /**
205   * @}
206   */
207 
208 /** @defgroup COMP_LL_EC_OUTPUT_POLARITY Comparator output - Output polarity
209   * @{
210   */
211 #define LL_COMP_OUTPUTPOL_NONINVERTED   (0x00000000UL)          /*!< 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 */
212 #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 */
213 /**
214   * @}
215   */
216 
217 /** @defgroup COMP_LL_EC_OUTPUT_BLANKING_SOURCE Comparator output - Blanking source
218   * @{
219   */
220 #define LL_COMP_BLANKINGSRC_NONE            (0x00000000UL)          /*!<Comparator output without blanking */
221 #define LL_COMP_BLANKINGSRC_TIM1_OC5_COMP1  (COMP_CSR_BLANKING_0)   /*!< Comparator output blanking source TIM1 OC5 (specific to COMP instance: COMP1) */
222 #define LL_COMP_BLANKINGSRC_TIM2_OC3_COMP1  (COMP_CSR_BLANKING_1)   /*!< Comparator output blanking source TIM2 OC3 (specific to COMP instance: COMP1) */
223 #define LL_COMP_BLANKINGSRC_TIM3_OC3_COMP1  (COMP_CSR_BLANKING_2)   /*!< Comparator output blanking source TIM3 OC3 (specific to COMP instance: COMP1) */
224 #define LL_COMP_BLANKINGSRC_TIM3_OC4_COMP2  (COMP_CSR_BLANKING_0)   /*!< Comparator output blanking source TIM3 OC4 (specific to COMP instance: COMP2) */
225 #define LL_COMP_BLANKINGSRC_TIM8_OC5_COMP2  (COMP_CSR_BLANKING_1)   /*!< Comparator output blanking source TIM8 OC5 (specific to COMP instance: COMP2) */
226 #define LL_COMP_BLANKINGSRC_TIM15_OC1_COMP2 (COMP_CSR_BLANKING_2)   /*!< Comparator output blanking source TIM15 OC1 (specific to COMP instance: COMP2) */
227 /**
228   * @}
229   */
230 
231 /** @defgroup COMP_LL_EC_OUTPUT_BLANKING_SOURCE_LEGACY Comparator output blanking source legacy literals name
232   * @{
233   */
234 #define LL_COMP_BLANKINGSRC_TIM1_OC5    (LL_COMP_BLANKINGSRC_TIM1_OC5_COMP1)
235 #define LL_COMP_BLANKINGSRC_TIM2_OC3    (LL_COMP_BLANKINGSRC_TIM2_OC3_COMP1)
236 #define LL_COMP_BLANKINGSRC_TIM3_OC3    (LL_COMP_BLANKINGSRC_TIM3_OC3_COMP1)
237 
238 #define LL_COMP_BLANKINGSRC_TIM3_OC4    (LL_COMP_BLANKINGSRC_TIM3_OC4_COMP2)
239 #define LL_COMP_BLANKINGSRC_TIM8_OC5    (LL_COMP_BLANKINGSRC_TIM8_OC5_COMP2)
240 #define LL_COMP_BLANKINGSRC_TIM15_OC1   (LL_COMP_BLANKINGSRC_TIM15_OC1_COMP2)
241 /**
242   * @}
243   */
244 
245 /** @defgroup COMP_LL_EC_OUTPUT_LEVEL Comparator output - Output level
246   * @{
247   */
248 #define LL_COMP_OUTPUT_LEVEL_LOW        (0x00000000UL)          /*!< Comparator output level low (if the polarity is not inverted, otherwise to be complemented) */
249 #define LL_COMP_OUTPUT_LEVEL_HIGH       (0x00000001UL)          /*!< Comparator output level high (if the polarity is not inverted, otherwise to be complemented) */
250 /**
251   * @}
252   */
253 
254 /** @defgroup COMP_LL_EC_HW_DELAYS  Definitions of COMP hardware constraints delays
255   * @note   Only COMP peripheral HW delays are defined in COMP LL driver driver,
256   *         not timeout values.
257   *         For details on delays values, refer to descriptions in source code
258   *         above each literal definition.
259   * @{
260   */
261 
262 /* Delay for comparator startup time.                                         */
263 /* Note: Delay required to reach propagation delay specification.             */
264 /* Literal set to maximum value (refer to device datasheet,                   */
265 /* parameter "tSTART").                                                       */
266 /* Unit: us                                                                   */
267 #define LL_COMP_DELAY_STARTUP_US          ( 80UL) /*!< Delay for COMP startup time */
268 
269 /* Delay for comparator voltage scaler stabilization time.                    */
270 /* Note: Voltage scaler is used when selecting comparator input               */
271 /*       based on VrefInt: VrefInt or subdivision of VrefInt.                 */
272 /* Literal set to maximum value (refer to device datasheet,                   */
273 /* parameter "tSTART_SCALER").                                                */
274 /* Unit: us                                                                   */
275 #define LL_COMP_DELAY_VOLTAGE_SCALER_STAB_US ( 200UL) /*!< Delay for COMP voltage scaler stabilization time */
276 
277 /**
278   * @}
279   */
280 
281 /**
282   * @}
283   */
284 
285 /* Exported macro ------------------------------------------------------------*/
286 /** @defgroup COMP_LL_Exported_Macros COMP Exported Macros
287   * @{
288   */
289 /** @defgroup COMP_LL_EM_WRITE_READ Common write and read registers macro
290   * @{
291   */
292 
293 /**
294   * @brief  Write a value in COMP register
295   * @param  __INSTANCE__ comparator instance
296   * @param  __REG__ Register to be written
297   * @param  __VALUE__ Value to be written in the register
298   * @retval None
299   */
300 #define LL_COMP_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG((__INSTANCE__)->__REG__, (__VALUE__))
301 
302 /**
303   * @brief  Read a value in COMP register
304   * @param  __INSTANCE__ comparator instance
305   * @param  __REG__ Register to be read
306   * @retval Register value
307   */
308 #define LL_COMP_ReadReg(__INSTANCE__, __REG__) READ_REG((__INSTANCE__)->__REG__)
309 /**
310   * @}
311   */
312 
313 /** @defgroup COMP_LL_EM_HELPER_MACRO COMP helper macro
314   * @{
315   */
316 
317 /**
318   * @brief  Helper macro to select the COMP common instance
319   *         to which is belonging the selected COMP instance.
320   * @note   COMP common register instance can be used to
321   *         set parameters common to several COMP instances.
322   *         Refer to functions having argument "COMPxy_COMMON" as parameter.
323   * @param  __COMPx__ COMP instance
324   * @retval COMP common instance or value "0" if there is no COMP common instance.
325   */
326 #define __LL_COMP_COMMON_INSTANCE(__COMPx__)                                   \
327   (COMP12_COMMON)
328 
329 /**
330   * @}
331   */
332 
333 /**
334   * @}
335   */
336 
337 /* Exported functions --------------------------------------------------------*/
338 /** @defgroup COMP_LL_Exported_Functions COMP Exported Functions
339   * @{
340   */
341 
342 #if defined(COMP2)
343 /** @defgroup COMP_LL_EF_Configuration_comparator_common Configuration of COMP hierarchical scope: common to several COMP instances
344   * @{
345   */
346 
347 /**
348   * @brief  Set window mode of a pair of comparators instances
349   *         (2 consecutive COMP instances COMP<x> and COMP<x+1>).
350   * @rmtoll CSR      WINMODE        LL_COMP_SetCommonWindowMode
351   * @param  COMPxy_COMMON Comparator common instance
352   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_COMP_COMMON_INSTANCE() )
353   * @param  WindowMode This parameter can be one of the following values:
354   *         @arg @ref LL_COMP_WINDOWMODE_DISABLE
355   *         @arg @ref LL_COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON
356   * @retval None
357   */
LL_COMP_SetCommonWindowMode(COMP_Common_TypeDef * COMPxy_COMMON,uint32_t WindowMode)358 __STATIC_INLINE void LL_COMP_SetCommonWindowMode(COMP_Common_TypeDef *COMPxy_COMMON, uint32_t WindowMode)
359 {
360   /* Note: On this STM32 series, window mode can be set only                  */
361   /*       from COMP instance: COMP2.                                         */
362   MODIFY_REG(COMPxy_COMMON->CSR, COMP_CSR_WINMODE, WindowMode);
363 }
364 
365 /**
366   * @brief  Get window mode of a pair of comparators instances
367   *         (2 consecutive COMP instances COMP<x> and COMP<x+1>).
368   * @rmtoll CSR      WINMODE        LL_COMP_GetCommonWindowMode
369   * @param  COMPxy_COMMON Comparator common instance
370   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_COMP_COMMON_INSTANCE() )
371   * @retval Returned value can be one of the following values:
372   *         @arg @ref LL_COMP_WINDOWMODE_DISABLE
373   *         @arg @ref LL_COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON
374   */
LL_COMP_GetCommonWindowMode(COMP_Common_TypeDef * COMPxy_COMMON)375 __STATIC_INLINE uint32_t LL_COMP_GetCommonWindowMode(COMP_Common_TypeDef *COMPxy_COMMON)
376 {
377   return (uint32_t)(READ_BIT(COMPxy_COMMON->CSR, COMP_CSR_WINMODE));
378 }
379 
380 /**
381   * @}
382   */
383 
384 #endif /* COMP2 */
385 /** @defgroup COMP_LL_EF_Configuration_comparator_modes Configuration of comparator modes
386   * @{
387   */
388 
389 /**
390   * @brief  Set comparator instance operating mode to adjust power and speed.
391   * @rmtoll CSR      PWRMODE        LL_COMP_SetPowerMode
392   * @param  COMPx Comparator instance
393   * @param  PowerMode This parameter can be one of the following values:
394   *         @arg @ref LL_COMP_POWERMODE_HIGHSPEED
395   *         @arg @ref LL_COMP_POWERMODE_MEDIUMSPEED
396   *         @arg @ref LL_COMP_POWERMODE_ULTRALOWPOWER
397   * @retval None
398   */
LL_COMP_SetPowerMode(COMP_TypeDef * COMPx,uint32_t PowerMode)399 __STATIC_INLINE void LL_COMP_SetPowerMode(COMP_TypeDef *COMPx, uint32_t PowerMode)
400 {
401   MODIFY_REG(COMPx->CSR, COMP_CSR_PWRMODE, PowerMode);
402 }
403 
404 /**
405   * @brief  Get comparator instance operating mode to adjust power and speed.
406   * @rmtoll CSR      PWRMODE        LL_COMP_GetPowerMode
407   * @param  COMPx Comparator instance
408   * @retval Returned value can be one of the following values:
409   *         @arg @ref LL_COMP_POWERMODE_HIGHSPEED
410   *         @arg @ref LL_COMP_POWERMODE_MEDIUMSPEED
411   *         @arg @ref LL_COMP_POWERMODE_ULTRALOWPOWER
412   */
LL_COMP_GetPowerMode(COMP_TypeDef * COMPx)413 __STATIC_INLINE uint32_t LL_COMP_GetPowerMode(COMP_TypeDef *COMPx)
414 {
415   return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_PWRMODE));
416 }
417 
418 /**
419   * @}
420   */
421 
422 /** @defgroup COMP_LL_EF_Configuration_comparator_inputs Configuration of comparator inputs
423   * @{
424   */
425 
426 /**
427   * @brief  Set comparator inputs minus (inverting) and plus (non-inverting).
428   * @note   In case of comparator input selected to be connected to IO:
429   *         GPIO pins are specific to each comparator instance.
430   *         Refer to description of parameters or to reference manual.
431   * @note   On this STM32 series, scaler bridge is configurable:
432   *         to optimize power consumption, this function enables the
433   *         voltage scaler bridge only when required
434   *         (when selecting comparator input based on VrefInt: VrefInt or
435   *         subdivision of VrefInt).
436   *         - For scaler bridge power consumption values,
437   *           refer to device datasheet, parameter "IDDA(SCALER)".
438   *         - Voltage scaler requires a delay for voltage stabilization.
439   *           Refer to device datasheet, parameter "tSTART_SCALER".
440   *         - Scaler bridge is common for all comparator instances,
441   *           therefore if at least one of the comparator instance
442   *           is requiring the scaler bridge, it remains enabled.
443   * @rmtoll CSR      INMSEL         LL_COMP_ConfigInputs\n
444   *         CSR      INPSEL         LL_COMP_ConfigInputs\n
445   *         CSR      BRGEN          LL_COMP_ConfigInputs\n
446   *         CSR      SCALEN         LL_COMP_ConfigInputs
447   * @param  COMPx Comparator instance
448   * @param  InputMinus This parameter can be one of the following values:
449   *         @arg @ref LL_COMP_INPUT_MINUS_1_4VREFINT
450   *         @arg @ref LL_COMP_INPUT_MINUS_1_2VREFINT
451   *         @arg @ref LL_COMP_INPUT_MINUS_3_4VREFINT
452   *         @arg @ref LL_COMP_INPUT_MINUS_VREFINT
453   *         @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH1
454   *         @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH2 (*)
455   *         @arg @ref LL_COMP_INPUT_MINUS_IO1
456   *         @arg @ref LL_COMP_INPUT_MINUS_IO2
457   *         @arg @ref LL_COMP_INPUT_MINUS_IO3 (*)
458   *         @arg @ref LL_COMP_INPUT_MINUS_IO4 (*)
459   *         @arg @ref LL_COMP_INPUT_MINUS_IO5 (*)
460   *
461   *         (*) Parameter not available on all devices.
462   * @param  InputPlus This parameter can be one of the following values:
463   *         @arg @ref LL_COMP_INPUT_PLUS_IO1
464   *         @arg @ref LL_COMP_INPUT_PLUS_IO2
465   *         @arg @ref LL_COMP_INPUT_PLUS_IO3 (*)
466   *
467   *         (*) Parameter not available on all devices.
468   * @retval None
469   */
LL_COMP_ConfigInputs(COMP_TypeDef * COMPx,uint32_t InputMinus,uint32_t InputPlus)470 __STATIC_INLINE void LL_COMP_ConfigInputs(COMP_TypeDef *COMPx, uint32_t InputMinus, uint32_t InputPlus)
471 {
472 #if defined(COMP_CSR_INMESEL_1)
473   MODIFY_REG(COMPx->CSR,
474              COMP_CSR_INMESEL | COMP_CSR_INMSEL | COMP_CSR_INPSEL | COMP_CSR_SCALEN | COMP_CSR_BRGEN,
475              InputMinus | InputPlus);
476 #else
477   MODIFY_REG(COMPx->CSR,
478              COMP_CSR_INMSEL | COMP_CSR_INPSEL | COMP_CSR_SCALEN | COMP_CSR_BRGEN,
479              InputMinus | InputPlus);
480 #endif
481 }
482 
483 /**
484   * @brief  Set comparator input plus (non-inverting).
485   * @note   In case of comparator input selected to be connected to IO:
486   *         GPIO pins are specific to each comparator instance.
487   *         Refer to description of parameters or to reference manual.
488   * @rmtoll CSR      INPSEL         LL_COMP_SetInputPlus
489   * @param  COMPx Comparator instance
490   * @param  InputPlus This parameter can be one of the following values:
491   *         @arg @ref LL_COMP_INPUT_PLUS_IO1
492   *         @arg @ref LL_COMP_INPUT_PLUS_IO2
493   *         @arg @ref LL_COMP_INPUT_PLUS_IO3 (*)
494   *
495   *         (*) Parameter not available on all devices.
496   * @retval None
497   */
LL_COMP_SetInputPlus(COMP_TypeDef * COMPx,uint32_t InputPlus)498 __STATIC_INLINE void LL_COMP_SetInputPlus(COMP_TypeDef *COMPx, uint32_t InputPlus)
499 {
500   MODIFY_REG(COMPx->CSR, COMP_CSR_INPSEL, InputPlus);
501 }
502 
503 /**
504   * @brief  Get comparator input plus (non-inverting).
505   * @note   In case of comparator input selected to be connected to IO:
506   *         GPIO pins are specific to each comparator instance.
507   *         Refer to description of parameters or to reference manual.
508   * @rmtoll CSR      INPSEL         LL_COMP_GetInputPlus
509   * @param  COMPx Comparator instance
510   * @retval Returned value can be one of the following values:
511   *         @arg @ref LL_COMP_INPUT_PLUS_IO1
512   *         @arg @ref LL_COMP_INPUT_PLUS_IO2
513   *         @arg @ref LL_COMP_INPUT_PLUS_IO3 (*)
514   *
515   *         (*) Parameter not available on all devices.
516   */
LL_COMP_GetInputPlus(COMP_TypeDef * COMPx)517 __STATIC_INLINE uint32_t LL_COMP_GetInputPlus(COMP_TypeDef *COMPx)
518 {
519   return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_INPSEL));
520 }
521 
522 /**
523   * @brief  Set comparator input minus (inverting).
524   * @note   In case of comparator input selected to be connected to IO:
525   *         GPIO pins are specific to each comparator instance.
526   *         Refer to description of parameters or to reference manual.
527   * @note   On this STM32 series, scaler bridge is configurable:
528   *         to optimize power consumption, this function enables the
529   *         voltage scaler bridge only when required
530   *         (when selecting comparator input based on VrefInt: VrefInt or
531   *         subdivision of VrefInt).
532   *         - For scaler bridge power consumption values,
533   *           refer to device datasheet, parameter "IDDA(SCALER)".
534   *         - Voltage scaler requires a delay for voltage stabilization.
535   *           Refer to device datasheet, parameter "tSTART_SCALER".
536   *         - Scaler bridge is common for all comparator instances,
537   *           therefore if at least one of the comparator instance
538   *           is requiring the scaler bridge, it remains enabled.
539   * @rmtoll CSR      INMSEL         LL_COMP_SetInputMinus\n
540   *         CSR      BRGEN          LL_COMP_SetInputMinus\n
541   *         CSR      SCALEN         LL_COMP_SetInputMinus
542   * @param  COMPx Comparator instance
543   * @param  InputMinus This parameter can be one of the following values:
544   *         @arg @ref LL_COMP_INPUT_MINUS_1_4VREFINT
545   *         @arg @ref LL_COMP_INPUT_MINUS_1_2VREFINT
546   *         @arg @ref LL_COMP_INPUT_MINUS_3_4VREFINT
547   *         @arg @ref LL_COMP_INPUT_MINUS_VREFINT
548   *         @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH1
549   *         @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH2 (*)
550   *         @arg @ref LL_COMP_INPUT_MINUS_IO1
551   *         @arg @ref LL_COMP_INPUT_MINUS_IO2
552   *         @arg @ref LL_COMP_INPUT_MINUS_IO3 (*)
553   *         @arg @ref LL_COMP_INPUT_MINUS_IO4 (*)
554   *         @arg @ref LL_COMP_INPUT_MINUS_IO5 (*)
555   *
556   *         (*) Parameter not available on all devices.
557   * @retval None
558   */
LL_COMP_SetInputMinus(COMP_TypeDef * COMPx,uint32_t InputMinus)559 __STATIC_INLINE void LL_COMP_SetInputMinus(COMP_TypeDef *COMPx, uint32_t InputMinus)
560 {
561 #if defined(COMP_CSR_INMESEL_1)
562   MODIFY_REG(COMPx->CSR, COMP_CSR_INMESEL | COMP_CSR_INMSEL | COMP_CSR_SCALEN | COMP_CSR_BRGEN, InputMinus);
563 #else
564   MODIFY_REG(COMPx->CSR, COMP_CSR_INMSEL | COMP_CSR_SCALEN | COMP_CSR_BRGEN, InputMinus);
565 #endif /* COMP_CSR_INMESEL_1 */
566 }
567 
568 /**
569   * @brief  Get comparator input minus (inverting).
570   * @note   In case of comparator input selected to be connected to IO:
571   *         GPIO pins are specific to each comparator instance.
572   *         Refer to description of parameters or to reference manual.
573   * @rmtoll CSR      INMSEL         LL_COMP_GetInputMinus\n
574   *         CSR      BRGEN          LL_COMP_GetInputMinus\n
575   *         CSR      SCALEN         LL_COMP_GetInputMinus
576   * @param  COMPx Comparator instance
577   * @retval Returned value can be one of the following values:
578   *         @arg @ref LL_COMP_INPUT_MINUS_1_4VREFINT
579   *         @arg @ref LL_COMP_INPUT_MINUS_1_2VREFINT
580   *         @arg @ref LL_COMP_INPUT_MINUS_3_4VREFINT
581   *         @arg @ref LL_COMP_INPUT_MINUS_VREFINT
582   *         @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH1
583   *         @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH2 (*)
584   *         @arg @ref LL_COMP_INPUT_MINUS_IO1
585   *         @arg @ref LL_COMP_INPUT_MINUS_IO2
586   *         @arg @ref LL_COMP_INPUT_MINUS_IO3 (*)
587   *         @arg @ref LL_COMP_INPUT_MINUS_IO4 (*)
588   *         @arg @ref LL_COMP_INPUT_MINUS_IO5 (*)
589   *
590   *         (*) Parameter not available on all devices.
591   */
LL_COMP_GetInputMinus(COMP_TypeDef * COMPx)592 __STATIC_INLINE uint32_t LL_COMP_GetInputMinus(COMP_TypeDef *COMPx)
593 {
594 #if defined(COMP_CSR_INMESEL_1)
595   return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_INMESEL | COMP_CSR_INMSEL | COMP_CSR_SCALEN | COMP_CSR_BRGEN));
596 #else
597   return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_INMSEL | COMP_CSR_SCALEN | COMP_CSR_BRGEN));
598 #endif /* COMP_CSR_INMESEL_1 */
599 }
600 
601 /**
602   * @brief  Set comparator instance hysteresis mode of the input minus (inverting input).
603   * @rmtoll CSR      HYST           LL_COMP_SetInputHysteresis
604   * @param  COMPx Comparator instance
605   * @param  InputHysteresis This parameter can be one of the following values:
606   *         @arg @ref LL_COMP_HYSTERESIS_NONE
607   *         @arg @ref LL_COMP_HYSTERESIS_LOW
608   *         @arg @ref LL_COMP_HYSTERESIS_MEDIUM
609   *         @arg @ref LL_COMP_HYSTERESIS_HIGH
610   * @retval None
611   */
LL_COMP_SetInputHysteresis(COMP_TypeDef * COMPx,uint32_t InputHysteresis)612 __STATIC_INLINE void LL_COMP_SetInputHysteresis(COMP_TypeDef *COMPx, uint32_t InputHysteresis)
613 {
614   MODIFY_REG(COMPx->CSR, COMP_CSR_HYST, InputHysteresis);
615 }
616 
617 /**
618   * @brief  Get comparator instance hysteresis mode of the minus (inverting) input.
619   * @rmtoll CSR      HYST           LL_COMP_GetInputHysteresis
620   * @param  COMPx Comparator instance
621   * @retval Returned value can be one of the following values:
622   *         @arg @ref LL_COMP_HYSTERESIS_NONE
623   *         @arg @ref LL_COMP_HYSTERESIS_LOW
624   *         @arg @ref LL_COMP_HYSTERESIS_MEDIUM
625   *         @arg @ref LL_COMP_HYSTERESIS_HIGH
626   */
LL_COMP_GetInputHysteresis(COMP_TypeDef * COMPx)627 __STATIC_INLINE uint32_t LL_COMP_GetInputHysteresis(COMP_TypeDef *COMPx)
628 {
629   return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_HYST));
630 }
631 
632 /**
633   * @}
634   */
635 
636 /** @defgroup COMP_LL_EF_Configuration_comparator_output Configuration of comparator output
637   * @{
638   */
639 
640 /**
641   * @brief  Set comparator instance output polarity.
642   * @rmtoll CSR      POLARITY       LL_COMP_SetOutputPolarity
643   * @param  COMPx Comparator instance
644   * @param  OutputPolarity This parameter can be one of the following values:
645   *         @arg @ref LL_COMP_OUTPUTPOL_NONINVERTED
646   *         @arg @ref LL_COMP_OUTPUTPOL_INVERTED
647   * @retval None
648   */
LL_COMP_SetOutputPolarity(COMP_TypeDef * COMPx,uint32_t OutputPolarity)649 __STATIC_INLINE void LL_COMP_SetOutputPolarity(COMP_TypeDef *COMPx, uint32_t OutputPolarity)
650 {
651   MODIFY_REG(COMPx->CSR, COMP_CSR_POLARITY, OutputPolarity);
652 }
653 
654 /**
655   * @brief  Get comparator instance output polarity.
656   * @rmtoll CSR      POLARITY       LL_COMP_GetOutputPolarity
657   * @param  COMPx Comparator instance
658   * @retval Returned value can be one of the following values:
659   *         @arg @ref LL_COMP_OUTPUTPOL_NONINVERTED
660   *         @arg @ref LL_COMP_OUTPUTPOL_INVERTED
661   */
LL_COMP_GetOutputPolarity(COMP_TypeDef * COMPx)662 __STATIC_INLINE uint32_t LL_COMP_GetOutputPolarity(COMP_TypeDef *COMPx)
663 {
664   return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_POLARITY));
665 }
666 
667 /**
668   * @brief  Set comparator instance blanking source.
669   * @note   Blanking source may be specific to each comparator instance.
670   *         Refer to description of parameters or to reference manual.
671   * @note   Availability of parameters of blanking source from timer
672   *         depends on timers availability on the selected device.
673   * @rmtoll CSR      BLANKING       LL_COMP_SetOutputBlankingSource
674   * @param  COMPx Comparator instance
675   * @param  BlankingSource This parameter can be one of the following values:
676   *         @arg @ref LL_COMP_BLANKINGSRC_NONE
677   *         @arg @ref LL_COMP_BLANKINGSRC_TIM1_OC5_COMP1  (1)(2)
678   *         @arg @ref LL_COMP_BLANKINGSRC_TIM2_OC3_COMP1  (1)(2)
679   *         @arg @ref LL_COMP_BLANKINGSRC_TIM3_OC3_COMP1  (1)(2)
680   *         @arg @ref LL_COMP_BLANKINGSRC_TIM3_OC4_COMP2  (1)(3)
681   *         @arg @ref LL_COMP_BLANKINGSRC_TIM8_OC5_COMP2  (1)(3)
682   *         @arg @ref LL_COMP_BLANKINGSRC_TIM15_OC1_COMP2 (1)(3)
683   *
684   *         (1) Parameter availability depending on timer availability
685   *             on the selected device.
686   *         (2) On STM32L4, parameter available only on comparator instance: COMP1.
687   *         (3) On STM32L4, parameter available only on comparator instance: COMP2.
688   * @retval None
689   */
LL_COMP_SetOutputBlankingSource(COMP_TypeDef * COMPx,uint32_t BlankingSource)690 __STATIC_INLINE void LL_COMP_SetOutputBlankingSource(COMP_TypeDef *COMPx, uint32_t BlankingSource)
691 {
692   MODIFY_REG(COMPx->CSR, COMP_CSR_BLANKING, BlankingSource);
693 }
694 
695 /**
696   * @brief  Get comparator instance blanking source.
697   * @note   Availability of parameters of blanking source from timer
698   *         depends on timers availability on the selected device.
699   * @note   Blanking source may be specific to each comparator instance.
700   *         Refer to description of parameters or to reference manual.
701   * @rmtoll CSR      BLANKING       LL_COMP_GetOutputBlankingSource
702   * @param  COMPx Comparator instance
703   * @retval Returned value can be one of the following values:
704   *         @arg @ref LL_COMP_BLANKINGSRC_NONE
705   *         @arg @ref LL_COMP_BLANKINGSRC_TIM1_OC5_COMP1  (1)(2)
706   *         @arg @ref LL_COMP_BLANKINGSRC_TIM2_OC3_COMP1  (1)(2)
707   *         @arg @ref LL_COMP_BLANKINGSRC_TIM3_OC3_COMP1  (1)(2)
708   *         @arg @ref LL_COMP_BLANKINGSRC_TIM3_OC4_COMP2  (1)(3)
709   *         @arg @ref LL_COMP_BLANKINGSRC_TIM8_OC5_COMP2  (1)(3)
710   *         @arg @ref LL_COMP_BLANKINGSRC_TIM15_OC1_COMP2 (1)(3)
711   *
712   *         (1) Parameter availability depending on timer availability
713   *             on the selected device.
714   *         (2) On STM32L4, parameter available only on comparator instance: COMP1.
715   *         (3) On STM32L4, parameter available only on comparator instance: COMP2.
716   */
LL_COMP_GetOutputBlankingSource(COMP_TypeDef * COMPx)717 __STATIC_INLINE uint32_t LL_COMP_GetOutputBlankingSource(COMP_TypeDef *COMPx)
718 {
719   return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_BLANKING));
720 }
721 
722 /**
723   * @}
724   */
725 
726 /** @defgroup COMP_LL_EF_Configuration_Legacy_Functions Configuration of COMP, legacy functions name
727   * @{
728   */
729 /* Old functions name kept for legacy purpose, to be replaced by the          */
730 /* current functions name.                                                    */
LL_COMP_SetInputNonInverting(COMP_TypeDef * COMPx,uint32_t InputNonInverting)731 __STATIC_INLINE void LL_COMP_SetInputNonInverting(COMP_TypeDef *COMPx, uint32_t InputNonInverting)
732 {
733   LL_COMP_SetInputPlus(COMPx, InputNonInverting);
734 }
LL_COMP_GetInputNonInverting(COMP_TypeDef * COMPx)735 __STATIC_INLINE uint32_t LL_COMP_GetInputNonInverting(COMP_TypeDef *COMPx)
736 {
737   return LL_COMP_GetInputPlus(COMPx);
738 }
739 
LL_COMP_SetInputInverting(COMP_TypeDef * COMPx,uint32_t InputInverting)740 __STATIC_INLINE void LL_COMP_SetInputInverting(COMP_TypeDef *COMPx, uint32_t InputInverting)
741 {
742   LL_COMP_SetInputMinus(COMPx, InputInverting);
743 }
LL_COMP_GetInputInverting(COMP_TypeDef * COMPx)744 __STATIC_INLINE uint32_t LL_COMP_GetInputInverting(COMP_TypeDef *COMPx)
745 {
746   return LL_COMP_GetInputMinus(COMPx);
747 }
748 
749 /**
750   * @}
751   */
752 
753 /** @defgroup COMP_LL_EF_Operation Operation on comparator instance
754   * @{
755   */
756 
757 /**
758   * @brief  Enable comparator instance.
759   * @note   After enable from off state, comparator requires a delay
760   *         to reach reach propagation delay specification.
761   *         Refer to device datasheet, parameter "tSTART".
762   * @rmtoll CSR      EN             LL_COMP_Enable
763   * @param  COMPx Comparator instance
764   * @retval None
765   */
LL_COMP_Enable(COMP_TypeDef * COMPx)766 __STATIC_INLINE void LL_COMP_Enable(COMP_TypeDef *COMPx)
767 {
768   SET_BIT(COMPx->CSR, COMP_CSR_EN);
769 }
770 
771 /**
772   * @brief  Disable comparator instance.
773   * @rmtoll CSR      EN             LL_COMP_Disable
774   * @param  COMPx Comparator instance
775   * @retval None
776   */
LL_COMP_Disable(COMP_TypeDef * COMPx)777 __STATIC_INLINE void LL_COMP_Disable(COMP_TypeDef *COMPx)
778 {
779   CLEAR_BIT(COMPx->CSR, COMP_CSR_EN);
780 }
781 
782 /**
783   * @brief  Get comparator enable state
784   *         (0: COMP is disabled, 1: COMP is enabled)
785   * @rmtoll CSR      EN             LL_COMP_IsEnabled
786   * @param  COMPx Comparator instance
787   * @retval State of bit (1 or 0).
788   */
LL_COMP_IsEnabled(COMP_TypeDef * COMPx)789 __STATIC_INLINE uint32_t LL_COMP_IsEnabled(COMP_TypeDef *COMPx)
790 {
791   return ((READ_BIT(COMPx->CSR, COMP_CSR_EN) == (COMP_CSR_EN)) ? 1UL : 0UL);
792 }
793 
794 /**
795   * @brief  Lock comparator instance.
796   * @note   Once locked, comparator configuration can be accessed in read-only.
797   * @note   The only way to unlock the comparator is a device hardware reset.
798   * @rmtoll CSR      LOCK           LL_COMP_Lock
799   * @param  COMPx Comparator instance
800   * @retval None
801   */
LL_COMP_Lock(COMP_TypeDef * COMPx)802 __STATIC_INLINE void LL_COMP_Lock(COMP_TypeDef *COMPx)
803 {
804   SET_BIT(COMPx->CSR, COMP_CSR_LOCK);
805 }
806 
807 /**
808   * @brief  Get comparator lock state
809   *         (0: COMP is unlocked, 1: COMP is locked).
810   * @note   Once locked, comparator configuration can be accessed in read-only.
811   * @note   The only way to unlock the comparator is a device hardware reset.
812   * @rmtoll CSR      LOCK           LL_COMP_IsLocked
813   * @param  COMPx Comparator instance
814   * @retval State of bit (1 or 0).
815   */
LL_COMP_IsLocked(COMP_TypeDef * COMPx)816 __STATIC_INLINE uint32_t LL_COMP_IsLocked(COMP_TypeDef *COMPx)
817 {
818   return ((READ_BIT(COMPx->CSR, COMP_CSR_LOCK) == (COMP_CSR_LOCK)) ? 1UL : 0UL);
819 }
820 
821 /**
822   * @brief  Read comparator instance output level.
823   * @note   The comparator output level depends on the selected polarity
824   *         (Refer to function @ref LL_COMP_SetOutputPolarity()).
825   *         If the comparator polarity is not inverted:
826   *          - Comparator output is low when the input plus
827   *            is at a lower voltage than the input minus
828   *          - Comparator output is high when the input plus
829   *            is at a higher voltage than the input minus
830   *         If the comparator polarity is inverted:
831   *          - Comparator output is high when the input plus
832   *            is at a lower voltage than the input minus
833   *          - Comparator output is low when the input plus
834   *            is at a higher voltage than the input minus
835   * @rmtoll CSR      VALUE          LL_COMP_ReadOutputLevel
836   * @param  COMPx Comparator instance
837   * @retval Returned value can be one of the following values:
838   *         @arg @ref LL_COMP_OUTPUT_LEVEL_LOW
839   *         @arg @ref LL_COMP_OUTPUT_LEVEL_HIGH
840   */
LL_COMP_ReadOutputLevel(COMP_TypeDef * COMPx)841 __STATIC_INLINE uint32_t LL_COMP_ReadOutputLevel(COMP_TypeDef *COMPx)
842 {
843   return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_VALUE)
844                     >> LL_COMP_OUTPUT_LEVEL_BITOFFSET_POS);
845 }
846 
847 /**
848   * @}
849   */
850 
851 #if defined(USE_FULL_LL_DRIVER)
852 /** @defgroup COMP_LL_EF_Init Initialization and de-initialization functions
853   * @{
854   */
855 
856 ErrorStatus LL_COMP_DeInit(COMP_TypeDef *COMPx);
857 ErrorStatus LL_COMP_Init(COMP_TypeDef *COMPx, LL_COMP_InitTypeDef *COMP_InitStruct);
858 void        LL_COMP_StructInit(LL_COMP_InitTypeDef *COMP_InitStruct);
859 
860 /**
861   * @}
862   */
863 #endif /* USE_FULL_LL_DRIVER */
864 
865 /**
866   * @}
867   */
868 
869 /**
870   * @}
871   */
872 
873 /**
874   * @}
875   */
876 
877 #endif /* COMP1 || COMP2 */
878 
879 /**
880   * @}
881   */
882 
883 #ifdef __cplusplus
884 }
885 #endif
886 
887 #endif /* STM32L4xx_LL_COMP_H */
888