30 #ifndef __STM32F30x_OPAMP_H 31 #define __STM32F30x_OPAMP_H 38 #include "stm32f30x.h" 75 #define OPAMP_Selection_OPAMP1 ((uint32_t)0x00000000) 76 #define OPAMP_Selection_OPAMP2 ((uint32_t)0x00000004) 77 #define OPAMP_Selection_OPAMP3 ((uint32_t)0x00000008) 78 #define OPAMP_Selection_OPAMP4 ((uint32_t)0x0000000C) 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)) 93 #define OPAMP_InvertingInput_IO1 ((uint32_t)0x00000000) 95 #define OPAMP_InvertingInput_IO2 OPAMP_CSR_VMSEL_0 97 #define OPAMP_InvertingInput_PGA OPAMP_CSR_VMSEL_1 98 #define OPAMP_InvertingInput_Vout OPAMP_CSR_VMSEL 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)) 112 #define OPAMP_NonInvertingInput_IO1 ((uint32_t)0x00000000) 114 #define OPAMP_NonInvertingInput_IO2 OPAMP_CSR_VPSEL_0 116 #define OPAMP_NonInvertingInput_IO3 OPAMP_CSR_VPSEL_1 118 #define OPAMP_NonInvertingInput_IO4 OPAMP_CSR_VPSEL 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)) 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)) 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)) 165 #define IS_OPAMP_SECONDARY_INVINPUT(INVINPUT) (((INVINPUT) == OPAMP_InvertingInput_IO1) || \ 166 ((INVINPUT) == OPAMP_InvertingInput_IO2)) 175 #define OPAMP_Input_Inverting ((uint32_t)0x00000018) 176 #define OPAMP_Input_NonInverting ((uint32_t)0x00000013) 178 #define IS_OPAMP_INPUT(INPUT) (((INPUT) == OPAMP_Input_Inverting) || \ 179 ((INPUT) == OPAMP_Input_NonInverting)) 189 #define OPAMP_Vref_3VDDA ((uint32_t)0x00000000) 190 #define OPAMP_Vref_10VDDA OPAMP_CSR_CALSEL_0 191 #define OPAMP_Vref_50VDDA OPAMP_CSR_CALSEL_1 192 #define OPAMP_Vref_90VDDA OPAMP_CSR_CALSEL 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)) 206 #define OPAMP_Trimming_Factory ((uint32_t)0x00000000) 207 #define OPAMP_Trimming_User OPAMP_CSR_USERTRIM 209 #define IS_OPAMP_TRIMMING(TRIMMING) (((TRIMMING) == OPAMP_Trimming_Factory) || \ 210 ((TRIMMING) == OPAMP_Trimming_User)) 220 #define IS_OPAMP_TRIMMINGVALUE(VALUE) ((VALUE) <= 0x0000001F) 230 #define OPAMP_OutputLevel_High OPAMP_CSR_OUTCAL 231 #define OPAMP_OutputLevel_Low ((uint32_t)0x00000000) 246 void OPAMP_PGAConfig(uint32_t OPAMP_Selection, uint32_t OPAMP_PGAGain, uint32_t OPAMP_PGAConnect);
void OPAMP_DeInit(uint32_t OPAMP_Selection)
Deinitializes OPAMP peripheral registers to their default reset values.
uint32_t OPAMP_NonInvertingInput
uint32_t OPAMP_GetOutputLevel(uint32_t OPAMP_Selection)
Return the output level (high or low) during calibration of the selected OPAMP.
void OPAMP_PGAConfig(uint32_t OPAMP_Selection, uint32_t OPAMP_PGAGain, uint32_t OPAMP_PGAConnect)
Configure the feedback resistor gain.
void OPAMP_TimerControlledMuxCmd(uint32_t OPAMP_Selection, FunctionalState NewState)
Enable or disable the timer-controlled mux mode.
void OPAMP_VrefConnectADCCmd(uint32_t OPAMP_Selection, FunctionalState NewState)
Enables or disables connecting the OPAMP's internal reference to ADC.
uint32_t OPAMP_InvertingInput
void OPAMP_VrefConfig(uint32_t OPAMP_Selection, uint32_t OPAMP_Vref)
Configure the OPAMP's internal reference.
void OPAMP_VrefConnectNonInvertingInput(uint32_t OPAMP_Selection, FunctionalState NewState)
Connnect the internal reference to the OPAMP's non inverting input.
void OPAMP_LockConfig(uint32_t OPAMP_Selection)
Lock the selected OPAMP configuration.
void OPAMP_Init(uint32_t OPAMP_Selection, OPAMP_InitTypeDef *OPAMP_InitStruct)
Initializes the OPAMP peripheral according to the specified parameters in OPAMP_InitStruct.
void OPAMP_Cmd(uint32_t OPAMP_Selection, FunctionalState NewState)
Enable or disable the OPAMP peripheral.
void OPAMP_OffsetTrimModeSelect(uint32_t OPAMP_Selection, uint32_t OPAMP_Trimming)
Select the trimming mode.
void OPAMP_StartCalibration(uint32_t OPAMP_Selection, FunctionalState NewState)
Start or stop the calibration of selected OPAMP peripheral.
void OPAMP_StructInit(OPAMP_InitTypeDef *OPAMP_InitStruct)
Fills each OPAMP_InitStruct member with its default value.
void OPAMP_TimerControlledMuxConfig(uint32_t OPAMP_Selection, OPAMP_InitTypeDef *OPAMP_InitStruct)
Configure the OPAMP peripheral (secondary inputs) for timer-controlled mux mode according to the spec...
void OPAMP_OffsetTrimConfig(uint32_t OPAMP_Selection, uint32_t OPAMP_Input, uint32_t OPAMP_TrimValue)
Configure the trimming value of the OPAMP.
OPAMP Init structure definition.