stm32l4xx_hal_comp.h 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814
  1. /**
  2. ******************************************************************************
  3. * @file stm32l4xx_hal_comp.h
  4. * @author MCD Application Team
  5. * @brief Header file of COMP HAL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2017 STMicroelectronics.
  10. * All rights reserved.
  11. *
  12. * This software is licensed under terms that can be found in the LICENSE file
  13. * in the root directory of this software component.
  14. * If no LICENSE file comes with this software, it is provided AS-IS.
  15. *
  16. ******************************************************************************
  17. */
  18. /* Define to prevent recursive inclusion -------------------------------------*/
  19. #ifndef STM32L4xx_HAL_COMP_H
  20. #define STM32L4xx_HAL_COMP_H
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /* Includes ------------------------------------------------------------------*/
  25. #include "stm32l4xx_hal_def.h"
  26. #include "stm32l4xx_ll_exti.h"
  27. /** @addtogroup STM32L4xx_HAL_Driver
  28. * @{
  29. */
  30. #if defined (COMP1) || defined (COMP2)
  31. /** @addtogroup COMP
  32. * @{
  33. */
  34. /* Exported types ------------------------------------------------------------*/
  35. /** @defgroup COMP_Exported_Types COMP Exported Types
  36. * @{
  37. */
  38. /**
  39. * @brief COMP Init structure definition
  40. */
  41. typedef struct
  42. {
  43. #if defined(COMP2)
  44. uint32_t WindowMode; /*!< Set window mode of a pair of comparators instances
  45. (2 consecutive instances odd and even COMP<x> and COMP<x+1>).
  46. Note: HAL COMP driver allows to set window mode from any COMP instance of the pair of COMP instances composing window mode.
  47. This parameter can be a value of @ref COMP_WindowMode */
  48. #endif /* COMP2 */
  49. uint32_t Mode; /*!< Set comparator operating mode to adjust power and speed.
  50. Note: For the characteristics of comparator power modes
  51. (propagation delay and power consumption), refer to device datasheet.
  52. This parameter can be a value of @ref COMP_PowerMode */
  53. uint32_t NonInvertingInput; /*!< Set comparator input plus (non-inverting input).
  54. This parameter can be a value of @ref COMP_InputPlus */
  55. uint32_t InvertingInput; /*!< Set comparator input minus (inverting input).
  56. This parameter can be a value of @ref COMP_InputMinus */
  57. uint32_t Hysteresis; /*!< Set comparator hysteresis mode of the input minus.
  58. This parameter can be a value of @ref COMP_Hysteresis */
  59. uint32_t OutputPol; /*!< Set comparator output polarity.
  60. This parameter can be a value of @ref COMP_OutputPolarity */
  61. uint32_t BlankingSrce; /*!< Set comparator blanking source.
  62. This parameter can be a value of @ref COMP_BlankingSrce */
  63. uint32_t TriggerMode; /*!< Set the comparator output triggering External Interrupt Line (EXTI).
  64. This parameter can be a value of @ref COMP_EXTI_TriggerMode */
  65. } COMP_InitTypeDef;
  66. /**
  67. * @brief HAL COMP state machine: HAL COMP states definition
  68. */
  69. #define COMP_STATE_BITFIELD_LOCK (0x10U)
  70. typedef enum
  71. {
  72. HAL_COMP_STATE_RESET = 0x00U, /*!< COMP not yet initialized */
  73. HAL_COMP_STATE_RESET_LOCKED = (HAL_COMP_STATE_RESET | COMP_STATE_BITFIELD_LOCK), /*!< COMP not yet initialized and configuration is locked */
  74. HAL_COMP_STATE_READY = 0x01U, /*!< COMP initialized and ready for use */
  75. HAL_COMP_STATE_READY_LOCKED = (HAL_COMP_STATE_READY | COMP_STATE_BITFIELD_LOCK), /*!< COMP initialized but configuration is locked */
  76. HAL_COMP_STATE_BUSY = 0x02U, /*!< COMP is running */
  77. HAL_COMP_STATE_BUSY_LOCKED = (HAL_COMP_STATE_BUSY | COMP_STATE_BITFIELD_LOCK) /*!< COMP is running and configuration is locked */
  78. } HAL_COMP_StateTypeDef;
  79. /**
  80. * @brief COMP Handle Structure definition
  81. */
  82. #if (USE_HAL_COMP_REGISTER_CALLBACKS == 1)
  83. typedef struct __COMP_HandleTypeDef
  84. #else
  85. typedef struct
  86. #endif /* USE_HAL_COMP_REGISTER_CALLBACKS */
  87. {
  88. COMP_TypeDef *Instance; /*!< Register base address */
  89. COMP_InitTypeDef Init; /*!< COMP required parameters */
  90. HAL_LockTypeDef Lock; /*!< Locking object */
  91. __IO HAL_COMP_StateTypeDef State; /*!< COMP communication state */
  92. __IO uint32_t ErrorCode; /*!< COMP error code */
  93. #if (USE_HAL_COMP_REGISTER_CALLBACKS == 1)
  94. void (* TriggerCallback)(struct __COMP_HandleTypeDef *hcomp); /*!< COMP trigger callback */
  95. void (* MspInitCallback)(struct __COMP_HandleTypeDef *hcomp); /*!< COMP Msp Init callback */
  96. void (* MspDeInitCallback)(struct __COMP_HandleTypeDef *hcomp); /*!< COMP Msp DeInit callback */
  97. #endif /* USE_HAL_COMP_REGISTER_CALLBACKS */
  98. } COMP_HandleTypeDef;
  99. #if (USE_HAL_COMP_REGISTER_CALLBACKS == 1)
  100. /**
  101. * @brief HAL COMP Callback ID enumeration definition
  102. */
  103. typedef enum
  104. {
  105. HAL_COMP_TRIGGER_CB_ID = 0x00U, /*!< COMP trigger callback ID */
  106. HAL_COMP_MSPINIT_CB_ID = 0x01U, /*!< COMP Msp Init callback ID */
  107. HAL_COMP_MSPDEINIT_CB_ID = 0x02U /*!< COMP Msp DeInit callback ID */
  108. } HAL_COMP_CallbackIDTypeDef;
  109. /**
  110. * @brief HAL COMP Callback pointer definition
  111. */
  112. typedef void (*pCOMP_CallbackTypeDef)(COMP_HandleTypeDef *hcomp); /*!< pointer to a COMP callback function */
  113. #endif /* USE_HAL_COMP_REGISTER_CALLBACKS */
  114. /**
  115. * @}
  116. */
  117. /* Exported constants --------------------------------------------------------*/
  118. /** @defgroup COMP_Exported_Constants COMP Exported Constants
  119. * @{
  120. */
  121. /** @defgroup COMP_Error_Code COMP Error Code
  122. * @{
  123. */
  124. #define HAL_COMP_ERROR_NONE (0x00UL) /*!< No error */
  125. #if (USE_HAL_COMP_REGISTER_CALLBACKS == 1)
  126. #define HAL_COMP_ERROR_INVALID_CALLBACK (0x01UL) /*!< Invalid Callback error */
  127. #endif /* USE_HAL_COMP_REGISTER_CALLBACKS */
  128. /**
  129. * @}
  130. */
  131. #if defined(COMP2)
  132. /** @defgroup COMP_WindowMode COMP Window Mode
  133. * @{
  134. */
  135. #define COMP_WINDOWMODE_DISABLE (0x00000000UL) /*!< Window mode disable: Comparators instances pair COMP1 and COMP2 are independent */
  136. #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). */
  137. /**
  138. * @}
  139. */
  140. #endif /* COMP2 */
  141. /** @defgroup COMP_PowerMode COMP power mode
  142. * @{
  143. */
  144. /* Note: For the characteristics of comparator power modes */
  145. /* (propagation delay and power consumption), */
  146. /* refer to device datasheet. */
  147. #define COMP_POWERMODE_HIGHSPEED (0x00000000UL) /*!< High Speed */
  148. #define COMP_POWERMODE_MEDIUMSPEED (COMP_CSR_PWRMODE_0) /*!< Medium Speed */
  149. #define COMP_POWERMODE_ULTRALOWPOWER (COMP_CSR_PWRMODE) /*!< Ultra-low power mode */
  150. /**
  151. * @}
  152. */
  153. /** @defgroup COMP_InputPlus COMP input plus (non-inverting input)
  154. * @{
  155. */
  156. #define COMP_INPUT_PLUS_IO1 (0x00000000UL) /*!< Comparator input plus connected to IO1 (pin PC5 for COMP1, pin PB4 for COMP2) */
  157. #define COMP_INPUT_PLUS_IO2 (COMP_CSR_INPSEL_0) /*!< Comparator input plus connected to IO2 (pin PB2 for COMP1, pin PB6 for COMP2) */
  158. #if defined(COMP_CSR_INPSEL_1)
  159. #define COMP_INPUT_PLUS_IO3 (COMP_CSR_INPSEL_1) /*!< Comparator input plus connected to IO3 (pin PA1 for COMP1, pin PA3 for COMP2) */
  160. #endif
  161. /**
  162. * @}
  163. */
  164. /** @defgroup COMP_InputMinus COMP input minus (inverting input)
  165. * @{
  166. */
  167. #define COMP_INPUT_MINUS_1_4VREFINT ( COMP_CSR_SCALEN | COMP_CSR_BRGEN) /*!< Comparator input minus connected to 1/4 VrefInt */
  168. #define COMP_INPUT_MINUS_1_2VREFINT ( COMP_CSR_INMSEL_0 | COMP_CSR_SCALEN | COMP_CSR_BRGEN) /*!< Comparator input minus connected to 1/2 VrefInt */
  169. #define COMP_INPUT_MINUS_3_4VREFINT ( COMP_CSR_INMSEL_1 | COMP_CSR_SCALEN | COMP_CSR_BRGEN) /*!< Comparator input minus connected to 3/4 VrefInt */
  170. #define COMP_INPUT_MINUS_VREFINT ( COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0 | COMP_CSR_SCALEN ) /*!< Comparator input minus connected to VrefInt */
  171. #define COMP_INPUT_MINUS_DAC1_CH1 (COMP_CSR_INMSEL_2 ) /*!< Comparator input minus connected to DAC1 channel 1 (DAC_OUT1) */
  172. #if defined(DAC_CHANNEL2_SUPPORT)
  173. #define COMP_INPUT_MINUS_DAC1_CH2 (COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_0) /*!< Comparator input minus connected to DAC1 channel 2 (DAC_OUT2) */
  174. #endif /* DAC_CHANNEL2_SUPPORT */
  175. #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) */
  176. #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) */
  177. #if defined(COMP_CSR_INMESEL_1)
  178. #define COMP_INPUT_MINUS_IO3 ( COMP_CSR_INMESEL_0 | COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0) /*!< Comparator input minus connected to IO3 (pin PA0 for COMP1, pin PA2 for COMP2) */
  179. #define COMP_INPUT_MINUS_IO4 (COMP_CSR_INMESEL_1 | COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0) /*!< Comparator input minus connected to IO4 (pin PA4 for COMP1, pin PA4 for COMP2) */
  180. #define COMP_INPUT_MINUS_IO5 (COMP_CSR_INMESEL_1 | COMP_CSR_INMESEL_0 | COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0) /*!< Comparator input minus connected to IO5 (pin PA5 for COMP1, pin PA5 for COMP2) */
  181. #endif /* COMP_CSR_INMESEL_1 */
  182. /**
  183. * @}
  184. */
  185. /** @defgroup COMP_Hysteresis COMP hysteresis
  186. * @{
  187. */
  188. #define COMP_HYSTERESIS_NONE (0x00000000UL) /*!< No hysteresis */
  189. #define COMP_HYSTERESIS_LOW ( COMP_CSR_HYST_0) /*!< Hysteresis level low */
  190. #define COMP_HYSTERESIS_MEDIUM (COMP_CSR_HYST_1 ) /*!< Hysteresis level medium */
  191. #define COMP_HYSTERESIS_HIGH (COMP_CSR_HYST_1 | COMP_CSR_HYST_0) /*!< Hysteresis level high */
  192. /**
  193. * @}
  194. */
  195. /** @defgroup COMP_OutputPolarity COMP output Polarity
  196. * @{
  197. */
  198. #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) */
  199. #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) */
  200. /**
  201. * @}
  202. */
  203. /** @defgroup COMP_BlankingSrce COMP blanking source
  204. * @{
  205. */
  206. #define COMP_BLANKINGSRC_NONE (0x00000000UL) /*!<Comparator output without blanking */
  207. #define COMP_BLANKINGSRC_TIM1_OC5_COMP1 (COMP_CSR_BLANKING_0) /*!< Comparator output blanking source TIM1 OC5 (specific to COMP instance: COMP1) */
  208. #define COMP_BLANKINGSRC_TIM2_OC3_COMP1 (COMP_CSR_BLANKING_1) /*!< Comparator output blanking source TIM2 OC3 (specific to COMP instance: COMP1) */
  209. #define COMP_BLANKINGSRC_TIM3_OC3_COMP1 (COMP_CSR_BLANKING_2) /*!< Comparator output blanking source TIM3 OC3 (specific to COMP instance: COMP1) */
  210. #define COMP_BLANKINGSRC_TIM3_OC4_COMP2 (COMP_CSR_BLANKING_0) /*!< Comparator output blanking source TIM3 OC4 (specific to COMP instance: COMP2) */
  211. #define COMP_BLANKINGSRC_TIM8_OC5_COMP2 (COMP_CSR_BLANKING_1) /*!< Comparator output blanking source TIM8 OC5 (specific to COMP instance: COMP2) */
  212. #define COMP_BLANKINGSRC_TIM15_OC1_COMP2 (COMP_CSR_BLANKING_2) /*!< Comparator output blanking source TIM15 OC1 (specific to COMP instance: COMP2) */
  213. /**
  214. * @}
  215. */
  216. /** @defgroup COMP_OutputLevel COMP Output Level
  217. * @{
  218. */
  219. /* Note: Comparator output level values are fixed to "0" and "1", */
  220. /* corresponding COMP register bit is managed by HAL function to match */
  221. /* with these values (independently of bit position in register). */
  222. /* When output polarity is not inverted, comparator output is low when
  223. the input plus is at a lower voltage than the input minus */
  224. #define COMP_OUTPUT_LEVEL_LOW (0x00000000UL)
  225. /* When output polarity is not inverted, comparator output is high when
  226. the input plus is at a higher voltage than the input minus */
  227. #define COMP_OUTPUT_LEVEL_HIGH (0x00000001UL)
  228. /**
  229. * @}
  230. */
  231. /** @defgroup COMP_EXTI_TriggerMode COMP output to EXTI
  232. * @{
  233. */
  234. #define COMP_TRIGGERMODE_NONE (0x00000000UL) /*!< Comparator output triggering no External Interrupt Line */
  235. #define COMP_TRIGGERMODE_IT_RISING (COMP_EXTI_IT | COMP_EXTI_RISING) /*!< Comparator output triggering External Interrupt Line event with interruption, on rising edge */
  236. #define COMP_TRIGGERMODE_IT_FALLING (COMP_EXTI_IT | COMP_EXTI_FALLING) /*!< Comparator output triggering External Interrupt Line event with interruption, on falling edge */
  237. #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 */
  238. #define COMP_TRIGGERMODE_EVENT_RISING (COMP_EXTI_EVENT | COMP_EXTI_RISING) /*!< Comparator output triggering External Interrupt Line event only (without interruption), on rising edge */
  239. #define COMP_TRIGGERMODE_EVENT_FALLING (COMP_EXTI_EVENT | COMP_EXTI_FALLING) /*!< Comparator output triggering External Interrupt Line event only (without interruption), on falling edge */
  240. #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 */
  241. /**
  242. * @}
  243. */
  244. /**
  245. * @}
  246. */
  247. /* Exported macro ------------------------------------------------------------*/
  248. /** @defgroup COMP_Exported_Macros COMP Exported Macros
  249. * @{
  250. */
  251. /** @defgroup COMP_Handle_Management COMP Handle Management
  252. * @{
  253. */
  254. /** @brief Reset COMP handle state.
  255. * @param __HANDLE__ COMP handle
  256. * @retval None
  257. */
  258. #if (USE_HAL_COMP_REGISTER_CALLBACKS == 1)
  259. #define __HAL_COMP_RESET_HANDLE_STATE(__HANDLE__) do{ \
  260. (__HANDLE__)->State = HAL_COMP_STATE_RESET; \
  261. (__HANDLE__)->MspInitCallback = NULL; \
  262. (__HANDLE__)->MspDeInitCallback = NULL; \
  263. } while(0)
  264. #else
  265. #define __HAL_COMP_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_COMP_STATE_RESET)
  266. #endif /* USE_HAL_COMP_REGISTER_CALLBACKS */
  267. /**
  268. * @brief Clear COMP error code (set it to no error code "HAL_COMP_ERROR_NONE").
  269. * @param __HANDLE__ COMP handle
  270. * @retval None
  271. */
  272. #define COMP_CLEAR_ERRORCODE(__HANDLE__) ((__HANDLE__)->ErrorCode = HAL_COMP_ERROR_NONE)
  273. /**
  274. * @brief Enable the specified comparator.
  275. * @param __HANDLE__ COMP handle
  276. * @retval None
  277. */
  278. #define __HAL_COMP_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_EN)
  279. /**
  280. * @brief Disable the specified comparator.
  281. * @param __HANDLE__ COMP handle
  282. * @retval None
  283. */
  284. #define __HAL_COMP_DISABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_EN)
  285. /**
  286. * @brief Lock the specified comparator configuration.
  287. * @note Using this macro induce HAL COMP handle state machine being no
  288. * more in line with COMP instance state.
  289. * To keep HAL COMP handle state machine updated, it is recommended
  290. * to use function "HAL_COMP_Lock')".
  291. * @param __HANDLE__ COMP handle
  292. * @retval None
  293. */
  294. #define __HAL_COMP_LOCK(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_LOCK)
  295. /**
  296. * @brief Check whether the specified comparator is locked.
  297. * @param __HANDLE__ COMP handle
  298. * @retval Value 0 if COMP instance is not locked, value 1 if COMP instance is locked
  299. */
  300. #define __HAL_COMP_IS_LOCKED(__HANDLE__) (READ_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_LOCK) == COMP_CSR_LOCK)
  301. /**
  302. * @}
  303. */
  304. /** @defgroup COMP_Exti_Management COMP external interrupt line management
  305. * @{
  306. */
  307. /**
  308. * @brief Enable the COMP1 EXTI line rising edge trigger.
  309. * @retval None
  310. */
  311. #define __HAL_COMP_COMP1_EXTI_ENABLE_RISING_EDGE() LL_EXTI_EnableRisingTrig_0_31(COMP_EXTI_LINE_COMP1)
  312. /**
  313. * @brief Disable the COMP1 EXTI line rising edge trigger.
  314. * @retval None
  315. */
  316. #define __HAL_COMP_COMP1_EXTI_DISABLE_RISING_EDGE() LL_EXTI_DisableRisingTrig_0_31(COMP_EXTI_LINE_COMP1)
  317. /**
  318. * @brief Enable the COMP1 EXTI line falling edge trigger.
  319. * @retval None
  320. */
  321. #define __HAL_COMP_COMP1_EXTI_ENABLE_FALLING_EDGE() LL_EXTI_EnableFallingTrig_0_31(COMP_EXTI_LINE_COMP1)
  322. /**
  323. * @brief Disable the COMP1 EXTI line falling edge trigger.
  324. * @retval None
  325. */
  326. #define __HAL_COMP_COMP1_EXTI_DISABLE_FALLING_EDGE() LL_EXTI_DisableFallingTrig_0_31(COMP_EXTI_LINE_COMP1)
  327. /**
  328. * @brief Enable the COMP1 EXTI line rising & falling edge trigger.
  329. * @retval None
  330. */
  331. #define __HAL_COMP_COMP1_EXTI_ENABLE_RISING_FALLING_EDGE() do { \
  332. LL_EXTI_EnableRisingTrig_0_31(COMP_EXTI_LINE_COMP1); \
  333. LL_EXTI_EnableFallingTrig_0_31(COMP_EXTI_LINE_COMP1); \
  334. } while(0)
  335. /**
  336. * @brief Disable the COMP1 EXTI line rising & falling edge trigger.
  337. * @retval None
  338. */
  339. #define __HAL_COMP_COMP1_EXTI_DISABLE_RISING_FALLING_EDGE() do { \
  340. LL_EXTI_DisableRisingTrig_0_31(COMP_EXTI_LINE_COMP1); \
  341. LL_EXTI_DisableFallingTrig_0_31(COMP_EXTI_LINE_COMP1); \
  342. } while(0)
  343. /**
  344. * @brief Enable the COMP1 EXTI line in interrupt mode.
  345. * @retval None
  346. */
  347. #define __HAL_COMP_COMP1_EXTI_ENABLE_IT() LL_EXTI_EnableIT_0_31(COMP_EXTI_LINE_COMP1)
  348. /**
  349. * @brief Disable the COMP1 EXTI line in interrupt mode.
  350. * @retval None
  351. */
  352. #define __HAL_COMP_COMP1_EXTI_DISABLE_IT() LL_EXTI_DisableIT_0_31(COMP_EXTI_LINE_COMP1)
  353. /**
  354. * @brief Generate a software interrupt on the COMP1 EXTI line.
  355. * @retval None
  356. */
  357. #define __HAL_COMP_COMP1_EXTI_GENERATE_SWIT() LL_EXTI_GenerateSWI_0_31(COMP_EXTI_LINE_COMP1)
  358. /**
  359. * @brief Enable the COMP1 EXTI line in event mode.
  360. * @retval None
  361. */
  362. #define __HAL_COMP_COMP1_EXTI_ENABLE_EVENT() LL_EXTI_EnableEvent_0_31(COMP_EXTI_LINE_COMP1)
  363. /**
  364. * @brief Disable the COMP1 EXTI line in event mode.
  365. * @retval None
  366. */
  367. #define __HAL_COMP_COMP1_EXTI_DISABLE_EVENT() LL_EXTI_DisableEvent_0_31(COMP_EXTI_LINE_COMP1)
  368. /**
  369. * @brief Check whether the COMP1 EXTI line flag is set.
  370. * @retval RESET or SET
  371. */
  372. #define __HAL_COMP_COMP1_EXTI_GET_FLAG() LL_EXTI_IsActiveFlag_0_31(COMP_EXTI_LINE_COMP1)
  373. /**
  374. * @brief Clear the COMP1 EXTI flag.
  375. * @retval None
  376. */
  377. #define __HAL_COMP_COMP1_EXTI_CLEAR_FLAG() LL_EXTI_ClearFlag_0_31(COMP_EXTI_LINE_COMP1)
  378. #if defined(COMP2)
  379. /**
  380. * @brief Enable the COMP2 EXTI line rising edge trigger.
  381. * @retval None
  382. */
  383. #define __HAL_COMP_COMP2_EXTI_ENABLE_RISING_EDGE() LL_EXTI_EnableRisingTrig_0_31(COMP_EXTI_LINE_COMP2)
  384. /**
  385. * @brief Disable the COMP2 EXTI line rising edge trigger.
  386. * @retval None
  387. */
  388. #define __HAL_COMP_COMP2_EXTI_DISABLE_RISING_EDGE() LL_EXTI_DisableRisingTrig_0_31(COMP_EXTI_LINE_COMP2)
  389. /**
  390. * @brief Enable the COMP2 EXTI line falling edge trigger.
  391. * @retval None
  392. */
  393. #define __HAL_COMP_COMP2_EXTI_ENABLE_FALLING_EDGE() LL_EXTI_EnableFallingTrig_0_31(COMP_EXTI_LINE_COMP2)
  394. /**
  395. * @brief Disable the COMP2 EXTI line falling edge trigger.
  396. * @retval None
  397. */
  398. #define __HAL_COMP_COMP2_EXTI_DISABLE_FALLING_EDGE() LL_EXTI_DisableFallingTrig_0_31(COMP_EXTI_LINE_COMP2)
  399. /**
  400. * @brief Enable the COMP2 EXTI line rising & falling edge trigger.
  401. * @retval None
  402. */
  403. #define __HAL_COMP_COMP2_EXTI_ENABLE_RISING_FALLING_EDGE() do { \
  404. LL_EXTI_EnableRisingTrig_0_31(COMP_EXTI_LINE_COMP2); \
  405. LL_EXTI_EnableFallingTrig_0_31(COMP_EXTI_LINE_COMP2); \
  406. } while(0)
  407. /**
  408. * @brief Disable the COMP2 EXTI line rising & falling edge trigger.
  409. * @retval None
  410. */
  411. #define __HAL_COMP_COMP2_EXTI_DISABLE_RISING_FALLING_EDGE() do { \
  412. LL_EXTI_DisableRisingTrig_0_31(COMP_EXTI_LINE_COMP2); \
  413. LL_EXTI_DisableFallingTrig_0_31(COMP_EXTI_LINE_COMP2); \
  414. } while(0)
  415. /**
  416. * @brief Enable the COMP2 EXTI line in interrupt mode.
  417. * @retval None
  418. */
  419. #define __HAL_COMP_COMP2_EXTI_ENABLE_IT() LL_EXTI_EnableIT_0_31(COMP_EXTI_LINE_COMP2)
  420. /**
  421. * @brief Disable the COMP2 EXTI line in interrupt mode.
  422. * @retval None
  423. */
  424. #define __HAL_COMP_COMP2_EXTI_DISABLE_IT() LL_EXTI_DisableIT_0_31(COMP_EXTI_LINE_COMP2)
  425. /**
  426. * @brief Generate a software interrupt on the COMP2 EXTI line.
  427. * @retval None
  428. */
  429. #define __HAL_COMP_COMP2_EXTI_GENERATE_SWIT() LL_EXTI_GenerateSWI_0_31(COMP_EXTI_LINE_COMP2)
  430. /**
  431. * @brief Enable the COMP2 EXTI line in event mode.
  432. * @retval None
  433. */
  434. #define __HAL_COMP_COMP2_EXTI_ENABLE_EVENT() LL_EXTI_EnableEvent_0_31(COMP_EXTI_LINE_COMP2)
  435. /**
  436. * @brief Disable the COMP2 EXTI line in event mode.
  437. * @retval None
  438. */
  439. #define __HAL_COMP_COMP2_EXTI_DISABLE_EVENT() LL_EXTI_DisableEvent_0_31(COMP_EXTI_LINE_COMP2)
  440. /**
  441. * @brief Check whether the COMP2 EXTI line flag is set.
  442. * @retval RESET or SET
  443. */
  444. #define __HAL_COMP_COMP2_EXTI_GET_FLAG() LL_EXTI_IsActiveFlag_0_31(COMP_EXTI_LINE_COMP2)
  445. /**
  446. * @brief Clear the COMP2 EXTI flag.
  447. * @retval None
  448. */
  449. #define __HAL_COMP_COMP2_EXTI_CLEAR_FLAG() LL_EXTI_ClearFlag_0_31(COMP_EXTI_LINE_COMP2)
  450. #endif /* COMP2 */
  451. /**
  452. * @}
  453. */
  454. /**
  455. * @}
  456. */
  457. /* Private types -------------------------------------------------------------*/
  458. /* Private constants ---------------------------------------------------------*/
  459. /** @defgroup COMP_Private_Constants COMP Private Constants
  460. * @{
  461. */
  462. /** @defgroup COMP_ExtiLine COMP EXTI Lines
  463. * @{
  464. */
  465. #define COMP_EXTI_LINE_COMP1 (LL_EXTI_LINE_21) /*!< EXTI line 21 connected to COMP1 output */
  466. #if defined(COMP2)
  467. #define COMP_EXTI_LINE_COMP2 (LL_EXTI_LINE_22) /*!< EXTI line 22 connected to COMP2 output */
  468. #endif /* COMP2 */
  469. /**
  470. * @}
  471. */
  472. /** @defgroup COMP_ExtiLine COMP EXTI Lines
  473. * @{
  474. */
  475. #define COMP_EXTI_IT (0x00000001UL) /*!< EXTI line event with interruption */
  476. #define COMP_EXTI_EVENT (0x00000002UL) /*!< EXTI line event only (without interruption) */
  477. #define COMP_EXTI_RISING (0x00000010UL) /*!< EXTI line event on rising edge */
  478. #define COMP_EXTI_FALLING (0x00000020UL) /*!< EXTI line event on falling edge */
  479. /**
  480. * @}
  481. */
  482. /**
  483. * @}
  484. */
  485. /* Private macros ------------------------------------------------------------*/
  486. /** @defgroup COMP_Private_Macros COMP Private Macros
  487. * @{
  488. */
  489. /** @defgroup COMP_GET_EXTI_LINE COMP private macros to get EXTI line associated with comparators
  490. * @{
  491. */
  492. /**
  493. * @brief Get the specified EXTI line for a comparator instance.
  494. * @param __INSTANCE__ specifies the COMP instance.
  495. * @retval value of @ref COMP_ExtiLine
  496. */
  497. #if defined(COMP2)
  498. #define COMP_GET_EXTI_LINE(__INSTANCE__) (((__INSTANCE__) == COMP1) ? COMP_EXTI_LINE_COMP1 \
  499. : COMP_EXTI_LINE_COMP2)
  500. #else
  501. #define COMP_GET_EXTI_LINE(__INSTANCE__) COMP_EXTI_LINE_COMP1
  502. #endif /* COMP2 */
  503. /**
  504. * @}
  505. */
  506. /** @defgroup COMP_IS_COMP_Private_Definitions COMP private macros to check input parameters
  507. * @{
  508. */
  509. #if defined(COMP2)
  510. #define IS_COMP_WINDOWMODE(__WINDOWMODE__) (((__WINDOWMODE__) == COMP_WINDOWMODE_DISABLE) || \
  511. ((__WINDOWMODE__) == COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON) )
  512. #endif /* COMP2 */
  513. #define IS_COMP_POWERMODE(__POWERMODE__) (((__POWERMODE__) == COMP_POWERMODE_HIGHSPEED) || \
  514. ((__POWERMODE__) == COMP_POWERMODE_MEDIUMSPEED) || \
  515. ((__POWERMODE__) == COMP_POWERMODE_ULTRALOWPOWER) )
  516. #if defined(COMP_CSR_INPSEL_1)
  517. #define IS_COMP_INPUT_PLUS(__COMP_INSTANCE__, __INPUT_PLUS__) (((__INPUT_PLUS__) == COMP_INPUT_PLUS_IO1) || \
  518. ((__INPUT_PLUS__) == COMP_INPUT_PLUS_IO2) || \
  519. ((__INPUT_PLUS__) == COMP_INPUT_PLUS_IO3))
  520. #else
  521. #define IS_COMP_INPUT_PLUS(__COMP_INSTANCE__, __INPUT_PLUS__) (((__INPUT_PLUS__) == COMP_INPUT_PLUS_IO1) || \
  522. ((__INPUT_PLUS__) == COMP_INPUT_PLUS_IO2))
  523. #endif
  524. /* Note: On this STM32 series, comparator input minus parameters are */
  525. /* the same on all COMP instances. */
  526. /* However, comparator instance kept as macro parameter for */
  527. /* compatibility with other STM32 families. */
  528. #if defined(COMP_CSR_INMESEL_1) && defined(DAC_CHANNEL2_SUPPORT)
  529. #define IS_COMP_INPUT_MINUS(__COMP_INSTANCE__, __INPUT_MINUS__) (((__INPUT_MINUS__) == COMP_INPUT_MINUS_1_4VREFINT) || \
  530. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_1_2VREFINT) || \
  531. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_3_4VREFINT) || \
  532. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_VREFINT) || \
  533. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_DAC1_CH1) || \
  534. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_DAC1_CH2) || \
  535. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO1) || \
  536. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO2) || \
  537. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO3) || \
  538. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO4) || \
  539. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO5))
  540. #elif defined(COMP_CSR_INMESEL_1)
  541. #define IS_COMP_INPUT_MINUS(__COMP_INSTANCE__, __INPUT_MINUS__) (((__INPUT_MINUS__) == COMP_INPUT_MINUS_1_4VREFINT) || \
  542. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_1_2VREFINT) || \
  543. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_3_4VREFINT) || \
  544. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_VREFINT) || \
  545. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_DAC1_CH1) || \
  546. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO1) || \
  547. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO2) || \
  548. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO3) || \
  549. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO4) || \
  550. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO5))
  551. #elif defined(DAC_CHANNEL2_SUPPORT)
  552. #define IS_COMP_INPUT_MINUS(__COMP_INSTANCE__, __INPUT_MINUS__) (((__INPUT_MINUS__) == COMP_INPUT_MINUS_1_4VREFINT) || \
  553. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_1_2VREFINT) || \
  554. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_3_4VREFINT) || \
  555. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_VREFINT) || \
  556. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_DAC1_CH1) || \
  557. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_DAC1_CH2) || \
  558. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO1) || \
  559. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO2))
  560. #else
  561. #define IS_COMP_INPUT_MINUS(__COMP_INSTANCE__, __INPUT_MINUS__) (((__INPUT_MINUS__) == COMP_INPUT_MINUS_1_4VREFINT) || \
  562. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_1_2VREFINT) || \
  563. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_3_4VREFINT) || \
  564. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_VREFINT) || \
  565. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_DAC1_CH1) || \
  566. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO1) || \
  567. ((__INPUT_MINUS__) == COMP_INPUT_MINUS_IO2))
  568. #endif /* COMP_CSR_INMESEL_1 && DAC_CHANNEL2_SUPPORT */
  569. #define IS_COMP_HYSTERESIS(__HYSTERESIS__) (((__HYSTERESIS__) == COMP_HYSTERESIS_NONE) || \
  570. ((__HYSTERESIS__) == COMP_HYSTERESIS_LOW) || \
  571. ((__HYSTERESIS__) == COMP_HYSTERESIS_MEDIUM) || \
  572. ((__HYSTERESIS__) == COMP_HYSTERESIS_HIGH))
  573. #define IS_COMP_OUTPUTPOL(__POL__) (((__POL__) == COMP_OUTPUTPOL_NONINVERTED) || \
  574. ((__POL__) == COMP_OUTPUTPOL_INVERTED))
  575. #if defined(COMP2)
  576. #define IS_COMP_BLANKINGSRCE(__OUTPUT_BLANKING_SOURCE__) \
  577. ( ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_NONE) \
  578. || ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM1_OC5_COMP1) \
  579. || ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM2_OC3_COMP1) \
  580. || ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM3_OC3_COMP1) \
  581. || ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM3_OC4_COMP2) \
  582. || ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM8_OC5_COMP2) \
  583. || ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM15_OC1_COMP2) \
  584. )
  585. #else
  586. #if defined(TIM3)
  587. #define IS_COMP_BLANKINGSRCE(__OUTPUT_BLANKING_SOURCE__) \
  588. ( ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_NONE) \
  589. || ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM1_OC5_COMP1) \
  590. || ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM2_OC3_COMP1) \
  591. || ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM3_OC3_COMP1) \
  592. )
  593. #else
  594. #define IS_COMP_BLANKINGSRCE(__OUTPUT_BLANKING_SOURCE__) \
  595. ( ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_NONE) \
  596. || ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM1_OC5_COMP1) \
  597. || ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM2_OC3_COMP1) \
  598. )
  599. #endif /* TIM3 */
  600. #endif /* COMP2 */
  601. #if defined(COMP2)
  602. #define IS_COMP_BLANKINGSRC_INSTANCE(__INSTANCE__, __OUTPUT_BLANKING_SOURCE__) \
  603. ((((__INSTANCE__) == COMP1) && \
  604. (((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_NONE) || \
  605. ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM1_OC5_COMP1) || \
  606. ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM2_OC3_COMP1) || \
  607. ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM3_OC3_COMP1))) \
  608. || \
  609. (((__INSTANCE__) == COMP2) && \
  610. (((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_NONE) || \
  611. ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM3_OC4_COMP2) || \
  612. ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM8_OC5_COMP2) || \
  613. ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM15_OC1_COMP2))))
  614. #else
  615. #if defined(TIM3)
  616. #define IS_COMP_BLANKINGSRC_INSTANCE(__INSTANCE__, __OUTPUT_BLANKING_SOURCE__) \
  617. (((__INSTANCE__) == COMP1) && \
  618. (((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_NONE) || \
  619. ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM1_OC5_COMP1) || \
  620. ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM2_OC3_COMP1) || \
  621. ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM3_OC3_COMP1)))
  622. #else
  623. #define IS_COMP_BLANKINGSRC_INSTANCE(__INSTANCE__, __OUTPUT_BLANKING_SOURCE__) \
  624. (((__INSTANCE__) == COMP1) && \
  625. (((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_NONE) || \
  626. ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM1_OC5_COMP1) || \
  627. ((__OUTPUT_BLANKING_SOURCE__) == COMP_BLANKINGSRC_TIM2_OC3_COMP1) ))
  628. #endif /* TIM3 */
  629. #endif /* COMP2 */
  630. #define IS_COMP_TRIGGERMODE(__MODE__) (((__MODE__) == COMP_TRIGGERMODE_NONE) || \
  631. ((__MODE__) == COMP_TRIGGERMODE_IT_RISING) || \
  632. ((__MODE__) == COMP_TRIGGERMODE_IT_FALLING) || \
  633. ((__MODE__) == COMP_TRIGGERMODE_IT_RISING_FALLING) || \
  634. ((__MODE__) == COMP_TRIGGERMODE_EVENT_RISING) || \
  635. ((__MODE__) == COMP_TRIGGERMODE_EVENT_FALLING) || \
  636. ((__MODE__) == COMP_TRIGGERMODE_EVENT_RISING_FALLING))
  637. #define IS_COMP_OUTPUT_LEVEL(__OUTPUT_LEVEL__) (((__OUTPUT_LEVEL__) == COMP_OUTPUT_LEVEL_LOW) || \
  638. ((__OUTPUT_LEVEL__) == COMP_OUTPUT_LEVEL_HIGH))
  639. /**
  640. * @}
  641. */
  642. /**
  643. * @}
  644. */
  645. /* Exported functions --------------------------------------------------------*/
  646. /** @addtogroup COMP_Exported_Functions
  647. * @{
  648. */
  649. /** @addtogroup COMP_Exported_Functions_Group1
  650. * @{
  651. */
  652. /* Initialization and de-initialization functions **********************************/
  653. HAL_StatusTypeDef HAL_COMP_Init(COMP_HandleTypeDef *hcomp);
  654. HAL_StatusTypeDef HAL_COMP_DeInit(COMP_HandleTypeDef *hcomp);
  655. void HAL_COMP_MspInit(COMP_HandleTypeDef *hcomp);
  656. void HAL_COMP_MspDeInit(COMP_HandleTypeDef *hcomp);
  657. #if (USE_HAL_COMP_REGISTER_CALLBACKS == 1)
  658. /* Callbacks Register/UnRegister functions ***********************************/
  659. HAL_StatusTypeDef HAL_COMP_RegisterCallback(COMP_HandleTypeDef *hcomp, HAL_COMP_CallbackIDTypeDef CallbackID,
  660. pCOMP_CallbackTypeDef pCallback);
  661. HAL_StatusTypeDef HAL_COMP_UnRegisterCallback(COMP_HandleTypeDef *hcomp, HAL_COMP_CallbackIDTypeDef CallbackID);
  662. #endif /* USE_HAL_COMP_REGISTER_CALLBACKS */
  663. /**
  664. * @}
  665. */
  666. /* IO operation functions *****************************************************/
  667. /** @addtogroup COMP_Exported_Functions_Group2
  668. * @{
  669. */
  670. HAL_StatusTypeDef HAL_COMP_Start(COMP_HandleTypeDef *hcomp);
  671. HAL_StatusTypeDef HAL_COMP_Stop(COMP_HandleTypeDef *hcomp);
  672. void HAL_COMP_IRQHandler(COMP_HandleTypeDef *hcomp);
  673. /**
  674. * @}
  675. */
  676. /* Peripheral Control functions ************************************************/
  677. /** @addtogroup COMP_Exported_Functions_Group3
  678. * @{
  679. */
  680. HAL_StatusTypeDef HAL_COMP_Lock(COMP_HandleTypeDef *hcomp);
  681. uint32_t HAL_COMP_GetOutputLevel(COMP_HandleTypeDef *hcomp);
  682. /* Callback in interrupt mode */
  683. void HAL_COMP_TriggerCallback(COMP_HandleTypeDef *hcomp);
  684. /**
  685. * @}
  686. */
  687. /* Peripheral State functions **************************************************/
  688. /** @addtogroup COMP_Exported_Functions_Group4
  689. * @{
  690. */
  691. HAL_COMP_StateTypeDef HAL_COMP_GetState(COMP_HandleTypeDef *hcomp);
  692. uint32_t HAL_COMP_GetError(COMP_HandleTypeDef *hcomp);
  693. /**
  694. * @}
  695. */
  696. /**
  697. * @}
  698. */
  699. /**
  700. * @}
  701. */
  702. #endif /* COMP1 || COMP2 */
  703. /**
  704. * @}
  705. */
  706. #ifdef __cplusplus
  707. }
  708. #endif
  709. #endif /* STM32L4xx_HAL_COMP_H */