Move telemetry displayport init and cms device registering
[betaflight.git] / lib / main / STM32F3 / Drivers / STM32F30x_StdPeriph_Driver / inc / stm32f30x_opamp.h
blobf1e170eb7e6764c6d44e3cb4f40ad65673f8d4f2
1 /**
2 ******************************************************************************
3 * @file stm32f30x_opamp.h
4 * @author MCD Application Team
5 * @version V1.1.1
6 * @date 04-April-2014
7 * @brief This file contains all the functions prototypes for the operational
8 * amplifiers (OPAMP) firmware library.
9 ******************************************************************************
10 * @attention
12 * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
14 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
15 * You may not use this file except in compliance with the License.
16 * You may obtain a copy of the License at:
18 * http://www.st.com/software_license_agreement_liberty_v2
20 * Unless required by applicable law or agreed to in writing, software
21 * distributed under the License is distributed on an "AS IS" BASIS,
22 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 * See the License for the specific language governing permissions and
24 * limitations under the License.
26 ******************************************************************************
27 */
29 /* Define to prevent recursive inclusion -------------------------------------*/
30 #ifndef __STM32F30x_OPAMP_H
31 #define __STM32F30x_OPAMP_H
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
37 /* Includes ------------------------------------------------------------------*/
38 #include "stm32f30x.h"
40 /** @addtogroup STM32F30x_StdPeriph_Driver
41 * @{
44 /** @addtogroup OPAMP
45 * @{
48 /* Exported types ------------------------------------------------------------*/
50 /**
51 * @brief OPAMP Init structure definition
54 typedef struct
57 uint32_t OPAMP_InvertingInput; /*!< Selects the inverting input of the operational amplifier.
58 This parameter can be a value of @ref OPAMP_InvertingInput */
60 uint32_t OPAMP_NonInvertingInput; /*!< Selects the non inverting input of the operational amplifier.
61 This parameter can be a value of @ref OPAMP_NonInvertingInput */
63 }OPAMP_InitTypeDef;
65 /* Exported constants --------------------------------------------------------*/
67 /** @defgroup OPAMP_Exported_Constants
68 * @{
69 */
71 /** @defgroup OPAMP_Selection
72 * @{
75 #define OPAMP_Selection_OPAMP1 ((uint32_t)0x00000000) /*!< OPAMP1 Selection */
76 #define OPAMP_Selection_OPAMP2 ((uint32_t)0x00000004) /*!< OPAMP2 Selection */
77 #define OPAMP_Selection_OPAMP3 ((uint32_t)0x00000008) /*!< OPAMP3 Selection */
78 #define OPAMP_Selection_OPAMP4 ((uint32_t)0x0000000C) /*!< OPAMP4 Selection */
80 #define IS_OPAMP_ALL_PERIPH(PERIPH) (((PERIPH) == OPAMP_Selection_OPAMP1) || \
81 ((PERIPH) == OPAMP_Selection_OPAMP2) || \
82 ((PERIPH) == OPAMP_Selection_OPAMP3) || \
83 ((PERIPH) == OPAMP_Selection_OPAMP4))
85 /**
86 * @}
89 /** @defgroup OPAMP_InvertingInput
90 * @{
93 #define OPAMP_InvertingInput_IO1 ((uint32_t)0x00000000) /*!< IO1 (PC5 for OPAMP1 and OPAMP2, PB10 for OPAMP3 and OPAMP4)
94 connected to OPAMPx inverting input */
95 #define OPAMP_InvertingInput_IO2 OPAMP_CSR_VMSEL_0 /*!< IO2 (PA3 for OPAMP1, PA5 for OPAMP2, PB2 for OPAMP3, PD8 for OPAMP4)
96 connected to OPAMPx inverting input */
97 #define OPAMP_InvertingInput_PGA OPAMP_CSR_VMSEL_1 /*!< Resistor feedback output connected to OPAMPx inverting input (PGA mode) */
98 #define OPAMP_InvertingInput_Vout OPAMP_CSR_VMSEL /*!< Vout connected to OPAMPx inverting input (follower mode) */
100 #define IS_OPAMP_INVERTING_INPUT(INPUT) (((INPUT) == OPAMP_InvertingInput_IO1) || \
101 ((INPUT) == OPAMP_InvertingInput_IO2) || \
102 ((INPUT) == OPAMP_InvertingInput_PGA) || \
103 ((INPUT) == OPAMP_InvertingInput_Vout))
105 * @}
108 /** @defgroup OPAMP_NonInvertingInput
109 * @{
112 #define OPAMP_NonInvertingInput_IO1 ((uint32_t)0x00000000) /*!< IO1 (PA7 for OPAMP1, PD14 for OPAMP2, PB13 for OPAMP3, PD11 for OPAMP4)
113 connected to OPAMPx non inverting input */
114 #define OPAMP_NonInvertingInput_IO2 OPAMP_CSR_VPSEL_0 /*!< IO2 (PA5 for OPAMP1, PB14 for OPAMP2, PA5 for OPAMP3, PB11 for OPAMP4)
115 connected to OPAMPx non inverting input */
116 #define OPAMP_NonInvertingInput_IO3 OPAMP_CSR_VPSEL_1 /*!< IO3 (PA3 for OPAMP1, PB0 for OPAMP2, PA1 for OPAMP3, PA4 for OPAMP4)
117 connected to OPAMPx non inverting input */
118 #define OPAMP_NonInvertingInput_IO4 OPAMP_CSR_VPSEL /*!< IO4 (PA1 for OPAMP1, PA7 for OPAMP2, PB0 for OPAMP3, PB13 for OPAMP4)
119 connected to OPAMPx non inverting input */
121 #define IS_OPAMP_NONINVERTING_INPUT(INPUT) (((INPUT) == OPAMP_NonInvertingInput_IO1) || \
122 ((INPUT) == OPAMP_NonInvertingInput_IO2) || \
123 ((INPUT) == OPAMP_NonInvertingInput_IO3) || \
124 ((INPUT) == OPAMP_NonInvertingInput_IO4))
126 * @}
129 /** @defgroup OPAMP_PGAGain_Config
130 * @{
133 #define OPAMP_OPAMP_PGAGain_2 ((uint32_t)0x00000000)
134 #define OPAMP_OPAMP_PGAGain_4 OPAMP_CSR_PGGAIN_0
135 #define OPAMP_OPAMP_PGAGain_8 OPAMP_CSR_PGGAIN_1
136 #define OPAMP_OPAMP_PGAGain_16 ((uint32_t)0x0000C000)
138 #define IS_OPAMP_PGAGAIN(GAIN) (((GAIN) == OPAMP_OPAMP_PGAGain_2) || \
139 ((GAIN) == OPAMP_OPAMP_PGAGain_4) || \
140 ((GAIN) == OPAMP_OPAMP_PGAGain_8) || \
141 ((GAIN) == OPAMP_OPAMP_PGAGain_16))
143 * @}
146 /** @defgroup OPAMP_PGAConnect_Config
147 * @{
150 #define OPAMP_PGAConnect_No ((uint32_t)0x00000000)
151 #define OPAMP_PGAConnect_IO1 OPAMP_CSR_PGGAIN_3
152 #define OPAMP_PGAConnect_IO2 ((uint32_t)0x00030000)
154 #define IS_OPAMP_PGACONNECT(CONNECT) (((CONNECT) == OPAMP_PGAConnect_No) || \
155 ((CONNECT) == OPAMP_PGAConnect_IO1) || \
156 ((CONNECT) == OPAMP_PGAConnect_IO2))
158 * @}
161 /** @defgroup OPAMP_SecondaryInvertingInput
162 * @{
165 #define IS_OPAMP_SECONDARY_INVINPUT(INVINPUT) (((INVINPUT) == OPAMP_InvertingInput_IO1) || \
166 ((INVINPUT) == OPAMP_InvertingInput_IO2))
168 * @}
171 /** @defgroup OPAMP_Input
172 * @{
175 #define OPAMP_Input_Inverting ((uint32_t)0x00000018) /*!< Inverting input */
176 #define OPAMP_Input_NonInverting ((uint32_t)0x00000013) /*!< Non inverting input */
178 #define IS_OPAMP_INPUT(INPUT) (((INPUT) == OPAMP_Input_Inverting) || \
179 ((INPUT) == OPAMP_Input_NonInverting))
182 * @}
185 /** @defgroup OPAMP_Vref
186 * @{
189 #define OPAMP_Vref_3VDDA ((uint32_t)0x00000000) /*!< OPMAP Vref = 3.3% VDDA */
190 #define OPAMP_Vref_10VDDA OPAMP_CSR_CALSEL_0 /*!< OPMAP Vref = 10% VDDA */
191 #define OPAMP_Vref_50VDDA OPAMP_CSR_CALSEL_1 /*!< OPMAP Vref = 50% VDDA */
192 #define OPAMP_Vref_90VDDA OPAMP_CSR_CALSEL /*!< OPMAP Vref = 90% VDDA */
194 #define IS_OPAMP_VREF(VREF) (((VREF) == OPAMP_Vref_3VDDA) || \
195 ((VREF) == OPAMP_Vref_10VDDA) || \
196 ((VREF) == OPAMP_Vref_50VDDA) || \
197 ((VREF) == OPAMP_Vref_90VDDA))
200 * @}
203 /** @defgroup OPAMP_Trimming
206 #define OPAMP_Trimming_Factory ((uint32_t)0x00000000) /*!< Factory trimming */
207 #define OPAMP_Trimming_User OPAMP_CSR_USERTRIM /*!< User trimming */
209 #define IS_OPAMP_TRIMMING(TRIMMING) (((TRIMMING) == OPAMP_Trimming_Factory) || \
210 ((TRIMMING) == OPAMP_Trimming_User))
213 * @}
216 /** @defgroup OPAMP_TrimValue
217 * @{
220 #define IS_OPAMP_TRIMMINGVALUE(VALUE) ((VALUE) <= 0x0000001F) /*!< Trimming value */
223 * @}
226 /** @defgroup OPAMP_OutputLevel
227 * @{
230 #define OPAMP_OutputLevel_High OPAMP_CSR_OUTCAL
231 #define OPAMP_OutputLevel_Low ((uint32_t)0x00000000)
234 * @}
237 /* Exported macro ------------------------------------------------------------*/
238 /* Exported functions ------------------------------------------------------- */
240 /* Function used to set the OPAMP configuration to the default reset state ***/
241 void OPAMP_DeInit(uint32_t OPAMP_Selection);
243 /* Initialization and Configuration functions *********************************/
244 void OPAMP_Init(uint32_t OPAMP_Selection, OPAMP_InitTypeDef* OPAMP_InitStruct);
245 void OPAMP_StructInit(OPAMP_InitTypeDef* OPAMP_InitStruct);
246 void OPAMP_PGAConfig(uint32_t OPAMP_Selection, uint32_t OPAMP_PGAGain, uint32_t OPAMP_PGAConnect);
247 void OPAMP_VrefConfig(uint32_t OPAMP_Selection, uint32_t OPAMP_Vref);
248 void OPAMP_VrefConnectADCCmd(uint32_t OPAMP_Selection, FunctionalState NewState);
249 void OPAMP_TimerControlledMuxConfig(uint32_t OPAMP_Selection, OPAMP_InitTypeDef* OPAMP_InitStruct);
250 void OPAMP_TimerControlledMuxCmd(uint32_t OPAMP_Selection, FunctionalState NewState);
251 void OPAMP_Cmd(uint32_t OPAMP_Selection, FunctionalState NewState);
252 uint32_t OPAMP_GetOutputLevel(uint32_t OPAMP_Selection);
254 /* Calibration functions ******************************************************/
255 void OPAMP_VrefConnectNonInvertingInput(uint32_t OPAMP_Selection, FunctionalState NewState);
256 void OPAMP_OffsetTrimModeSelect(uint32_t OPAMP_Selection, uint32_t OPAMP_Trimming);
257 void OPAMP_OffsetTrimConfig(uint32_t OPAMP_Selection, uint32_t OPAMP_Input, uint32_t OPAMP_TrimValue);
258 void OPAMP_StartCalibration(uint32_t OPAMP_Selection, FunctionalState NewState);
260 /* OPAMP configuration locking function ***************************************/
261 void OPAMP_LockConfig(uint32_t OPAMP_Selection);
263 #ifdef __cplusplus
265 #endif
267 #endif /*__STM32F30x_OPAMP_H */
270 * @}
274 * @}
277 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/