@@ -51,7 +51,8 @@ typedef struct
5151#if defined(COMP2 )
5252 uint32_t WindowMode ; /*!< Set window mode of a pair of comparators instances
5353 (2 consecutive instances odd and even COMP<x> and COMP<x+1>).
54- Note: HAL COMP driver allows to set window mode from any COMP instance of the pair of COMP instances composing window mode.
54+ Note: HAL COMP driver allows to set window mode from any COMP
55+ instance of the pair of COMP instances composing window mode.
5556 This parameter can be a value of @ref COMP_WindowMode */
5657#endif /* COMP2 */
5758
@@ -153,17 +154,25 @@ typedef void (*pCOMP_CallbackTypeDef)(COMP_HandleTypeDef *hcomp); /*!< pointer
153154 * @}
154155 */
155156
157+
156158#if defined(COMP2 )
157159/** @defgroup COMP_WindowMode COMP Window Mode
158160 * @{
159161 */
160- #define COMP_WINDOWMODE_DISABLE (0x00000000UL) /*!< Window mode disable: Comparators instances pair COMP1 and COMP2 are independent */
161- #define COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON (COMP_CSR_WINMODE) /*!< Window mode enable: Comparators instances pair COMP1 and COMP2 have their input plus connected together. The common input is COMP1 input plus (COMP2 input plus is no more accessible). */
162+ #define COMP_WINDOWMODE_DISABLE (0x00000000UL) /*!< Window mode disable: Comparators instances
163+ pair COMP1 and COMP2 are independent */
164+ #define COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON (COMP_CSR_WINMODE) /*!< Window mode enable: Comparators instances
165+ pair COMP1 and COMP2 have their input plus
166+ connected together. The common input is
167+ COMP1 input plus
168+ (COMP2 input plus is no more accessible). */
162169/**
163170 * @}
164171 */
165172#endif /* COMP2 */
166173
174+
175+
167176/** @defgroup COMP_PowerMode COMP power mode
168177 * @{
169178 */
@@ -198,7 +207,7 @@ typedef void (*pCOMP_CallbackTypeDef)(COMP_HandleTypeDef *hcomp); /*!< pointer
198207#define COMP_INPUT_MINUS_1_2VREFINT ( COMP_CSR_INMSEL_0 | COMP_CSR_SCALEN | COMP_CSR_BRGEN) /*!< Comparator input minus connected to 1/2 VrefInt */
199208#define COMP_INPUT_MINUS_3_4VREFINT ( COMP_CSR_INMSEL_1 | COMP_CSR_SCALEN | COMP_CSR_BRGEN) /*!< Comparator input minus connected to 3/4 VrefInt */
200209#define COMP_INPUT_MINUS_VREFINT ( COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0 | COMP_CSR_SCALEN ) /*!< Comparator input minus connected to VrefInt */
201- #define COMP_INPUT_MINUS_IO1 (COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_1 ) /*!< Comparator input minus connected to IO1 (pin PB1 for COMP1, pin PB3 for COMP2) */
210+ #define COMP_INPUT_MINUS_IO1 (COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_1 ) /*!< Comparator input minus connected to IO1 (pin PB1 for COMP1, pin PB3 for COMP2) */
202211#if defined(STM32WB15xx ) || defined(STM32WB10xx ) || defined(STM32WB1Mxx )
203212/* COMP_INPUT_MINUS_IO2 not available on this device */
204213#else
@@ -312,14 +321,14 @@ typedef void (*pCOMP_CallbackTypeDef)(COMP_HandleTypeDef *hcomp); /*!< pointer
312321 * @param __HANDLE__ COMP handle
313322 * @retval None
314323 */
315- #define __HAL_COMP_ENABLE (__HANDLE__ ) SET_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_EN)
324+ #define __HAL_COMP_ENABLE (__HANDLE__ ) SET_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_EN)
316325
317326/**
318327 * @brief Disable the specified comparator.
319328 * @param __HANDLE__ COMP handle
320329 * @retval None
321330 */
322- #define __HAL_COMP_DISABLE (__HANDLE__ ) CLEAR_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_EN)
331+ #define __HAL_COMP_DISABLE (__HANDLE__ ) CLEAR_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_EN)
323332
324333/**
325334 * @brief Lock the specified comparator configuration.
@@ -330,14 +339,14 @@ typedef void (*pCOMP_CallbackTypeDef)(COMP_HandleTypeDef *hcomp); /*!< pointer
330339 * @param __HANDLE__ COMP handle
331340 * @retval None
332341 */
333- #define __HAL_COMP_LOCK (__HANDLE__ ) SET_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_LOCK)
342+ #define __HAL_COMP_LOCK (__HANDLE__ ) SET_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_LOCK)
334343
335344/**
336345 * @brief Check whether the specified comparator is locked.
337346 * @param __HANDLE__ COMP handle
338347 * @retval Value 0 if COMP instance is not locked, value 1 if COMP instance is locked
339348 */
340- #define __HAL_COMP_IS_LOCKED (__HANDLE__ ) (READ_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_LOCK) == COMP_CSR_LOCK)
349+ #define __HAL_COMP_IS_LOCKED (__HANDLE__ ) (READ_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_LOCK) == COMP_CSR_LOCK)
341350
342351/**
343352 * @}
@@ -346,7 +355,6 @@ typedef void (*pCOMP_CallbackTypeDef)(COMP_HandleTypeDef *hcomp); /*!< pointer
346355/** @defgroup COMP_Exti_Management COMP external interrupt line management
347356 * @{
348357 */
349-
350358/**
351359 * @brief Enable the COMP1 EXTI line rising edge trigger.
352360 * @retval None
@@ -375,19 +383,19 @@ typedef void (*pCOMP_CallbackTypeDef)(COMP_HandleTypeDef *hcomp); /*!< pointer
375383 * @brief Enable the COMP1 EXTI line rising & falling edge trigger.
376384 * @retval None
377385 */
378- #define __HAL_COMP_COMP1_EXTI_ENABLE_RISING_FALLING_EDGE () do { \
379- LL_EXTI_EnableRisingTrig_0_31(COMP_EXTI_LINE_COMP1); \
380- LL_EXTI_EnableFallingTrig_0_31(COMP_EXTI_LINE_COMP1); \
381- } while(0)
386+ #define __HAL_COMP_COMP1_EXTI_ENABLE_RISING_FALLING_EDGE () do { \
387+ LL_EXTI_EnableRisingTrig_0_31(COMP_EXTI_LINE_COMP1); \
388+ LL_EXTI_EnableFallingTrig_0_31(COMP_EXTI_LINE_COMP1);\
389+ } while(0)
382390
383391/**
384392 * @brief Disable the COMP1 EXTI line rising & falling edge trigger.
385393 * @retval None
386394 */
387- #define __HAL_COMP_COMP1_EXTI_DISABLE_RISING_FALLING_EDGE () do { \
388- LL_EXTI_DisableRisingTrig_0_31(COMP_EXTI_LINE_COMP1); \
389- LL_EXTI_DisableFallingTrig_0_31(COMP_EXTI_LINE_COMP1); \
390- } while(0)
395+ #define __HAL_COMP_COMP1_EXTI_DISABLE_RISING_FALLING_EDGE () do { \
396+ LL_EXTI_DisableRisingTrig_0_31(COMP_EXTI_LINE_COMP1); \
397+ LL_EXTI_DisableFallingTrig_0_31(COMP_EXTI_LINE_COMP1);\
398+ } while(0)
391399
392400/**
393401 * @brief Enable the COMP1 EXTI line in interrupt mode.
@@ -460,19 +468,19 @@ typedef void (*pCOMP_CallbackTypeDef)(COMP_HandleTypeDef *hcomp); /*!< pointer
460468 * @brief Enable the COMP2 EXTI line rising & falling edge trigger.
461469 * @retval None
462470 */
463- #define __HAL_COMP_COMP2_EXTI_ENABLE_RISING_FALLING_EDGE () do { \
464- LL_EXTI_EnableRisingTrig_0_31(COMP_EXTI_LINE_COMP2); \
465- LL_EXTI_EnableFallingTrig_0_31(COMP_EXTI_LINE_COMP2); \
466- } while(0)
471+ #define __HAL_COMP_COMP2_EXTI_ENABLE_RISING_FALLING_EDGE () do { \
472+ LL_EXTI_EnableRisingTrig_0_31(COMP_EXTI_LINE_COMP2); \
473+ LL_EXTI_EnableFallingTrig_0_31(COMP_EXTI_LINE_COMP2); \
474+ } while(0)
467475
468476/**
469477 * @brief Disable the COMP2 EXTI line rising & falling edge trigger.
470478 * @retval None
471- */
472- #define __HAL_COMP_COMP2_EXTI_DISABLE_RISING_FALLING_EDGE () do { \
473- LL_EXTI_DisableRisingTrig_0_31(COMP_EXTI_LINE_COMP2); \
474- LL_EXTI_DisableFallingTrig_0_31(COMP_EXTI_LINE_COMP2); \
475- } while(0)
479+ */
480+ #define __HAL_COMP_COMP2_EXTI_DISABLE_RISING_FALLING_EDGE () do { \
481+ LL_EXTI_DisableRisingTrig_0_31(COMP_EXTI_LINE_COMP2); \
482+ LL_EXTI_DisableFallingTrig_0_31(COMP_EXTI_LINE_COMP2);\
483+ } while(0)
476484
477485/**
478486 * @brief Enable the COMP2 EXTI line in interrupt mode.
@@ -607,23 +615,23 @@ typedef void (*pCOMP_CallbackTypeDef)(COMP_HandleTypeDef *hcomp); /*!< pointer
607615/* However, comparator instance kept as macro parameter for */
608616/* compatibility with other STM32 families. */
609617#if defined(COMP_INPUT_MINUS_IO2 )
610- #define IS_COMP_INPUT_MINUS (__COMP_INSTANCE__ , __INPUT_MINUS__ ) (((__INPUT_MINUS__) == COMP_INPUT_MINUS_1_4VREFINT) || \
611- ((__INPUT_MINUS__) == COMP_INPUT_MINUS_1_2VREFINT) || \
612- ((__INPUT_MINUS__) == COMP_INPUT_MINUS_3_4VREFINT) || \
613- ((__INPUT_MINUS__) == COMP_INPUT_MINUS_VREFINT) || \
614- ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO1) || \
615- ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO2) || \
616- ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO3) || \
617- ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO4) || \
618+ #define IS_COMP_INPUT_MINUS (__COMP_INSTANCE__ , __INPUT_MINUS__ ) (((__INPUT_MINUS__) == COMP_INPUT_MINUS_1_4VREFINT) ||\
619+ ((__INPUT_MINUS__) == COMP_INPUT_MINUS_1_2VREFINT) ||\
620+ ((__INPUT_MINUS__) == COMP_INPUT_MINUS_3_4VREFINT) ||\
621+ ((__INPUT_MINUS__) == COMP_INPUT_MINUS_VREFINT) ||\
622+ ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO1) ||\
623+ ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO2) ||\
624+ ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO3) ||\
625+ ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO4) ||\
618626 ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO5))
619627#else
620- #define IS_COMP_INPUT_MINUS (__COMP_INSTANCE__ , __INPUT_MINUS__ ) (((__INPUT_MINUS__) == COMP_INPUT_MINUS_1_4VREFINT) || \
621- ((__INPUT_MINUS__) == COMP_INPUT_MINUS_1_2VREFINT) || \
622- ((__INPUT_MINUS__) == COMP_INPUT_MINUS_3_4VREFINT) || \
623- ((__INPUT_MINUS__) == COMP_INPUT_MINUS_VREFINT) || \
624- ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO1) || \
625- ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO3) || \
626- ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO4) || \
628+ #define IS_COMP_INPUT_MINUS (__COMP_INSTANCE__ , __INPUT_MINUS__ ) (((__INPUT_MINUS__) == COMP_INPUT_MINUS_1_4VREFINT) ||\
629+ ((__INPUT_MINUS__) == COMP_INPUT_MINUS_1_2VREFINT) ||\
630+ ((__INPUT_MINUS__) == COMP_INPUT_MINUS_3_4VREFINT) ||\
631+ ((__INPUT_MINUS__) == COMP_INPUT_MINUS_VREFINT) ||\
632+ ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO1) ||\
633+ ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO3) ||\
634+ ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO4) ||\
627635 ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO5))
628636#endif
629637
@@ -637,14 +645,14 @@ typedef void (*pCOMP_CallbackTypeDef)(COMP_HandleTypeDef *hcomp); /*!< pointer
637645
638646#define IS_COMP_BLANKINGSRCE (__OUTPUT_BLANKING_SOURCE__ ) \
639647 ( ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_NONE) \
640- || ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM1_OC5) \
641- || ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM2_OC3) \
648+ || ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM1_OC5) \
649+ || ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM2_OC3) \
642650 )
643651
644652/* Note: Output blanking source common to all COMP instances */
645653/* Macro kept for compatibility with other STM32 series */
646654#define IS_COMP_BLANKINGSRC_INSTANCE (__INSTANCE__ , __OUTPUT_BLANKING_SOURCE__ ) \
647- (IS_COMP_BLANKINGSRCE(__OUTPUT_BLANKING_SOURCE__))
655+ (IS_COMP_BLANKINGSRCE(__OUTPUT_BLANKING_SOURCE__))
648656
649657
650658#define IS_COMP_TRIGGERMODE (__MODE__ ) (((__MODE__) == COMP_TRIGGERMODE_NONE) || \
0 commit comments