stm32l4xx_hal_comp.h 39 KB

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