You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

stm32l1xx_hal_opamp.h 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  1. /**
  2. ******************************************************************************
  3. * @file stm32l1xx_hal_opamp.h
  4. * @author MCD Application Team
  5. * @brief Header file of OPAMP HAL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by ST under BSD 3-Clause license,
  13. * the "License"; You may not use this file except in compliance with the
  14. * License. You may obtain a copy of the License at:
  15. * opensource.org/licenses/BSD-3-Clause
  16. *
  17. ******************************************************************************
  18. */
  19. /* Define to prevent recursive inclusion -------------------------------------*/
  20. #ifndef STM32L1xx_HAL_OPAMP_H
  21. #define STM32L1xx_HAL_OPAMP_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. #if defined (STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined (STM32L151xE) || defined (STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX) || defined (STM32L162xC) || defined (STM32L152xC) || defined (STM32L151xC)
  26. /* Includes ------------------------------------------------------------------*/
  27. #include "stm32l1xx_hal_def.h"
  28. /** @addtogroup STM32L1xx_HAL_Driver
  29. * @{
  30. */
  31. /** @addtogroup OPAMP
  32. * @{
  33. */
  34. /* Exported types ------------------------------------------------------------*/
  35. /** @defgroup OPAMP_Exported_Types OPAMP Exported Types
  36. * @{
  37. */
  38. /**
  39. * @brief OPAMP Init structure definition
  40. */
  41. typedef struct
  42. {
  43. uint32_t PowerSupplyRange; /*!< Specifies the power supply range: above or under 2.4V.
  44. This parameter must be a value of @ref OPAMP_PowerSupplyRange
  45. Caution: This parameter is common to all OPAMP instances: a modification of this parameter for the selected OPAMP impacts the other OPAMP instances. */
  46. uint32_t PowerMode; /*!< Specifies the power mode Normal or Low-Power.
  47. This parameter must be a value of @ref OPAMP_PowerMode */
  48. uint32_t Mode; /*!< Specifies the OPAMP mode
  49. This parameter must be a value of @ref OPAMP_Mode
  50. mode is either Standalone or Follower */
  51. uint32_t InvertingInput; /*!< Specifies the inverting input in Standalone mode
  52. - In Standalone mode: i.e when mode is OPAMP_STANDALONE_MODE
  53. This parameter must be a value of @ref OPAMP_InvertingInput
  54. InvertingInput is either VM0 or VM1
  55. - In Follower mode: i.e when mode is OPAMP_FOLLOWER_MODE
  56. This parameter is Not Applicable */
  57. uint32_t NonInvertingInput; /*!< Specifies the non inverting input of the opamp:
  58. This parameter must be a value of @ref OPAMP_NonInvertingInput
  59. Note: Non-inverting input availability depends on OPAMP instance:
  60. OPAMP1: Non-inverting input is either IO0, DAC_Channel1
  61. OPAMP2: Non-inverting input is either IO0, DAC_Channel1, DAC_Channel2
  62. OPAMP3: Non-inverting input is either IO0, DAC_Channel2 (OPAMP3 availability depends on STM32L1 devices) */
  63. uint32_t UserTrimming; /*!< Specifies the trimming mode
  64. This parameter must be a value of @ref OPAMP_UserTrimming
  65. UserTrimming is either factory or user trimming.
  66. Caution: This parameter is common to all OPAMP instances: a modification of this parameter for the selected OPAMP impacts the other OPAMP instances. */
  67. uint32_t TrimmingValueP; /*!< Specifies the offset trimming value (PMOS)
  68. i.e. when UserTrimming is OPAMP_TRIMMING_USER.
  69. This parameter must be a number between Min_Data = 0 and Max_Data = 30 (Trimming value 31 is forbidden)
  70. 16 is typical default value */
  71. uint32_t TrimmingValueN; /*!< Specifies the offset trimming value (NMOS)
  72. i.e. when UserTrimming is OPAMP_TRIMMING_USER.
  73. This parameter must be a number between Min_Data = 0 and Max_Data = 30 (Trimming value 31 is forbidden)
  74. 16 is typical default value */
  75. uint32_t TrimmingValuePLowPower; /*!< Specifies the offset trimming value (PMOS)
  76. i.e. when UserTrimming is OPAMP_TRIMMING_USER.
  77. This parameter must be a number between Min_Data = 0 and Max_Data = 30 (Trimming value 31 is forbidden)
  78. 16 is typical default value */
  79. uint32_t TrimmingValueNLowPower; /*!< Specifies the offset trimming value (NMOS)
  80. i.e. when UserTrimming is OPAMP_TRIMMING_USER.
  81. This parameter must be a number between Min_Data = 0 and Max_Data = 30 (Trimming value 31 is forbidden)
  82. 16 is typical default value */
  83. }OPAMP_InitTypeDef;
  84. /**
  85. * @brief HAL State structures definition
  86. */
  87. typedef enum
  88. {
  89. HAL_OPAMP_STATE_RESET = 0x00000000, /*!< OPAMP is not yet Initialized */
  90. HAL_OPAMP_STATE_READY = 0x00000001, /*!< OPAMP is initialized and ready for use */
  91. HAL_OPAMP_STATE_CALIBBUSY = 0x00000002, /*!< OPAMP is enabled in auto calibration mode */
  92. HAL_OPAMP_STATE_BUSY = 0x00000004, /*!< OPAMP is enabled and running in normal mode */
  93. HAL_OPAMP_STATE_BUSYLOCKED = 0x00000005 /*!< OPAMP is locked
  94. only system reset allows reconfiguring the opamp. */
  95. }HAL_OPAMP_StateTypeDef;
  96. /**
  97. * @brief OPAMP Handle Structure definition
  98. */
  99. #if (USE_HAL_OPAMP_REGISTER_CALLBACKS == 1)
  100. typedef struct __OPAMP_HandleTypeDef
  101. #else
  102. typedef struct
  103. #endif /* USE_HAL_OPAMP_REGISTER_CALLBACKS */
  104. {
  105. OPAMP_TypeDef *Instance; /*!< OPAMP instance's registers base address */
  106. OPAMP_InitTypeDef Init; /*!< OPAMP required parameters */
  107. HAL_StatusTypeDef Status; /*!< OPAMP peripheral status */
  108. HAL_LockTypeDef Lock; /*!< Locking object */
  109. __IO HAL_OPAMP_StateTypeDef State; /*!< OPAMP communication state */
  110. #if (USE_HAL_OPAMP_REGISTER_CALLBACKS == 1)
  111. void (* MspInitCallback) (struct __OPAMP_HandleTypeDef *hopamp);
  112. void (* MspDeInitCallback) (struct __OPAMP_HandleTypeDef *hopamp);
  113. #endif /* USE_HAL_OPAMP_REGISTER_CALLBACKS */
  114. } OPAMP_HandleTypeDef;
  115. /**
  116. * @brief HAl_OPAMP_TrimmingValueTypeDef definition
  117. */
  118. typedef uint32_t HAL_OPAMP_TrimmingValueTypeDef;
  119. /**
  120. * @}
  121. */
  122. #if (USE_HAL_OPAMP_REGISTER_CALLBACKS == 1)
  123. /**
  124. * @brief HAL OPAMP Callback ID enumeration definition
  125. */
  126. typedef enum
  127. {
  128. HAL_OPAMP_MSPINIT_CB_ID = 0x01U, /*!< OPAMP MspInit Callback ID */
  129. HAL_OPAMP_MSPDEINIT_CB_ID = 0x02U, /*!< OPAMP MspDeInit Callback ID */
  130. HAL_OPAMP_ALL_CB_ID = 0x03U /*!< OPAMP All ID */
  131. }HAL_OPAMP_CallbackIDTypeDef;
  132. /**
  133. * @brief HAL OPAMP Callback pointer definition
  134. */
  135. typedef void (*pOPAMP_CallbackTypeDef)(OPAMP_HandleTypeDef *hopamp);
  136. #endif /* USE_HAL_OPAMP_REGISTER_CALLBACKS */
  137. /* Exported constants --------------------------------------------------------*/
  138. /** @defgroup OPAMP_Exported_Constants OPAMP Exported Constants
  139. * @{
  140. */
  141. /**
  142. * OTR register Mask
  143. */
  144. #define OPAMP_TRIM_VALUE_MASK OPAMP_OTR_AO1_OPT_OFFSET_TRIM_LOW
  145. /**
  146. * CSR register Mask
  147. */
  148. #define OPAMP_CSR_INSTANCE_OFFSET ( 8U) /* Offset of each OPAMP instance into register CSR */
  149. #define OPAMP_OTR_INSTANCE_OFFSET (10U) /* Offset of each OPAMP instance into register OTR */
  150. /** @defgroup OPAMP_Mode OPAMP Mode
  151. * @{
  152. */
  153. #define OPAMP_STANDALONE_MODE 0x00000000U /*!< OPAMP standalone mode */
  154. #define OPAMP_FOLLOWER_MODE 0x00000001U /*!< OPAMP follower mode */
  155. /**
  156. * @}
  157. */
  158. /** @defgroup OPAMP_NonInvertingInput OPAMP NonInvertingInput
  159. * @{
  160. */
  161. #define OPAMP_NONINVERTINGINPUT_IO0 0x00000000U /*!< Comparator non-inverting input connected to dedicated IO pin low-leakage */
  162. #define OPAMP_NONINVERTINGINPUT_DAC_CH1 0x00000001U /*!< Comparator non-inverting input connected internally to DAC channel 1. Available only on OPAMP1 and OPAMP2. */
  163. #define OPAMP_NONINVERTINGINPUT_DAC_CH2 0x00000002U /*!< Comparator non-inverting input connected internally to DAC channel 2. Available only on OPAMP2 and OPAMP3 (OPAMP3 availability depends on STM32L1 devices). */
  164. /**
  165. * @}
  166. */
  167. /** @defgroup OPAMP_InvertingInput OPAMP InvertingInput
  168. * @{
  169. */
  170. /* Note: Literal "OPAMP_SEC_INVERTINGINPUT_IO1" is a legacy naming of "OPAMP_INVERTINGINPUT_IO1". It is equivalent and must be replaced by "OPAMP_INVERTINGINPUT_IO1". */
  171. #define OPAMP_INVERTINGINPUT_IO0 0x00000000U /*!< Comparator inverting input connected to dedicated IO pin low-leakage */
  172. #define OPAMP_INVERTINGINPUT_IO1 0x00000001U /*!< Comparator inverting input connected to alternative IO pin available on some device packages */
  173. /**
  174. * @}
  175. */
  176. /** @defgroup OPAMP_PowerMode OPAMP PowerMode
  177. * @{
  178. */
  179. #define OPAMP_POWERMODE_NORMAL 0x00000000U
  180. #define OPAMP_POWERMODE_LOWPOWER 0x00000001U
  181. /**
  182. * @}
  183. */
  184. /** @defgroup OPAMP_PowerSupplyRange OPAMP PowerSupplyRange
  185. * @{
  186. */
  187. #define OPAMP_POWERSUPPLY_LOW 0x00000000U /*!< Power supply range low (VDDA lower than 2.4V) */
  188. #define OPAMP_POWERSUPPLY_HIGH OPAMP_CSR_AOP_RANGE /*!< Power supply range high (VDDA higher than 2.4V) */
  189. /**
  190. * @}
  191. */
  192. /** @defgroup OPAMP_UserTrimming OPAMP User Trimming
  193. * @{
  194. */
  195. #define OPAMP_TRIMMING_FACTORY 0x00000000U /*!< Factory trimming */
  196. #define OPAMP_TRIMMING_USER OPAMP_OTR_OT_USER /*!< User trimming */
  197. /**
  198. * @}
  199. */
  200. /** @defgroup OPAMP_FactoryTrimming OPAMP FactoryTrimming
  201. * @{
  202. */
  203. #define OPAMP_FACTORYTRIMMING_DUMMY 0xFFFFFFFFU /*!< Dummy value if trimming value could not be retrieved */
  204. #define OPAMP_FACTORYTRIMMING_P 0U /*!< Offset trimming P */
  205. #define OPAMP_FACTORYTRIMMING_N POSITION_VAL(OPAMP_OTR_AO1_OPT_OFFSET_TRIM_HIGH) /*!< Offset trimming N */
  206. /**
  207. * @}
  208. */
  209. /**
  210. * @}
  211. */
  212. /* Private constants ---------------------------------------------------------*/
  213. /** @defgroup OPAMP_Private_Constants OPAMP Private Constants
  214. * @{
  215. */
  216. /* Offset trimming time: during calibration, minimum time needed between two */
  217. /* steps to have 1 mV accuracy. */
  218. /* Refer to datasheet, electrical characteristics: parameter tOFFTRIM Typ=1ms.*/
  219. /* Unit: ms. */
  220. #define OPAMP_TRIMMING_DELAY ((uint32_t) 1)
  221. /**
  222. * @}
  223. */
  224. /* Exported macros -----------------------------------------------------------*/
  225. /** @defgroup OPAMP_Private_Macro OPAMP Private Macro
  226. * @{
  227. */
  228. /** @brief Reset OPAMP handle state
  229. * @param __HANDLE__ OPAMP handle.
  230. * @retval None
  231. */
  232. #define __HAL_OPAMP_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_OPAMP_STATE_RESET)
  233. /**
  234. * @}
  235. */
  236. /* Private macro -------------------------------------------------------------*/
  237. /** @defgroup OPAMP_Private_Macro OPAMP Private Macro
  238. * @{
  239. */
  240. /**
  241. * @brief Select the OPAMP bit OPAxPD (power-down) corresponding to the
  242. * selected OPAMP instance.
  243. * @param __HANDLE__: OPAMP handle
  244. * @retval None
  245. */
  246. #define OPAMP_CSR_OPAXPD(__HANDLE__) \
  247. (OPAMP_CSR_OPA1PD << (OPAMP_INSTANCE_DECIMAL(__HANDLE__) * OPAMP_CSR_INSTANCE_OFFSET))
  248. /**
  249. * @brief Select the OPAMP bit S3SELx (switch 3) corresponding to the
  250. * selected OPAMP instance.
  251. * @param __HANDLE__: OPAMP handle
  252. * @retval None
  253. */
  254. #define OPAMP_CSR_S3SELX(__HANDLE__) \
  255. (OPAMP_CSR_S3SEL1 << ((OPAMP_INSTANCE_DECIMAL(__HANDLE__) * OPAMP_CSR_INSTANCE_OFFSET) & 0x1fU))
  256. /**
  257. * @brief Select the OPAMP bit S4SELx (switch 4) corresponding to the
  258. * selected OPAMP instance.
  259. * @param __HANDLE__: OPAMP handle
  260. * @retval None
  261. */
  262. #define OPAMP_CSR_S4SELX(__HANDLE__) \
  263. (OPAMP_CSR_S4SEL1 << (OPAMP_INSTANCE_DECIMAL(__HANDLE__) * OPAMP_CSR_INSTANCE_OFFSET))
  264. /**
  265. * @brief Select the OPAMP bit S5SELx (switch 5) corresponding to the
  266. * selected OPAMP instance.
  267. * @param __HANDLE__: OPAMP handle
  268. * @retval None
  269. */
  270. #define OPAMP_CSR_S5SELX(__HANDLE__) \
  271. (OPAMP_CSR_S5SEL1 << (OPAMP_INSTANCE_DECIMAL(__HANDLE__) * OPAMP_CSR_INSTANCE_OFFSET))
  272. /**
  273. * @brief Select the OPAMP bit S3SELx (switch 6) corresponding to the
  274. * selected OPAMP instance.
  275. * @param __HANDLE__: OPAMP handle
  276. * @retval None
  277. */
  278. #define OPAMP_CSR_S6SELX(__HANDLE__) \
  279. (OPAMP_CSR_S6SEL1 << (OPAMP_INSTANCE_DECIMAL(__HANDLE__) * OPAMP_CSR_INSTANCE_OFFSET))
  280. /**
  281. * @brief Select the OPAMP bit OPAxCAL_L (offset calibration for differential
  282. * pair P) corresponding to the selected OPAMP instance.
  283. * @param __HANDLE__: OPAMP handle
  284. * @retval None
  285. */
  286. #define OPAMP_CSR_OPAXCAL_L(__HANDLE__) \
  287. (OPAMP_CSR_OPA1CAL_L << (OPAMP_INSTANCE_DECIMAL(__HANDLE__) * OPAMP_CSR_INSTANCE_OFFSET))
  288. /**
  289. * @brief Select the OPAMP bit OPAxCAL_H (offset calibration for differential
  290. * pair N) corresponding to the selected OPAMP instance.
  291. * @param __HANDLE__: OPAMP handle
  292. * @retval None
  293. */
  294. #define OPAMP_CSR_OPAXCAL_H(__HANDLE__) \
  295. (OPAMP_CSR_OPA1CAL_H << (OPAMP_INSTANCE_DECIMAL(__HANDLE__) * OPAMP_CSR_INSTANCE_OFFSET))
  296. /**
  297. * @brief Select the OPAMP bit OPAxLPM (low power mode) corresponding to the
  298. * selected OPAMP instance.
  299. * @param __HANDLE__: OPAMP handle
  300. * @retval None
  301. */
  302. #define OPAMP_CSR_OPAXLPM(__HANDLE__) \
  303. (OPAMP_CSR_OPA1LPM << (OPAMP_INSTANCE_DECIMAL(__HANDLE__) * OPAMP_CSR_INSTANCE_OFFSET))
  304. /**
  305. * @brief Select the OPAMP bits of all switches corresponding to the
  306. * selected OPAMP instance.
  307. * @param __HANDLE__: OPAMP handle
  308. * @retval None
  309. */
  310. #define OPAMP_CSR_ALL_SWITCHES(__HANDLE__) \
  311. ( ( ((__HANDLE__)->Instance != OPAMP2) \
  312. )? \
  313. ( \
  314. ((OPAMP_CSR_S3SEL1 | OPAMP_CSR_S4SEL1 | OPAMP_CSR_S5SEL1 | OPAMP_CSR_S6SEL1) << (OPAMP_INSTANCE_DECIMAL(__HANDLE__) * OPAMP_CSR_INSTANCE_OFFSET)) \
  315. | \
  316. (OPAMP_CSR_ANAWSEL1 << (OPAMP_INSTANCE_DECIMAL(__HANDLE__))) \
  317. ) \
  318. : \
  319. ( \
  320. ((OPAMP_CSR_S3SEL1 | OPAMP_CSR_S4SEL1 | OPAMP_CSR_S5SEL1 | OPAMP_CSR_S6SEL1) << (OPAMP_INSTANCE_DECIMAL(__HANDLE__) * OPAMP_CSR_INSTANCE_OFFSET)) \
  321. | \
  322. (OPAMP_CSR_ANAWSEL1 << (OPAMP_INSTANCE_DECIMAL(__HANDLE__))) \
  323. | \
  324. (OPAMP_CSR_S7SEL2) \
  325. ) \
  326. )
  327. /**
  328. * @brief Select the OPAMP bit ANAWSELx (switch SanA) corresponding to the
  329. * selected OPAMP instance.
  330. * @param __HANDLE__: OPAMP handle
  331. * @retval None
  332. */
  333. #define OPAMP_CSR_ANAWSELX(__HANDLE__) \
  334. (OPAMP_CSR_ANAWSEL1 << (OPAMP_INSTANCE_DECIMAL(__HANDLE__)))
  335. /**
  336. * @brief Select the OPAMP bit OPAxCALOUT in function of the selected
  337. * OPAMP instance.
  338. * @param __HANDLE__: OPAMP handle
  339. * @retval None
  340. */
  341. #define OPAMP_CSR_OPAXCALOUT(__HANDLE__) \
  342. (OPAMP_CSR_OPA1CALOUT << (OPAMP_INSTANCE_DECIMAL(__HANDLE__)))
  343. /**
  344. * @brief Select the OPAMP trimming bits position value (position of LSB)
  345. * in register OPAMP_OTR or register OPAMP_LPOTR in function of the selected
  346. * OPAMP instance and the transistors differential pair high (PMOS) or
  347. * low (NMOS).
  348. * @param __HANDLE__: OPAMP handle
  349. * @param __TRIM_HIGH_LOW__: transistors differential pair high or low.
  350. * Must be a value of @ref OPAMP_FactoryTrimming.
  351. * @retval None
  352. */
  353. #define OPAMP_OFFSET_TRIM_BITSPOSITION(__HANDLE__, __TRIM_HIGH_LOW__) \
  354. ((OPAMP_INSTANCE_DECIMAL((__HANDLE__)) * OPAMP_OTR_INSTANCE_OFFSET) + (__TRIM_HIGH_LOW__))
  355. /**
  356. * @brief Shift the OPAMP trimming bits to register OPAMP_OTR or register
  357. * OPAMP_LPOTR in function of the selected OPAMP instance and the transistors
  358. * differential pair high (PMOS) or low (NMOS).
  359. * @param __HANDLE__: OPAMP handle
  360. * @param __TRIM_HIGH_LOW__: transistors differential pair high or low.
  361. * Must be a value of @ref OPAMP_FactoryTrimming.
  362. * @param __TRIMMING_VALUE__: Trimming value
  363. * @retval None
  364. */
  365. #define OPAMP_OFFSET_TRIM_SET(__HANDLE__, __TRIM_HIGH_LOW__, __TRIMMING_VALUE__) \
  366. ((__TRIMMING_VALUE__) << (OPAMP_OFFSET_TRIM_BITSPOSITION((__HANDLE__), (__TRIM_HIGH_LOW__))))
  367. /**
  368. * @brief Check that trimming value is within correct range
  369. * @param TRIMMINGVALUE: OPAMP trimming value
  370. * @retval None
  371. */
  372. #define IS_OPAMP_TRIMMINGVALUE(TRIMMINGVALUE) ((TRIMMINGVALUE) <= 30U)
  373. #define IS_OPAMP_FUNCTIONAL_NORMALMODE(INPUT) (((INPUT) == OPAMP_STANDALONE_MODE) || \
  374. ((INPUT) == OPAMP_FOLLOWER_MODE))
  375. #define IS_OPAMP_INVERTING_INPUT(INPUT) (((INPUT) == OPAMP_INVERTINGINPUT_IO0) || \
  376. ((INPUT) == OPAMP_INVERTINGINPUT_IO1) )
  377. #define IS_OPAMP_POWERMODE(TRIMMING) (((TRIMMING) == OPAMP_POWERMODE_NORMAL) || \
  378. ((TRIMMING) == OPAMP_POWERMODE_LOWPOWER) )
  379. #define IS_OPAMP_POWER_SUPPLY_RANGE(RANGE) (((RANGE) == OPAMP_POWERSUPPLY_LOW) || \
  380. ((RANGE) == OPAMP_POWERSUPPLY_HIGH) )
  381. #define IS_OPAMP_TRIMMING(TRIMMING) (((TRIMMING) == OPAMP_TRIMMING_FACTORY) || \
  382. ((TRIMMING) == OPAMP_TRIMMING_USER))
  383. #define IS_OPAMP_FACTORYTRIMMING(TRIMMING) (((TRIMMING) == OPAMP_FACTORYTRIMMING_N) || \
  384. ((TRIMMING) == OPAMP_FACTORYTRIMMING_P) )
  385. /**
  386. * @}
  387. */
  388. /* Include OPAMP HAL Extension module */
  389. #include "stm32l1xx_hal_opamp_ex.h"
  390. /* Exported functions --------------------------------------------------------*/
  391. /** @addtogroup OPAMP_Exported_Functions
  392. * @{
  393. */
  394. /** @addtogroup OPAMP_Exported_Functions_Group1
  395. * @{
  396. */
  397. /* Initialization/de-initialization functions **********************************/
  398. HAL_StatusTypeDef HAL_OPAMP_Init(OPAMP_HandleTypeDef *hopamp);
  399. HAL_StatusTypeDef HAL_OPAMP_DeInit (OPAMP_HandleTypeDef *hopamp);
  400. void HAL_OPAMP_MspInit(OPAMP_HandleTypeDef *hopamp);
  401. void HAL_OPAMP_MspDeInit(OPAMP_HandleTypeDef *hopamp);
  402. /**
  403. * @}
  404. */
  405. /** @addtogroup OPAMP_Exported_Functions_Group2
  406. * @{
  407. */
  408. /* I/O operation functions *****************************************************/
  409. HAL_StatusTypeDef HAL_OPAMP_Start(OPAMP_HandleTypeDef *hopamp);
  410. HAL_StatusTypeDef HAL_OPAMP_Stop(OPAMP_HandleTypeDef *hopamp);
  411. HAL_StatusTypeDef HAL_OPAMP_SelfCalibrate(OPAMP_HandleTypeDef *hopamp);
  412. /**
  413. * @}
  414. */
  415. /** @addtogroup OPAMP_Exported_Functions_Group3
  416. * @{
  417. */
  418. /* Peripheral Control functions ************************************************/
  419. #if (USE_HAL_OPAMP_REGISTER_CALLBACKS == 1)
  420. /* OPAMP callback registering/unregistering */
  421. HAL_StatusTypeDef HAL_OPAMP_RegisterCallback (OPAMP_HandleTypeDef *hopamp, HAL_OPAMP_CallbackIDTypeDef CallbackID, pOPAMP_CallbackTypeDef pCallback);
  422. HAL_StatusTypeDef HAL_OPAMP_UnRegisterCallback (OPAMP_HandleTypeDef *hopamp, HAL_OPAMP_CallbackIDTypeDef CallbackID);
  423. #endif /* USE_HAL_OPAMP_REGISTER_CALLBACKS */
  424. HAL_StatusTypeDef HAL_OPAMP_Lock(OPAMP_HandleTypeDef *hopamp);
  425. HAL_OPAMP_TrimmingValueTypeDef HAL_OPAMP_GetTrimOffset (OPAMP_HandleTypeDef *hopamp, uint32_t trimmingoffset);
  426. /**
  427. * @}
  428. */
  429. /** @addtogroup OPAMP_Exported_Functions_Group4
  430. * @{
  431. */
  432. /* Peripheral State functions **************************************************/
  433. HAL_OPAMP_StateTypeDef HAL_OPAMP_GetState(OPAMP_HandleTypeDef *hopamp);
  434. /**
  435. * @}
  436. */
  437. /**
  438. * @}
  439. */
  440. /**
  441. * @}
  442. */
  443. /**
  444. * @}
  445. */
  446. #endif /* STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L151xDX || STM32L152xE || STM32L152xDX || STM32L162xE || STM32L162xDX || STM32L162xC || STM32L152xC || STM32L151xC */
  447. #ifdef __cplusplus
  448. }
  449. #endif
  450. #endif /* STM32L1xx_HAL_OPAMP_H */
  451. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/