stm32l1xx_hal_opamp.h 22 KB

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