1 /** 2 ****************************************************************************** 3 * @file stm32g0xx_hal_comp.h 4 * @author MCD Application Team 5 * @brief Header file of COMP HAL module. 6 ****************************************************************************** 7 * @attention 8 * 9 * Copyright (c) 2018 STMicroelectronics. 10 * All rights reserved. 11 * 12 * This software is licensed under terms that can be found in the LICENSE file 13 * in the root directory of this software component. 14 * If no LICENSE file comes with this software, it is provided AS-IS. 15 * 16 ****************************************************************************** 17 */ 18 19 /* Define to prevent recursive inclusion -------------------------------------*/ 20 #ifndef STM32G0xx_HAL_COMP_H 21 #define STM32G0xx_HAL_COMP_H 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 /* Includes ------------------------------------------------------------------*/ 28 #include "stm32g0xx_hal_def.h" 29 #include "stm32g0xx_ll_exti.h" 30 31 /** @addtogroup STM32G0xx_HAL_Driver 32 * @{ 33 */ 34 #if defined (COMP1) || defined (COMP2) 35 36 /** @addtogroup COMP 37 * @{ 38 */ 39 40 /* Exported types ------------------------------------------------------------*/ 41 /** @defgroup COMP_Exported_Types COMP Exported Types 42 * @{ 43 */ 44 45 /** 46 * @brief COMP Init structure definition 47 */ 48 typedef struct 49 { 50 51 uint32_t WindowMode; /*!< Set window mode of a pair of comparators instances 52 (2 consecutive instances odd and even COMP<x> and COMP<x+1>). 53 Note: HAL COMP driver allows to set window mode from any COMP instance of the pair 54 of COMP instances composing window mode, except for window mode with COMP2 and COMP3 55 (for devices featuring COMP3): it must be set from COMP3 instance. 56 This parameter can be a value of @ref COMP_WindowMode */ 57 58 uint32_t WindowOutput; /*!< Set window mode output. 59 This parameter can be a value of @ref COMP_WindowOutput */ 60 61 uint32_t Mode; /*!< Set comparator operating mode to adjust power and speed. 62 Note: For the characteristics of comparator power modes 63 (propagation delay and power consumption), refer to device datasheet. 64 This parameter can be a value of @ref COMP_PowerMode */ 65 66 uint32_t InputPlus; /*!< Set comparator input plus (non-inverting input). 67 This parameter can be a value of @ref COMP_InputPlus */ 68 69 uint32_t InputMinus; /*!< Set comparator input minus (inverting input). 70 This parameter can be a value of @ref COMP_InputMinus */ 71 72 uint32_t Hysteresis; /*!< Set comparator hysteresis mode of the input minus. 73 This parameter can be a value of @ref COMP_Hysteresis */ 74 75 uint32_t OutputPol; /*!< Set comparator output polarity. 76 This parameter can be a value of @ref COMP_OutputPolarity */ 77 78 uint32_t BlankingSrce; /*!< Set comparator blanking source. 79 This parameter can be a value of @ref COMP_BlankingSrce */ 80 81 uint32_t TriggerMode; /*!< Set the comparator output triggering External Interrupt Line (EXTI). 82 This parameter can be a value of @ref COMP_EXTI_TriggerMode */ 83 84 } COMP_InitTypeDef; 85 86 /** 87 * @brief HAL COMP state machine: HAL COMP states definition 88 */ 89 #define COMP_STATE_BITFIELD_LOCK (0x10U) 90 typedef enum 91 { 92 HAL_COMP_STATE_RESET = 0x00U, /*!< COMP not yet initialized */ 93 HAL_COMP_STATE_RESET_LOCKED = (HAL_COMP_STATE_RESET | COMP_STATE_BITFIELD_LOCK), /*!< COMP not yet initialized and configuration is locked */ 94 HAL_COMP_STATE_READY = 0x01U, /*!< COMP initialized and ready for use */ 95 HAL_COMP_STATE_READY_LOCKED = (HAL_COMP_STATE_READY | COMP_STATE_BITFIELD_LOCK), /*!< COMP initialized but configuration is locked */ 96 HAL_COMP_STATE_BUSY = 0x02U, /*!< COMP is running */ 97 HAL_COMP_STATE_BUSY_LOCKED = (HAL_COMP_STATE_BUSY | COMP_STATE_BITFIELD_LOCK) /*!< COMP is running and configuration is locked */ 98 } HAL_COMP_StateTypeDef; 99 100 /** 101 * @brief COMP Handle Structure definition 102 */ 103 #if (USE_HAL_COMP_REGISTER_CALLBACKS == 1) 104 typedef struct __COMP_HandleTypeDef 105 #else 106 typedef struct 107 #endif /* USE_HAL_COMP_REGISTER_CALLBACKS */ 108 { 109 COMP_TypeDef *Instance; /*!< Register base address */ 110 COMP_InitTypeDef Init; /*!< COMP required parameters */ 111 HAL_LockTypeDef Lock; /*!< Locking object */ 112 __IO HAL_COMP_StateTypeDef State; /*!< COMP communication state */ 113 __IO uint32_t ErrorCode; /*!< COMP error code */ 114 #if (USE_HAL_COMP_REGISTER_CALLBACKS == 1) 115 void (* TriggerCallback)(struct __COMP_HandleTypeDef *hcomp); /*!< COMP trigger callback */ 116 void (* MspInitCallback)(struct __COMP_HandleTypeDef *hcomp); /*!< COMP Msp Init callback */ 117 void (* MspDeInitCallback)(struct __COMP_HandleTypeDef *hcomp); /*!< COMP Msp DeInit callback */ 118 #endif /* USE_HAL_COMP_REGISTER_CALLBACKS */ 119 } COMP_HandleTypeDef; 120 121 #if (USE_HAL_COMP_REGISTER_CALLBACKS == 1) 122 /** 123 * @brief HAL COMP Callback ID enumeration definition 124 */ 125 typedef enum 126 { 127 HAL_COMP_TRIGGER_CB_ID = 0x00U, /*!< COMP trigger callback ID */ 128 HAL_COMP_MSPINIT_CB_ID = 0x01U, /*!< COMP Msp Init callback ID */ 129 HAL_COMP_MSPDEINIT_CB_ID = 0x02U /*!< COMP Msp DeInit callback ID */ 130 } HAL_COMP_CallbackIDTypeDef; 131 132 /** 133 * @brief HAL COMP Callback pointer definition 134 */ 135 typedef void (*pCOMP_CallbackTypeDef)(COMP_HandleTypeDef *hcomp); /*!< pointer to a COMP callback function */ 136 137 #endif /* USE_HAL_COMP_REGISTER_CALLBACKS */ 138 139 /** 140 * @} 141 */ 142 143 /* Exported constants --------------------------------------------------------*/ 144 /** @defgroup COMP_Exported_Constants COMP Exported Constants 145 * @{ 146 */ 147 148 /** @defgroup COMP_Error_Code COMP Error Code 149 * @{ 150 */ 151 #define HAL_COMP_ERROR_NONE (0x00UL) /*!< No error */ 152 #if (USE_HAL_COMP_REGISTER_CALLBACKS == 1) 153 #define HAL_COMP_ERROR_INVALID_CALLBACK (0x01UL) /*!< Invalid Callback error */ 154 #endif /* USE_HAL_COMP_REGISTER_CALLBACKS */ 155 /** 156 * @} 157 */ 158 159 160 /** @defgroup COMP_WindowMode COMP Window Mode 161 * @{ 162 */ 163 #define COMP_WINDOWMODE_DISABLE (0x00000000UL) /*!< Window mode disable: Comparators 164 instances pair COMP1 and COMP2 are 165 independent */ 166 #define COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON (COMP_CSR_WINMODE) /*!< Window mode enable: Comparators instances 167 pair COMP1 and COMP2 have their input 168 plus connected together. 169 The common input is COMP1 input plus 170 (COMP2 input plus is no more accessible). 171 */ 172 #define COMP_WINDOWMODE_COMP2_INPUT_PLUS_COMMON (COMP_CSR_WINMODE \ 173 | COMP_WINDOWMODE_COMP2) /*!< Window mode enable: if used from COMP1 or 174 COMP2 instance, comparators instances 175 pair COMP1 and COMP2 have their input 176 plus connected together, the common input 177 is COMP2 input plus (COMP1 input plus is 178 no more accessible). If used from COMP3 179 instance (when available), comparators 180 instances pair COMP2 and COMP3 have their 181 input plus connected together, the common 182 input is COMP2 input plus (COMP3 input 183 plus is no more accessible). */ 184 /** 185 * @} 186 */ 187 188 /** @defgroup COMP_WindowOutput COMP Window output 189 * @{ 190 */ 191 #define COMP_WINDOWOUTPUT_EACH_COMP (0x00000000UL) /*!< Window output default mode: Comparators output are 192 indicating each their own state. 193 To know window mode state: each comparator output 194 must be read, if "((COMPx exclusive or COMPy) == 1)" 195 then monitored signal is within comparators window.*/ 196 #define COMP_WINDOWOUTPUT_COMP1 (COMP_CSR_WINOUT) /*!< Window output synthesized on COMP1 output: 197 COMP1 output is no more indicating its own state, but 198 global window mode state (logical high means 199 monitored signal is within comparators window). 200 Note: impacts only comparator output signal level 201 (COMPx_OUT propagated to GPIO, EXTI lines, 202 timers, ...), does not impact output digital state 203 of comparator (COMPx_VALUE) always reflecting each 204 comparator output state.*/ 205 #define COMP_WINDOWOUTPUT_COMP2 (COMP_CSR_WINOUT \ 206 | COMP_WINDOWMODE_COMP2) /*!< Window output synthesized on COMP2 output: 207 COMP2 output is no more indicating its own state, but 208 global window mode state (logical high means 209 monitored signal is within comparators window). 210 Note: impacts only comparator output signal level 211 (COMPx_OUT propagated to GPIO, EXTI lines, 212 timers, ...), does not impact output digital state 213 of comparator (COMPx_VALUE) always reflecting each 214 comparator output state.*/ 215 #if defined(COMP3) 216 #define COMP_WINDOWOUTPUT_COMP3 (COMP_CSR_WINOUT) /*!< Window output synthesized on COMP3 output: 217 COMP3 output is no more indicating its own state, but 218 global window mode state (logical high means 219 monitored signal is within comparators window). */ 220 #endif /* COMP3 */ 221 #define COMP_WINDOWOUTPUT_BOTH (0x00000001UL) /*!< Window output synthesized on both comparators output 222 of pair of comparator selected (COMP1 and COMP2, or 223 COMP2 and COMP3 for devices featuring 224 COMP3 instance): 225 both comparators outputs are no more indicating their 226 own state, but global window mode state (logical high 227 means monitored signal is within comparators window). 228 This is a specific configuration (technically 229 possible but not relevant from application 230 point of view: 231 2 comparators output used for the same signal level), 232 standard configuration for window mode is one of the 233 settings above. */ 234 /** 235 * @} 236 */ 237 238 239 /** @defgroup COMP_PowerMode COMP power mode 240 * @{ 241 */ 242 /* Note: For the characteristics of comparator power modes */ 243 /* (propagation delay and power consumption), */ 244 /* refer to device datasheet. */ 245 #define COMP_POWERMODE_HIGHSPEED (0x00000000UL) /*!< High Speed */ 246 #define COMP_POWERMODE_MEDIUMSPEED (COMP_CSR_PWRMODE_0) /*!< Medium Speed */ 247 /** 248 * @} 249 */ 250 251 /** @defgroup COMP_InputPlus COMP input plus (non-inverting input) 252 * @{ 253 */ 254 #define COMP_INPUT_PLUS_IO1 (0x00000000UL) /*!< Comparator input plus connected to IO1 (pin PC5 for COMP1, pin PB4 for COMP2, pin PB0 for COMP3 (for devices featuring COMP3 instance)) */ 255 #define COMP_INPUT_PLUS_IO2 (COMP_CSR_INPSEL_0) /*!< Comparator input plus connected to IO2 (pin PB2 for COMP1, pin PB6 for COMP2, pin PC1 for COMP3 (for devices featuring COMP3 instance)) */ 256 #define COMP_INPUT_PLUS_IO3 (COMP_CSR_INPSEL_1) /*!< Comparator input plus connected to IO3 (pin PA1 for COMP1, pin PA3 for COMP2, pin PE7 for COMP3 (for devices featuring COMP3 instance)) */ 257 /** 258 * @} 259 */ 260 261 /** @defgroup COMP_InputMinus COMP input minus (inverting input) 262 * @{ 263 */ 264 #define COMP_INPUT_MINUS_1_4VREFINT (0x00000000UL) /*!< Comparator input minus connected to 1/4 VrefInt */ 265 #define COMP_INPUT_MINUS_1_2VREFINT ( COMP_CSR_INMSEL_0) /*!< Comparator input minus connected to 1/2 VrefInt */ 266 #define COMP_INPUT_MINUS_3_4VREFINT ( COMP_CSR_INMSEL_1 ) /*!< Comparator input minus connected to 3/4 VrefInt */ 267 #define COMP_INPUT_MINUS_VREFINT ( COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0) /*!< Comparator input minus connected to VrefInt */ 268 #define COMP_INPUT_MINUS_DAC1_CH1 ( COMP_CSR_INMSEL_2 ) /*!< Comparator input minus connected to DAC1 channel 1 (DAC_OUT1) */ 269 #define COMP_INPUT_MINUS_DAC1_CH2 ( COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_0) /*!< Comparator input minus connected to DAC1 channel 2 (DAC_OUT2) */ 270 #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, pin PB2 for COMP3 (for devices featuring COMP3 instance)) */ 271 #define COMP_INPUT_MINUS_IO2 ( COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0) /*!< Comparator input minus connected to IO2 (pin PC4 for COMP1, pin PB7 for COMP2, pin PC0 for COMP3 (for devices featuring COMP3 instance)) */ 272 #define COMP_INPUT_MINUS_IO3 (COMP_CSR_INMSEL_3 ) /*!< Comparator input minus connected to IO3 (pin PA0 for COMP1, pin PA2 for COMP2, pin PE8 for COMP3 (for devices featuring COMP3 instance)) */ 273 /** 274 * @} 275 */ 276 277 /** @defgroup COMP_Hysteresis COMP hysteresis 278 * @{ 279 */ 280 #define COMP_HYSTERESIS_NONE (0x00000000UL) /*!< No hysteresis */ 281 #define COMP_HYSTERESIS_LOW ( COMP_CSR_HYST_0) /*!< Hysteresis level low */ 282 #define COMP_HYSTERESIS_MEDIUM (COMP_CSR_HYST_1 ) /*!< Hysteresis level medium */ 283 #define COMP_HYSTERESIS_HIGH (COMP_CSR_HYST_1 | COMP_CSR_HYST_0) /*!< Hysteresis level high */ 284 /** 285 * @} 286 */ 287 288 /** @defgroup COMP_OutputPolarity COMP output Polarity 289 * @{ 290 */ 291 #define COMP_OUTPUTPOL_NONINVERTED (0x00000000UL) /*!< COMP output level is not inverted (comparator output is high when the input plus is at a higher voltage than the input minus) */ 292 #define COMP_OUTPUTPOL_INVERTED (COMP_CSR_POLARITY) /*!< COMP output level is inverted (comparator output is low when the input plus is at a higher voltage than the input minus) */ 293 /** 294 * @} 295 */ 296 297 /** @defgroup COMP_BlankingSrce COMP blanking source 298 * @{ 299 */ 300 #define COMP_BLANKINGSRC_NONE (0x00000000UL) /*!<Comparator output without blanking */ 301 /* Note: Output blanking source common to all COMP instances */ 302 #define COMP_BLANKINGSRC_TIM1_OC4 (COMP_CSR_BLANKING_0) /*!< Comparator output blanking source TIM1 OC4 (common to all COMP instances: COMP1, COMP2, COMP3 (when available)) */ 303 #define COMP_BLANKINGSRC_TIM1_OC5 (COMP_CSR_BLANKING_1) /*!< Comparator output blanking source TIM1 OC5 (common to all COMP instances: COMP1, COMP2, COMP3 (when available)) */ 304 #define COMP_BLANKINGSRC_TIM2_OC3 (COMP_CSR_BLANKING_2) /*!< Comparator output blanking source TIM2 OC3 (common to all COMP instances: COMP1, COMP2, COMP3 (when available)) */ 305 #define COMP_BLANKINGSRC_TIM3_OC3 (COMP_CSR_BLANKING_3) /*!< Comparator output blanking source TIM3 OC3 (common to all COMP instances: COMP1, COMP2, COMP3 (when available)) */ 306 #define COMP_BLANKINGSRC_TIM15_OC2 (COMP_CSR_BLANKING_4) /*!< Comparator output blanking source TIM15 OC2 (common to all COMP instances: COMP1, COMP2, COMP3 (when available)) */ 307 /** 308 * @} 309 */ 310 311 /** @defgroup COMP_OutputLevel COMP Output Level 312 * @{ 313 */ 314 /* Note: Comparator output level values are fixed to "0" and "1", */ 315 /* corresponding COMP register bit is managed by HAL function to match */ 316 /* with these values (independently of bit position in register). */ 317 318 /* When output polarity is not inverted, comparator output is low when 319 the input plus is at a lower voltage than the input minus */ 320 #define COMP_OUTPUT_LEVEL_LOW (0x00000000UL) 321 /* When output polarity is not inverted, comparator output is high when 322 the input plus is at a higher voltage than the input minus */ 323 #define COMP_OUTPUT_LEVEL_HIGH (0x00000001UL) 324 /** 325 * @} 326 */ 327 328 /** @defgroup COMP_EXTI_TriggerMode COMP output to EXTI 329 * @{ 330 */ 331 #define COMP_TRIGGERMODE_NONE (0x00000000UL) /*!< Comparator output triggering no External Interrupt Line */ 332 #define COMP_TRIGGERMODE_IT_RISING (COMP_EXTI_IT | COMP_EXTI_RISING) /*!< Comparator output triggering External Interrupt Line event with interruption, on rising edge */ 333 #define COMP_TRIGGERMODE_IT_FALLING (COMP_EXTI_IT | COMP_EXTI_FALLING) /*!< Comparator output triggering External Interrupt Line event with interruption, on falling edge */ 334 #define COMP_TRIGGERMODE_IT_RISING_FALLING (COMP_EXTI_IT | COMP_EXTI_RISING | COMP_EXTI_FALLING) /*!< Comparator output triggering External Interrupt Line event with interruption, on both rising and falling edges */ 335 #define COMP_TRIGGERMODE_EVENT_RISING (COMP_EXTI_EVENT | COMP_EXTI_RISING) /*!< Comparator output triggering External Interrupt Line event only (without interruption), on rising edge */ 336 #define COMP_TRIGGERMODE_EVENT_FALLING (COMP_EXTI_EVENT | COMP_EXTI_FALLING) /*!< Comparator output triggering External Interrupt Line event only (without interruption), on falling edge */ 337 #define COMP_TRIGGERMODE_EVENT_RISING_FALLING (COMP_EXTI_EVENT | COMP_EXTI_RISING | COMP_EXTI_FALLING) /*!< Comparator output triggering External Interrupt Line event only (without interruption), on both rising and falling edges */ 338 /** 339 * @} 340 */ 341 342 /** 343 * @} 344 */ 345 346 /* Exported macro ------------------------------------------------------------*/ 347 /** @defgroup COMP_Exported_Macros COMP Exported Macros 348 * @{ 349 */ 350 351 /** @defgroup COMP_Handle_Management COMP Handle Management 352 * @{ 353 */ 354 355 /** @brief Reset COMP handle state. 356 * @param __HANDLE__ COMP handle 357 * @retval None 358 */ 359 #if (USE_HAL_COMP_REGISTER_CALLBACKS == 1) 360 #define __HAL_COMP_RESET_HANDLE_STATE(__HANDLE__) do{ \ 361 (__HANDLE__)->State = HAL_COMP_STATE_RESET; \ 362 (__HANDLE__)->MspInitCallback = NULL; \ 363 (__HANDLE__)->MspDeInitCallback = NULL; \ 364 } while(0) 365 #else 366 #define __HAL_COMP_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_COMP_STATE_RESET) 367 #endif /* USE_HAL_COMP_REGISTER_CALLBACKS */ 368 369 /** 370 * @brief Clear COMP error code (set it to no error code "HAL_COMP_ERROR_NONE"). 371 * @param __HANDLE__ COMP handle 372 * @retval None 373 */ 374 #define COMP_CLEAR_ERRORCODE(__HANDLE__) ((__HANDLE__)->ErrorCode = HAL_COMP_ERROR_NONE) 375 376 /** 377 * @brief Enable the specified comparator. 378 * @param __HANDLE__ COMP handle 379 * @retval None 380 */ 381 #define __HAL_COMP_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_EN) 382 383 /** 384 * @brief Disable the specified comparator. 385 * @param __HANDLE__ COMP handle 386 * @retval None 387 */ 388 #define __HAL_COMP_DISABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_EN) 389 390 /** 391 * @brief Lock the specified comparator configuration. 392 * @note Using this macro induce HAL COMP handle state machine being no 393 * more in line with COMP instance state. 394 * To keep HAL COMP handle state machine updated, it is recommended 395 * to use function "HAL_COMP_Lock')". 396 * @param __HANDLE__ COMP handle 397 * @retval None 398 */ 399 #define __HAL_COMP_LOCK(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_LOCK) 400 401 /** 402 * @brief Check whether the specified comparator is locked. 403 * @param __HANDLE__ COMP handle 404 * @retval Value 0 if COMP instance is not locked, value 1 if COMP instance is locked 405 */ 406 #define __HAL_COMP_IS_LOCKED(__HANDLE__) (READ_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_LOCK) == COMP_CSR_LOCK) 407 408 /** 409 * @} 410 */ 411 412 /** @defgroup COMP_Exti_Management COMP external interrupt line management 413 * @{ 414 */ 415 /** 416 * @brief Enable the COMP1 EXTI line rising edge trigger. 417 * @retval None 418 */ 419 #define __HAL_COMP_COMP1_EXTI_ENABLE_RISING_EDGE() LL_EXTI_EnableRisingTrig_0_31(COMP_EXTI_LINE_COMP1) 420 421 /** 422 * @brief Disable the COMP1 EXTI line rising edge trigger. 423 * @retval None 424 */ 425 #define __HAL_COMP_COMP1_EXTI_DISABLE_RISING_EDGE() LL_EXTI_DisableRisingTrig_0_31(COMP_EXTI_LINE_COMP1) 426 427 /** 428 * @brief Enable the COMP1 EXTI line falling edge trigger. 429 * @retval None 430 */ 431 #define __HAL_COMP_COMP1_EXTI_ENABLE_FALLING_EDGE() LL_EXTI_EnableFallingTrig_0_31(COMP_EXTI_LINE_COMP1) 432 433 /** 434 * @brief Disable the COMP1 EXTI line falling edge trigger. 435 * @retval None 436 */ 437 #define __HAL_COMP_COMP1_EXTI_DISABLE_FALLING_EDGE() LL_EXTI_DisableFallingTrig_0_31(COMP_EXTI_LINE_COMP1) 438 439 /** 440 * @brief Enable the COMP1 EXTI line rising & falling edge trigger. 441 * @retval None 442 */ 443 #define __HAL_COMP_COMP1_EXTI_ENABLE_RISING_FALLING_EDGE() do { \ 444 LL_EXTI_EnableRisingTrig_0_31(COMP_EXTI_LINE_COMP1); \ 445 LL_EXTI_EnableFallingTrig_0_31(COMP_EXTI_LINE_COMP1);\ 446 } while(0) 447 448 /** 449 * @brief Disable the COMP1 EXTI line rising & falling edge trigger. 450 * @retval None 451 */ 452 #define __HAL_COMP_COMP1_EXTI_DISABLE_RISING_FALLING_EDGE() do { \ 453 LL_EXTI_DisableRisingTrig_0_31(COMP_EXTI_LINE_COMP1); \ 454 LL_EXTI_DisableFallingTrig_0_31(COMP_EXTI_LINE_COMP1);\ 455 } while(0) 456 457 /** 458 * @brief Enable the COMP1 EXTI line in interrupt mode. 459 * @retval None 460 */ 461 #define __HAL_COMP_COMP1_EXTI_ENABLE_IT() LL_EXTI_EnableIT_0_31(COMP_EXTI_LINE_COMP1) 462 463 /** 464 * @brief Disable the COMP1 EXTI line in interrupt mode. 465 * @retval None 466 */ 467 #define __HAL_COMP_COMP1_EXTI_DISABLE_IT() LL_EXTI_DisableIT_0_31(COMP_EXTI_LINE_COMP1) 468 469 /** 470 * @brief Generate a software interrupt on the COMP1 EXTI line. 471 * @retval None 472 */ 473 #define __HAL_COMP_COMP1_EXTI_GENERATE_SWIT() LL_EXTI_GenerateSWI_0_31(COMP_EXTI_LINE_COMP1) 474 475 /** 476 * @brief Enable the COMP1 EXTI line in event mode. 477 * @retval None 478 */ 479 #define __HAL_COMP_COMP1_EXTI_ENABLE_EVENT() LL_EXTI_EnableEvent_0_31(COMP_EXTI_LINE_COMP1) 480 481 /** 482 * @brief Disable the COMP1 EXTI line in event mode. 483 * @retval None 484 */ 485 #define __HAL_COMP_COMP1_EXTI_DISABLE_EVENT() LL_EXTI_DisableEvent_0_31(COMP_EXTI_LINE_COMP1) 486 487 /** 488 * @brief Check whether the COMP1 EXTI line rising flag is set. 489 * @retval RESET or SET 490 */ 491 #define __HAL_COMP_COMP1_EXTI_GET_RISING_FLAG() LL_EXTI_IsActiveRisingFlag_0_31(COMP_EXTI_LINE_COMP1) 492 493 /** 494 * @brief Clear the COMP1 EXTI rising flag. 495 * @retval None 496 */ 497 #define __HAL_COMP_COMP1_EXTI_CLEAR_RISING_FLAG() LL_EXTI_ClearRisingFlag_0_31(COMP_EXTI_LINE_COMP1) 498 499 /** 500 * @brief Check whether the COMP1 EXTI line falling flag is set. 501 * @retval RESET or SET 502 */ 503 #define __HAL_COMP_COMP1_EXTI_GET_FALLING_FLAG() LL_EXTI_IsActiveFallingFlag_0_31(COMP_EXTI_LINE_COMP1) 504 505 /** 506 * @brief Clear the COMP1 EXTI falling flag. 507 * @retval None 508 */ 509 #define __HAL_COMP_COMP1_EXTI_CLEAR_FALLING_FLAG() LL_EXTI_ClearFallingFlag_0_31(COMP_EXTI_LINE_COMP1) 510 511 /** 512 * @brief Enable the COMP2 EXTI line rising edge trigger. 513 * @retval None 514 */ 515 #define __HAL_COMP_COMP2_EXTI_ENABLE_RISING_EDGE() LL_EXTI_EnableRisingTrig_0_31(COMP_EXTI_LINE_COMP2) 516 517 /** 518 * @brief Disable the COMP2 EXTI line rising edge trigger. 519 * @retval None 520 */ 521 #define __HAL_COMP_COMP2_EXTI_DISABLE_RISING_EDGE() LL_EXTI_DisableRisingTrig_0_31(COMP_EXTI_LINE_COMP2) 522 523 /** 524 * @brief Enable the COMP2 EXTI line falling edge trigger. 525 * @retval None 526 */ 527 #define __HAL_COMP_COMP2_EXTI_ENABLE_FALLING_EDGE() LL_EXTI_EnableFallingTrig_0_31(COMP_EXTI_LINE_COMP2) 528 529 /** 530 * @brief Disable the COMP2 EXTI line falling edge trigger. 531 * @retval None 532 */ 533 #define __HAL_COMP_COMP2_EXTI_DISABLE_FALLING_EDGE() LL_EXTI_DisableFallingTrig_0_31(COMP_EXTI_LINE_COMP2) 534 535 /** 536 * @brief Enable the COMP2 EXTI line rising & falling edge trigger. 537 * @retval None 538 */ 539 #define __HAL_COMP_COMP2_EXTI_ENABLE_RISING_FALLING_EDGE() do { \ 540 LL_EXTI_EnableRisingTrig_0_31(COMP_EXTI_LINE_COMP2);\ 541 LL_EXTI_EnableFallingTrig_0_31(COMP_EXTI_LINE_COMP2);\ 542 } while(0) 543 544 /** 545 * @brief Disable the COMP2 EXTI line rising & falling edge trigger. 546 * @retval None 547 */ 548 #define __HAL_COMP_COMP2_EXTI_DISABLE_RISING_FALLING_EDGE() do { \ 549 LL_EXTI_DisableRisingTrig_0_31(COMP_EXTI_LINE_COMP2);\ 550 LL_EXTI_DisableFallingTrig_0_31(COMP_EXTI_LINE_COMP2);\ 551 } while(0) 552 553 /** 554 * @brief Enable the COMP2 EXTI line in interrupt mode. 555 * @retval None 556 */ 557 #define __HAL_COMP_COMP2_EXTI_ENABLE_IT() LL_EXTI_EnableIT_0_31(COMP_EXTI_LINE_COMP2) 558 559 /** 560 * @brief Disable the COMP2 EXTI line in interrupt mode. 561 * @retval None 562 */ 563 #define __HAL_COMP_COMP2_EXTI_DISABLE_IT() LL_EXTI_DisableIT_0_31(COMP_EXTI_LINE_COMP2) 564 565 /** 566 * @brief Generate a software interrupt on the COMP2 EXTI line. 567 * @retval None 568 */ 569 #define __HAL_COMP_COMP2_EXTI_GENERATE_SWIT() LL_EXTI_GenerateSWI_0_31(COMP_EXTI_LINE_COMP2) 570 571 /** 572 * @brief Enable the COMP2 EXTI line in event mode. 573 * @retval None 574 */ 575 #define __HAL_COMP_COMP2_EXTI_ENABLE_EVENT() LL_EXTI_EnableEvent_0_31(COMP_EXTI_LINE_COMP2) 576 577 /** 578 * @brief Disable the COMP2 EXTI line in event mode. 579 * @retval None 580 */ 581 #define __HAL_COMP_COMP2_EXTI_DISABLE_EVENT() LL_EXTI_DisableEvent_0_31(COMP_EXTI_LINE_COMP2) 582 583 /** 584 * @brief Check whether the COMP2 EXTI line rising flag is set. 585 * @retval RESET or SET 586 */ 587 #define __HAL_COMP_COMP2_EXTI_GET_RISING_FLAG() LL_EXTI_IsActiveRisingFlag_0_31(COMP_EXTI_LINE_COMP2) 588 589 /** 590 * @brief Clear the COMP2 EXTI rising flag. 591 * @retval None 592 */ 593 #define __HAL_COMP_COMP2_EXTI_CLEAR_RISING_FLAG() LL_EXTI_ClearRisingFlag_0_31(COMP_EXTI_LINE_COMP2) 594 595 /** 596 * @brief Check whether the COMP2 EXTI line falling flag is set. 597 * @retval RESET or SET 598 */ 599 #define __HAL_COMP_COMP2_EXTI_GET_FALLING_FLAG() LL_EXTI_IsActiveFallingFlag_0_31(COMP_EXTI_LINE_COMP2) 600 601 /** 602 * @brief Clear the COMP2 EXTI falling flag. 603 * @retval None 604 */ 605 #define __HAL_COMP_COMP2_EXTI_CLEAR_FALLING_FLAG() LL_EXTI_ClearFallingFlag_0_31(COMP_EXTI_LINE_COMP2) 606 607 /** 608 * @brief Enable the COMP3 EXTI line rising edge trigger. 609 * @retval None 610 */ 611 #define __HAL_COMP_COMP3_EXTI_ENABLE_RISING_EDGE() LL_EXTI_EnableRisingTrig_0_31(COMP_EXTI_LINE_COMP3) 612 613 /** 614 * @brief Disable the COMP3 EXTI line rising edge trigger. 615 * @retval None 616 */ 617 #define __HAL_COMP_COMP3_EXTI_DISABLE_RISING_EDGE() LL_EXTI_DisableRisingTrig_0_31(COMP_EXTI_LINE_COMP3) 618 619 /** 620 * @brief Enable the COMP3 EXTI line falling edge trigger. 621 * @retval None 622 */ 623 #define __HAL_COMP_COMP3_EXTI_ENABLE_FALLING_EDGE() LL_EXTI_EnableFallingTrig_0_31(COMP_EXTI_LINE_COMP3) 624 625 /** 626 * @brief Disable the COMP3 EXTI line falling edge trigger. 627 * @retval None 628 */ 629 #define __HAL_COMP_COMP3_EXTI_DISABLE_FALLING_EDGE() LL_EXTI_DisableFallingTrig_0_31(COMP_EXTI_LINE_COMP3) 630 631 /** 632 * @brief Enable the COMP3 EXTI line rising & falling edge trigger. 633 * @retval None 634 */ 635 #define __HAL_COMP_COMP3_EXTI_ENABLE_RISING_FALLING_EDGE() do { \ 636 LL_EXTI_EnableRisingTrig_0_31(COMP_EXTI_LINE_COMP3); \ 637 LL_EXTI_EnableFallingTrig_0_31(COMP_EXTI_LINE_COMP3); \ 638 } while(0) 639 640 /** 641 * @brief Disable the COMP3 EXTI line rising & falling edge trigger. 642 * @retval None 643 */ 644 #define __HAL_COMP_COMP3_EXTI_DISABLE_RISING_FALLING_EDGE() do { \ 645 LL_EXTI_DisableRisingTrig_0_31(COMP_EXTI_LINE_COMP3); \ 646 LL_EXTI_DisableFallingTrig_0_31(COMP_EXTI_LINE_COMP3); \ 647 } while(0) 648 649 /** 650 * @brief Enable the COMP3 EXTI line in interrupt mode. 651 * @retval None 652 */ 653 #define __HAL_COMP_COMP3_EXTI_ENABLE_IT() LL_EXTI_EnableIT_0_31(COMP_EXTI_LINE_COMP3) 654 655 /** 656 * @brief Disable the COMP3 EXTI line in interrupt mode. 657 * @retval None 658 */ 659 #define __HAL_COMP_COMP3_EXTI_DISABLE_IT() LL_EXTI_DisableIT_0_31(COMP_EXTI_LINE_COMP3) 660 661 /** 662 * @brief Generate a software interrupt on the COMP3 EXTI line. 663 * @retval None 664 */ 665 #define __HAL_COMP_COMP3_EXTI_GENERATE_SWIT() LL_EXTI_GenerateSWI_0_31(COMP_EXTI_LINE_COMP3) 666 667 /** 668 * @brief Enable the COMP3 EXTI line in event mode. 669 * @retval None 670 */ 671 #define __HAL_COMP_COMP3_EXTI_ENABLE_EVENT() LL_EXTI_EnableEvent_0_31(COMP_EXTI_LINE_COMP3) 672 673 /** 674 * @brief Disable the COMP3 EXTI line in event mode. 675 * @retval None 676 */ 677 #define __HAL_COMP_COMP3_EXTI_DISABLE_EVENT() LL_EXTI_DisableEvent_0_31(COMP_EXTI_LINE_COMP3) 678 679 /** 680 * @brief Check whether the COMP3 EXTI line rising flag is set. 681 * @retval RESET or SET 682 */ 683 #define __HAL_COMP_COMP3_EXTI_GET_RISING_FLAG() LL_EXTI_IsActiveRisingFlag_0_31(COMP_EXTI_LINE_COMP3) 684 685 /** 686 * @brief Clear the COMP3 EXTI rising flag. 687 * @retval None 688 */ 689 #define __HAL_COMP_COMP3_EXTI_CLEAR_RISING_FLAG() LL_EXTI_ClearRisingFlag_0_31(COMP_EXTI_LINE_COMP3) 690 691 /** 692 * @brief Check whether the COMP3 EXTI line falling flag is set. 693 * @retval RESET or SET 694 */ 695 #define __HAL_COMP_COMP3_EXTI_GET_FALLING_FLAG() LL_EXTI_IsActiveFallingFlag_0_31(COMP_EXTI_LINE_COMP3) 696 697 /** 698 * @brief Clear the COMP3 EXTI falling flag. 699 * @retval None 700 */ 701 #define __HAL_COMP_COMP3_EXTI_CLEAR_FALLING_FLAG() LL_EXTI_ClearFallingFlag_0_31(COMP_EXTI_LINE_COMP3) 702 703 /** 704 * @} 705 */ 706 707 /** 708 * @} 709 */ 710 711 712 /* Private types -------------------------------------------------------------*/ 713 /* Private constants ---------------------------------------------------------*/ 714 /** @defgroup COMP_Private_Constants COMP Private Constants 715 * @{ 716 */ 717 718 /** @defgroup COMP_WindowMode_Instance_Differentiator COMP window mode instance differentiator 719 * @{ 720 */ 721 #define COMP_WINDOWMODE_COMP2 0x00001000U /*!< COMP window mode using common input of COMP instance: COMP2 */ 722 /** 723 * @} 724 */ 725 726 /** @defgroup COMP_ExtiLine COMP EXTI Lines 727 * @{ 728 */ 729 #define COMP_EXTI_LINE_COMP1 (EXTI_IMR1_IM17) /*!< EXTI line 17 connected to COMP1 output */ 730 #define COMP_EXTI_LINE_COMP2 (EXTI_IMR1_IM18) /*!< EXTI line 18 connected to COMP2 output */ 731 #if defined(COMP3) 732 #define COMP_EXTI_LINE_COMP3 (EXTI_IMR1_IM20) /*!< EXTI line 20 connected to COMP3 output */ 733 #endif /* COMP3 */ 734 /** 735 * @} 736 */ 737 738 /** @defgroup COMP_ExtiLine COMP EXTI Lines 739 * @{ 740 */ 741 #define COMP_EXTI_IT (0x00000001UL) /*!< EXTI line event with interruption */ 742 #define COMP_EXTI_EVENT (0x00000002UL) /*!< EXTI line event only (without interruption) */ 743 #define COMP_EXTI_RISING (0x00000010UL) /*!< EXTI line event on rising edge */ 744 #define COMP_EXTI_FALLING (0x00000020UL) /*!< EXTI line event on falling edge */ 745 /** 746 * @} 747 */ 748 749 /** 750 * @} 751 */ 752 753 /* Private macros ------------------------------------------------------------*/ 754 /** @defgroup COMP_Private_Macros COMP Private Macros 755 * @{ 756 */ 757 758 /** @defgroup COMP_GET_EXTI_LINE COMP private macros to get EXTI line associated with comparators 759 * @{ 760 */ 761 /** 762 * @brief Get the specified EXTI line for a comparator instance. 763 * @param __INSTANCE__ specifies the COMP instance. 764 * @retval value of @ref COMP_ExtiLine 765 */ 766 #if defined(COMP3) 767 #define COMP_GET_EXTI_LINE(__INSTANCE__) (((__INSTANCE__) == COMP1) ? COMP_EXTI_LINE_COMP1 \ 768 :((__INSTANCE__) == COMP2) ? COMP_EXTI_LINE_COMP2 \ 769 : COMP_EXTI_LINE_COMP3) 770 #else 771 #define COMP_GET_EXTI_LINE(__INSTANCE__) (((__INSTANCE__) == COMP1) ? COMP_EXTI_LINE_COMP1 \ 772 : COMP_EXTI_LINE_COMP2) 773 #endif /* COMP3 */ 774 /** 775 * @} 776 */ 777 778 /** @defgroup COMP_IS_COMP_Private_Definitions COMP private macros to check input parameters 779 * @{ 780 */ 781 #if defined(COMP3) 782 #define IS_COMP_WINDOWMODE(__INSTANCE__, __WINDOWMODE__) \ 783 (((__INSTANCE__) == COMP3) \ 784 ? \ 785 (((__WINDOWMODE__) == COMP_WINDOWMODE_DISABLE) || \ 786 ((__WINDOWMODE__) == COMP_WINDOWMODE_COMP2_INPUT_PLUS_COMMON) ) \ 787 :\ 788 (((__WINDOWMODE__) == COMP_WINDOWMODE_DISABLE) || \ 789 ((__WINDOWMODE__) == COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON)|| \ 790 ((__WINDOWMODE__) == COMP_WINDOWMODE_COMP2_INPUT_PLUS_COMMON) ) \ 791 ) 792 #else 793 #define IS_COMP_WINDOWMODE(__INSTANCE__, __WINDOWMODE__) \ 794 (((__WINDOWMODE__) == COMP_WINDOWMODE_DISABLE) || \ 795 ((__WINDOWMODE__) == COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON)|| \ 796 ((__WINDOWMODE__) == COMP_WINDOWMODE_COMP2_INPUT_PLUS_COMMON) ) 797 #endif /* COMP3 */ 798 799 #define IS_COMP_WINDOWOUTPUT(__WINDOWOUTPUT__) (((__WINDOWOUTPUT__) == COMP_WINDOWOUTPUT_EACH_COMP) || \ 800 ((__WINDOWOUTPUT__) == COMP_WINDOWOUTPUT_COMP1) || \ 801 ((__WINDOWOUTPUT__) == COMP_WINDOWOUTPUT_COMP2) || \ 802 ((__WINDOWOUTPUT__) == COMP_WINDOWOUTPUT_BOTH) ) 803 804 #define IS_COMP_POWERMODE(__POWERMODE__) (((__POWERMODE__) == COMP_POWERMODE_HIGHSPEED) || \ 805 ((__POWERMODE__) == COMP_POWERMODE_MEDIUMSPEED) ) 806 807 #define IS_COMP_INPUT_PLUS(__COMP_INSTANCE__, __INPUT_PLUS__) (((__INPUT_PLUS__) == COMP_INPUT_PLUS_IO1) || \ 808 ((__INPUT_PLUS__) == COMP_INPUT_PLUS_IO2) || \ 809 ((__INPUT_PLUS__) == COMP_INPUT_PLUS_IO3)) 810 811 #define IS_COMP_INPUT_MINUS(__COMP_INSTANCE__, __INPUT_MINUS__) (((__INPUT_MINUS__) == COMP_INPUT_MINUS_1_4VREFINT) ||\ 812 ((__INPUT_MINUS__) == COMP_INPUT_MINUS_1_2VREFINT) ||\ 813 ((__INPUT_MINUS__) == COMP_INPUT_MINUS_3_4VREFINT) ||\ 814 ((__INPUT_MINUS__) == COMP_INPUT_MINUS_VREFINT) ||\ 815 ((__INPUT_MINUS__) == COMP_INPUT_MINUS_DAC1_CH1) ||\ 816 ((__INPUT_MINUS__) == COMP_INPUT_MINUS_DAC1_CH2) ||\ 817 ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO1) ||\ 818 ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO2) ||\ 819 ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO3)) 820 821 #define IS_COMP_HYSTERESIS(__HYSTERESIS__) (((__HYSTERESIS__) == COMP_HYSTERESIS_NONE) || \ 822 ((__HYSTERESIS__) == COMP_HYSTERESIS_LOW) || \ 823 ((__HYSTERESIS__) == COMP_HYSTERESIS_MEDIUM) || \ 824 ((__HYSTERESIS__) == COMP_HYSTERESIS_HIGH)) 825 826 #define IS_COMP_OUTPUTPOL(__POL__) (((__POL__) == COMP_OUTPUTPOL_NONINVERTED) || \ 827 ((__POL__) == COMP_OUTPUTPOL_INVERTED)) 828 829 #define IS_COMP_BLANKINGSRCE(__OUTPUT_BLANKING_SOURCE__) \ 830 ( ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_NONE) \ 831 || ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM1_OC4) \ 832 || ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM1_OC5) \ 833 || ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM2_OC3) \ 834 || ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM3_OC3) \ 835 || ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM15_OC2) \ 836 ) 837 838 /* Note: Output blanking source common to all COMP instances */ 839 /* Macro kept for compatibility with other STM32 series */ 840 #define IS_COMP_BLANKINGSRC_INSTANCE(__INSTANCE__, __OUTPUT_BLANKING_SOURCE__) \ 841 (IS_COMP_BLANKINGSRCE(__OUTPUT_BLANKING_SOURCE__)) 842 843 844 #define IS_COMP_TRIGGERMODE(__MODE__) (((__MODE__) == COMP_TRIGGERMODE_NONE) || \ 845 ((__MODE__) == COMP_TRIGGERMODE_IT_RISING) || \ 846 ((__MODE__) == COMP_TRIGGERMODE_IT_FALLING) || \ 847 ((__MODE__) == COMP_TRIGGERMODE_IT_RISING_FALLING) || \ 848 ((__MODE__) == COMP_TRIGGERMODE_EVENT_RISING) || \ 849 ((__MODE__) == COMP_TRIGGERMODE_EVENT_FALLING) || \ 850 ((__MODE__) == COMP_TRIGGERMODE_EVENT_RISING_FALLING)) 851 852 #define IS_COMP_OUTPUT_LEVEL(__OUTPUT_LEVEL__) (((__OUTPUT_LEVEL__) == COMP_OUTPUT_LEVEL_LOW) || \ 853 ((__OUTPUT_LEVEL__) == COMP_OUTPUT_LEVEL_HIGH)) 854 855 /** 856 * @} 857 */ 858 859 /** 860 * @} 861 */ 862 863 864 /* Exported functions --------------------------------------------------------*/ 865 /** @addtogroup COMP_Exported_Functions 866 * @{ 867 */ 868 869 /** @addtogroup COMP_Exported_Functions_Group1 870 * @{ 871 */ 872 873 /* Initialization and de-initialization functions **********************************/ 874 HAL_StatusTypeDef HAL_COMP_Init(COMP_HandleTypeDef *hcomp); 875 HAL_StatusTypeDef HAL_COMP_DeInit(COMP_HandleTypeDef *hcomp); 876 void HAL_COMP_MspInit(COMP_HandleTypeDef *hcomp); 877 void HAL_COMP_MspDeInit(COMP_HandleTypeDef *hcomp); 878 879 #if (USE_HAL_COMP_REGISTER_CALLBACKS == 1) 880 /* Callbacks Register/UnRegister functions ***********************************/ 881 HAL_StatusTypeDef HAL_COMP_RegisterCallback(COMP_HandleTypeDef *hcomp, HAL_COMP_CallbackIDTypeDef CallbackID, 882 pCOMP_CallbackTypeDef pCallback); 883 HAL_StatusTypeDef HAL_COMP_UnRegisterCallback(COMP_HandleTypeDef *hcomp, HAL_COMP_CallbackIDTypeDef CallbackID); 884 #endif /* USE_HAL_COMP_REGISTER_CALLBACKS */ 885 /** 886 * @} 887 */ 888 889 /* IO operation functions *****************************************************/ 890 /** @addtogroup COMP_Exported_Functions_Group2 891 * @{ 892 */ 893 HAL_StatusTypeDef HAL_COMP_Start(COMP_HandleTypeDef *hcomp); 894 HAL_StatusTypeDef HAL_COMP_Stop(COMP_HandleTypeDef *hcomp); 895 void HAL_COMP_IRQHandler(COMP_HandleTypeDef *hcomp); 896 /** 897 * @} 898 */ 899 900 /* Peripheral Control functions ************************************************/ 901 /** @addtogroup COMP_Exported_Functions_Group3 902 * @{ 903 */ 904 HAL_StatusTypeDef HAL_COMP_Lock(COMP_HandleTypeDef *hcomp); 905 uint32_t HAL_COMP_GetOutputLevel(const COMP_HandleTypeDef *hcomp); 906 /* Callback in interrupt mode */ 907 void HAL_COMP_TriggerCallback(COMP_HandleTypeDef *hcomp); 908 /** 909 * @} 910 */ 911 912 /* Peripheral State functions **************************************************/ 913 /** @addtogroup COMP_Exported_Functions_Group4 914 * @{ 915 */ 916 HAL_COMP_StateTypeDef HAL_COMP_GetState(const COMP_HandleTypeDef *hcomp); 917 uint32_t HAL_COMP_GetError(const COMP_HandleTypeDef *hcomp); 918 /** 919 * @} 920 */ 921 922 /** 923 * @} 924 */ 925 926 /** 927 * @} 928 */ 929 #endif /* COMP1 || COMP2 */ 930 /** 931 * @} 932 */ 933 934 #ifdef __cplusplus 935 } 936 #endif 937 938 #endif /* STM32G0xx_HAL_COMP_H */ 939