Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Space_Invaders_Demo neopixels gpio_test_stm32f3_discovery gpio_test_systimer ... more
stm32f30x_opamp.h
00001 /** 00002 ****************************************************************************** 00003 * @file stm32f30x_opamp.h 00004 * @author MCD Application Team 00005 * @version V1.2.3 00006 * @date 10-July-2015 00007 * @brief This file contains all the functions prototypes for the operational 00008 * amplifiers (OPAMP) firmware library. 00009 ****************************************************************************** 00010 * @attention 00011 * 00012 * <h2><center>© COPYRIGHT 2015 STMicroelectronics</center></h2> 00013 * 00014 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 00015 * You may not use this file except in compliance with the License. 00016 * You may obtain a copy of the License at: 00017 * 00018 * http://www.st.com/software_license_agreement_liberty_v2 00019 * 00020 * Unless required by applicable law or agreed to in writing, software 00021 * distributed under the License is distributed on an "AS IS" BASIS, 00022 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00023 * See the License for the specific language governing permissions and 00024 * limitations under the License. 00025 * 00026 ****************************************************************************** 00027 */ 00028 00029 /* Define to prevent recursive inclusion -------------------------------------*/ 00030 #ifndef __STM32F30x_OPAMP_H 00031 #define __STM32F30x_OPAMP_H 00032 00033 #ifdef __cplusplus 00034 extern "C" { 00035 #endif 00036 00037 /* Includes ------------------------------------------------------------------*/ 00038 #include "stm32f30x.h" 00039 00040 /** @addtogroup STM32F30x_StdPeriph_Driver 00041 * @{ 00042 */ 00043 00044 /** @addtogroup OPAMP 00045 * @{ 00046 */ 00047 00048 /* Exported types ------------------------------------------------------------*/ 00049 00050 /** 00051 * @brief OPAMP Init structure definition 00052 */ 00053 00054 typedef struct 00055 { 00056 00057 uint32_t OPAMP_InvertingInput; /*!< Selects the inverting input of the operational amplifier. 00058 This parameter can be a value of @ref OPAMP_InvertingInput */ 00059 00060 uint32_t OPAMP_NonInvertingInput; /*!< Selects the non inverting input of the operational amplifier. 00061 This parameter can be a value of @ref OPAMP_NonInvertingInput */ 00062 00063 }OPAMP_InitTypeDef; 00064 00065 /* Exported constants --------------------------------------------------------*/ 00066 00067 /** @defgroup OPAMP_Exported_Constants 00068 * @{ 00069 */ 00070 00071 /** @defgroup OPAMP_Selection 00072 * @{ 00073 */ 00074 00075 #define OPAMP_Selection_OPAMP1 ((uint32_t)0x00000000) /*!< OPAMP1 Selection */ 00076 #define OPAMP_Selection_OPAMP2 ((uint32_t)0x00000004) /*!< OPAMP2 Selection */ 00077 #define OPAMP_Selection_OPAMP3 ((uint32_t)0x00000008) /*!< OPAMP3 Selection */ 00078 #define OPAMP_Selection_OPAMP4 ((uint32_t)0x0000000C) /*!< OPAMP4 Selection */ 00079 00080 #define IS_OPAMP_ALL_PERIPH(PERIPH) (((PERIPH) == OPAMP_Selection_OPAMP1) || \ 00081 ((PERIPH) == OPAMP_Selection_OPAMP2) || \ 00082 ((PERIPH) == OPAMP_Selection_OPAMP3) || \ 00083 ((PERIPH) == OPAMP_Selection_OPAMP4)) 00084 00085 /** 00086 * @} 00087 */ 00088 00089 /** @defgroup OPAMP_InvertingInput 00090 * @{ 00091 */ 00092 00093 #define OPAMP_InvertingInput_IO1 ((uint32_t)0x00000000) /*!< IO1 (PC5 for OPAMP1 and OPAMP2, PB10 for OPAMP3 and OPAMP4) 00094 connected to OPAMPx inverting input */ 00095 #define OPAMP_InvertingInput_IO2 OPAMP_CSR_VMSEL_0 /*!< IO2 (PA3 for OPAMP1, PA5 for OPAMP2, PB2 for OPAMP3, PD8 for OPAMP4) 00096 connected to OPAMPx inverting input */ 00097 #define OPAMP_InvertingInput_PGA OPAMP_CSR_VMSEL_1 /*!< Resistor feedback output connected to OPAMPx inverting input (PGA mode) */ 00098 #define OPAMP_InvertingInput_Vout OPAMP_CSR_VMSEL /*!< Vout connected to OPAMPx inverting input (follower mode) */ 00099 00100 #define IS_OPAMP_INVERTING_INPUT(INPUT) (((INPUT) == OPAMP_InvertingInput_IO1) || \ 00101 ((INPUT) == OPAMP_InvertingInput_IO2) || \ 00102 ((INPUT) == OPAMP_InvertingInput_PGA) || \ 00103 ((INPUT) == OPAMP_InvertingInput_Vout)) 00104 /** 00105 * @} 00106 */ 00107 00108 /** @defgroup OPAMP_NonInvertingInput 00109 * @{ 00110 */ 00111 00112 #define OPAMP_NonInvertingInput_IO1 ((uint32_t)0x00000000) /*!< IO1 (PA7 for OPAMP1, PD14 for OPAMP2, PB13 for OPAMP3, PD11 for OPAMP4) 00113 connected to OPAMPx non inverting input */ 00114 #define OPAMP_NonInvertingInput_IO2 OPAMP_CSR_VPSEL_0 /*!< IO2 (PA5 for OPAMP1, PB14 for OPAMP2, PA5 for OPAMP3, PB11 for OPAMP4) 00115 connected to OPAMPx non inverting input */ 00116 #define OPAMP_NonInvertingInput_IO3 OPAMP_CSR_VPSEL_1 /*!< IO3 (PA3 for OPAMP1, PB0 for OPAMP2, PA1 for OPAMP3, PA4 for OPAMP4) 00117 connected to OPAMPx non inverting input */ 00118 #define OPAMP_NonInvertingInput_IO4 OPAMP_CSR_VPSEL /*!< IO4 (PA1 for OPAMP1, PA7 for OPAMP2, PB0 for OPAMP3, PB13 for OPAMP4) 00119 connected to OPAMPx non inverting input */ 00120 00121 #define IS_OPAMP_NONINVERTING_INPUT(INPUT) (((INPUT) == OPAMP_NonInvertingInput_IO1) || \ 00122 ((INPUT) == OPAMP_NonInvertingInput_IO2) || \ 00123 ((INPUT) == OPAMP_NonInvertingInput_IO3) || \ 00124 ((INPUT) == OPAMP_NonInvertingInput_IO4)) 00125 /** 00126 * @} 00127 */ 00128 00129 /** @defgroup OPAMP_PGAGain_Config 00130 * @{ 00131 */ 00132 00133 #define OPAMP_OPAMP_PGAGain_2 ((uint32_t)0x00000000) 00134 #define OPAMP_OPAMP_PGAGain_4 OPAMP_CSR_PGGAIN_0 00135 #define OPAMP_OPAMP_PGAGain_8 OPAMP_CSR_PGGAIN_1 00136 #define OPAMP_OPAMP_PGAGain_16 ((uint32_t)0x0000C000) 00137 00138 #define IS_OPAMP_PGAGAIN(GAIN) (((GAIN) == OPAMP_OPAMP_PGAGain_2) || \ 00139 ((GAIN) == OPAMP_OPAMP_PGAGain_4) || \ 00140 ((GAIN) == OPAMP_OPAMP_PGAGain_8) || \ 00141 ((GAIN) == OPAMP_OPAMP_PGAGain_16)) 00142 /** 00143 * @} 00144 */ 00145 00146 /** @defgroup OPAMP_PGAConnect_Config 00147 * @{ 00148 */ 00149 00150 #define OPAMP_PGAConnect_No ((uint32_t)0x00000000) 00151 #define OPAMP_PGAConnect_IO1 OPAMP_CSR_PGGAIN_3 00152 #define OPAMP_PGAConnect_IO2 ((uint32_t)0x00030000) 00153 00154 #define IS_OPAMP_PGACONNECT(CONNECT) (((CONNECT) == OPAMP_PGAConnect_No) || \ 00155 ((CONNECT) == OPAMP_PGAConnect_IO1) || \ 00156 ((CONNECT) == OPAMP_PGAConnect_IO2)) 00157 /** 00158 * @} 00159 */ 00160 00161 /** @defgroup OPAMP_SecondaryInvertingInput 00162 * @{ 00163 */ 00164 00165 #define IS_OPAMP_SECONDARY_INVINPUT(INVINPUT) (((INVINPUT) == OPAMP_InvertingInput_IO1) || \ 00166 ((INVINPUT) == OPAMP_InvertingInput_IO2)) 00167 /** 00168 * @} 00169 */ 00170 00171 /** @defgroup OPAMP_Input 00172 * @{ 00173 */ 00174 00175 #define OPAMP_Input_Inverting ((uint32_t)0x00000018) /*!< Inverting input */ 00176 #define OPAMP_Input_NonInverting ((uint32_t)0x00000013) /*!< Non inverting input */ 00177 00178 #define IS_OPAMP_INPUT(INPUT) (((INPUT) == OPAMP_Input_Inverting) || \ 00179 ((INPUT) == OPAMP_Input_NonInverting)) 00180 00181 /** 00182 * @} 00183 */ 00184 00185 /** @defgroup OPAMP_Vref 00186 * @{ 00187 */ 00188 00189 #define OPAMP_Vref_3VDDA ((uint32_t)0x00000000) /*!< OPMAP Vref = 3.3% VDDA */ 00190 #define OPAMP_Vref_10VDDA OPAMP_CSR_CALSEL_0 /*!< OPMAP Vref = 10% VDDA */ 00191 #define OPAMP_Vref_50VDDA OPAMP_CSR_CALSEL_1 /*!< OPMAP Vref = 50% VDDA */ 00192 #define OPAMP_Vref_90VDDA OPAMP_CSR_CALSEL /*!< OPMAP Vref = 90% VDDA */ 00193 00194 #define IS_OPAMP_VREF(VREF) (((VREF) == OPAMP_Vref_3VDDA) || \ 00195 ((VREF) == OPAMP_Vref_10VDDA) || \ 00196 ((VREF) == OPAMP_Vref_50VDDA) || \ 00197 ((VREF) == OPAMP_Vref_90VDDA)) 00198 00199 /** 00200 * @} 00201 */ 00202 00203 /** @defgroup OPAMP_Trimming 00204 */ 00205 00206 #define OPAMP_Trimming_Factory ((uint32_t)0x00000000) /*!< Factory trimming */ 00207 #define OPAMP_Trimming_User OPAMP_CSR_USERTRIM /*!< User trimming */ 00208 00209 #define IS_OPAMP_TRIMMING(TRIMMING) (((TRIMMING) == OPAMP_Trimming_Factory) || \ 00210 ((TRIMMING) == OPAMP_Trimming_User)) 00211 00212 /** 00213 * @} 00214 */ 00215 00216 /** @defgroup OPAMP_TrimValue 00217 * @{ 00218 */ 00219 00220 #define IS_OPAMP_TRIMMINGVALUE(VALUE) ((VALUE) <= 0x0000001F) /*!< Trimming value */ 00221 00222 /** 00223 * @} 00224 */ 00225 00226 /** @defgroup OPAMP_OutputLevel 00227 * @{ 00228 */ 00229 00230 #define OPAMP_OutputLevel_High OPAMP_CSR_OUTCAL 00231 #define OPAMP_OutputLevel_Low ((uint32_t)0x00000000) 00232 00233 /** 00234 * @} 00235 */ 00236 00237 /* Exported macro ------------------------------------------------------------*/ 00238 /* Exported functions ------------------------------------------------------- */ 00239 00240 /* Function used to set the OPAMP configuration to the default reset state ***/ 00241 void OPAMP_DeInit(uint32_t OPAMP_Selection); 00242 00243 /* Initialization and Configuration functions *********************************/ 00244 void OPAMP_Init(uint32_t OPAMP_Selection, OPAMP_InitTypeDef* OPAMP_InitStruct); 00245 void OPAMP_StructInit(OPAMP_InitTypeDef* OPAMP_InitStruct); 00246 void OPAMP_PGAConfig(uint32_t OPAMP_Selection, uint32_t OPAMP_PGAGain, uint32_t OPAMP_PGAConnect); 00247 void OPAMP_VrefConfig(uint32_t OPAMP_Selection, uint32_t OPAMP_Vref); 00248 void OPAMP_VrefConnectADCCmd(uint32_t OPAMP_Selection, FunctionalState NewState); 00249 void OPAMP_TimerControlledMuxConfig(uint32_t OPAMP_Selection, OPAMP_InitTypeDef* OPAMP_InitStruct); 00250 void OPAMP_TimerControlledMuxCmd(uint32_t OPAMP_Selection, FunctionalState NewState); 00251 void OPAMP_Cmd(uint32_t OPAMP_Selection, FunctionalState NewState); 00252 uint32_t OPAMP_GetOutputLevel(uint32_t OPAMP_Selection); 00253 00254 /* Calibration functions ******************************************************/ 00255 void OPAMP_VrefConnectNonInvertingInput(uint32_t OPAMP_Selection, FunctionalState NewState); 00256 void OPAMP_OffsetTrimModeSelect(uint32_t OPAMP_Selection, uint32_t OPAMP_Trimming); 00257 void OPAMP_OffsetTrimConfig(uint32_t OPAMP_Selection, uint32_t OPAMP_Input, uint32_t OPAMP_TrimValue); 00258 void OPAMP_StartCalibration(uint32_t OPAMP_Selection, FunctionalState NewState); 00259 00260 /* OPAMP configuration locking function ***************************************/ 00261 void OPAMP_LockConfig(uint32_t OPAMP_Selection); 00262 00263 #ifdef __cplusplus 00264 } 00265 #endif 00266 00267 #endif /*__STM32F30x_OPAMP_H */ 00268 00269 /** 00270 * @} 00271 */ 00272 00273 /** 00274 * @} 00275 */ 00276 00277 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Tue Jul 12 2022 17:34:44 by
