Merge pull request #11189 from klutvott123/move-telemetry-displayport-init
[betaflight.git] / lib / main / STM32F3 / Drivers / STM32F3xx_HAL_Driver / Inc / stm32f3xx_ll_comp.h
blobbb4e492b1691abebee6f430416c18a5759b91054
1 /**
2 ******************************************************************************
3 * @file stm32f3xx_ll_comp.h
4 * @author MCD Application Team
5 * @brief Header file of COMP LL module.
6 ******************************************************************************
7 * @attention
9 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
11 * Redistribution and use in source and binary forms, with or without modification,
12 * are permitted provided that the following conditions are met:
13 * 1. Redistributions of source code must retain the above copyright notice,
14 * this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 * 3. Neither the name of STMicroelectronics nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 ******************************************************************************
36 /* Define to prevent recursive inclusion -------------------------------------*/
37 #ifndef __STM32F3xx_LL_COMP_H
38 #define __STM32F3xx_LL_COMP_H
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
44 /* Includes ------------------------------------------------------------------*/
45 #include "stm32f3xx.h"
47 /** @addtogroup STM32F3xx_LL_Driver
48 * @{
51 /* Note: Devices of STM32F3 serie embed 1 out of 2 different comparator IP. */
52 /* - STM32F30x, STM32F31x, STM32F32x, STM32F33x, STM32F35x, STM32F39x: */
53 /* COMP IP from 3 to 7 instances and other specific features */
54 /* (comparator output blanking, ...) (refer to reference manual). */
55 /* - STM32F37x: */
56 /* COMP IP with 2 instances */
57 /* This file contains the drivers of these COMP IP, located in 2 area */
58 /* delimited by compilation switches. */
60 #if defined(COMP_V1_3_0_0)
62 #if defined (COMP1) || defined (COMP2) || defined (COMP3) || defined (COMP4) || defined (COMP5) || defined (COMP6) || defined (COMP7)
64 /** @defgroup COMP_LL COMP
65 * @{
68 /* Private types -------------------------------------------------------------*/
69 /* Private variables ---------------------------------------------------------*/
70 /* Private constants ---------------------------------------------------------*/
71 /** @defgroup COMP_LL_Private_Constants COMP Private Constants
72 * @{
75 /* COMP registers bits positions */
76 #define LL_COMP_OUTPUT_LEVEL_BITOFFSET_POS ((uint32_t)30U) /* Value equivalent to POSITION_VAL(COMPxOUT) */
78 /**
79 * @}
82 /* Private macros ------------------------------------------------------------*/
83 /* Exported types ------------------------------------------------------------*/
84 #if defined(USE_FULL_LL_DRIVER)
85 /** @defgroup COMP_LL_ES_INIT COMP Exported Init structure
86 * @{
89 /**
90 * @brief Structure definition of some features of COMP instance.
92 typedef struct
94 uint32_t PowerMode; /*!< Set comparator operating mode to adjust power and speed.
95 This parameter can be a value of @ref COMP_LL_EC_POWERMODE
97 This feature can be modified afterwards using unitary function @ref LL_COMP_SetPowerMode(). */
99 uint32_t InputPlus; /*!< Set comparator input plus (non-inverting input).
100 This parameter can be a value of @ref COMP_LL_EC_INPUT_PLUS
102 This feature can be modified afterwards using unitary function @ref LL_COMP_SetInputPlus(). */
104 uint32_t InputMinus; /*!< Set comparator input minus (inverting input).
105 This parameter can be a value of @ref COMP_LL_EC_INPUT_MINUS
107 This feature can be modified afterwards using unitary function @ref LL_COMP_SetInputMinus(). */
109 uint32_t InputHysteresis; /*!< Set comparator hysteresis mode of the input minus.
110 This parameter can be a value of @ref COMP_LL_EC_INPUT_HYSTERESIS
112 This feature can be modified afterwards using unitary function @ref LL_COMP_SetInputHysteresis(). */
114 uint32_t OutputSelection; /*!< Set comparator output selection.
115 This parameter can be a value of @ref COMP_LL_EC_OUTPUT_SELECTION
117 This feature can be modified afterwards using unitary function @ref LL_COMP_SetOutputSelection(). */
119 uint32_t OutputPolarity; /*!< Set comparator output polarity.
120 This parameter can be a value of @ref COMP_LL_EC_OUTPUT_POLARITY
122 This feature can be modified afterwards using unitary function @ref LL_COMP_SetOutputPolarity(). */
124 uint32_t OutputBlankingSource; /*!< Set comparator blanking source.
125 This parameter can be a value of @ref COMP_LL_EC_OUTPUT_BLANKING_SOURCE
127 This feature can be modified afterwards using unitary function @ref LL_COMP_SetOutputBlankingSource(). */
129 } LL_COMP_InitTypeDef;
132 * @}
134 #endif /* USE_FULL_LL_DRIVER */
136 /* Exported constants --------------------------------------------------------*/
137 /** @defgroup COMP_LL_Exported_Constants COMP Exported Constants
138 * @{
141 /** @defgroup COMP_LL_EC_COMMON_WINDOWMODE Comparator common modes - Window mode
142 * @{
144 #define LL_COMP_WINDOWMODE_DISABLE ((uint32_t)0x00000000U) /*!< Window mode disable: Comparators 1 and 2 are independent */
145 #if defined(COMP2_CSR_COMP2WNDWEN)
146 #define LL_COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON (COMP2_CSR_COMP2WNDWEN) /*!< 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). */
147 #endif
148 #if defined(COMP4_CSR_COMP4WNDWEN)
149 #define LL_COMP_WINDOWMODE_COMP3_INPUT_PLUS_COMMON (COMP4_CSR_COMP4WNDWEN) /*!< Window mode enable: Comparators instances pair COMP3 and COMP4 have their input plus connected together. The common input is COMP3 input plus (COMP4 input plus is no more accessible). */
150 #endif
151 #if defined(COMP6_CSR_COMP6WNDWEN)
152 #define LL_COMP_WINDOWMODE_COMP5_INPUT_PLUS_COMMON (COMP6_CSR_COMP6WNDWEN) /*!< Window mode enable: Comparators instances pair COMP5 and COMP6 have their input plus connected together. The common input is COMP5 input plus (COMP6 input plus is no more accessible). */
153 #endif
155 * @}
158 /** @defgroup COMP_LL_EC_POWERMODE Comparator modes - Power mode
159 * @{
161 #define LL_COMP_POWERMODE_HIGHSPEED ((uint32_t)0x00000000U) /*!< COMP power mode to high speed */
162 #if defined(COMP_CSR_COMPxMODE)
163 #define LL_COMP_POWERMODE_MEDIUMSPEED (COMP_CSR_COMPxMODE_0) /*!< COMP power mode to medium speed */
164 #define LL_COMP_POWERMODE_LOWPOWER (COMP_CSR_COMPxMODE_1) /*!< COMP power mode to low power */
165 #define LL_COMP_POWERMODE_ULTRALOWPOWER (COMP_CSR_COMPxMODE_1 | COMP_CSR_COMPxMODE_0) /*!< COMP power mode to ultra-low power */
166 #endif
168 * @}
171 /** @defgroup COMP_LL_EC_INPUT_PLUS Comparator inputs - Input plus (input non-inverting) selection
172 * @{
174 #if !defined(COMP_CSR_COMPxNONINSEL)
175 #define LL_COMP_INPUT_PLUS_IO1 ((uint32_t)0x00000000U) /*!< Comparator input plus connected to IO1 (pin PA1 for COMP1, PA3 for COMP2 (except STM32F334xx: PA7), PB14 for COMP3, PB0 for COMP4, PD12 for COMP5, PD11 for COMP6, PA0 for COMP7) (COMP instance availability depends on the selected device) */
176 #define LL_COMP_INPUT_PLUS_IO2 ((uint32_t)0x00000000U) /*!< Comparator input plus connected to IO2: Same as IO1 */
177 #else
178 #define LL_COMP_INPUT_PLUS_IO1 ((uint32_t)0x00000000U) /*!< Comparator input plus connected to IO1 (pin PA7 for COMP2, PB14 for COMP3, PB0 for COMP4, PD12 for COMP5, PD11 for COMP6, PA0 for COMP7) (COMP instance availability depends on the selected device) */
179 #define LL_COMP_INPUT_PLUS_IO2 (COMP_CSR_COMPxNONINSEL) /*!< Comparator input plus connected to IO2 (pin PA3 for COMP2, PD14 for COMP3, PE7 for COMP4, PB13 for COMP5, PB11 for COMP6, PC1 for COMP7) (COMP instance availability depends on the selected device) */
180 #endif
181 #if defined(STM32F302xC) || defined(STM32F302xE) || defined(STM32F303xC) || defined(STM32F303xE) || defined(STM32F358xx) || defined(STM32F398xx)
182 #define LL_COMP_INPUT_PLUS_DAC1_CH1_COMP1 (COMP_CSR_COMPxSW1) /*!< Comparator input plus connected to DAC1 channel 1 (DAC_OUT1), through dedicated switch (Note: this switch is solely intended to redirect signals onto high impedance input, such as COMP1 input plus (highly resistive switch)) (specific to COMP instance: COMP1) */
184 /* Note: Comparator input plus specific to COMP instances, defined with */
185 /* generic naming not taking into account COMP instance constraints. */
186 /* Refer to literal definitions above for COMP instance constraints. */
187 #define LL_COMP_INPUT_PLUS_DAC1_CH1 LL_COMP_INPUT_PLUS_DAC1_CH1_COMP1 /*!< Comparator input plus connected to DAC1 channel 1 (DAC_OUT1), through dedicated switch. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
189 #elif defined(STM32F301x8) || defined(STM32F318xx) || defined(STM32F302x8)
190 #define LL_COMP_INPUT_PLUS_DAC1_CH1_COMP2 (COMP_CSR_COMPxSW1) /*!< Comparator input plus connected to DAC1 channel 1 (DAC_OUT1), through dedicated switch (Note: this switch is solely intended to redirect signals onto high impedance input, such as COMP2 input plus (highly resistive switch)) (specific to COMP instance: COMP2) */
192 /* Note: Comparator input plus specific to COMP instances, defined with */
193 /* generic naming not taking into account COMP instance constraints. */
194 /* Refer to literal definitions above for COMP instance constraints. */
195 #define LL_COMP_INPUT_PLUS_DAC1_CH1 LL_COMP_INPUT_PLUS_DAC1_CH1_COMP2 /*!< Comparator input plus connected to DAC1 channel 1 (DAC_OUT1), through dedicated switch. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
197 #endif
199 * @}
202 /** @defgroup COMP_LL_EC_INPUT_MINUS Comparator inputs - Input minus (input inverting) selection
203 * @{
205 #define LL_COMP_INPUT_MINUS_1_4VREFINT ((uint32_t)0x00000000U) /*!< Comparator input minus connected to 1/4 VrefInt */
206 #define LL_COMP_INPUT_MINUS_1_2VREFINT ( COMP_CSR_COMPxINSEL_0) /*!< Comparator input minus connected to 1/2 VrefInt */
207 #define LL_COMP_INPUT_MINUS_3_4VREFINT ( COMP_CSR_COMPxINSEL_1 ) /*!< Comparator input minus connected to 3/4 VrefInt */
208 #define LL_COMP_INPUT_MINUS_VREFINT ( COMP_CSR_COMPxINSEL_1 | COMP_CSR_COMPxINSEL_0) /*!< Comparator input minus connected to VrefInt */
209 #define LL_COMP_INPUT_MINUS_DAC1_CH1 (COMP_CSR_COMPxINSEL_2 ) /*!< Comparator input minus connected to DAC1 channel 1 (DAC_OUT1) */
210 #if defined(STM32F301x8) || defined(STM32F318xx) || defined(STM32F302x8) || defined(STM32F302xC) || defined(STM32F302xE)
211 /* This device has no comparator input minus DAC1_CH2 */
212 #else
213 #define LL_COMP_INPUT_MINUS_DAC1_CH2 (COMP_CSR_COMPxINSEL_2 | COMP_CSR_COMPxINSEL_0) /*!< Comparator input minus connected to DAC1 channel 2 (DAC_OUT2) */
214 #endif
215 #if defined(STM32F301x8) || defined(STM32F318xx) || defined(STM32F334x8)
216 #define LL_COMP_INPUT_MINUS_IO1 (COMP_CSR_COMPxINSEL_2 | COMP_CSR_COMPxINSEL_1 ) /*!< Comparator input minus connected to IO1 (pin PA2 for COMP2) */
217 #else
218 #define LL_COMP_INPUT_MINUS_IO1 (COMP_CSR_COMPxINSEL_2 | COMP_CSR_COMPxINSEL_1 ) /*!< Comparator input minus connected to IO1 (pin PA0 for COMP1, pin PA2 for COMP2, PD15 for COMP3, PE8 for COMP4, PD13 for COMP5, PD10 for COMP6, PC0 for COMP7 (COMP instance availability depends on the selected device)) */
219 #endif
220 #define LL_COMP_INPUT_MINUS_IO2 (COMP_CSR_COMPxINSEL_2 | COMP_CSR_COMPxINSEL_1 | COMP_CSR_COMPxINSEL_0) /*!< Comparator input minus connected to IO2 (PB12 for COMP3, PB2 for COMP4, PB10 for COMP5, PB15 for COMP6 (COMP instance availability depends on the selected device)) */
221 #if defined(STM32F301x8) || defined(STM32F318xx) || defined(STM32F334x8) || defined(STM32F302x8) || defined(STM32F303x8) || defined(STM32F328xx)
222 /* This device has no comparator input minus IO3 */
223 #else
224 #define LL_COMP_INPUT_MINUS_IO3 (COMP_CSR_COMPxINSEL_2 | COMP_CSR_COMPxINSEL_0) /*!< Comparator input minus connected to IO3 (pin PA5 for COMP1/2/3/4/5/6/7 (COMP instance availability depends on the selected device)) */
225 #endif
226 #define LL_COMP_INPUT_MINUS_IO4 (COMP_CSR_COMPxINSEL_2 ) /*!< Comparator input minus connected to IO4 (pin PA4 for COMP1/2/3/4/5/6/7 (COMP instance availability depends on the selected device)) */
227 #if defined(STM32F303x8) || defined(STM32F328xx) || defined(STM32F334x8)
228 #define LL_COMP_INPUT_MINUS_DAC2_CH1 (COMP_CSR_COMPxINSEL_3 ) /*!< Comparator input minus connected to DAC2 channel 1 (DAC2_OUT1) */
229 #else
230 /* This device has no comparator input minus DAC2_CH1 */
231 #endif
233 * @}
236 /** @defgroup COMP_LL_EC_INPUT_HYSTERESIS Comparator input - Hysteresis
237 * @{
239 #define LL_COMP_HYSTERESIS_NONE ((uint32_t)0x00000000U) /*!< No hysteresis */
240 #if defined(COMP_CSR_COMPxHYST)
241 #define LL_COMP_HYSTERESIS_LOW ( COMP_CSR_COMPxHYST_0) /*!< Hysteresis level low (available only on devices: STM32F303xB/C, STM32F358xC) */
242 #define LL_COMP_HYSTERESIS_MEDIUM (COMP_CSR_COMPxHYST_1 ) /*!< Hysteresis level medium (available only on devices: STM32F303xB/C, STM32F358xC) */
243 #define LL_COMP_HYSTERESIS_HIGH (COMP_CSR_COMPxHYST_1 | COMP_CSR_COMPxHYST_0) /*!< Hysteresis level high (available only on devices: STM32F303xB/C, STM32F358xC) */
244 #endif
246 * @}
249 /** @defgroup COMP_LL_EC_OUTPUT_SELECTION Comparator output - Output selection
250 * @{
252 #define LL_COMP_OUTPUT_NONE ((uint32_t)0x00000000) /*!< COMP output is not connected to other peripherals (except GPIO and EXTI that are always connected to COMP output) (specific to COMP instance: COMP2) */
253 #if defined(COMP_CSR_COMPxOUT)
254 /* Note: Output redirection common to all COMP instances, all STM32F3 serie */
255 /* devices. */
256 #define LL_COMP_OUTPUT_TIM1_BKIN (COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM1 break input (BKIN) */
257 #define LL_COMP_OUTPUT_TIM1_BKIN2 (COMP_CSR_COMPxOUTSEL_1) /*!< COMP output connected to TIM1 break input 2 (BKIN2) */
259 #if defined(STM32F301x8) || defined(STM32F318xx)
260 /* Note: Output redirection specific to COMP instance: COMP2 */
261 #define LL_COMP_OUTPUT_TIM1_IC1_COMP2 (COMP_CSR_COMPxOUTSEL_2 | COMP_CSR_COMPxOUTSEL_1 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM1 input capture 1 (specific to COMP instance: COMP2) */
262 #define LL_COMP_OUTPUT_TIM2_IC4_COMP2 (COMP_CSR_COMPxOUTSEL_3) /*!< COMP output connected to TIM1 input capture 4 (specific to COMP instance: COMP2) */
263 #define LL_COMP_OUTPUT_TIM1_OCCLR_COMP2 (COMP_CSR_COMPxOUTSEL_2 | COMP_CSR_COMPxOUTSEL_1) /*!< COMP output connected to TIM1 OCREF clear (specific to COMP instance: COMP2) */
264 #define LL_COMP_OUTPUT_TIM2_OCCLR_COMP2 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM2 OCREF clear (specific to COMP instance: COMP2) */
265 /* Note: Output redirection specific to COMP instance: COMP4 */
266 #define LL_COMP_OUTPUT_TIM15_IC2_COMP4 (COMP_CSR_COMPxOUTSEL_3) /*!< COMP output connected to TIM15 input capture 1 (specific to COMP instance: COMP4) */
267 #define LL_COMP_OUTPUT_TIM15_OCCLR_COMP4 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_1) /*!< COMP output connected to TIM15 OCREF clear (specific to COMP instance: COMP4) */
268 /* Note: Output redirection specific to COMP instance: COMP6 */
269 #define LL_COMP_OUTPUT_TIM2_IC2_COMP6 (COMP_CSR_COMPxOUTSEL_2 | COMP_CSR_COMPxOUTSEL_1) /*!< COMP output connected to TIM2 input capture 2 (specific to COMP instance: COMP6) */
270 #define LL_COMP_OUTPUT_TIM2_OCCLR_COMP6 (COMP_CSR_COMPxOUTSEL_3) /*!< COMP output connected to TIM2 OCREF clear (specific to COMP instance: COMP6) */
271 #define LL_COMP_OUTPUT_TIM16_IC1_COMP6 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_1) /*!< COMP output connected to TIM16 input capture 1 (specific to COMP instance: COMP6) */
272 #define LL_COMP_OUTPUT_TIM16_OCCLR_COMP6 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM16 OCREF clear (specific to COMP instance: COMP6) */
274 /* Note: Output redirection specific to COMP instances, defined with */
275 /* generic naming not taking into account COMP instance constraints. */
276 /* Refer to literal definitions above for COMP instance constraints. */
277 /* Note: Some output redirections cannot have a generic naming, */
278 /* due to literal value different depending on COMP instance. */
279 /* (For exemple: LL_COMP_OUTPUT_TIM2_OCCLR_COMP2 and */
280 /* LL_COMP_OUTPUT_TIM2_OCCLR_COMP6). */
281 #define LL_COMP_OUTPUT_TIM1_IC1 LL_COMP_OUTPUT_TIM1_IC1_COMP2 /*!< COMP output connected to TIM1 input capture 1. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
282 #define LL_COMP_OUTPUT_TIM1_OCCLR LL_COMP_OUTPUT_TIM1_OCCLR_COMP2 /*!< COMP output connected to TIM1 OCREF clear. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
283 #define LL_COMP_OUTPUT_TIM2_IC2 LL_COMP_OUTPUT_TIM2_IC2_COMP6 /*!< COMP output connected to TIM2 input capture 2. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
284 #define LL_COMP_OUTPUT_TIM2_IC4 LL_COMP_OUTPUT_TIM2_IC4_COMP2 /*!< COMP output connected to TIM2 input capture 4. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
285 #define LL_COMP_OUTPUT_TIM15_IC2 LL_COMP_OUTPUT_TIM15_IC2_COMP4 /*!< COMP output connected to TIM15 input capture 1. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
286 #define LL_COMP_OUTPUT_TIM15_OCCLR LL_COMP_OUTPUT_TIM15_OCCLR_COMP4 /*!< COMP output connected to TIM15 OCREF clear. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
287 #define LL_COMP_OUTPUT_TIM16_IC1 LL_COMP_OUTPUT_TIM16_IC1_COMP6 /*!< COMP output connected to TIM16 input capture 1. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
288 #define LL_COMP_OUTPUT_TIM16_OCCLR LL_COMP_OUTPUT_TIM16_OCCLR_COMP6 /*!< COMP output connected to TIM16 OCREF clear. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
289 /* Note: Output redirection specific to COMP instances, defined with */
290 /* partially generic naming grouping COMP instance constraints. */
291 /* Refer to literal definitions above for COMP instance constraints. */
292 #define LL_COMP_OUTPUT_TIM2_OCCLR_COMP1_2_3 LL_COMP_OUTPUT_TIM2_OCCLR_COMP2 /*!< COMP output connected to TIM2 OCREF clear. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
294 #elif defined(STM32F303x8) || defined(STM32F328xx) || defined(STM32F334x8)|| defined(STM32F302x8)
295 /* Note: Output redirection specific to COMP instance: COMP2, COMP4 */
296 #define LL_COMP_OUTPUT_TIM3_OCCLR_COMP2_4 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_1 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM3 OCREF clear (specific to COMP instance: COMP2, COMP4) */
297 /* Note: Output redirection specific to COMP instance: COMP2 */
298 #define LL_COMP_OUTPUT_TIM1_IC1_COMP2 (COMP_CSR_COMPxOUTSEL_2 | COMP_CSR_COMPxOUTSEL_1 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM1 input capture 1 (specific to COMP instance: COMP2) */
299 #define LL_COMP_OUTPUT_TIM2_IC4_COMP2 (COMP_CSR_COMPxOUTSEL_3) /*!< COMP output connected to TIM1 input capture 4 (specific to COMP instance: COMP2) */
300 #define LL_COMP_OUTPUT_TIM1_OCCLR_COMP2 (COMP_CSR_COMPxOUTSEL_2 | COMP_CSR_COMPxOUTSEL_1) /*!< COMP output connected to TIM1 OCREF clear (specific to COMP instance: COMP2) */
301 #define LL_COMP_OUTPUT_TIM2_OCCLR_COMP2 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM2 OCREF clear (specific to COMP instance: COMP2) */
302 #define LL_COMP_OUTPUT_TIM3_IC1_COMP2 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_1 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM3 input capture 1 (specific to COMP instance: COMP2) */
303 /* Note: Output redirection specific to COMP instance: COMP4 */
304 #define LL_COMP_OUTPUT_TIM3_IC3_COMP4 (COMP_CSR_COMPxOUTSEL_2 | COMP_CSR_COMPxOUTSEL_1) /*!< COMP output connected to TIM3 input capture 3 (specific to COMP instance: COMP4) */
305 #define LL_COMP_OUTPUT_TIM15_IC2_COMP4 (COMP_CSR_COMPxOUTSEL_3) /*!< COMP output connected to TIM15 input capture 1 (specific to COMP instance: COMP4) */
306 #define LL_COMP_OUTPUT_TIM15_OCCLR_COMP4 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_1) /*!< COMP output connected to TIM15 OCREF clear (specific to COMP instance: COMP4) */
307 /* Note: Output redirection specific to COMP instance: COMP6 */
308 #define LL_COMP_OUTPUT_TIM2_IC2_COMP6 (COMP_CSR_COMPxOUTSEL_2 | COMP_CSR_COMPxOUTSEL_1) /*!< COMP output connected to TIM2 input capture 2 (specific to COMP instance: COMP6) */
309 #define LL_COMP_OUTPUT_TIM2_OCCLR_COMP6 (COMP_CSR_COMPxOUTSEL_3) /*!< COMP output connected to TIM2 OCREF clear (specific to COMP instance: COMP6) */
310 #define LL_COMP_OUTPUT_TIM16_IC1_COMP6 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_1) /*!< COMP output connected to TIM16 input capture 1 (specific to COMP instance: COMP6) */
311 #define LL_COMP_OUTPUT_TIM16_OCCLR_COMP6 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM16 OCREF clear (specific to COMP instance: COMP6) */
313 /* Note: Output redirection specific to COMP instances, defined with */
314 /* generic naming not taking into account COMP instance constraints. */
315 /* Refer to literal definitions above for COMP instance constraints. */
316 /* Note: Some output redirections cannot have a generic naming, */
317 /* due to literal value different depending on COMP instance. */
318 /* (For exemple: LL_COMP_OUTPUT_TIM2_OCCLR_COMP2 and */
319 /* LL_COMP_OUTPUT_TIM2_OCCLR_COMP6). */
320 #define LL_COMP_OUTPUT_TIM1_IC1 LL_COMP_OUTPUT_TIM1_IC1_COMP2 /*!< COMP output connected to TIM1 input capture 1. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
321 #define LL_COMP_OUTPUT_TIM1_OCCLR LL_COMP_OUTPUT_TIM1_OCCLR_COMP2 /*!< COMP output connected to TIM1 OCREF clear. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
322 #define LL_COMP_OUTPUT_TIM2_IC2 LL_COMP_OUTPUT_TIM2_IC2_COMP6 /*!< COMP output connected to TIM2 input capture 2. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
323 #define LL_COMP_OUTPUT_TIM2_IC4 LL_COMP_OUTPUT_TIM2_IC4_COMP2 /*!< COMP output connected to TIM2 input capture 4. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
324 #define LL_COMP_OUTPUT_TIM3_IC1 LL_COMP_OUTPUT_TIM3_IC1_COMP2 /*!< COMP output connected to TIM3 input capture 1. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
325 #define LL_COMP_OUTPUT_TIM3_IC3 LL_COMP_OUTPUT_TIM3_IC3_COMP4 /*!< COMP output connected to TIM3 input capture 3. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
326 #define LL_COMP_OUTPUT_TIM3_OCCLR LL_COMP_OUTPUT_TIM3_OCCLR_COMP2_4 /*!< COMP output connected to TIM3 OCREF clear. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
327 #define LL_COMP_OUTPUT_TIM15_IC2 LL_COMP_OUTPUT_TIM15_IC2_COMP4 /*!< COMP output connected to TIM15 input capture 1. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
328 #define LL_COMP_OUTPUT_TIM15_OCCLR LL_COMP_OUTPUT_TIM15_OCCLR_COMP4 /*!< COMP output connected to TIM15 OCREF clear. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
329 #define LL_COMP_OUTPUT_TIM16_IC1 LL_COMP_OUTPUT_TIM16_IC1_COMP6 /*!< COMP output connected to TIM16 input capture 1. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
330 #define LL_COMP_OUTPUT_TIM16_OCCLR LL_COMP_OUTPUT_TIM16_OCCLR_COMP6 /*!< COMP output connected to TIM16 OCREF clear. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
331 /* Note: Output redirection specific to COMP instances, defined with */
332 /* partially generic naming grouping COMP instance constraints. */
333 /* Refer to literal definitions above for COMP instance constraints. */
334 #define LL_COMP_OUTPUT_TIM2_OCCLR_COMP1_2_3 LL_COMP_OUTPUT_TIM2_OCCLR_COMP2 /*!< COMP output connected to TIM2 OCREF clear. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
336 #elif defined(STM32F302xC) || defined(STM32F302xE)
337 /* Note: Output redirection specific to COMP instance: COMP1, COMP2, COMP4 */
338 #define LL_COMP_OUTPUT_TIM3_OCCLR_COMP1_2_4 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_1 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM3 OCREF clear (specific to COMP instance: COMP2, COMP4) */
339 /* Note: Output redirection specific to COMP instance: COMP1, COMP2 */
340 #define LL_COMP_OUTPUT_TIM1_IC1_COMP1_2 (COMP_CSR_COMPxOUTSEL_2 | COMP_CSR_COMPxOUTSEL_1 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM1 input capture 1 (specific to COMP instance: COMP2) */
341 #define LL_COMP_OUTPUT_TIM2_IC4_COMP1_2 (COMP_CSR_COMPxOUTSEL_3) /*!< COMP output connected to TIM2 input capture 4 (specific to COMP instance: COMP2) */
342 #define LL_COMP_OUTPUT_TIM1_OCCLR_COMP1_2 (COMP_CSR_COMPxOUTSEL_2 | COMP_CSR_COMPxOUTSEL_1) /*!< COMP output connected to TIM1 OCREF clear (specific to COMP instance: COMP2) */
343 #define LL_COMP_OUTPUT_TIM2_OCCLR_COMP1_2 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM2 OCREF clear (specific to COMP instance: COMP2) */
344 #define LL_COMP_OUTPUT_TIM3_IC1_COMP1_2 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_1 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM3 input capture 1 (specific to COMP instance: COMP2) */
345 /* Note: Output redirection specific to COMP instance: COMP4 */
346 #define LL_COMP_OUTPUT_TIM3_IC3_COMP4 (COMP_CSR_COMPxOUTSEL_2 | COMP_CSR_COMPxOUTSEL_1) /*!< COMP output connected to TIM3 input capture 3 (specific to COMP instance: COMP4) */
347 #define LL_COMP_OUTPUT_TIM4_IC2_COMP4 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM4 input capture 2 (specific to COMP instance: COMP4) */
348 #define LL_COMP_OUTPUT_TIM15_IC2_COMP4 (COMP_CSR_COMPxOUTSEL_3) /*!< COMP output connected to TIM15 input capture 1 (specific to COMP instance: COMP4) */
349 #define LL_COMP_OUTPUT_TIM15_OCCLR_COMP4 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_1) /*!< COMP output connected to TIM15 OCREF clear (specific to COMP instance: COMP4) */
350 /* Note: Output redirection specific to COMP instance: COMP6 */
351 #define LL_COMP_OUTPUT_TIM2_IC2_COMP6 (COMP_CSR_COMPxOUTSEL_2 | COMP_CSR_COMPxOUTSEL_1) /*!< COMP output connected to TIM2 input capture 2 (specific to COMP instance: COMP6) */
352 #define LL_COMP_OUTPUT_TIM2_OCCLR_COMP6 (COMP_CSR_COMPxOUTSEL_3) /*!< COMP output connected to TIM2 OCREF clear (specific to COMP instance: COMP6) */
353 #define LL_COMP_OUTPUT_TIM4_IC4_COMP6 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_1 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM4 input capture 4 (specific to COMP instance: COMP6) */
354 #define LL_COMP_OUTPUT_TIM16_IC1_COMP6 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_1) /*!< COMP output connected to TIM16 input capture 1 (specific to COMP instance: COMP6) */
355 #define LL_COMP_OUTPUT_TIM16_OCCLR_COMP6 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_1 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM16 OCREF clear (specific to COMP instance: COMP6) */
357 /* Note: Output redirection specific to COMP instances, defined with */
358 /* generic naming not taking into account COMP instance constraints. */
359 /* Refer to literal definitions above for COMP instance constraints. */
360 /* Note: Some output redirections cannot have a generic naming, */
361 /* due to literal value different depending on COMP instance. */
362 /* (For exemple: LL_COMP_OUTPUT_TIM2_OCCLR_COMP1_2 and */
363 /* LL_COMP_OUTPUT_TIM2_OCCLR_COMP6). */
364 #define LL_COMP_OUTPUT_TIM1_IC1 LL_COMP_OUTPUT_TIM1_IC1_COMP1_2 /*!< COMP output connected to TIM1 input capture 1. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
365 #define LL_COMP_OUTPUT_TIM1_OCCLR LL_COMP_OUTPUT_TIM1_OCCLR_COMP1_2 /*!< COMP output connected to TIM1 OCREF clear. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
366 #define LL_COMP_OUTPUT_TIM2_IC2 LL_COMP_OUTPUT_TIM2_IC2_COMP6 /*!< COMP output connected to TIM2 input capture 2. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
367 #define LL_COMP_OUTPUT_TIM2_IC4 LL_COMP_OUTPUT_TIM2_IC4_COMP1_2 /*!< COMP output connected to TIM2 input capture 4. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
368 #define LL_COMP_OUTPUT_TIM3_IC1 LL_COMP_OUTPUT_TIM3_IC1_COMP1_2 /*!< COMP output connected to TIM3 input capture 1. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
369 #define LL_COMP_OUTPUT_TIM3_IC3 LL_COMP_OUTPUT_TIM3_IC3_COMP4 /*!< COMP output connected to TIM3 input capture 3. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
370 #define LL_COMP_OUTPUT_TIM3_OCCLR LL_COMP_OUTPUT_TIM3_OCCLR_COMP1_2_4 /*!< COMP output connected to TIM3 OCREF clear. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
371 #define LL_COMP_OUTPUT_TIM4_IC2 LL_COMP_OUTPUT_TIM4_IC2_COMP4 /*!< COMP output connected to TIM4 input capture 2. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
372 #define LL_COMP_OUTPUT_TIM4_IC4 LL_COMP_OUTPUT_TIM4_IC4_COMP6 /*!< COMP output connected to TIM4 input capture 4. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
373 #define LL_COMP_OUTPUT_TIM15_IC2 LL_COMP_OUTPUT_TIM15_IC2_COMP4 /*!< COMP output connected to TIM15 input capture 1. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
374 #define LL_COMP_OUTPUT_TIM15_OCCLR LL_COMP_OUTPUT_TIM15_OCCLR_COMP4 /*!< COMP output connected to TIM15 OCREF clear. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
375 #define LL_COMP_OUTPUT_TIM16_IC1 LL_COMP_OUTPUT_TIM16_IC1_COMP6 /*!< COMP output connected to TIM16 input capture 1. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
376 #define LL_COMP_OUTPUT_TIM16_OCCLR LL_COMP_OUTPUT_TIM16_OCCLR_COMP6 /*!< COMP output connected to TIM16 OCREF clear. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
377 /* Note: Output redirection specific to COMP instances, defined with */
378 /* partially generic naming grouping COMP instance constraints. */
379 /* Refer to literal definitions above for COMP instance constraints. */
380 #define LL_COMP_OUTPUT_TIM2_OCCLR_COMP1_2_3 LL_COMP_OUTPUT_TIM2_OCCLR_COMP1_2 /*!< COMP output connected to TIM2 OCREF clear. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
382 #elif defined(STM32F303xC) || defined(STM32F358xx) || defined(STM32F303xE) || defined(STM32F398xx)
383 /* Note: Output redirection common to all COMP instances */
384 #define LL_COMP_OUTPUT_TIM8_BKIN (COMP_CSR_COMPxOUTSEL_1 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM8 break input (BKIN) */
385 #define LL_COMP_OUTPUT_TIM8_BKIN2 (COMP_CSR_COMPxOUTSEL_2) /*!< COMP output connected to TIM8 break input 2 (BKIN2) */
386 #define LL_COMP_OUTPUT_TIM1_TIM8_BKIN2 (COMP_CSR_COMPxOUTSEL_2| COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM1 break input 2 and TIM8 break input 2 (BKIN2) */
387 #if defined(STM32F303xE) || defined(STM32F398xx)
388 #define LL_COMP_OUTPUT_TIM20_BKIN (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_2) /*!< COMP output connected to TIM8 break input (BKIN) */
389 #define LL_COMP_OUTPUT_TIM20_BKIN2 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_2 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM8 break input 2 (BKIN2) */
390 #define LL_COMP_OUTPUT_TIM1_TIM8_TIM20_BKIN2 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_2| COMP_CSR_COMPxOUTSEL_1) /*!< COMP output connected to TIM1 break input 2, TIM8 break input 2 and TIM20 break input 2 (BKIN2) */
391 #endif
392 /* Note: Output redirection specific to COMP instance: COMP1, COMP2, COMP3, COMP7 */
393 #define LL_COMP_OUTPUT_TIM1_OCCLR_COMP1_2_3_7 (COMP_CSR_COMPxOUTSEL_2 | COMP_CSR_COMPxOUTSEL_1) /*!< COMP output connected to TIM1 OCREF clear (specific to COMP instance: COMP1, COMP2, COMP3, COMP7) */
394 /* Note: Output redirection specific to COMP instance: COMP1, COMP2, COMP3 */
395 #define LL_COMP_OUTPUT_TIM2_OCCLR_COMP1_2_3 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM2 OCREF clear (specific to COMP instance: COMP1, COMP2, COMP3) */
396 /* Note: Output redirection specific to COMP instance: COMP1, COMP2, COMP4, COMP5 */
397 #define LL_COMP_OUTPUT_TIM3_OCCLR_COMP1_2_4_5 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_1 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM3 OCREF clear (specific to COMP instance: COMP1, COMP2, COMP4, COMP5) */
398 /* Note: Output redirection specific to COMP instance: COMP4, COMP5, COMP6, COMP7 */
399 #define LL_COMP_OUTPUT_TIM8_OCCLR_COMP4_5_6_7 (COMP_CSR_COMPxOUTSEL_2 | COMP_CSR_COMPxOUTSEL_1 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM8 OCREF clear (specific to COMP instance: COMP4, COMP5, COMP6, COMP7) */
400 /* Note: Output redirection specific to COMP instance: COMP1, COMP2 */
401 #define LL_COMP_OUTPUT_TIM1_IC1_COMP1_2 (COMP_CSR_COMPxOUTSEL_2 | COMP_CSR_COMPxOUTSEL_1 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM1 input capture 1 (specific to COMP instance: COMP2) */
402 #define LL_COMP_OUTPUT_TIM2_IC4_COMP1_2 (COMP_CSR_COMPxOUTSEL_3) /*!< COMP output connected to TIM2 input capture 4 (specific to COMP instance: COMP2) */
403 #define LL_COMP_OUTPUT_TIM3_IC1_COMP1_2 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_1 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM3 input capture 1 (specific to COMP instance: COMP2) */
404 #if defined(STM32F303xE) || defined(STM32F398xx)
405 #define LL_COMP_OUTPUT_TIM20_OCCLR_COMP2 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_2 | COMP_CSR_COMPxOUTSEL_1 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM20 OCREF clear (specific to COMP instance: COMP2) */
406 #endif
407 /* Note: Output redirection specific to COMP instance: COMP3 */
408 #define LL_COMP_OUTPUT_TIM3_IC2_COMP3 (COMP_CSR_COMPxOUTSEL_3) /*!< COMP output connected to TIM3 input capture 2 (specific to COMP instance: COMP3) */
409 #define LL_COMP_OUTPUT_TIM4_IC1_COMP3 (COMP_CSR_COMPxOUTSEL_2 | COMP_CSR_COMPxOUTSEL_1 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM4 input capture 1 (specific to COMP instance: COMP3) */
410 #define LL_COMP_OUTPUT_TIM15_IC1_COMP3 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_1) /*!< COMP output connected to TIM15 input capture 1 (specific to COMP instance: COMP3) */
411 #define LL_COMP_OUTPUT_TIM15_BKIN_COMP3 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_1 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM15 break input (BKIN) */
412 /* Note: Output redirection specific to COMP instance: COMP4 */
413 #define LL_COMP_OUTPUT_TIM3_IC3_COMP4 (COMP_CSR_COMPxOUTSEL_2 | COMP_CSR_COMPxOUTSEL_1) /*!< COMP output connected to TIM3 input capture 3 (specific to COMP instance: COMP4) */
414 #define LL_COMP_OUTPUT_TIM4_IC2_COMP4 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM4 input capture 2 (specific to COMP instance: COMP4) */
415 #define LL_COMP_OUTPUT_TIM15_IC2_COMP4 (COMP_CSR_COMPxOUTSEL_3) /*!< COMP output connected to TIM15 input capture 1 (specific to COMP instance: COMP4) */
416 #define LL_COMP_OUTPUT_TIM15_OCCLR_COMP4 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_1) /*!< COMP output connected to TIM15 OCREF clear (specific to COMP instance: COMP4) */
417 /* Note: Output redirection specific to COMP instance: COMP5 */
418 #define LL_COMP_OUTPUT_TIM2_IC1_COMP5 (COMP_CSR_COMPxOUTSEL_2 | COMP_CSR_COMPxOUTSEL_1) /*!< COMP output connected to TIM2 input capture 1 (specific to COMP instance: COMP5) */
419 #define LL_COMP_OUTPUT_TIM4_IC3_COMP5 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM4 input capture 3 (specific to COMP instance: COMP5) */
420 #define LL_COMP_OUTPUT_TIM17_IC1_COMP5 (COMP_CSR_COMPxOUTSEL_3) /*!< COMP output connected to TIM17 input capture 1 (specific to COMP instance: COMP5) */
421 #define LL_COMP_OUTPUT_TIM16_BKIN_COMP5 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_1) /*!< COMP output connected to TIM16 break input (BKIN) */
422 /* Note: Output redirection specific to COMP instance: COMP6 */
423 #define LL_COMP_OUTPUT_TIM2_IC2_COMP6 (COMP_CSR_COMPxOUTSEL_2 | COMP_CSR_COMPxOUTSEL_1) /*!< COMP output connected to TIM2 input capture 2 (specific to COMP instance: COMP6) */
424 #define LL_COMP_OUTPUT_TIM2_OCCLR_COMP6 (COMP_CSR_COMPxOUTSEL_3) /*!< COMP output connected to TIM2 OCREF clear (specific to COMP instance: COMP6) */
425 #define LL_COMP_OUTPUT_TIM4_IC4_COMP6 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_1 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM4 input capture 4 (specific to COMP instance: COMP6) */
426 #define LL_COMP_OUTPUT_TIM16_IC1_COMP6 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_1) /*!< COMP output connected to TIM16 input capture 1 (specific to COMP instance: COMP6) */
427 #define LL_COMP_OUTPUT_TIM16_OCCLR_COMP6 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_1 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM16 OCREF clear (specific to COMP instance: COMP6) */
428 /* Note: Output redirection specific to COMP instance: COMP7 */
429 #define LL_COMP_OUTPUT_TIM1_IC2_COMP7 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM2 input capture 1 (specific to COMP instance: COMP7) */
430 #define LL_COMP_OUTPUT_TIM2_IC3_COMP7 (COMP_CSR_COMPxOUTSEL_3) /*!< COMP output connected to TIM4 input capture 3 (specific to COMP instance: COMP7) */
431 #define LL_COMP_OUTPUT_TIM17_OCCLR_COMP7 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_1) /*!< COMP output connected to TIM17 OCREF clear (specific to COMP instance: COMP7) */
432 #define LL_COMP_OUTPUT_TIM17_BKIN_COMP7 (COMP_CSR_COMPxOUTSEL_3 | COMP_CSR_COMPxOUTSEL_1 | COMP_CSR_COMPxOUTSEL_0) /*!< COMP output connected to TIM17 break input (BKIN) */
434 /* Note: Output redirection specific to COMP instances, defined with */
435 /* generic naming not taking into account COMP instance constraints. */
436 /* Refer to literal definitions above for COMP instance constraints. */
437 /* Note: Some output redirections cannot have a generic naming, */
438 /* due to literal value different depending on COMP instance. */
439 /* (For exemple: LL_COMP_OUTPUT_TIM2_OCCLR_COMP1_2_3 and */
440 /* LL_COMP_OUTPUT_TIM2_OCCLR_COMP6). */
441 #define LL_COMP_OUTPUT_TIM1_IC1 LL_COMP_OUTPUT_TIM1_IC1_COMP1_2 /*!< COMP output connected to TIM1 input capture 1. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
442 #define LL_COMP_OUTPUT_TIM1_IC2 LL_COMP_OUTPUT_TIM1_IC2_COMP7 /*!< COMP output connected to TIM2 input capture 1. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
443 #define LL_COMP_OUTPUT_TIM1_OCCLR LL_COMP_OUTPUT_TIM1_OCCLR_COMP1_2_3_7 /*!< COMP output connected to TIM1 OCREF clear. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
444 #define LL_COMP_OUTPUT_TIM2_IC1 LL_COMP_OUTPUT_TIM2_IC1_COMP5 /*!< COMP output connected to TIM2 input capture 1. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
445 #define LL_COMP_OUTPUT_TIM2_IC2 LL_COMP_OUTPUT_TIM2_IC2_COMP6 /*!< COMP output connected to TIM2 input capture 2. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
446 #define LL_COMP_OUTPUT_TIM2_IC3 LL_COMP_OUTPUT_TIM2_IC3_COMP7 /*!< COMP output connected to TIM4 input capture 3. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
447 #define LL_COMP_OUTPUT_TIM2_IC4 LL_COMP_OUTPUT_TIM2_IC4_COMP1_2 /*!< COMP output connected to TIM2 input capture 4. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
448 #define LL_COMP_OUTPUT_TIM3_IC1 LL_COMP_OUTPUT_TIM3_IC1_COMP1_2 /*!< COMP output connected to TIM3 input capture 1. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
449 #define LL_COMP_OUTPUT_TIM3_IC2 LL_COMP_OUTPUT_TIM3_IC2_COMP3 /*!< COMP output connected to TIM3 input capture 2. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
450 #define LL_COMP_OUTPUT_TIM3_IC3 LL_COMP_OUTPUT_TIM3_IC3_COMP4 /*!< COMP output connected to TIM3 input capture 3. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
451 #define LL_COMP_OUTPUT_TIM3_OCCLR LL_COMP_OUTPUT_TIM3_OCCLR_COMP1_2_4_5 /*!< COMP output connected to TIM3 OCREF clear. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
452 #define LL_COMP_OUTPUT_TIM4_IC1 LL_COMP_OUTPUT_TIM4_IC1_COMP3 /*!< COMP output connected to TIM4 input capture 1. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
453 #define LL_COMP_OUTPUT_TIM4_IC2 LL_COMP_OUTPUT_TIM4_IC2_COMP4 /*!< COMP output connected to TIM4 input capture 2. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
454 #define LL_COMP_OUTPUT_TIM4_IC3 LL_COMP_OUTPUT_TIM4_IC3_COMP5 /*!< COMP output connected to TIM4 input capture 3. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
455 #define LL_COMP_OUTPUT_TIM4_IC4 LL_COMP_OUTPUT_TIM4_IC4_COMP6 /*!< COMP output connected to TIM4 input capture 4. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
456 #define LL_COMP_OUTPUT_TIM8_OCCLR LL_COMP_OUTPUT_TIM8_OCCLR_COMP4_5_6_7 /*!< COMP output connected to TIM8 OCREF clear. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
457 #define LL_COMP_OUTPUT_TIM15_IC1 LL_COMP_OUTPUT_TIM15_IC1_COMP3 /*!< COMP output connected to TIM15 input capture 1. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
458 #define LL_COMP_OUTPUT_TIM15_IC2 LL_COMP_OUTPUT_TIM15_IC2_COMP4 /*!< COMP output connected to TIM15 input capture 1. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
459 #define LL_COMP_OUTPUT_TIM15_BKIN LL_COMP_OUTPUT_TIM15_BKIN_COMP3 /*!< COMP output connected to TIM15 break input (BKIN). Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
460 #define LL_COMP_OUTPUT_TIM15_OCCLR LL_COMP_OUTPUT_TIM15_OCCLR_COMP4 /*!< COMP output connected to TIM15 OCREF clear. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
461 #define LL_COMP_OUTPUT_TIM16_IC1 LL_COMP_OUTPUT_TIM16_IC1_COMP6 /*!< COMP output connected to TIM16 input capture 1. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
462 #define LL_COMP_OUTPUT_TIM16_BKIN LL_COMP_OUTPUT_TIM16_BKIN_COMP5 /*!< COMP output connected to TIM16 break input (BKIN). Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
463 #define LL_COMP_OUTPUT_TIM16_OCCLR LL_COMP_OUTPUT_TIM16_OCCLR_COMP6 /*!< COMP output connected to TIM16 OCREF clear. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
464 #define LL_COMP_OUTPUT_TIM17_IC1 LL_COMP_OUTPUT_TIM17_IC1_COMP5 /*!< COMP output connected to TIM17 input capture 1. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
465 #define LL_COMP_OUTPUT_TIM17_BKIN LL_COMP_OUTPUT_TIM17_BKIN_COMP7 /*!< COMP output connected to TIM17 break input (BKIN). Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
466 #define LL_COMP_OUTPUT_TIM17_OCCLR LL_COMP_OUTPUT_TIM17_OCCLR_COMP7 /*!< COMP output connected to TIM17 OCREF clear. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
467 #if defined(STM32F303xE) || defined(STM32F398xx)
468 #define LL_COMP_OUTPUT_TIM20_OCCLR LL_COMP_OUTPUT_TIM20_OCCLR_COMP2 /*!< COMP output connected to TIM20 OCREF clear. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
469 #endif
471 #endif
472 #endif
474 * @}
477 /** @defgroup COMP_LL_EC_OUTPUT_POLARITY Comparator output - Output polarity
478 * @{
480 #define LL_COMP_OUTPUTPOL_NONINVERTED ((uint32_t)0x00000000U) /*!< COMP output polarity is not inverted: comparator output is high when the plus (non-inverting) input is at a higher voltage than the minus (inverting) input */
481 #define LL_COMP_OUTPUTPOL_INVERTED (COMP_CSR_COMPxPOL) /*!< 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 */
483 * @}
486 /** @defgroup COMP_LL_EC_OUTPUT_BLANKING_SOURCE Comparator output - Blanking source
487 * @{
489 #define LL_COMP_BLANKINGSRC_NONE ((uint32_t)0x00000000U) /*!<Comparator output without blanking */
490 #if defined(COMP_CSR_COMPxBLANKING)
491 #if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx) || defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx)
492 /* Note: Output blanking source specific to COMP instance: COMP2 */
493 #define LL_COMP_BLANKINGSRC_TIM1_OC5_COMP2 (COMP_CSR_COMPxBLANKING_0) /*!< Comparator output blanking source TIM1 OC5 (specific to COMP instance: COMP2) */
494 #define LL_COMP_BLANKINGSRC_TIM2_OC3_COMP2 (COMP_CSR_COMPxBLANKING_1) /*!< Comparator output blanking source TIM2 OC3 (specific to COMP instance: COMP2) */
495 #define LL_COMP_BLANKINGSRC_TIM3_OC3_COMP2 (COMP_CSR_COMPxBLANKING_1 | COMP_CSR_COMPxBLANKING_0) /*!< Comparator output blanking source TIM3 OC3 (specific to COMP instance: COMP2) */
496 /* Note: Output blanking source specific to COMP instance: COMP4 */
497 #define LL_COMP_BLANKINGSRC_TIM3_OC4_COMP4 (COMP_CSR_COMPxBLANKING_0) /*!< Comparator output blanking source TIM3 OC4 (specific to COMP instance: COMP4) */
498 #define LL_COMP_BLANKINGSRC_TIM15_OC1_COMP4 (COMP_CSR_COMPxBLANKING_0 | COMP_CSR_COMPxBLANKING_1) /*!< Comparator output blanking source TIM15 OC1 (specific to COMP instance: COMP4) */
499 /* Note: Output blanking source specific to COMP instance: COMP6 */
500 #define LL_COMP_BLANKINGSRC_TIM2_OC4_COMP6 (COMP_CSR_COMPxBLANKING_0 | COMP_CSR_COMPxBLANKING_1) /*!< Comparator output blanking source TIM2 OC4 (specific to COMP instance: COMP6) */
501 #define LL_COMP_BLANKINGSRC_TIM15_OC2_COMP6 (COMP_CSR_COMPxBLANKING_0) /*!< Comparator output blanking source TIM15 OC2 (specific to COMP instance: COMP6) */
503 /* Note: Output blanking source specific to COMP instances, defined with */
504 /* generic naming not taking into account COMP instance constraints. */
505 /* Refer to literal definitions above for COMP instance constraints. */
506 #define LL_COMP_BLANKINGSRC_TIM1_OC5 LL_COMP_BLANKINGSRC_TIM1_OC5_COMP2 /*!< Comparator output blanking source TIM1 OC5. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
507 #define LL_COMP_BLANKINGSRC_TIM2_OC3 LL_COMP_BLANKINGSRC_TIM2_OC3_COMP2 /*!< Comparator output blanking source TIM2 OC3. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
508 #define LL_COMP_BLANKINGSRC_TIM2_OC4 LL_COMP_BLANKINGSRC_TIM2_OC4_COMP6 /*!< Comparator output blanking source TIM2 OC4. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
509 #define LL_COMP_BLANKINGSRC_TIM3_OC3 LL_COMP_BLANKINGSRC_TIM3_OC3_COMP2 /*!< Comparator output blanking source TIM3 OC3. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
510 #define LL_COMP_BLANKINGSRC_TIM3_OC4 LL_COMP_BLANKINGSRC_TIM3_OC4_COMP4 /*!< Comparator output blanking source TIM3 OC4. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
511 #define LL_COMP_BLANKINGSRC_TIM15_OC1 LL_COMP_BLANKINGSRC_TIM15_OC1_COMP4 /*!< Comparator output blanking source TIM15 OC1. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
512 #define LL_COMP_BLANKINGSRC_TIM15_OC2 LL_COMP_BLANKINGSRC_TIM15_OC2_COMP6 /*!< Comparator output blanking source TIM15 OC2. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
514 #elif defined(STM32F302xE) || defined(STM32F302xC)
515 /* Note: Output blanking source specific to COMP instance: COMP1, COMP2 */
516 #define LL_COMP_BLANKINGSRC_TIM1_OC5_COMP1_2 (COMP_CSR_COMPxBLANKING_0) /*!< Comparator output blanking source TIM1 OC5 (specific to COMP instance: COMP1, COMP2) */
517 #define LL_COMP_BLANKINGSRC_TIM2_OC3_COMP1_2 (COMP_CSR_COMPxBLANKING_1) /*!< Comparator output blanking source TIM2 OC3 (specific to COMP instance: COMP1, COMP2) */
518 #define LL_COMP_BLANKINGSRC_TIM3_OC3_COMP1_2 (COMP_CSR_COMPxBLANKING_1 | COMP_CSR_COMPxBLANKING_0) /*!< Comparator output blanking source TIM3 OC3 (specific to COMP instance: COMP1, COMP2) */
519 /* Note: Output blanking source specific to COMP instance: COMP4 */
520 #define LL_COMP_BLANKINGSRC_TIM3_OC4_COMP4 (COMP_CSR_COMPxBLANKING_0) /*!< Comparator output blanking source TIM3 OC4 (specific to COMP instance: COMP4) */
521 #define LL_COMP_BLANKINGSRC_TIM15_OC1_COMP4 (COMP_CSR_COMPxBLANKING_0 | COMP_CSR_COMPxBLANKING_1) /*!< Comparator output blanking source TIM15 OC1 (specific to COMP instance: COMP4) */
522 /* Note: Output blanking source specific to COMP instance: COMP6 */
523 #define LL_COMP_BLANKINGSRC_TIM2_OC4_COMP6 (COMP_CSR_COMPxBLANKING_0 | COMP_CSR_COMPxBLANKING_1) /*!< Comparator output blanking source TIM2 OC4 (specific to COMP instance: COMP6) */
524 #define LL_COMP_BLANKINGSRC_TIM15_OC2_COMP6 (COMP_CSR_COMPxBLANKING_0) /*!< Comparator output blanking source TIM15 OC2 (specific to COMP instance: COMP6) */
526 /* Note: Output blanking source specific to COMP instances, defined with */
527 /* generic naming not taking into account COMP instance constraints. */
528 /* Refer to literal definitions above for COMP instance constraints. */
529 #define LL_COMP_BLANKINGSRC_TIM1_OC5 LL_COMP_BLANKINGSRC_TIM1_OC5_COMP1_2 /*!< Comparator output blanking source TIM1 OC5. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
530 #define LL_COMP_BLANKINGSRC_TIM2_OC3 LL_COMP_BLANKINGSRC_TIM2_OC3_COMP1_2 /*!< Comparator output blanking source TIM2 OC3. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
531 #define LL_COMP_BLANKINGSRC_TIM2_OC4 LL_COMP_BLANKINGSRC_TIM2_OC4_COMP6 /*!< Comparator output blanking source TIM2 OC4. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
532 #define LL_COMP_BLANKINGSRC_TIM3_OC3 LL_COMP_BLANKINGSRC_TIM3_OC3_COMP1_2 /*!< Comparator output blanking source TIM3 OC3. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
533 #define LL_COMP_BLANKINGSRC_TIM3_OC4 LL_COMP_BLANKINGSRC_TIM3_OC4_COMP4 /*!< Comparator output blanking source TIM3 OC4. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
534 #define LL_COMP_BLANKINGSRC_TIM15_OC1 LL_COMP_BLANKINGSRC_TIM15_OC1_COMP4 /*!< Comparator output blanking source TIM15 OC1. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
535 #define LL_COMP_BLANKINGSRC_TIM15_OC2 LL_COMP_BLANKINGSRC_TIM15_OC2_COMP6 /*!< Comparator output blanking source TIM15 OC2. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
537 #elif defined(STM32F303xE) || defined(STM32F398xx) || defined(STM32F303xC) || defined(STM32F358xx)
538 /* Note: Output blanking source specific to COMP instance: COMP1, COMP2, COMP7 */
539 #define LL_COMP_BLANKINGSRC_TIM1_OC5_COMP1_2_7 (COMP_CSR_COMPxBLANKING_0) /*!< Comparator output blanking source TIM1 OC5 (specific to COMP instance: COMP1, COMP2, COMP7) */
540 /* Note: Output blanking source specific to COMP instance: COMP1, COMP2 */
541 #define LL_COMP_BLANKINGSRC_TIM2_OC3_COMP1_2 (COMP_CSR_COMPxBLANKING_1) /*!< Comparator output blanking source TIM2 OC3 (specific to COMP instance: COMP1, COMP2) */
542 #define LL_COMP_BLANKINGSRC_TIM3_OC3_COMP1_2 (COMP_CSR_COMPxBLANKING_1 | COMP_CSR_COMPxBLANKING_0) /*!< Comparator output blanking source TIM3 OC3 (specific to COMP instance: COMP1, COMP2) */
543 /* Note: Output blanking source specific to COMP instance: COMP3, COMP6 */
544 #define LL_COMP_BLANKINGSRC_TIM2_OC4_COMP3_6 (COMP_CSR_COMPxBLANKING_1 | COMP_CSR_COMPxBLANKING_0) /*!< Comparator output blanking source TIM2 OC4 (specific to COMP instance: COMP3, COMP6) */
545 /* Note: Output blanking source specific to COMP instance: COMP4, COMP5, COMP6, COMP7 */
546 #define LL_COMP_BLANKINGSRC_TIM8_OC5_COMP4_5_6_7 (COMP_CSR_COMPxBLANKING_1) /*!< Comparator output blanking source TIM8 OC5 (specific to COMP instance: COMP4, COMP5, COMP6, COMP7) */
547 /* Note: Output blanling source specific to COMP instance: COMP6, COMP7 */
548 #define LL_COMP_BLANKINGSRC_TIM15_OC2_COMP6_7 (COMP_CSR_COMPxBLANKING_2) /*!< Comparator output blanking source TIM15 OC2 (specific to COMP instance: COMP6, COMP7) */
549 /* Note: Output blanking source specific to COMP instance: COMP4 */
550 #define LL_COMP_BLANKINGSRC_TIM3_OC4_COMP4 (COMP_CSR_COMPxBLANKING_0) /*!< Comparator output blanking source TIM3 OC4 (specific to COMP instance: COMP4) */
551 #define LL_COMP_BLANKINGSRC_TIM15_OC1_COMP4 (COMP_CSR_COMPxBLANKING_1 | COMP_CSR_COMPxBLANKING_0) /*!< Comparator output blanking source TIM15 OC1 (specific to COMP instance: COMP4) */
553 /* Note: Output blanking source specific to COMP instances, defined with */
554 /* generic naming not taking into account COMP instance constraints. */
555 /* Refer to literal definitions above for COMP instance constraints. */
556 #define LL_COMP_BLANKINGSRC_TIM1_OC5 LL_COMP_BLANKINGSRC_TIM1_OC5_COMP1_2_7 /*!< Comparator output blanking source TIM1 OC5. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
557 #define LL_COMP_BLANKINGSRC_TIM2_OC3 LL_COMP_BLANKINGSRC_TIM2_OC3_COMP1_2 /*!< Comparator output blanking source TIM2 OC3. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
558 #define LL_COMP_BLANKINGSRC_TIM2_OC4 LL_COMP_BLANKINGSRC_TIM2_OC4_COMP3_6 /*!< Comparator output blanking source TIM2 OC4. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
559 #define LL_COMP_BLANKINGSRC_TIM3_OC3 LL_COMP_BLANKINGSRC_TIM3_OC3_COMP1_2 /*!< Comparator output blanking source TIM3 OC3. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
560 #define LL_COMP_BLANKINGSRC_TIM3_OC4 LL_COMP_BLANKINGSRC_TIM3_OC4_COMP4 /*!< Comparator output blanking source TIM3 OC4. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
561 #define LL_COMP_BLANKINGSRC_TIM8_OC5 LL_COMP_BLANKINGSRC_TIM8_OC5_COMP4_5_6_7 /*!< Comparator output blanking source TIM8 OC5. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
562 #define LL_COMP_BLANKINGSRC_TIM15_OC1 LL_COMP_BLANKINGSRC_TIM15_OC1_COMP4 /*!< Comparator output blanking source TIM15 OC1. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
563 #define LL_COMP_BLANKINGSRC_TIM15_OC2 LL_COMP_BLANKINGSRC_TIM15_OC2_COMP6_7 /*!< Comparator output blanking source TIM15 OC2. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
565 #endif
566 #endif
568 * @}
571 /** @defgroup COMP_LL_EC_OUTPUT_LEVEL Comparator output - Output level
572 * @{
574 #define LL_COMP_OUTPUT_LEVEL_LOW ((uint32_t)0x00000000U) /*!< Comparator output level low (if the polarity is not inverted, otherwise to be complemented) */
575 #define LL_COMP_OUTPUT_LEVEL_HIGH ((uint32_t)0x00000001U) /*!< Comparator output level high (if the polarity is not inverted, otherwise to be complemented) */
577 * @}
580 /** @defgroup COMP_LL_EC_HW_DELAYS Definitions of COMP hardware constraints delays
581 * @note Only COMP IP HW delays are defined in COMP LL driver driver,
582 * not timeout values.
583 * For details on delays values, refer to descriptions in source code
584 * above each literal definition.
585 * @{
588 /* Delay for comparator startup time. */
589 /* Note: Delay required to reach propagation delay specification. */
590 /* Literal set to maximum value (refer to device datasheet, */
591 /* parameter "tSTART"). */
592 /* Unit: us */
593 #if defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx)
594 #define LL_COMP_DELAY_STARTUP_US ((uint32_t) 60U) /*!< Delay for COMP startup time */
595 #else
596 #define LL_COMP_DELAY_STARTUP_US ((uint32_t) 10U) /*!< Delay for COMP startup time */
597 #endif
599 /* Delay for comparator voltage scaler stabilization time. */
600 /* Note: Voltage scaler is used when selecting comparator input */
601 /* based on VrefInt: VrefInt or subdivision of VrefInt. */
602 /* Literal set to maximum value (refer to device datasheet, */
603 /* parameter "tS_SC"). */
604 /* Unit: us */
605 #define LL_COMP_DELAY_VOLTAGE_SCALER_STAB_US ((uint32_t) 200U) /*!< Delay for COMP voltage scaler stabilization time */
608 * @}
612 * @}
615 /* Exported macro ------------------------------------------------------------*/
616 /** @defgroup COMP_LL_Exported_Macros COMP Exported Macros
617 * @{
619 /** @defgroup COMP_LL_EM_WRITE_READ Common write and read registers macro
620 * @{
624 * @brief Write a value in COMP register
625 * @param __INSTANCE__ comparator instance
626 * @param __REG__ Register to be written
627 * @param __VALUE__ Value to be written in the register
628 * @retval None
630 #define LL_COMP_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
633 * @brief Read a value in COMP register
634 * @param __INSTANCE__ comparator instance
635 * @param __REG__ Register to be read
636 * @retval Register value
638 #define LL_COMP_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
640 * @}
643 /** @defgroup COMP_LL_EM_HELPER_MACRO COMP helper macro
644 * @{
648 * @brief Helper macro to select the COMP common instance
649 * to which is belonging the selected COMP instance.
650 * @note COMP common register instance can be used to
651 * set parameters common to several COMP instances.
652 * Refer to functions having argument "COMPxy_COMMON" as parameter.
653 * @param __COMPx__ COMP instance
654 * @retval COMP common instance or value "0" if there is no COMP common instance.
656 #if defined(COMP1) && defined(COMP2) && defined(COMP3) && defined(COMP4) && defined(COMP5) && defined(COMP6) && defined(COMP7)
657 /* Note: On STM32F3 serie devices with 7 comparator instances, */
658 /* COMP instance COMP7 has no other comparator instance to work */
659 /* in pair with: window mode is not available for COMP7. */
660 #define __LL_COMP_COMMON_INSTANCE(__COMPx__) \
661 ((((__COMPx__) == COMP1) || ((__COMPx__) == COMP2)) \
662 ? ( \
663 (COMP12_COMMON) \
666 ((((__COMPx__) == COMP3) || ((__COMPx__) == COMP4)) \
667 ? ( \
668 (COMP34_COMMON) \
671 ((((__COMPx__) == COMP5) || ((__COMPx__) == COMP6)) \
672 ? ( \
673 (COMP56_COMMON) \
677 ((uint32_t)0U) \
682 #elif defined(COMP1) && defined(COMP2) && defined(COMP4) && defined(COMP6)
683 #define __LL_COMP_COMMON_INSTANCE(__COMPx__) \
684 ((((__COMPx__) == COMP1) || ((__COMPx__) == COMP2)) \
685 ? ( \
686 (COMP12_COMMON) \
690 ((uint32_t)0U) \
693 #elif defined(COMP2) && defined(COMP4) && defined(COMP6)
694 /* Note: On STM32F3 serie devices with 3 comparator instances (COMP2, 4, 6) */
695 /* COMP instances have no other comparator instance to work */
696 /* in pair with: window mode is not available for all COMP instances. */
697 #define __LL_COMP_COMMON_INSTANCE(__COMPx__) \
698 ((uint32_t)0U)
699 #endif
702 * @}
706 * @}
709 /* Exported functions --------------------------------------------------------*/
710 /** @defgroup COMP_LL_Exported_Functions COMP Exported Functions
711 * @{
714 /** @defgroup COMP_LL_EF_Configuration_comparator_common Configuration of COMP hierarchical scope: common to several COMP instances
715 * @{
719 * @brief Set window mode of a pair of comparators instances
720 * (2 consecutive COMP instances odd and even COMP<x> and COMP<x+1>).
721 * @rmtoll CSR COMPxWNDWEN LL_COMP_SetCommonWindowMode
722 * @param COMPxy_COMMON Comparator common instance
723 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_COMP_COMMON_INSTANCE() )
724 * @param WindowMode This parameter can be one of the following values:
725 * @arg @ref LL_COMP_WINDOWMODE_DISABLE
726 * @arg @ref LL_COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON (1)
727 * @arg @ref LL_COMP_WINDOWMODE_COMP3_INPUT_PLUS_COMMON (2)
728 * @arg @ref LL_COMP_WINDOWMODE_COMP5_INPUT_PLUS_COMMON (2)
730 * (1) Parameter available on devices: STM32F302xB/C, STM32F303xB/C, STM32F358xC
731 * (2) Parameter available on devices: STM32F303xB/C, STM32F358xC
732 * @retval None
734 __STATIC_INLINE void LL_COMP_SetCommonWindowMode(COMP_Common_TypeDef *COMPxy_COMMON, uint32_t WindowMode)
736 #if defined(COMP_CSR_COMPxWNDWEN)
737 MODIFY_REG(COMPxy_COMMON->CSR, COMP_CSR_COMPxWNDWEN, WindowMode);
738 #else
739 /* Device without pair of comparator working in window mode */
740 /* No update of comparator register (corresponds to setting */
741 /* "LL_COMP_WINDOWMODE_DISABLE"). */
742 #endif
746 * @brief Get window mode of a pair of comparators instances
747 * (2 consecutive COMP instances odd and even COMP<x> and COMP<x+1>).
748 * @rmtoll CSR COMPxWNDWEN LL_COMP_GetCommonWindowMode
749 * @param COMPxy_COMMON Comparator common instance
750 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_COMP_COMMON_INSTANCE() )
751 * @retval Returned value can be one of the following values:
752 * @arg @ref LL_COMP_WINDOWMODE_DISABLE
753 * @arg @ref LL_COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON (1)
754 * @arg @ref LL_COMP_WINDOWMODE_COMP3_INPUT_PLUS_COMMON (2)
755 * @arg @ref LL_COMP_WINDOWMODE_COMP5_INPUT_PLUS_COMMON (2)
757 * (1) Parameter available on devices: STM32F302xB/C, STM32F303xB/C, STM32F358xC
758 * (2) Parameter available on devices: STM32F303xB/C, STM32F358xC
760 __STATIC_INLINE uint32_t LL_COMP_GetCommonWindowMode(COMP_Common_TypeDef *COMPxy_COMMON)
762 #if defined(COMP_CSR_COMPxWNDWEN)
763 return (uint32_t)(READ_BIT(COMPxy_COMMON->CSR, COMP_CSR_COMPxWNDWEN));
764 #else
765 /* Device without pair of comparator working in window mode */
766 return (LL_COMP_WINDOWMODE_DISABLE);
767 #endif
771 * @}
774 /** @defgroup COMP_LL_EF_Configuration_comparator_modes Configuration of comparator modes
775 * @{
779 * @brief Set comparator instance operating mode to adjust power and speed.
780 * @rmtoll CSR COMPxMODE LL_COMP_SetPowerMode
781 * @param COMPx Comparator instance
782 * @param PowerMode This parameter can be one of the following values:
783 * @arg @ref LL_COMP_POWERMODE_HIGHSPEED
784 * @arg @ref LL_COMP_POWERMODE_MEDIUMSPEED (1)
785 * @arg @ref LL_COMP_POWERMODE_LOWPOWER (1)
786 * @arg @ref LL_COMP_POWERMODE_ULTRALOWPOWER (1)
788 * (1) Parameter available only on devices: STM32F302xB/C, STM32F303xB/C, STM32F358xC
789 * @retval None
791 __STATIC_INLINE void LL_COMP_SetPowerMode(COMP_TypeDef *COMPx, uint32_t PowerMode)
793 #if defined(COMP_CSR_COMPxMODE)
794 MODIFY_REG(COMPx->CSR, COMP_CSR_COMPxMODE, PowerMode);
795 #else
796 /* Device without comparator power mode configurable */
797 /* No update of comparator register (corresponds to setting */
798 /* "LL_COMP_POWERMODE_HIGHSPEED"). */
799 #endif
803 * @brief Get comparator instance operating mode to adjust power and speed.
804 * @rmtoll CSR COMPxMODE LL_COMP_GetPowerMode
805 * @param COMPx Comparator instance
806 * @retval Returned value can be one of the following values:
807 * @arg @ref LL_COMP_POWERMODE_HIGHSPEED
808 * @arg @ref LL_COMP_POWERMODE_MEDIUMSPEED (1)
809 * @arg @ref LL_COMP_POWERMODE_LOWPOWER (1)
810 * @arg @ref LL_COMP_POWERMODE_ULTRALOWPOWER (1)
812 * (1) Parameter available only on devices: STM32F302xB/C, STM32F303xB/C, STM32F358xC
814 __STATIC_INLINE uint32_t LL_COMP_GetPowerMode(COMP_TypeDef *COMPx)
816 #if defined(COMP_CSR_COMPxMODE)
817 return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_COMPxMODE));
818 #else
819 /* Device without comparator power mode configurable */
820 return (LL_COMP_POWERMODE_HIGHSPEED);
821 #endif
825 * @}
828 /** @defgroup COMP_LL_EF_Configuration_comparator_inputs Configuration of comparator inputs
829 * @{
833 * @brief Set comparator inputs minus (inverting) and plus (non-inverting).
834 * @note In case of comparator input selected to be connected to IO:
835 * GPIO pins are specific to each comparator instance.
836 * Refer to description of parameters or to reference manual.
837 * @note On this STM32 serie, a voltage scaler is used
838 * when COMP input is based on VrefInt (VrefInt or subdivision
839 * of VrefInt):
840 * Voltage scaler requires a delay for voltage stabilization.
841 * Refer to device datasheet, parameter "tS_SC".
842 * @rmtoll CSR INMSEL LL_COMP_ConfigInputs\n
843 * CSR NONINSEL LL_COMP_ConfigInputs
844 * @param COMPx Comparator instance
845 * @param InputMinus This parameter can be one of the following values:
846 * @arg @ref LL_COMP_INPUT_MINUS_1_4VREFINT
847 * @arg @ref LL_COMP_INPUT_MINUS_1_2VREFINT
848 * @arg @ref LL_COMP_INPUT_MINUS_3_4VREFINT
849 * @arg @ref LL_COMP_INPUT_MINUS_VREFINT
850 * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH1
851 * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH2 (3)
852 * @arg @ref LL_COMP_INPUT_MINUS_DAC2_CH1 (2)
853 * @arg @ref LL_COMP_INPUT_MINUS_IO1
854 * @arg @ref LL_COMP_INPUT_MINUS_IO2
855 * @arg @ref LL_COMP_INPUT_MINUS_IO3 (1)
856 * @arg @ref LL_COMP_INPUT_MINUS_IO4
857 * (1) Parameter available on all devices except STM32F301x6/8, STM32F318x8, STM32F302x6/8, STM32F303x6/8, STM32F328xx, STM32F334xx.\n
858 * (2) Parameter available only on devices STM32F303x6/8, STM32F328x8, STM32F334xx.\n
859 * (3) Parameter available on all devices except STM32F301x6/8, STM32F318x8, STM32F302xx.\n
860 * @param InputPlus This parameter can be one of the following values:
861 * @arg @ref LL_COMP_INPUT_PLUS_IO1
862 * @arg @ref LL_COMP_INPUT_PLUS_IO2 (1)
863 * @arg @ref LL_COMP_INPUT_PLUS_DAC1_CH1_COMP1 (2)
864 * @arg @ref LL_COMP_INPUT_PLUS_DAC1_CH1_COMP2 (3)
866 * (1) Parameter available only on devices STM32F302xB/C, STM32F303xB/C, STM32F358xC.\n
867 * (2) Parameter available on devices: STM32F302xB/C, STM32F302xD/E, STM32F303xB/C/D/E, STM32F358xC, STM32F398xE.\n
868 * (3) Parameter available on devices: STM32F301x6/8, STM32F318xx, STM32F302x6/8.
869 * @retval None
871 __STATIC_INLINE void LL_COMP_ConfigInputs(COMP_TypeDef *COMPx, uint32_t InputMinus, uint32_t InputPlus)
873 #if defined(COMP_CSR_COMPxNONINSEL) && defined(COMP_CSR_COMPxSW1)
874 MODIFY_REG(COMPx->CSR,
875 COMP_CSR_COMPxINSEL | COMP_CSR_COMPxNONINSEL | COMP_CSR_COMPxSW1,
876 InputMinus | InputPlus);
877 #elif defined(COMP_CSR_COMPxNONINSEL)
878 MODIFY_REG(COMPx->CSR,
879 COMP_CSR_COMPxINSEL | COMP_CSR_COMPxNONINSEL,
880 InputMinus | InputPlus);
881 #elif defined(COMP_CSR_COMPxSW1)
882 MODIFY_REG(COMPx->CSR,
883 COMP_CSR_COMPxINSEL | COMP_CSR_COMPxSW1,
884 InputMinus | InputPlus);
885 #else
886 /* Device without comparator input plus configurable */
887 /* No update of comparator register (corresponds to setting */
888 /* "LL_COMP_INPUT_PLUS_IO1" or "LL_COMP_INPUT_PLUS_IO2" compared to */
889 /* other STM32F3 devices, depending on comparator instance */
890 /* (refer to reference manual)). */
891 MODIFY_REG(COMPx->CSR,
892 COMP_CSR_COMPxINSEL,
893 InputMinus);
894 #endif
898 * @brief Set comparator input plus (non-inverting).
899 * @note In case of comparator input selected to be connected to IO:
900 * GPIO pins are specific to each comparator instance.
901 * Refer to description of parameters or to reference manual.
902 * @rmtoll CSR NONINSEL LL_COMP_SetInputPlus
903 * @param COMPx Comparator instance
904 * @param InputPlus This parameter can be one of the following values:
905 * @arg @ref LL_COMP_INPUT_PLUS_IO1
906 * @arg @ref LL_COMP_INPUT_PLUS_IO2 (1)
907 * @arg @ref LL_COMP_INPUT_PLUS_DAC1_CH1_COMP1 (2)
908 * @arg @ref LL_COMP_INPUT_PLUS_DAC1_CH1_COMP2 (3)
910 * (1) Parameter available only on devices STM32F302xB/C, STM32F303xB/C, STM32F358xC.\n
911 * (2) Parameter available on devices: STM32F302xB/C, STM32F302xD/E, STM32F303xB/C/D/E, STM32F358xC, STM32F398xE.\n
912 * (3) Parameter available on devices: STM32F301x6/8, STM32F318xx, STM32F302x6/8.
913 * @retval None
915 __STATIC_INLINE void LL_COMP_SetInputPlus(COMP_TypeDef *COMPx, uint32_t InputPlus)
917 #if defined(COMP_CSR_COMPxNONINSEL) && defined(COMP_CSR_COMPxSW1)
918 MODIFY_REG(COMPx->CSR, (COMP_CSR_COMPxNONINSEL | COMP_CSR_COMPxSW1), InputPlus);
919 #elif defined(COMP_CSR_COMPxNONINSEL)
920 MODIFY_REG(COMPx->CSR, COMP_CSR_COMPxNONINSEL, InputPlus);
921 #elif defined(COMP_CSR_COMPxSW1)
922 MODIFY_REG(COMPx->CSR, COMP_CSR_COMPxSW1, InputPlus);
923 #else
924 /* Device without comparator input plus configurable */
925 /* No update of comparator register (corresponds to setting */
926 /* "LL_COMP_INPUT_PLUS_IO1" or "LL_COMP_INPUT_PLUS_IO2" compared to */
927 /* other STM32F3 devices, depending on comparator instance */
928 /* (refer to reference manual)). */
929 #endif
933 * @brief Get comparator input plus (non-inverting).
934 * @note In case of comparator input selected to be connected to IO:
935 * GPIO pins are specific to each comparator instance.
936 * Refer to description of parameters or to reference manual.
937 * @rmtoll CSR NONINSEL LL_COMP_GetInputPlus
938 * @param COMPx Comparator instance
939 * @retval Returned value can be one of the following values:
940 * @arg @ref LL_COMP_INPUT_PLUS_IO1
941 * @arg @ref LL_COMP_INPUT_PLUS_IO2 (1)
942 * @arg @ref LL_COMP_INPUT_PLUS_DAC1_CH1_COMP1 (2)
943 * @arg @ref LL_COMP_INPUT_PLUS_DAC1_CH1_COMP2 (3)
945 * (1) Parameter available only on devices STM32F302xB/C, STM32F303xB/C, STM32F358xC.\n
946 * (2) Parameter available on devices: STM32F302xB/C, STM32F302xD/E, STM32F303xB/C/D/E, STM32F358xC, STM32F398xE.\n
947 * (3) Parameter available on devices: STM32F301x6/8, STM32F318xx, STM32F302x6/8.
949 __STATIC_INLINE uint32_t LL_COMP_GetInputPlus(COMP_TypeDef *COMPx)
951 #if defined(COMP_CSR_COMPxNONINSEL) && defined(COMP_CSR_COMPxSW1)
952 return (uint32_t)(READ_BIT(COMPx->CSR, (COMP_CSR_COMPxNONINSEL | COMP_CSR_COMPxSW1)));
953 #elif defined(COMP_CSR_COMPxNONINSEL)
954 return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_COMPxNONINSEL));
955 #elif defined(COMP_CSR_COMPxSW1)
956 return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_COMPxSW1));
957 #else
958 /* Device without comparator input plus configurable */
959 /* No update of comparator register (corresponds to setting */
960 /* "LL_COMP_INPUT_PLUS_IO1" or "LL_COMP_INPUT_PLUS_IO2" compared to */
961 /* other STM32F3 devices, depending on comparator instance */
962 /* (refer to reference manual)). */
963 return (LL_COMP_INPUT_PLUS_IO1);
964 #endif
968 * @brief Set comparator input minus (inverting).
969 * @note In case of comparator input selected to be connected to IO:
970 * GPIO pins are specific to each comparator instance.
971 * Refer to description of parameters or to reference manual.
972 * @note On this STM32 serie, a voltage scaler is used
973 * when COMP input is based on VrefInt (VrefInt or subdivision
974 * of VrefInt):
975 * Voltage scaler requires a delay for voltage stabilization.
976 * Refer to device datasheet, parameter "tS_SC".
977 * @rmtoll CSR INMSEL LL_COMP_SetInputMinus
978 * @param COMPx Comparator instance
979 * @param InputMinus This parameter can be one of the following values:
980 * @arg @ref LL_COMP_INPUT_MINUS_1_4VREFINT
981 * @arg @ref LL_COMP_INPUT_MINUS_1_2VREFINT
982 * @arg @ref LL_COMP_INPUT_MINUS_3_4VREFINT
983 * @arg @ref LL_COMP_INPUT_MINUS_VREFINT
984 * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH1
985 * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH2 (3)
986 * @arg @ref LL_COMP_INPUT_MINUS_DAC2_CH1 (2)
987 * @arg @ref LL_COMP_INPUT_MINUS_IO1
988 * @arg @ref LL_COMP_INPUT_MINUS_IO2
989 * @arg @ref LL_COMP_INPUT_MINUS_IO3 (1)
990 * @arg @ref LL_COMP_INPUT_MINUS_IO4
991 * (1) Parameter available on all devices except STM32F301x6/8, STM32F318x8, STM32F302x6/8, STM32F303x6/8, STM32F328xx, STM32F334xx.\n
992 * (2) Parameter available only on devices STM32F303x6/8, STM32F328x8, STM32F334xx.\n
993 * (3) Parameter available on all devices except STM32F301x6/8, STM32F318x8, STM32F302xx.\n
994 * @retval None
996 __STATIC_INLINE void LL_COMP_SetInputMinus(COMP_TypeDef *COMPx, uint32_t InputMinus)
998 MODIFY_REG(COMPx->CSR, COMP_CSR_COMPxINSEL, InputMinus);
1002 * @brief Get comparator input minus (inverting).
1003 * @note In case of comparator input selected to be connected to IO:
1004 * GPIO pins are specific to each comparator instance.
1005 * Refer to description of parameters or to reference manual.
1006 * @rmtoll CSR INMSEL LL_COMP_GetInputMinus
1007 * @param COMPx Comparator instance
1008 * @retval Returned value can be one of the following values:
1009 * @arg @ref LL_COMP_INPUT_MINUS_1_4VREFINT
1010 * @arg @ref LL_COMP_INPUT_MINUS_1_2VREFINT
1011 * @arg @ref LL_COMP_INPUT_MINUS_3_4VREFINT
1012 * @arg @ref LL_COMP_INPUT_MINUS_VREFINT
1013 * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH1
1014 * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH2 (3)
1015 * @arg @ref LL_COMP_INPUT_MINUS_DAC2_CH1 (2)
1016 * @arg @ref LL_COMP_INPUT_MINUS_IO1
1017 * @arg @ref LL_COMP_INPUT_MINUS_IO2
1018 * @arg @ref LL_COMP_INPUT_MINUS_IO3 (1)
1019 * @arg @ref LL_COMP_INPUT_MINUS_IO4
1020 * (1) Parameter available on all devices except STM32F301x6/8, STM32F318x8, STM32F302x6/8, STM32F303x6/8, STM32F328xx, STM32F334xx.\n
1021 * (2) Parameter available only on devices STM32F303x6/8, STM32F328x8, STM32F334xx.\n
1022 * (3) Parameter available on all devices except STM32F301x6/8, STM32F318x8, STM32F302xx.\n
1024 __STATIC_INLINE uint32_t LL_COMP_GetInputMinus(COMP_TypeDef *COMPx)
1026 return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_COMPxINSEL));
1030 * @brief Set comparator instance hysteresis mode of the input minus (inverting input).
1031 * @rmtoll CSR COMPxHYST LL_COMP_SetInputHysteresis
1032 * @param COMPx Comparator instance
1033 * @param InputHysteresis This parameter can be one of the following values:
1034 * @arg @ref LL_COMP_HYSTERESIS_NONE
1035 * @arg @ref LL_COMP_HYSTERESIS_LOW (1)
1036 * @arg @ref LL_COMP_HYSTERESIS_MEDIUM (1)
1037 * @arg @ref LL_COMP_HYSTERESIS_HIGH (1)
1039 * (1) Parameter available only on devices: STM32F302xB/C, STM32F303xB/C, STM32F358xC
1040 * @retval None
1042 __STATIC_INLINE void LL_COMP_SetInputHysteresis(COMP_TypeDef *COMPx, uint32_t InputHysteresis)
1044 #if defined(COMP_CSR_COMPxHYST)
1045 MODIFY_REG(COMPx->CSR, COMP_CSR_COMPxHYST, InputHysteresis);
1046 #else
1047 /* Device without comparator input hysteresis */
1048 /* No update of comparator register (corresponds to setting */
1049 /* "LL_COMP_HYSTERESIS_NONE"). */
1050 #endif
1054 * @brief Get comparator instance hysteresis mode of the minus (inverting) input.
1055 * @rmtoll CSR COMPxHYST LL_COMP_GetInputHysteresis
1056 * @param COMPx Comparator instance
1057 * @retval Returned value can be one of the following values:
1058 * @arg @ref LL_COMP_HYSTERESIS_NONE
1059 * @arg @ref LL_COMP_HYSTERESIS_LOW (1)
1060 * @arg @ref LL_COMP_HYSTERESIS_MEDIUM (1)
1061 * @arg @ref LL_COMP_HYSTERESIS_HIGH (1)
1063 * (1) Parameter available only on devices: STM32F302xB/C, STM32F303xB/C, STM32F358xC
1065 __STATIC_INLINE uint32_t LL_COMP_GetInputHysteresis(COMP_TypeDef *COMPx)
1067 #if defined(COMP_CSR_COMPxHYST)
1068 return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_COMPxHYST));
1069 #else
1070 /* Device without comparator input hysteresis */
1071 return (LL_COMP_HYSTERESIS_NONE);
1072 #endif
1076 * @}
1079 /** @defgroup COMP_LL_EF_Configuration_comparator_output Configuration of comparator output
1080 * @{
1084 * @brief Set comparator output selection.
1085 * @note Availability of parameters of output selection to timer
1086 * depends on timers availability on the selected device.
1087 * @rmtoll CSR COMPxOUTSEL LL_COMP_SetOutputSelection
1088 * @param COMPx Comparator instance
1089 * @param OutputSelection This parameter can be one of the following values:
1090 * @arg @ref LL_COMP_OUTPUT_NONE
1091 * @arg @ref LL_COMP_OUTPUT_TIM1_BKIN
1092 * @arg @ref LL_COMP_OUTPUT_TIM1_BKIN2
1093 * @arg @ref LL_COMP_OUTPUT_TIM1_TIM8_BKIN2
1094 * @arg @ref LL_COMP_OUTPUT_TIM8_BKIN (4)
1095 * @arg @ref LL_COMP_OUTPUT_TIM8_BKIN2 (4)
1096 * @arg @ref LL_COMP_OUTPUT_TIM1_TIM8_BKIN2 (4)
1097 * @arg @ref LL_COMP_OUTPUT_TIM20_BKIN (5)
1098 * @arg @ref LL_COMP_OUTPUT_TIM20_BKIN2 (5)
1099 * @arg @ref LL_COMP_OUTPUT_TIM1_TIM8_TIM20_BKIN2 (5)
1100 * @arg @ref LL_COMP_OUTPUT_TIM1_OCCLR_COMP1_2_3_7 (4)
1101 * @arg @ref LL_COMP_OUTPUT_TIM2_OCCLR_COMP1_2_3 (4)
1102 * @arg @ref LL_COMP_OUTPUT_TIM3_OCCLR_COMP1_2_4_5 (4)
1103 * @arg @ref LL_COMP_OUTPUT_TIM8_OCCLR_COMP4_5_6_7 (4)
1104 * @arg @ref LL_COMP_OUTPUT_TIM3_OCCLR_COMP2_4 (6)
1105 * @arg @ref LL_COMP_OUTPUT_TIM1_IC1_COMP2 (2)
1106 * @arg @ref LL_COMP_OUTPUT_TIM2_IC4_COMP2 (2)
1107 * @arg @ref LL_COMP_OUTPUT_TIM3_IC1_COMP2 (1)
1108 * @arg @ref LL_COMP_OUTPUT_TIM1_IC1_COMP1_2 (3)
1109 * @arg @ref LL_COMP_OUTPUT_TIM2_IC4_COMP1_2 (3)
1110 * @arg @ref LL_COMP_OUTPUT_TIM3_IC1_COMP1_2 (3)
1111 * @arg @ref LL_COMP_OUTPUT_TIM20_OCCLR_COMP2 (5)
1112 * @arg @ref LL_COMP_OUTPUT_TIM3_IC2_COMP3 (4)
1113 * @arg @ref LL_COMP_OUTPUT_TIM4_IC1_COMP3 (4)
1114 * @arg @ref LL_COMP_OUTPUT_TIM15_IC1_COMP3 (4)
1115 * @arg @ref LL_COMP_OUTPUT_TIM15_BKIN
1116 * @arg @ref LL_COMP_OUTPUT_TIM3_IC3_COMP4 (1)
1117 * @arg @ref LL_COMP_OUTPUT_TIM4_IC2_COMP4
1118 * @arg @ref LL_COMP_OUTPUT_TIM15_IC2_COMP4
1119 * @arg @ref LL_COMP_OUTPUT_TIM15_OCCLR_COMP4
1120 * @arg @ref LL_COMP_OUTPUT_TIM2_IC1_COMP5 (4)
1121 * @arg @ref LL_COMP_OUTPUT_TIM4_IC3_COMP5 (4)
1122 * @arg @ref LL_COMP_OUTPUT_TIM17_IC1_COMP5 (4)
1123 * @arg @ref LL_COMP_OUTPUT_TIM16_BKIN
1124 * @arg @ref LL_COMP_OUTPUT_TIM2_IC2_COMP6
1125 * @arg @ref LL_COMP_OUTPUT_TIM2_OCCLR_COMP6
1126 * @arg @ref LL_COMP_OUTPUT_TIM4_IC4_COMP6
1127 * @arg @ref LL_COMP_OUTPUT_TIM16_IC1_COMP6
1128 * @arg @ref LL_COMP_OUTPUT_TIM16_OCCLR_COMP6
1129 * @arg @ref LL_COMP_OUTPUT_TIM1_IC2_COMP7 (4)
1130 * @arg @ref LL_COMP_OUTPUT_TIM2_IC3_COMP7 (4)
1131 * @arg @ref LL_COMP_OUTPUT_TIM17_OCCLR_COMP7 (4)
1132 * @arg @ref LL_COMP_OUTPUT_TIM17_BKIN (4)
1134 * (1) Parameter available on devices: STM32F302x8, STM32F318xx, STM32F303x8, STM32F328xx, STM32F334x8, STM32F302xC, STM32F302xE, STM32F303xC, STM32F358xx, STM32F303xE, STM32F398xx.\n
1135 * (2) Parameter available on devices: STM32F301x8, STM32F302x8, STM32F318xx, STM32F303x8, STM32F328xx, STM32F334x8.\n
1136 * (3) Parameter available on devices: STM32F302xC, STM32F302xE, STM32F303xC, STM32F358xx, STM32F303xE, STM32F398xx.\n
1137 * (4) Parameter available on devices: STM32F303xC, STM32F358xx, STM32F303xE, STM32F398xx.\n
1138 * (5) Parameter available on devices: STM32F303xE, STM32F398xx.\n
1139 * (6) Parameter available on devices: STM32F303x8, STM32F328xx, STM32F334x8.
1140 * @retval None
1142 __STATIC_INLINE void LL_COMP_SetOutputSelection(COMP_TypeDef *COMPx, uint32_t OutputSelection)
1144 MODIFY_REG(COMPx->CSR, COMP_CSR_COMPxOUTSEL , OutputSelection);
1148 * @brief Get comparator output selection.
1149 * @note Availability of parameters of output selection to timer
1150 * depends on timers availability on the selected device.
1151 * @rmtoll CSR COMPxOUTSEL LL_COMP_GetOutputSelection
1152 * @param COMPx Comparator instance
1153 * @retval Returned value can be one of the following values:
1154 * @arg @ref LL_COMP_OUTPUT_NONE
1155 * @arg @ref LL_COMP_OUTPUT_TIM1_BKIN
1156 * @arg @ref LL_COMP_OUTPUT_TIM1_BKIN2
1157 * @arg @ref LL_COMP_OUTPUT_TIM1_TIM8_BKIN2
1158 * @arg @ref LL_COMP_OUTPUT_TIM8_BKIN (4)
1159 * @arg @ref LL_COMP_OUTPUT_TIM8_BKIN2 (4)
1160 * @arg @ref LL_COMP_OUTPUT_TIM1_TIM8_BKIN2 (4)
1161 * @arg @ref LL_COMP_OUTPUT_TIM20_BKIN (5)
1162 * @arg @ref LL_COMP_OUTPUT_TIM20_BKIN2 (5)
1163 * @arg @ref LL_COMP_OUTPUT_TIM1_TIM8_TIM20_BKIN2 (5)
1164 * @arg @ref LL_COMP_OUTPUT_TIM1_OCCLR_COMP1_2_3_7 (4)
1165 * @arg @ref LL_COMP_OUTPUT_TIM2_OCCLR_COMP1_2_3 (4)
1166 * @arg @ref LL_COMP_OUTPUT_TIM3_OCCLR_COMP1_2_4_5 (4)
1167 * @arg @ref LL_COMP_OUTPUT_TIM8_OCCLR_COMP4_5_6_7 (4)
1168 * @arg @ref LL_COMP_OUTPUT_TIM3_OCCLR_COMP2_4 (6)
1169 * @arg @ref LL_COMP_OUTPUT_TIM1_IC1_COMP2 (2)
1170 * @arg @ref LL_COMP_OUTPUT_TIM2_IC4_COMP2 (2)
1171 * @arg @ref LL_COMP_OUTPUT_TIM3_IC1_COMP2 (1)
1172 * @arg @ref LL_COMP_OUTPUT_TIM1_IC1_COMP1_2 (3)
1173 * @arg @ref LL_COMP_OUTPUT_TIM2_IC4_COMP1_2 (3)
1174 * @arg @ref LL_COMP_OUTPUT_TIM3_IC1_COMP1_2 (3)
1175 * @arg @ref LL_COMP_OUTPUT_TIM20_OCCLR_COMP2 (5)
1176 * @arg @ref LL_COMP_OUTPUT_TIM3_IC2_COMP3 (4)
1177 * @arg @ref LL_COMP_OUTPUT_TIM4_IC1_COMP3 (4)
1178 * @arg @ref LL_COMP_OUTPUT_TIM15_IC1_COMP3 (4)
1179 * @arg @ref LL_COMP_OUTPUT_TIM15_BKIN
1180 * @arg @ref LL_COMP_OUTPUT_TIM3_IC3_COMP4 (1)
1181 * @arg @ref LL_COMP_OUTPUT_TIM4_IC2_COMP4
1182 * @arg @ref LL_COMP_OUTPUT_TIM15_IC2_COMP4
1183 * @arg @ref LL_COMP_OUTPUT_TIM15_OCCLR_COMP4
1184 * @arg @ref LL_COMP_OUTPUT_TIM2_IC1_COMP5 (4)
1185 * @arg @ref LL_COMP_OUTPUT_TIM4_IC3_COMP5 (4)
1186 * @arg @ref LL_COMP_OUTPUT_TIM17_IC1_COMP5 (4)
1187 * @arg @ref LL_COMP_OUTPUT_TIM16_BKIN
1188 * @arg @ref LL_COMP_OUTPUT_TIM2_IC2_COMP6
1189 * @arg @ref LL_COMP_OUTPUT_TIM2_OCCLR_COMP6
1190 * @arg @ref LL_COMP_OUTPUT_TIM4_IC4_COMP6
1191 * @arg @ref LL_COMP_OUTPUT_TIM16_IC1_COMP6
1192 * @arg @ref LL_COMP_OUTPUT_TIM16_OCCLR_COMP6
1193 * @arg @ref LL_COMP_OUTPUT_TIM1_IC2_COMP7 (4)
1194 * @arg @ref LL_COMP_OUTPUT_TIM2_IC3_COMP7 (4)
1195 * @arg @ref LL_COMP_OUTPUT_TIM17_OCCLR_COMP7 (4)
1196 * @arg @ref LL_COMP_OUTPUT_TIM17_BKIN (4)
1198 * (1) Parameter available on devices: STM32F302x8, STM32F318xx, STM32F303x8, STM32F328xx, STM32F334x8, STM32F302xC, STM32F302xE, STM32F303xC, STM32F358xx, STM32F303xE, STM32F398xx.\n
1199 * (2) Parameter available on devices: STM32F301x8, STM32F302x8, STM32F318xx, STM32F303x8, STM32F328xx, STM32F334x8.\n
1200 * (3) Parameter available on devices: STM32F302xC, STM32F302xE, STM32F303xC, STM32F358xx, STM32F303xE, STM32F398xx.\n
1201 * (4) Parameter available on devices: STM32F303xC, STM32F358xx, STM32F303xE, STM32F398xx.\n
1202 * (5) Parameter available on devices: STM32F303xE, STM32F398xx.\n
1203 * (6) Parameter available on devices: STM32F303x8, STM32F328xx, STM32F334x8.
1205 __STATIC_INLINE uint32_t LL_COMP_GetOutputSelection(COMP_TypeDef *COMPx)
1207 return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_COMPxOUTSEL));
1211 * @brief Set comparator instance output polarity.
1212 * @rmtoll CSR COMPxPOL LL_COMP_SetOutputPolarity
1213 * @param COMPx Comparator instance
1214 * @param OutputPolarity This parameter can be one of the following values:
1215 * @arg @ref LL_COMP_OUTPUTPOL_NONINVERTED
1216 * @arg @ref LL_COMP_OUTPUTPOL_INVERTED
1217 * @retval None
1219 __STATIC_INLINE void LL_COMP_SetOutputPolarity(COMP_TypeDef *COMPx, uint32_t OutputPolarity)
1221 MODIFY_REG(COMPx->CSR, COMP_CSR_COMPxPOL, OutputPolarity);
1225 * @brief Get comparator instance output polarity.
1226 * @rmtoll CSR COMPxPOL LL_COMP_GetOutputPolarity
1227 * @param COMPx Comparator instance
1228 * @retval Returned value can be one of the following values:
1229 * @arg @ref LL_COMP_OUTPUTPOL_NONINVERTED
1230 * @arg @ref LL_COMP_OUTPUTPOL_INVERTED
1232 __STATIC_INLINE uint32_t LL_COMP_GetOutputPolarity(COMP_TypeDef *COMPx)
1234 return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_COMPxPOL));
1238 * @brief Set comparator instance blanking source.
1239 * @note Blanking source may be specific to each comparator instance.
1240 * Refer to description of parameters or to reference manual.
1241 * @note Availability of parameters of blanking source from timer
1242 * depends on timers availability on the selected device.
1243 * @rmtoll CSR COMPxBLANKING LL_COMP_SetOutputBlankingSource
1244 * @param COMPx Comparator instance
1245 * @param BlankingSource This parameter can be one of the following values:
1246 * @arg @ref LL_COMP_BLANKINGSRC_NONE
1247 * @arg @ref LL_COMP_BLANKINGSRC_TIM1_OC5_COMP2 (1)
1248 * @arg @ref LL_COMP_BLANKINGSRC_TIM2_OC3_COMP2 (1)
1249 * @arg @ref LL_COMP_BLANKINGSRC_TIM3_OC3_COMP2 (1)
1250 * @arg @ref LL_COMP_BLANKINGSRC_TIM1_OC5_COMP1_2 (2)(3)
1251 * @arg @ref LL_COMP_BLANKINGSRC_TIM2_OC3_COMP1_2 (2)(3)
1252 * @arg @ref LL_COMP_BLANKINGSRC_TIM3_OC3_COMP1_2 (2)(3)
1253 * @arg @ref LL_COMP_BLANKINGSRC_TIM3_OC4_COMP4
1254 * @arg @ref LL_COMP_BLANKINGSRC_TIM15_OC1_COMP4
1255 * @arg @ref LL_COMP_BLANKINGSRC_TIM2_OC4_COMP6 (2)
1256 * @arg @ref LL_COMP_BLANKINGSRC_TIM15_OC2_COMP6 (1)(2)
1257 * @arg @ref LL_COMP_BLANKINGSRC_TIM1_OC5_COMP1_2_7 (3)
1258 * @arg @ref LL_COMP_BLANKINGSRC_TIM2_OC4_COMP3_6 (3)
1259 * @arg @ref LL_COMP_BLANKINGSRC_TIM8_OC5_COMP4_5_6_7 (3)
1260 * @arg @ref LL_COMP_BLANKINGSRC_TIM15_OC2_COMP6_7 (3)
1262 * (1) Parameter available on devices: STM32F301x8, STM32F302x8, STM32F318xx, STM32F303x8, STM32F334x8, STM32F328xx.\n
1263 * (2) Parameter available on devices: STM32F302xE, STM32F302xC.\n
1264 * (3) Parameter available on devices: STM32F303xE, STM32F398xx, STM32F303xC, STM32F358xx.
1265 * @retval None
1267 __STATIC_INLINE void LL_COMP_SetOutputBlankingSource(COMP_TypeDef *COMPx, uint32_t BlankingSource)
1269 MODIFY_REG(COMPx->CSR, COMP_CSR_COMPxBLANKING, BlankingSource);
1273 * @brief Get comparator instance blanking source.
1274 * @note Availability of parameters of blanking source from timer
1275 * depends on timers availability on the selected device.
1276 * @note Blanking source may be specific to each comparator instance.
1277 * Refer to description of parameters or to reference manual.
1278 * @rmtoll CSR COMPxBLANKING LL_COMP_GetOutputBlankingSource
1279 * @param COMPx Comparator instance
1280 * @retval Returned value can be one of the following values:
1281 * @arg @ref LL_COMP_BLANKINGSRC_NONE
1282 * @arg @ref LL_COMP_BLANKINGSRC_TIM1_OC5_COMP2 (1)
1283 * @arg @ref LL_COMP_BLANKINGSRC_TIM2_OC3_COMP2 (1)
1284 * @arg @ref LL_COMP_BLANKINGSRC_TIM3_OC3_COMP2 (1)
1285 * @arg @ref LL_COMP_BLANKINGSRC_TIM1_OC5_COMP1_2 (2)(3)
1286 * @arg @ref LL_COMP_BLANKINGSRC_TIM2_OC3_COMP1_2 (2)(3)
1287 * @arg @ref LL_COMP_BLANKINGSRC_TIM3_OC3_COMP1_2 (2)(3)
1288 * @arg @ref LL_COMP_BLANKINGSRC_TIM3_OC4_COMP4
1289 * @arg @ref LL_COMP_BLANKINGSRC_TIM15_OC1_COMP4
1290 * @arg @ref LL_COMP_BLANKINGSRC_TIM2_OC4_COMP6 (2)
1291 * @arg @ref LL_COMP_BLANKINGSRC_TIM15_OC2_COMP6 (1)(2)
1292 * @arg @ref LL_COMP_BLANKINGSRC_TIM1_OC5_COMP1_2_7 (3)
1293 * @arg @ref LL_COMP_BLANKINGSRC_TIM2_OC4_COMP3_6 (3)
1294 * @arg @ref LL_COMP_BLANKINGSRC_TIM8_OC5_COMP4_5_6_7 (3)
1295 * @arg @ref LL_COMP_BLANKINGSRC_TIM15_OC2_COMP6_7 (3)
1297 * (1) Parameter available on devices: STM32F301x8, STM32F302x8, STM32F318xx, STM32F303x8, STM32F334x8, STM32F328xx.\n
1298 * (2) Parameter available on devices: STM32F302xE, STM32F302xC.\n
1299 * (3) Parameter available on devices: STM32F303xE, STM32F398xx, STM32F303xC, STM32F358xx.
1301 __STATIC_INLINE uint32_t LL_COMP_GetOutputBlankingSource(COMP_TypeDef *COMPx)
1303 return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_COMPxBLANKING));
1307 * @}
1310 /** @defgroup COMP_LL_EF_Operation Operation on comparator instance
1311 * @{
1315 * @brief Enable comparator instance.
1316 * @note After enable from off state, comparator requires a delay
1317 * to reach reach propagation delay specification.
1318 * Refer to device datasheet, parameter "tSTART".
1319 * @rmtoll CSR COMPxEN LL_COMP_Enable
1320 * @param COMPx Comparator instance
1321 * @retval None
1323 __STATIC_INLINE void LL_COMP_Enable(COMP_TypeDef *COMPx)
1325 SET_BIT(COMPx->CSR, COMP_CSR_COMPxEN);
1329 * @brief Disable comparator instance.
1330 * @rmtoll CSR COMPxEN LL_COMP_Disable
1331 * @param COMPx Comparator instance
1332 * @retval None
1334 __STATIC_INLINE void LL_COMP_Disable(COMP_TypeDef *COMPx)
1336 CLEAR_BIT(COMPx->CSR, COMP_CSR_COMPxEN);
1340 * @brief Get comparator enable state
1341 * (0: COMP is disabled, 1: COMP is enabled)
1342 * @rmtoll CSR COMPxEN LL_COMP_IsEnabled
1343 * @param COMPx Comparator instance
1344 * @retval State of bit (1 or 0).
1346 __STATIC_INLINE uint32_t LL_COMP_IsEnabled(COMP_TypeDef *COMPx)
1348 return (READ_BIT(COMPx->CSR, COMP_CSR_COMPxEN) == (COMP_CSR_COMPxEN));
1352 * @brief Lock comparator instance.
1353 * @note Once locked, comparator configuration can be accessed in read-only.
1354 * @note The only way to unlock the comparator is a device hardware reset.
1355 * @rmtoll CSR COMPxLOCK LL_COMP_Lock
1356 * @param COMPx Comparator instance
1357 * @retval None
1359 __STATIC_INLINE void LL_COMP_Lock(COMP_TypeDef *COMPx)
1361 SET_BIT(COMPx->CSR, COMP_CSR_COMPxLOCK);
1365 * @brief Get comparator lock state
1366 * (0: COMP is unlocked, 1: COMP is locked).
1367 * @note Once locked, comparator configuration can be accessed in read-only.
1368 * @note The only way to unlock the comparator is a device hardware reset.
1369 * @rmtoll CSR COMPxLOCK LL_COMP_IsLocked
1370 * @param COMPx Comparator instance
1371 * @retval State of bit (1 or 0).
1373 __STATIC_INLINE uint32_t LL_COMP_IsLocked(COMP_TypeDef *COMPx)
1375 return (READ_BIT(COMPx->CSR, COMP_CSR_COMPxLOCK) == (COMP_CSR_COMPxLOCK));
1379 * @brief Read comparator instance output level.
1380 * @note The comparator output level depends on the selected polarity
1381 * (Refer to function @ref LL_COMP_SetOutputPolarity()).
1382 * If the comparator polarity is not inverted:
1383 * - Comparator output is low when the input plus
1384 * is at a lower voltage than the input minus
1385 * - Comparator output is high when the input plus
1386 * is at a higher voltage than the input minus
1387 * If the comparator polarity is inverted:
1388 * - Comparator output is high when the input plus
1389 * is at a lower voltage than the input minus
1390 * - Comparator output is low when the input plus
1391 * is at a higher voltage than the input minus
1392 * @rmtoll CSR COMPxOUT LL_COMP_ReadOutputLevel
1393 * @param COMPx Comparator instance
1394 * @retval Returned value can be one of the following values:
1395 * @arg @ref LL_COMP_OUTPUT_LEVEL_LOW
1396 * @arg @ref LL_COMP_OUTPUT_LEVEL_HIGH
1398 __STATIC_INLINE uint32_t LL_COMP_ReadOutputLevel(COMP_TypeDef *COMPx)
1400 return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_COMPxOUT)
1401 >> LL_COMP_OUTPUT_LEVEL_BITOFFSET_POS);
1405 * @}
1408 #if defined(USE_FULL_LL_DRIVER)
1409 /** @defgroup COMP_LL_EF_Init Initialization and de-initialization functions
1410 * @{
1413 ErrorStatus LL_COMP_DeInit(COMP_TypeDef *COMPx);
1414 ErrorStatus LL_COMP_Init(COMP_TypeDef *COMPx, LL_COMP_InitTypeDef *COMP_InitStruct);
1415 void LL_COMP_StructInit(LL_COMP_InitTypeDef *COMP_InitStruct);
1418 * @}
1420 #endif /* USE_FULL_LL_DRIVER */
1423 * @}
1427 * @}
1430 #endif /* COMP1 || COMP2 || COMP3 || COMP4 || COMP5 || COMP6 || COMP7 */
1433 #endif /* STM32F301x8 || STM32F302x8 || STM32F302xC || STM32F302xE || STM32F303x8 || STM32F303xC || STM32F303xE || STM32F318xx || STM32F328xx || STM32F334x8 || STM32F358xx || STM32F398xx */
1435 #if defined (COMP_V1_1_0_0)
1437 #if defined (COMP1) || defined (COMP2)
1439 /** @defgroup COMP_LL COMP
1440 * @{
1443 /* Private types -------------------------------------------------------------*/
1444 /* Private variables ---------------------------------------------------------*/
1445 /* Private constants ---------------------------------------------------------*/
1446 /** @defgroup COMP_LL_Private_Constants COMP Private Constants
1447 * @{
1450 /* Differentiation between COMP instances */
1451 /* Note: Value not corresponding to a register offset since both */
1452 /* COMP instances are sharing the same register) . */
1453 #define COMPX_BASE COMP_BASE
1454 #define COMPX (COMP1 - COMP2)
1456 /* COMP registers bits positions */
1457 #define LL_COMP_OUTPUT_LEVEL_BITOFFSET_POS ((uint32_t)14U) /* Value equivalent to POSITION_VAL(COMP_CSR_COMP1OUT) */
1460 * @}
1463 /* Private macros ------------------------------------------------------------*/
1464 /** @defgroup COMP_LL_Private_Macros COMP Private Macros
1465 * @{
1469 * @brief Driver macro reserved for internal use: if COMP instance selected
1470 * is odd (COMP1, COMP3, ...), return value '1', else return '0'.
1471 * @param __COMP_INSTANCE__ COMP instance
1472 * @retval If COMP instance is odd, value '1'. Else, value '0'.
1474 #define __COMP_IS_INSTANCE_ODD(__COMP_INSTANCE__) \
1475 ((~(((uint32_t)(__COMP_INSTANCE__) - COMP_BASE) >> 1U)) & 0x00000001)
1478 * @brief Driver macro reserved for internal use: if COMP instance selected
1479 * is even (COMP2, COMP4, ...), return value '1', else return '0'.
1480 * @param __COMP_INSTANCE__ COMP instance
1481 * @retval If COMP instance is even, value '1'. Else, value '0'.
1483 #define __COMP_IS_INSTANCE_EVEN(__COMP_INSTANCE__) \
1484 (((uint32_t)(__COMP_INSTANCE__) - COMP_BASE) >> 1U)
1487 * @brief Driver macro reserved for internal use: from COMP instance
1488 * selected, set offset of bits into COMP register.
1489 * @note Since both COMP instances are sharing the same register
1490 * with 2 area of bits with an offset of 16 bits, this function
1491 * returns value "0" if COMP1 is selected and "16" if COMP2 is
1492 * selected.
1493 * @param __COMP_INSTANCE__ COMP instance
1494 * @retval Bits offset in register 32 bits
1496 #define __COMP_BITOFFSET_INSTANCE(__COMP_INSTANCE__) \
1497 (((uint32_t)(__COMP_INSTANCE__) - COMP_BASE) << 3U)
1500 * @}
1503 /* Exported types ------------------------------------------------------------*/
1504 #if defined(USE_FULL_LL_DRIVER)
1505 /** @defgroup COMP_LL_ES_INIT COMP Exported Init structure
1506 * @{
1510 * @brief Structure definition of some features of COMP instance.
1512 typedef struct
1514 uint32_t PowerMode; /*!< Set comparator operating mode to adjust power and speed.
1515 This parameter can be a value of @ref COMP_LL_EC_POWERMODE
1517 This feature can be modified afterwards using unitary function @ref LL_COMP_SetPowerMode(). */
1519 uint32_t InputPlus; /*!< Set comparator input plus (non-inverting input).
1520 This parameter can be a value of @ref COMP_LL_EC_INPUT_PLUS
1522 This feature can be modified afterwards using unitary function @ref LL_COMP_SetInputPlus(). */
1524 uint32_t InputMinus; /*!< Set comparator input minus (inverting input).
1525 This parameter can be a value of @ref COMP_LL_EC_INPUT_MINUS
1527 This feature can be modified afterwards using unitary function @ref LL_COMP_SetInputMinus(). */
1529 uint32_t InputHysteresis; /*!< Set comparator hysteresis mode of the input minus.
1530 This parameter can be a value of @ref COMP_LL_EC_INPUT_HYSTERESIS
1532 This feature can be modified afterwards using unitary function @ref LL_COMP_SetInputHysteresis(). */
1534 uint32_t OutputSelection; /*!< Set comparator output selection.
1535 This parameter can be a value of @ref COMP_LL_EC_OUTPUT_SELECTION
1537 This feature can be modified afterwards using unitary function @ref LL_COMP_SetOutputSelection(). */
1539 uint32_t OutputPolarity; /*!< Set comparator output polarity.
1540 This parameter can be a value of @ref COMP_LL_EC_OUTPUT_POLARITY
1542 This feature can be modified afterwards using unitary function @ref LL_COMP_SetOutputPolarity(). */
1544 } LL_COMP_InitTypeDef;
1547 * @}
1549 #endif /* USE_FULL_LL_DRIVER */
1551 /* Exported constants --------------------------------------------------------*/
1552 /** @defgroup COMP_LL_Exported_Constants COMP Exported Constants
1553 * @{
1556 /** @defgroup COMP_LL_EC_COMMON_WINDOWMODE Comparator common modes - Window mode
1557 * @{
1559 #define LL_COMP_WINDOWMODE_DISABLE ((uint32_t)0x00000000U) /*!< Window mode disable: Comparators 1 and 2 are independent */
1560 #define LL_COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON (COMP_CSR_WNDWEN) /*!< 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). */
1562 * @}
1565 /** @defgroup COMP_LL_EC_POWERMODE Comparator modes - Power mode
1566 * @{
1568 #define LL_COMP_POWERMODE_HIGHSPEED ((uint32_t)0x00000000U) /*!< COMP power mode to high speed */
1569 #define LL_COMP_POWERMODE_MEDIUMSPEED (COMP_CSR_COMP1MODE_0) /*!< COMP power mode to medium speed */
1570 #define LL_COMP_POWERMODE_LOWPOWER (COMP_CSR_COMP1MODE_1) /*!< COMP power mode to low power */
1571 #define LL_COMP_POWERMODE_ULTRALOWPOWER (COMP_CSR_COMP1MODE_1 | COMP_CSR_COMP1MODE_0) /*!< COMP power mode to ultra-low power */
1573 * @}
1576 /** @defgroup COMP_LL_EC_INPUT_PLUS Comparator inputs - Input plus (input non-inverting) selection
1577 * @{
1579 #define LL_COMP_INPUT_PLUS_IO1 ((uint32_t)0x00000000U) /*!< Comparator input plus connected to IO1 (pin PA1 for COMP1, pin PA3 for COMP2) */
1580 #define LL_COMP_INPUT_PLUS_DAC1_CH1 (COMP_CSR_COMP1SW1) /*!< Comparator input plus connected to DAC1 channel 1 (DAC_OUT1), through dedicated switch (Note: this switch is solely intended to redirect signals onto high impedance input, such as COMP1 input plus (highly resistive switch)) (specific to COMP instance: COMP1) */
1582 * @}
1585 /** @defgroup COMP_LL_EC_INPUT_MINUS Comparator inputs - Input minus (input inverting) selection
1586 * @{
1588 #define LL_COMP_INPUT_MINUS_1_4VREFINT ((uint32_t)0x00000000U) /*!< Comparator input minus connected to 1/4 VrefInt */
1589 #define LL_COMP_INPUT_MINUS_1_2VREFINT ( COMP_CSR_COMP1INSEL_0) /*!< Comparator input minus connected to 1/2 VrefInt */
1590 #define LL_COMP_INPUT_MINUS_3_4VREFINT ( COMP_CSR_COMP1INSEL_1 ) /*!< Comparator input minus connected to 3/4 VrefInt */
1591 #define LL_COMP_INPUT_MINUS_VREFINT ( COMP_CSR_COMP1INSEL_1 | COMP_CSR_COMP1INSEL_0) /*!< Comparator input minus connected to VrefInt */
1592 #define LL_COMP_INPUT_MINUS_DAC1_CH1 (COMP_CSR_COMP1INSEL_2 ) /*!< Comparator input minus connected to DAC1 channel 1 (DAC_OUT1) */
1593 #define LL_COMP_INPUT_MINUS_DAC1_CH2 (COMP_CSR_COMP1INSEL_2 | COMP_CSR_COMP1INSEL_0) /*!< Comparator input minus connected to DAC1 channel 2 (DAC_OUT2) */
1594 #define LL_COMP_INPUT_MINUS_IO1 (COMP_CSR_COMP1INSEL_2 | COMP_CSR_COMP1INSEL_1 ) /*!< Comparator input minus connected to IO1 (pin PA0 for COMP1, pin PA2 for COMP2) */
1595 #define LL_COMP_INPUT_MINUS_IO2 (COMP_CSR_COMP1INSEL_2 | COMP_CSR_COMP1INSEL_1 | COMP_CSR_COMP1INSEL_0) /*!< Comparator input minus connected to IO2 (pin PA6 for COMP1 & COMP2) */
1596 #define LL_COMP_INPUT_MINUS_IO3 (COMP_CSR_COMP1INSEL_2 | COMP_CSR_COMP1INSEL_0) /*!< Comparator input minus connected to IO3 (pin PA5 for COMP1 & COMP2) */
1597 #define LL_COMP_INPUT_MINUS_IO4 (COMP_CSR_COMP1INSEL_2 ) /*!< Comparator input minus connected to IO4 (pin PA4 for COMP1 & COMP2) */
1598 #define LL_COMP_INPUT_MINUS_DAC2_CH1 (COMP_CSR_COMP1INSEL_2 | COMP_CSR_COMP1INSEL_1 | COMP_CSR_COMP1INSEL_0) /*!< Comparator input minus connected to DAC2 channel 1 (DAC2_OUT1) */
1600 * @}
1603 /** @defgroup COMP_LL_EC_INPUT_HYSTERESIS Comparator input - Hysteresis
1604 * @{
1606 #define LL_COMP_HYSTERESIS_NONE ((uint32_t)0x00000000U) /*!< No hysteresis */
1607 #define LL_COMP_HYSTERESIS_LOW ( COMP_CSR_COMP1HYST_0) /*!< Hysteresis level low */
1608 #define LL_COMP_HYSTERESIS_MEDIUM (COMP_CSR_COMP1HYST_1 ) /*!< Hysteresis level medium */
1609 #define LL_COMP_HYSTERESIS_HIGH (COMP_CSR_COMP1HYST_1 | COMP_CSR_COMP1HYST_0) /*!< Hysteresis level high */
1611 * @}
1614 /** @defgroup COMP_LL_EC_OUTPUT_SELECTION Comparator output - Output selection
1615 * @{
1617 /* Note: Output redirection is common for COMP1 and COMP2 */
1618 #define LL_COMP_OUTPUT_NONE ((uint32_t)0x00000000U) /*!< COMP output is not connected to other peripherals (except GPIO and EXTI that are always connected to COMP output) */
1619 #define LL_COMP_OUTPUT_TIM2_IC4 (COMP_CSR_COMP1OUTSEL_2) /*!< COMP output connected to TIM2 input capture 4 */
1620 #define LL_COMP_OUTPUT_TIM2_OCCLR (COMP_CSR_COMP1OUTSEL_2 | COMP_CSR_COMP1OUTSEL_0) /*!< COMP output connected to TIM2 OCREF clear */
1622 /* Note: Output redirection specific to COMP instance: COMP1 */
1623 #define LL_COMP_OUTPUT_TIM15_BKIN_COMP1 (COMP_CSR_COMP1OUTSEL_0) /*!< COMP output connected to TIM15 break input (BKIN) (specific to COMP instance: COMP1) */
1624 #define LL_COMP_OUTPUT_TIM3_IC1_COMP1 (COMP_CSR_COMP1OUTSEL_1) /*!< COMP output connected to TIM3 input capture 1 (specific to COMP instance: COMP1) */
1625 #define LL_COMP_OUTPUT_TIM3_OCCLR_COMP1 (COMP_CSR_COMP1OUTSEL_1 | COMP_CSR_COMP1OUTSEL_0) /*!< COMP output connected to TIM3 OCREF clear (specific to COMP instance: COMP1) */
1626 #define LL_COMP_OUTPUT_TIM5_IC4_COMP1 (COMP_CSR_COMP1OUTSEL_2 | COMP_CSR_COMP1OUTSEL_1) /*!< COMP output connected to TIM5 input capture 4 (specific to COMP instance: COMP1) */
1627 #define LL_COMP_OUTPUT_TIM5_OCCLR_COMP1 (COMP_CSR_COMP1OUTSEL_2 | COMP_CSR_COMP1OUTSEL_1 | COMP_CSR_COMP1OUTSEL_0) /*!< COMP output connected to TIM5 OCREF clear (specific to COMP instance: COMP1) */
1629 /* Note: Output redirection specific to COMP instance: COMP2 */
1630 #define LL_COMP_OUTPUT_TIM16_BKIN_COMP2 (COMP_CSR_COMP1OUTSEL_0) /*!< COMP output connected to TIM16 break input (BKIN) (specific to COMP instance: COMP2) */
1631 #define LL_COMP_OUTPUT_TIM4_IC1_COMP2 (COMP_CSR_COMP1OUTSEL_1) /*!< COMP output connected to TIM4 input capture 1 (specific to COMP instance: COMP2) */
1632 #define LL_COMP_OUTPUT_TIM4_OCCLR_COMP2 (COMP_CSR_COMP1OUTSEL_1 | COMP_CSR_COMP1OUTSEL_0) /*!< COMP output connected to TIM4 OCREF clear (specific to COMP instance: COMP2) */
1633 #define LL_COMP_OUTPUT_TIM3_IC1_COMP2 (COMP_CSR_COMP1OUTSEL_2 | COMP_CSR_COMP1OUTSEL_1) /*!< COMP output connected to TIM3 input capture 1 (specific to COMP instance: COMP2) */
1634 #define LL_COMP_OUTPUT_TIM3_OCCLR_COMP2 (COMP_CSR_COMP1OUTSEL_2 | COMP_CSR_COMP1OUTSEL_1 | COMP_CSR_COMP1OUTSEL_0) /*!< COMP output connected to TIM3 OCREF clear (specific to COMP instance: COMP2) */
1636 /* Note: Output redirection specific to COMP instances, defined with */
1637 /* generic naming not taking into account COMP instance constraints. */
1638 /* Refer to literal definitions above for COMP instance constraints. */
1639 /* Note: Some output redirections cannot have a generic naming, */
1640 /* due to literal value different depending on COMP instance. */
1641 /* (For exemple: LL_COMP_OUTPUT_TIM3_IC1_COMP1 and */
1642 /* LL_COMP_OUTPUT_TIM3_IC1_COMP2). */
1643 #define LL_COMP_OUTPUT_TIM15_BKIN LL_COMP_OUTPUT_TIM15_BKIN_COMP1 /*!< COMP output connected to TIM15 break input (BKIN). Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
1644 #define LL_COMP_OUTPUT_TIM16_BKIN LL_COMP_OUTPUT_TIM16_BKIN_COMP2 /*!< COMP output connected to TIM16 break input (BKIN). Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
1645 #define LL_COMP_OUTPUT_TIM4_IC1 LL_COMP_OUTPUT_TIM4_IC1_COMP2 /*!< COMP output connected to TIM4 input capture 1. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
1646 #define LL_COMP_OUTPUT_TIM4_OCCLR LL_COMP_OUTPUT_TIM4_OCCLR_COMP2 /*!< COMP output connected to TIM4 OCREF clear. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
1647 #define LL_COMP_OUTPUT_TIM5_IC4 LL_COMP_OUTPUT_TIM5_IC1_COMP1 /*!< COMP output connected to TIM5 input capture 4. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
1648 #define LL_COMP_OUTPUT_TIM5_OCCLR LL_COMP_OUTPUT_TIM5_OCCLR_COMP1 /*!< COMP output connected to TIM5 OCREF clear. Caution: Parameter specific to COMP instances, defined with generic naming, not taking into account COMP instance constraints. Refer to literal definitions above for COMP instance constraints. */
1650 * @}
1653 /** @defgroup COMP_LL_EC_OUTPUT_POLARITY Comparator output - Output polarity
1654 * @{
1656 #define LL_COMP_OUTPUTPOL_NONINVERTED ((uint32_t)0x00000000U) /*!< COMP output polarity is not inverted: comparator output is high when the plus (non-inverting) input is at a higher voltage than the minus (inverting) input */
1657 #define LL_COMP_OUTPUTPOL_INVERTED (COMP_CSR_COMP1POL) /*!< 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 */
1659 * @}
1662 /** @defgroup COMP_LL_EC_OUTPUT_LEVEL Comparator output - Output level
1663 * @{
1665 #define LL_COMP_OUTPUT_LEVEL_LOW ((uint32_t)0x00000000U) /*!< Comparator output level low (if the polarity is not inverted, otherwise to be complemented) */
1666 #define LL_COMP_OUTPUT_LEVEL_HIGH ((uint32_t)0x00000001U) /*!< Comparator output level high (if the polarity is not inverted, otherwise to be complemented) */
1668 * @}
1671 /** @defgroup COMP_LL_EC_HW_DELAYS Definitions of COMP hardware constraints delays
1672 * @note Only COMP IP HW delays are defined in COMP LL driver driver,
1673 * not timeout values.
1674 * For details on delays values, refer to descriptions in source code
1675 * above each literal definition.
1676 * @{
1679 /* Delay for comparator startup time. */
1680 /* Note: Delay required to reach propagation delay specification. */
1681 /* Literal set to maximum value (refer to device datasheet, */
1682 /* parameter "tSTART"). */
1683 /* Unit: us */
1684 #define LL_COMP_DELAY_STARTUP_US ((uint32_t) 60U) /*!< Delay for COMP startup time */
1686 /* Delay for comparator voltage scaler stabilization time */
1687 /* (voltage from VrefInt, delay based on VrefInt startup time). */
1688 /* Literal set to maximum value (refer to device datasheet, */
1689 /* parameter "tS_SC"). */
1690 /* Unit: us */
1691 #define LL_COMP_DELAY_VOLTAGE_SCALER_STAB_US ((uint32_t) 200U) /*!< Delay for COMP voltage scaler stabilization time */
1695 * @}
1699 * @}
1702 /* Exported macro ------------------------------------------------------------*/
1703 /** @defgroup COMP_LL_Exported_Macros COMP Exported Macros
1704 * @{
1706 /** @defgroup COMP_LL_EM_WRITE_READ Common write and read registers macro
1707 * @{
1711 * @brief Write a value in COMP register
1712 * @param __INSTANCE__ comparator instance
1713 * @param __REG__ Register to be written
1714 * @param __VALUE__ Value to be written in the register
1715 * @retval None
1717 #define LL_COMP_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
1720 * @brief Read a value in COMP register
1721 * @param __INSTANCE__ comparator instance
1722 * @param __REG__ Register to be read
1723 * @retval Register value
1725 #define LL_COMP_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
1727 * @}
1730 /** @defgroup COMP_LL_EM_HELPER_MACRO COMP helper macro
1731 * @{
1735 * @brief Helper macro to select the COMP common instance
1736 * to which is belonging the selected COMP instance.
1737 * @note COMP common register instance can be used to
1738 * set parameters common to several COMP instances.
1739 * Refer to functions having argument "COMPxy_COMMON" as parameter.
1740 * @param __COMPx__ COMP instance
1741 * @retval COMP common instance or value "0" if there is no COMP common instance.
1743 #define __LL_COMP_COMMON_INSTANCE(__COMPx__) \
1744 (COMP12_COMMON)
1747 * @}
1751 * @}
1754 /* Exported functions --------------------------------------------------------*/
1755 /** @defgroup COMP_LL_Exported_Functions COMP Exported Functions
1756 * @{
1759 /** @defgroup COMP_LL_EF_Configuration_comparator_common Configuration of COMP hierarchical scope: common to several COMP instances
1760 * @{
1764 * @brief Set window mode of a pair of comparators instances
1765 * (2 consecutive COMP instances odd and even COMP<x> and COMP<x+1>).
1766 * @rmtoll CSR WNDWEN LL_COMP_SetCommonWindowMode
1767 * @param COMPxy_COMMON Comparator common instance
1768 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_COMP_COMMON_INSTANCE() )
1769 * @param WindowMode This parameter can be one of the following values:
1770 * @arg @ref LL_COMP_WINDOWMODE_DISABLE
1771 * @arg @ref LL_COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON
1772 * @retval None
1774 __STATIC_INLINE void LL_COMP_SetCommonWindowMode(COMP_Common_TypeDef *COMPxy_COMMON, uint32_t WindowMode)
1776 MODIFY_REG(COMPxy_COMMON->CSR, COMP_CSR_WNDWEN, WindowMode);
1780 * @brief Get window mode of a pair of comparators instances
1781 * (2 consecutive COMP instances odd and even COMP<x> and COMP<x+1>).
1782 * @rmtoll CSR WNDWEN LL_COMP_GetCommonWindowMode
1783 * @param COMPxy_COMMON Comparator common instance
1784 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_COMP_COMMON_INSTANCE() )
1785 * @retval Returned value can be one of the following values:
1786 * @arg @ref LL_COMP_WINDOWMODE_DISABLE
1787 * @arg @ref LL_COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON
1789 __STATIC_INLINE uint32_t LL_COMP_GetCommonWindowMode(COMP_Common_TypeDef *COMPxy_COMMON)
1791 return (uint32_t)(READ_BIT(COMPxy_COMMON->CSR, COMP_CSR_WNDWEN));
1795 * @}
1798 /** @defgroup COMP_LL_EF_Configuration_comparator_modes Configuration of comparator modes
1799 * @{
1803 * @brief Set comparator instance operating mode to adjust power and speed.
1804 * @rmtoll CSR COMP1MODE LL_COMP_SetPowerMode\n
1805 * COMP2MODE LL_COMP_SetPowerMode
1806 * @param COMPx Comparator instance
1807 * @param PowerMode This parameter can be one of the following values:
1808 * @arg @ref LL_COMP_POWERMODE_HIGHSPEED
1809 * @arg @ref LL_COMP_POWERMODE_MEDIUMSPEED
1810 * @arg @ref LL_COMP_POWERMODE_LOWPOWER
1811 * @arg @ref LL_COMP_POWERMODE_ULTRALOWPOWER
1812 * @retval None
1814 __STATIC_INLINE void LL_COMP_SetPowerMode(COMP_TypeDef *COMPx, uint32_t PowerMode)
1816 MODIFY_REG(COMP->CSR,
1817 COMP_CSR_COMP1MODE << __COMP_BITOFFSET_INSTANCE(COMPx),
1818 PowerMode << __COMP_BITOFFSET_INSTANCE(COMPx) );
1822 * @brief Get comparator instance operating mode to adjust power and speed.
1823 * @rmtoll CSR COMP1MODE LL_COMP_GetPowerMode\n
1824 * COMP2MODE LL_COMP_GetPowerMode
1825 * @param COMPx Comparator instance
1826 * @retval Returned value can be one of the following values:
1827 * @arg @ref LL_COMP_POWERMODE_HIGHSPEED
1828 * @arg @ref LL_COMP_POWERMODE_MEDIUMSPEED
1829 * @arg @ref LL_COMP_POWERMODE_LOWPOWER
1830 * @arg @ref LL_COMP_POWERMODE_ULTRALOWPOWER
1832 __STATIC_INLINE uint32_t LL_COMP_GetPowerMode(COMP_TypeDef *COMPx)
1834 return (uint32_t)(READ_BIT(COMP->CSR,
1835 COMP_CSR_COMP1MODE << __COMP_BITOFFSET_INSTANCE(COMPx))
1836 >> __COMP_BITOFFSET_INSTANCE(COMPx)
1841 * @}
1844 /** @defgroup COMP_LL_EF_Configuration_comparator_inputs Configuration of comparator inputs
1845 * @{
1849 * @brief Set comparator inputs minus (inverting) and plus (non-inverting).
1850 * @note In case of comparator input selected to be connected to IO:
1851 * GPIO pins are specific to each comparator instance.
1852 * Refer to description of parameters or to reference manual.
1853 * @rmtoll CSR COMP1INSEL LL_COMP_ConfigInputs\n
1854 * CSR COMP2INSEL LL_COMP_ConfigInputs\n
1855 * CSR COMP1SW1 LL_COMP_ConfigInputs
1856 * @param COMPx Comparator instance
1857 * @param InputMinus This parameter can be one of the following values:
1858 * @arg @ref LL_COMP_INPUT_MINUS_1_4VREFINT
1859 * @arg @ref LL_COMP_INPUT_MINUS_1_2VREFINT
1860 * @arg @ref LL_COMP_INPUT_MINUS_3_4VREFINT
1861 * @arg @ref LL_COMP_INPUT_MINUS_VREFINT
1862 * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH1
1863 * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH2
1864 * @arg @ref LL_COMP_INPUT_MINUS_IO1
1865 * @arg @ref LL_COMP_INPUT_MINUS_IO2
1866 * @arg @ref LL_COMP_INPUT_MINUS_IO3
1867 * @arg @ref LL_COMP_INPUT_MINUS_IO4
1868 * @arg @ref LL_COMP_INPUT_MINUS_DAC2_CH1
1869 * @param InputPlus This parameter can be one of the following values:
1870 * @arg @ref LL_COMP_INPUT_PLUS_IO1
1871 * @arg @ref LL_COMP_INPUT_PLUS_DAC1_CH1 (1)
1873 * (1) Parameter available only on COMP instance: COMP1.
1874 * @retval None
1876 __STATIC_INLINE void LL_COMP_ConfigInputs(COMP_TypeDef *COMPx, uint32_t InputMinus, uint32_t InputPlus)
1878 /* Note: Connection switch is applicable only to COMP instance COMP1, */
1879 /* therefore if COMP2 is selected the equivalent bit is */
1880 /* kept unmodified. */
1881 MODIFY_REG(COMP->CSR,
1882 (COMP_CSR_COMP1INSEL | (COMP_CSR_COMP1SW1 * __COMP_IS_INSTANCE_ODD(COMPx))) << __COMP_BITOFFSET_INSTANCE(COMPx),
1883 (InputMinus | InputPlus) << __COMP_BITOFFSET_INSTANCE(COMPx) );
1887 * @brief Set comparator input plus (non-inverting).
1888 * @note In case of comparator input selected to be connected to IO:
1889 * GPIO pins are specific to each comparator instance.
1890 * Refer to description of parameters or to reference manual.
1891 * @rmtoll CSR COMP1INSEL LL_COMP_SetInputPlus\n
1892 * CSR COMP2INSEL LL_COMP_SetInputPlus
1893 * @param COMPx Comparator instance
1894 * @param InputPlus This parameter can be one of the following values:
1895 * @arg @ref LL_COMP_INPUT_PLUS_IO1
1896 * @arg @ref LL_COMP_INPUT_PLUS_DAC1_CH1 (1)
1898 * (1) Parameter available only on COMP instance: COMP1.
1899 * @retval None
1901 __STATIC_INLINE void LL_COMP_SetInputPlus(COMP_TypeDef *COMPx, uint32_t InputPlus)
1903 /* Note: Connection switch is applicable only to COMP instance COMP1, */
1904 /* therefore if COMP2 is selected the equivalent bit is */
1905 /* kept unmodified. */
1906 MODIFY_REG(COMP->CSR,
1907 (COMP_CSR_COMP1SW1 * __COMP_IS_INSTANCE_ODD(COMPx)) << __COMP_BITOFFSET_INSTANCE(COMPx),
1908 InputPlus << __COMP_BITOFFSET_INSTANCE(COMPx) );
1912 * @brief Get comparator input plus (non-inverting).
1913 * @note In case of comparator input selected to be connected to IO:
1914 * GPIO pins are specific to each comparator instance.
1915 * Refer to description of parameters or to reference manual.
1916 * @rmtoll CSR COMP1INSEL LL_COMP_GetInputPlus\n
1917 * CSR COMP2INSEL LL_COMP_GetInputPlus
1918 * @param COMPx Comparator instance
1919 * @retval Returned value can be one of the following values:
1920 * @arg @ref LL_COMP_INPUT_PLUS_IO1
1921 * @arg @ref LL_COMP_INPUT_PLUS_DAC1_CH1 (1)
1923 * (1) Parameter available only on COMP instance: COMP1.
1925 __STATIC_INLINE uint32_t LL_COMP_GetInputPlus(COMP_TypeDef *COMPx)
1927 /* Note: Connection switch is applicable only to COMP instance COMP1, */
1928 /* therefore is COMP2 is selected the returned value will be null. */
1929 return (uint32_t)(READ_BIT(COMP->CSR,
1930 COMP_CSR_COMP1SW1 << __COMP_BITOFFSET_INSTANCE(COMPx))
1931 >> __COMP_BITOFFSET_INSTANCE(COMPx)
1936 * @brief Set comparator input minus (inverting).
1937 * @note In case of comparator input selected to be connected to IO:
1938 * GPIO pins are specific to each comparator instance.
1939 * Refer to description of parameters or to reference manual.
1940 * @rmtoll CSR COMP1SW1 LL_COMP_SetInputMinus
1941 * @param COMPx Comparator instance
1942 * @param InputMinus This parameter can be one of the following values:
1943 * @arg @ref LL_COMP_INPUT_MINUS_1_4VREFINT
1944 * @arg @ref LL_COMP_INPUT_MINUS_1_2VREFINT
1945 * @arg @ref LL_COMP_INPUT_MINUS_3_4VREFINT
1946 * @arg @ref LL_COMP_INPUT_MINUS_VREFINT
1947 * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH1
1948 * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH2
1949 * @arg @ref LL_COMP_INPUT_MINUS_IO1
1950 * @arg @ref LL_COMP_INPUT_MINUS_IO2
1951 * @arg @ref LL_COMP_INPUT_MINUS_IO3
1952 * @arg @ref LL_COMP_INPUT_MINUS_IO4
1953 * @arg @ref LL_COMP_INPUT_MINUS_DAC2_CH1
1954 * @retval None
1956 __STATIC_INLINE void LL_COMP_SetInputMinus(COMP_TypeDef *COMPx, uint32_t InputMinus)
1958 MODIFY_REG(COMP->CSR,
1959 COMP_CSR_COMP1INSEL << __COMP_BITOFFSET_INSTANCE(COMPx),
1960 InputMinus << __COMP_BITOFFSET_INSTANCE(COMPx) );
1964 * @brief Get comparator input minus (inverting).
1965 * @note In case of comparator input selected to be connected to IO:
1966 * GPIO pins are specific to each comparator instance.
1967 * Refer to description of parameters or to reference manual.
1968 * @rmtoll CSR COMP1SW1 LL_COMP_GetInputMinus
1969 * @param COMPx Comparator instance
1970 * @retval Returned value can be one of the following values:
1971 * @arg @ref LL_COMP_INPUT_MINUS_1_4VREFINT
1972 * @arg @ref LL_COMP_INPUT_MINUS_1_2VREFINT
1973 * @arg @ref LL_COMP_INPUT_MINUS_3_4VREFINT
1974 * @arg @ref LL_COMP_INPUT_MINUS_VREFINT
1975 * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH1
1976 * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH2
1977 * @arg @ref LL_COMP_INPUT_MINUS_IO1
1978 * @arg @ref LL_COMP_INPUT_MINUS_IO2
1979 * @arg @ref LL_COMP_INPUT_MINUS_IO3
1980 * @arg @ref LL_COMP_INPUT_MINUS_IO4
1981 * @arg @ref LL_COMP_INPUT_MINUS_DAC2_CH1
1983 __STATIC_INLINE uint32_t LL_COMP_GetInputMinus(COMP_TypeDef *COMPx)
1985 return (uint32_t)(READ_BIT(COMP->CSR,
1986 COMP_CSR_COMP1INSEL << __COMP_BITOFFSET_INSTANCE(COMPx))
1987 >> __COMP_BITOFFSET_INSTANCE(COMPx)
1992 * @brief Set comparator instance hysteresis mode of the input minus (inverting input).
1993 * @rmtoll CSR COMP1HYST LL_COMP_SetInputHysteresis\n
1994 * COMP2HYST LL_COMP_SetInputHysteresis
1995 * @param COMPx Comparator instance
1996 * @param InputHysteresis This parameter can be one of the following values:
1997 * @arg @ref LL_COMP_HYSTERESIS_NONE
1998 * @arg @ref LL_COMP_HYSTERESIS_LOW
1999 * @arg @ref LL_COMP_HYSTERESIS_MEDIUM
2000 * @arg @ref LL_COMP_HYSTERESIS_HIGH
2001 * @retval None
2003 __STATIC_INLINE void LL_COMP_SetInputHysteresis(COMP_TypeDef *COMPx, uint32_t InputHysteresis)
2005 MODIFY_REG(COMP->CSR,
2006 COMP_CSR_COMP1HYST << __COMP_BITOFFSET_INSTANCE(COMPx),
2007 InputHysteresis << __COMP_BITOFFSET_INSTANCE(COMPx) );
2011 * @brief Get comparator instance hysteresis mode of the minus (inverting) input.
2012 * @rmtoll CSR COMP1HYST LL_COMP_GetInputHysteresis\n
2013 * COMP2HYST LL_COMP_GetInputHysteresis
2014 * @param COMPx Comparator instance
2015 * @retval Returned value can be one of the following values:
2016 * @arg @ref LL_COMP_HYSTERESIS_NONE
2017 * @arg @ref LL_COMP_HYSTERESIS_LOW
2018 * @arg @ref LL_COMP_HYSTERESIS_MEDIUM
2019 * @arg @ref LL_COMP_HYSTERESIS_HIGH
2021 __STATIC_INLINE uint32_t LL_COMP_GetInputHysteresis(COMP_TypeDef *COMPx)
2023 return (uint32_t)(READ_BIT(COMP->CSR,
2024 COMP_CSR_COMP1HYST << __COMP_BITOFFSET_INSTANCE(COMPx))
2025 >> __COMP_BITOFFSET_INSTANCE(COMPx)
2031 * @}
2034 /** @defgroup COMP_LL_EF_Configuration_comparator_output Configuration of comparator output
2035 * @{
2039 * @brief Set comparator output selection.
2040 * @note Availability of parameters of output selection to timer
2041 * depends on timers availability on the selected device.
2042 * @rmtoll CSR COMP1OUTSEL LL_COMP_SetOutputSelection\n
2043 * COMP2OUTSEL LL_COMP_SetOutputSelection
2044 * @param COMPx Comparator instance
2045 * @param OutputSelection This parameter can be one of the following values:
2046 * @arg @ref LL_COMP_OUTPUT_NONE
2047 * @arg @ref LL_COMP_OUTPUT_TIM16_BKIN (1)
2048 * @arg @ref LL_COMP_OUTPUT_TIM4_IC1 (1)
2049 * @arg @ref LL_COMP_OUTPUT_TIM4_OCCLR (1)
2050 * @arg @ref LL_COMP_OUTPUT_TIM2_IC4 (1)
2051 * @arg @ref LL_COMP_OUTPUT_TIM2_OCCLR (1)
2052 * @arg @ref LL_COMP_OUTPUT_TIM3_IC1 (1)
2053 * @arg @ref LL_COMP_OUTPUT_TIM3_OCCLR (1)
2055 * (1) Parameter availability depending on timer availability
2056 * on the selected device.
2057 * @retval None
2059 __STATIC_INLINE void LL_COMP_SetOutputSelection(COMP_TypeDef *COMPx, uint32_t OutputSelection)
2061 MODIFY_REG(COMP->CSR,
2062 COMP_CSR_COMP1OUTSEL << __COMP_BITOFFSET_INSTANCE(COMPx),
2063 OutputSelection << __COMP_BITOFFSET_INSTANCE(COMPx) );
2067 * @brief Get comparator output selection.
2068 * @note Availability of parameters of output selection to timer
2069 * depends on timers availability on the selected device.
2070 * @rmtoll CSR COMP1OUTSEL LL_COMP_GetOutputSelection\n
2071 * COMP2OUTSEL LL_COMP_GetOutputSelection
2072 * @param COMPx Comparator instance
2073 * @retval Returned value can be one of the following values:
2074 * @arg @ref LL_COMP_OUTPUT_NONE
2075 * @arg @ref LL_COMP_OUTPUT_TIM16_BKIN (1)
2076 * @arg @ref LL_COMP_OUTPUT_TIM4_IC1 (1)
2077 * @arg @ref LL_COMP_OUTPUT_TIM4_OCCLR (1)
2078 * @arg @ref LL_COMP_OUTPUT_TIM2_IC4 (1)
2079 * @arg @ref LL_COMP_OUTPUT_TIM2_OCCLR (1)
2080 * @arg @ref LL_COMP_OUTPUT_TIM3_IC1 (1)
2081 * @arg @ref LL_COMP_OUTPUT_TIM3_OCCLR (1)
2083 * (1) Parameter availability depending on timer availability
2084 * on the selected device.
2086 __STATIC_INLINE uint32_t LL_COMP_GetOutputSelection(COMP_TypeDef *COMPx)
2088 return (uint32_t)(READ_BIT(COMP->CSR,
2089 COMP_CSR_COMP1OUTSEL << __COMP_BITOFFSET_INSTANCE(COMPx))
2090 >> __COMP_BITOFFSET_INSTANCE(COMPx)
2095 * @brief Set comparator instance output polarity.
2096 * @rmtoll CSR COMP1POL LL_COMP_SetOutputPolarity\n
2097 * COMP2POL LL_COMP_SetOutputPolarity
2098 * @param COMPx Comparator instance
2099 * @param OutputPolarity This parameter can be one of the following values:
2100 * @arg @ref LL_COMP_OUTPUTPOL_NONINVERTED
2101 * @arg @ref LL_COMP_OUTPUTPOL_INVERTED
2102 * @retval None
2104 __STATIC_INLINE void LL_COMP_SetOutputPolarity(COMP_TypeDef *COMPx, uint32_t OutputPolarity)
2106 MODIFY_REG(COMP->CSR,
2107 COMP_CSR_COMP1POL << __COMP_BITOFFSET_INSTANCE(COMPx),
2108 OutputPolarity << __COMP_BITOFFSET_INSTANCE(COMPx) );
2112 * @brief Get comparator instance output polarity.
2113 * @rmtoll CSR COMP1POL LL_COMP_GetOutputPolarity\n
2114 * COMP2POL LL_COMP_GetOutputPolarity
2115 * @param COMPx Comparator instance
2116 * @retval Returned value can be one of the following values:
2117 * @arg @ref LL_COMP_OUTPUTPOL_NONINVERTED
2118 * @arg @ref LL_COMP_OUTPUTPOL_INVERTED
2120 __STATIC_INLINE uint32_t LL_COMP_GetOutputPolarity(COMP_TypeDef *COMPx)
2122 return (uint32_t)(READ_BIT(COMP->CSR,
2123 COMP_CSR_COMP1POL << __COMP_BITOFFSET_INSTANCE(COMPx))
2124 >> __COMP_BITOFFSET_INSTANCE(COMPx)
2129 * @}
2132 /** @defgroup COMP_LL_EF_Operation Operation on comparator instance
2133 * @{
2137 * @brief Enable comparator instance.
2138 * @note After enable from off state, comparator requires a delay
2139 * to reach reach propagation delay specification.
2140 * Refer to device datasheet, parameter "tSTART".
2141 * @rmtoll CSR COMP1EN LL_COMP_Enable\n
2142 * COMP2EN LL_COMP_Enable
2143 * @param COMPx Comparator instance
2144 * @retval None
2146 __STATIC_INLINE void LL_COMP_Enable(COMP_TypeDef *COMPx)
2148 SET_BIT(COMP->CSR, COMP_CSR_COMP1EN << __COMP_BITOFFSET_INSTANCE(COMPx));
2152 * @brief Disable comparator instance.
2153 * @rmtoll CSR COMP1EN LL_COMP_Disable\n
2154 * COMP2EN LL_COMP_Disable
2155 * @param COMPx Comparator instance
2156 * @retval None
2158 __STATIC_INLINE void LL_COMP_Disable(COMP_TypeDef *COMPx)
2160 CLEAR_BIT(COMP->CSR, COMP_CSR_COMP1EN << __COMP_BITOFFSET_INSTANCE(COMPx));
2164 * @brief Get comparator enable state
2165 * (0: COMP is disabled, 1: COMP is enabled)
2166 * @rmtoll CSR COMP1EN LL_COMP_IsEnabled\n
2167 * COMP2EN LL_COMP_IsEnabled
2168 * @param COMPx Comparator instance
2169 * @retval State of bit (1 or 0).
2171 __STATIC_INLINE uint32_t LL_COMP_IsEnabled(COMP_TypeDef *COMPx)
2173 return (READ_BIT(COMP->CSR, COMP_CSR_COMP1EN << __COMP_BITOFFSET_INSTANCE(COMPx)) == COMP_CSR_COMP1EN << __COMP_BITOFFSET_INSTANCE(COMPx));
2177 * @brief Lock comparator instance.
2178 * @note Once locked, comparator configuration can be accessed in read-only.
2179 * @note The only way to unlock the comparator is a device hardware reset.
2180 * @rmtoll CSR COMP1LOCK LL_COMP_Lock\n
2181 * COMP2LOCK LL_COMP_Lock
2182 * @param COMPx Comparator instance
2183 * @retval None
2185 __STATIC_INLINE void LL_COMP_Lock(COMP_TypeDef *COMPx)
2187 SET_BIT(COMP->CSR, COMP_CSR_COMP1LOCK << __COMP_BITOFFSET_INSTANCE(COMPx));
2191 * @brief Get comparator lock state
2192 * (0: COMP is unlocked, 1: COMP is locked).
2193 * @note Once locked, comparator configuration can be accessed in read-only.
2194 * @note The only way to unlock the comparator is a device hardware reset.
2195 * @rmtoll CSR COMP1LOCK LL_COMP_IsLocked\n
2196 * COMP2LOCK LL_COMP_IsLocked
2197 * @param COMPx Comparator instance
2198 * @retval State of bit (1 or 0).
2200 __STATIC_INLINE uint32_t LL_COMP_IsLocked(COMP_TypeDef *COMPx)
2202 return (READ_BIT(COMP->CSR, COMP_CSR_COMP1LOCK << __COMP_BITOFFSET_INSTANCE(COMPx)) == COMP_CSR_COMP1LOCK << __COMP_BITOFFSET_INSTANCE(COMPx));
2206 * @brief Read comparator instance output level.
2207 * @note The comparator output level depends on the selected polarity
2208 * (Refer to function @ref LL_COMP_SetOutputPolarity()).
2209 * If the comparator polarity is not inverted:
2210 * - Comparator output is low when the input plus
2211 * is at a lower voltage than the input minus
2212 * - Comparator output is high when the input plus
2213 * is at a higher voltage than the input minus
2214 * If the comparator polarity is inverted:
2215 * - Comparator output is high when the input plus
2216 * is at a lower voltage than the input minus
2217 * - Comparator output is low when the input plus
2218 * is at a higher voltage than the input minus
2219 * @rmtoll CSR COMP1OUT LL_COMP_ReadOutputLevel\n
2220 * COMP2OUT LL_COMP_ReadOutputLevel
2221 * @param COMPx Comparator instance
2222 * @retval Returned value can be one of the following values:
2223 * @arg @ref LL_COMP_OUTPUT_LEVEL_LOW
2224 * @arg @ref LL_COMP_OUTPUT_LEVEL_HIGH
2226 __STATIC_INLINE uint32_t LL_COMP_ReadOutputLevel(COMP_TypeDef *COMPx)
2228 return (uint32_t)(READ_BIT(COMP->CSR,
2229 COMP_CSR_COMP1OUT << __COMP_BITOFFSET_INSTANCE(COMPx))
2230 >> (__COMP_BITOFFSET_INSTANCE(COMPx) + LL_COMP_OUTPUT_LEVEL_BITOFFSET_POS)
2235 * @}
2238 #if defined(USE_FULL_LL_DRIVER)
2239 /** @defgroup COMP_LL_EF_Init Initialization and de-initialization functions
2240 * @{
2243 ErrorStatus LL_COMP_DeInit(COMP_TypeDef *COMPx);
2244 ErrorStatus LL_COMP_Init(COMP_TypeDef *COMPx, LL_COMP_InitTypeDef *COMP_InitStruct);
2245 void LL_COMP_StructInit(LL_COMP_InitTypeDef *COMP_InitStruct);
2248 * @}
2250 #endif /* USE_FULL_LL_DRIVER */
2253 * @}
2257 * @}
2260 #endif /* COMP1 || COMP2 */
2263 #endif /* STM32F373xC || STM32F378xx */
2266 * @}
2269 #ifdef __cplusplus
2271 #endif
2273 #endif /* __STM32F3xx_LL_COMP_H */
2275 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/