2 ******************************************************************************
\r
3 * @file stm32l1xx_opamp.h
\r
4 * @author MCD Application Team
\r
6 * @date 05-March-2012
\r
7 * @brief This file contains all the functions prototypes for the operational
\r
8 * amplifiers (opamp) firmware library.
\r
9 ******************************************************************************
\r
12 * <h2><center>© COPYRIGHT 2012 STMicroelectronics</center></h2>
\r
14 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
\r
15 * You may not use this file except in compliance with the License.
\r
16 * You may obtain a copy of the License at:
\r
18 * http://www.st.com/software_license_agreement_liberty_v2
\r
20 * Unless required by applicable law or agreed to in writing, software
\r
21 * distributed under the License is distributed on an "AS IS" BASIS,
\r
22 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
23 * See the License for the specific language governing permissions and
\r
24 * limitations under the License.
\r
26 ******************************************************************************
\r
29 /* Define to prevent recursive inclusion -------------------------------------*/
\r
30 #ifndef __STM32L1xx_OPAMP_H
\r
31 #define __STM32L1xx_OPAMP_H
\r
37 /* Includes ------------------------------------------------------------------*/
\r
38 #include "stm32l1xx.h"
\r
40 /** @addtogroup STM32L1xx_StdPeriph_Driver
\r
44 /** @addtogroup OPAMP
\r
48 /* Exported types ------------------------------------------------------------*/
\r
49 /* Exported constants --------------------------------------------------------*/
\r
51 /** @defgroup OPAMP_Exported_Constants
\r
55 /** @defgroup OPAMP_Selection
\r
59 #define OPAMP_Selection_OPAMP1 OPAMP_CSR_OPA1PD
\r
60 #define OPAMP_Selection_OPAMP2 OPAMP_CSR_OPA2PD
\r
61 #define OPAMP_Selection_OPAMP3 OPAMP_CSR_OPA3PD
\r
63 #define IS_OPAMP_ALL_PERIPH(PERIPH) (((PERIPH) == OPAMP_Selection_OPAMP1) || \
\r
64 ((PERIPH) == OPAMP_Selection_OPAMP2) || \
\r
65 ((PERIPH) == OPAMP_Selection_OPAMP3))
\r
71 /** @defgroup OPAMP_Switches
\r
75 /* OPAMP1 Switches */
\r
76 #define OPAMP_OPAMP1Switch3 OPAMP_CSR_S3SEL1 /*!< OPAMP1 Switch 3 */
\r
77 #define OPAMP_OPAMP1Switch4 OPAMP_CSR_S4SEL1 /*!< OPAMP1 Switch 4 */
\r
78 #define OPAMP_OPAMP1Switch5 OPAMP_CSR_S5SEL1 /*!< OPAMP1 Switch 5 */
\r
79 #define OPAMP_OPAMP1Switch6 OPAMP_CSR_S6SEL1 /*!< OPAMP1 Switch 6 */
\r
80 #define OPAMP_OPAMP1SwitchANA OPAMP_CSR_ANAWSEL1 /*!< OPAMP1 Switch ANA */
\r
82 /* OPAMP2 Switches */
\r
83 #define OPAMP_OPAMP2Switch3 OPAMP_CSR_S3SEL2 /*!< OPAMP2 Switch 3 */
\r
84 #define OPAMP_OPAMP2Switch4 OPAMP_CSR_S4SEL2 /*!< OPAMP2 Switch 4 */
\r
85 #define OPAMP_OPAMP2Switch5 OPAMP_CSR_S5SEL2 /*!< OPAMP2 Switch 5 */
\r
86 #define OPAMP_OPAMP2Switch6 OPAMP_CSR_S6SEL2 /*!< OPAMP2 Switch 6 */
\r
87 #define OPAMP_OPAMP2Switch7 OPAMP_CSR_S7SEL2 /*!< OPAMP2 Switch 7 */
\r
88 #define OPAMP_OPAMP2SwitchANA OPAMP_CSR_ANAWSEL2 /*!< OPAMP2 Switch ANA */
\r
90 /* OPAMP3 Switches */
\r
91 #define OPAMP_OPAMP3Switch3 OPAMP_CSR_S3SEL3 /*!< OPAMP3 Switch 3 */
\r
92 #define OPAMP_OPAMP3Switch4 OPAMP_CSR_S4SEL3 /*!< OPAMP3 Switch 4 */
\r
93 #define OPAMP_OPAMP3Switch5 OPAMP_CSR_S5SEL3 /*!< OPAMP3 Switch 5 */
\r
94 #define OPAMP_OPAMP3Switch6 OPAMP_CSR_S6SEL3 /*!< OPAMP3 Switch 6 */
\r
95 #define OPAMP_OPAMP3SwitchANA OPAMP_CSR_ANAWSEL3 /*!< OPAMP3 Switch ANA */
\r
97 #define IS_OPAMP_SWITCH(SWITCH) ((((SWITCH) & (uint32_t)0xF0E1E1E1) == 0x00) && ((SWITCH) != 0x00))
\r
103 /** @defgroup OPAMP_Trimming
\r
107 #define OPAMP_Trimming_Factory ((uint32_t)0x00000000) /*!< Factory trimming */
\r
108 #define OPAMP_Trimming_User OPAMP_OTR_OT_USER /*!< User trimming */
\r
110 #define IS_OPAMP_TRIMMING(TRIMMING) (((TRIMMING) == OPAMP_Trimming_Factory) || \
\r
111 ((TRIMMING) == OPAMP_Trimming_User))
\r
117 /** @defgroup OPAMP_Input
\r
121 #define OPAMP_Input_NMOS OPAMP_CSR_OPA1CAL_H /*!< NMOS input */
\r
122 #define OPAMP_Input_PMOS OPAMP_CSR_OPA1CAL_L /*!< PMOS input */
\r
124 #define IS_OPAMP_INPUT(INPUT) (((INPUT) == OPAMP_Input_NMOS) || \
\r
125 ((INPUT) == OPAMP_Input_PMOS))
\r
131 /** @defgroup OPAMP_TrimValue
\r
135 #define IS_OPAMP_TRIMMINGVALUE(VALUE) ((VALUE) <= 0x0000001F) /*!< Trimming value */
\r
141 /** @defgroup OPAMP_PowerRange
\r
145 #define OPAMP_PowerRange_Low ((uint32_t)0x00000000) /*!< Low power range is selected (VDDA is lower than 2.4V) */
\r
146 #define OPAMP_PowerRange_High OPAMP_CSR_AOP_RANGE /*!< High power range is selected (VDDA is higher than 2.4V) */
\r
148 #define IS_OPAMP_RANGE(RANGE) (((RANGE) == OPAMP_PowerRange_Low) || \
\r
149 ((RANGE) == OPAMP_PowerRange_High))
\r
158 /* Exported macro ------------------------------------------------------------*/
\r
159 /* Exported functions ------------------------------------------------------- */
\r
160 /* Initialization and Configuration functions *********************************/
\r
161 void OPAMP_DeInit(void);
\r
162 void OPAMP_SwitchCmd(uint32_t OPAMP_OPAMPxSwitchy, FunctionalState NewState);
\r
163 void OPAMP_Cmd(uint32_t OPAMP_Selection, FunctionalState NewState);
\r
164 void OPAMP_LowPowerCmd(uint32_t OPAMP_Selection, FunctionalState NewState);
\r
165 void OPAMP_PowerRangeSelect(uint32_t OPAMP_PowerRange);
\r
167 /* Calibration functions ******************************************************/
\r
168 void OPAMP_OffsetTrimmingModeSelect(uint32_t OPAMP_Trimming);
\r
169 void OPAMP_OffsetTrimConfig(uint32_t OPAMP_Selection, uint32_t OPAMP_Input, uint32_t OPAMP_TrimValue);
\r
170 void OPAMP_OffsetTrimLowPowerConfig(uint32_t OPAMP_Selection, uint32_t OPAMP_Input, uint32_t OPAMP_TrimValue);
\r
171 FlagStatus OPAMP_GetFlagStatus(uint32_t OPAMP_Selection);
\r
177 #endif /*__STM32L1xx_OPAMP_H */
\r
187 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
\r