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