Subversion Repositories DashDisplay

Rev

Rev 56 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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