Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
100:cbbeb26dbd92
.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 100:cbbeb26dbd92 1 /**
Kojto 100:cbbeb26dbd92 2 ******************************************************************************
Kojto 100:cbbeb26dbd92 3 * @file stm32f3xx_hal_opamp.h
Kojto 100:cbbeb26dbd92 4 * @author MCD Application Team
Kojto 100:cbbeb26dbd92 5 * @version V1.1.0
Kojto 100:cbbeb26dbd92 6 * @date 12-Sept-2014
Kojto 100:cbbeb26dbd92 7 * @brief Header file of OPAMP HAL module.
Kojto 100:cbbeb26dbd92 8 ******************************************************************************
Kojto 100:cbbeb26dbd92 9 * @attention
Kojto 100:cbbeb26dbd92 10 *
Kojto 100:cbbeb26dbd92 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
Kojto 100:cbbeb26dbd92 12 *
Kojto 100:cbbeb26dbd92 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 100:cbbeb26dbd92 14 * are permitted provided that the following conditions are met:
Kojto 100:cbbeb26dbd92 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 100:cbbeb26dbd92 16 * this list of conditions and the following disclaimer.
Kojto 100:cbbeb26dbd92 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 100:cbbeb26dbd92 18 * this list of conditions and the following disclaimer in the documentation
Kojto 100:cbbeb26dbd92 19 * and/or other materials provided with the distribution.
Kojto 100:cbbeb26dbd92 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 100:cbbeb26dbd92 21 * may be used to endorse or promote products derived from this software
Kojto 100:cbbeb26dbd92 22 * without specific prior written permission.
Kojto 100:cbbeb26dbd92 23 *
Kojto 100:cbbeb26dbd92 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 100:cbbeb26dbd92 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 100:cbbeb26dbd92 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 100:cbbeb26dbd92 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 100:cbbeb26dbd92 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 100:cbbeb26dbd92 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 100:cbbeb26dbd92 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 100:cbbeb26dbd92 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 100:cbbeb26dbd92 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 100:cbbeb26dbd92 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 100:cbbeb26dbd92 34 *
Kojto 100:cbbeb26dbd92 35 ******************************************************************************
Kojto 100:cbbeb26dbd92 36 */
Kojto 100:cbbeb26dbd92 37
Kojto 100:cbbeb26dbd92 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 100:cbbeb26dbd92 39 #ifndef __STM32F3xx_HAL_OPAMP_H
Kojto 100:cbbeb26dbd92 40 #define __STM32F3xx_HAL_OPAMP_H
Kojto 100:cbbeb26dbd92 41
Kojto 100:cbbeb26dbd92 42 #ifdef __cplusplus
Kojto 100:cbbeb26dbd92 43 extern "C" {
Kojto 100:cbbeb26dbd92 44 #endif
Kojto 100:cbbeb26dbd92 45
Kojto 100:cbbeb26dbd92 46 #if defined(STM32F302xE) || defined(STM32F303xE) || defined(STM32F398xx) || \
Kojto 100:cbbeb26dbd92 47 defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) || \
Kojto 100:cbbeb26dbd92 48 defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx) || \
Kojto 100:cbbeb26dbd92 49 defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx)
Kojto 100:cbbeb26dbd92 50
Kojto 100:cbbeb26dbd92 51 /* Includes ------------------------------------------------------------------*/
Kojto 100:cbbeb26dbd92 52 #include "stm32f3xx_hal_def.h"
Kojto 100:cbbeb26dbd92 53
Kojto 100:cbbeb26dbd92 54 /** @addtogroup STM32F3xx_HAL_Driver
Kojto 100:cbbeb26dbd92 55 * @{
Kojto 100:cbbeb26dbd92 56 */
Kojto 100:cbbeb26dbd92 57
Kojto 100:cbbeb26dbd92 58 /** @addtogroup OPAMP
Kojto 100:cbbeb26dbd92 59 * @{
Kojto 100:cbbeb26dbd92 60 */
Kojto 100:cbbeb26dbd92 61
Kojto 100:cbbeb26dbd92 62 /* Exported types ------------------------------------------------------------*/
Kojto 100:cbbeb26dbd92 63 /** @defgroup OPAMP_Exported_Types OPAMP Exported Types
Kojto 100:cbbeb26dbd92 64 * @{
Kojto 100:cbbeb26dbd92 65 */
Kojto 100:cbbeb26dbd92 66
Kojto 100:cbbeb26dbd92 67 /**
Kojto 100:cbbeb26dbd92 68 * @brief OPAMP Init structure definition
Kojto 100:cbbeb26dbd92 69 */
Kojto 100:cbbeb26dbd92 70
Kojto 100:cbbeb26dbd92 71 typedef struct
Kojto 100:cbbeb26dbd92 72 {
Kojto 100:cbbeb26dbd92 73 uint32_t Mode; /*!< Specifies the OPAMP mode
Kojto 100:cbbeb26dbd92 74 This parameter must be a value of @ref OPAMP_Mode
Kojto 100:cbbeb26dbd92 75 mode is either Standalone, - Follower or PGA */
Kojto 100:cbbeb26dbd92 76
Kojto 100:cbbeb26dbd92 77 uint32_t InvertingInput; /*!< Specifies the inverting input in Standalone & Pga modes
Kojto 100:cbbeb26dbd92 78 - In Standalone mode: i.e when mode is OPAMP_STANDALONE_MODE
Kojto 100:cbbeb26dbd92 79 This parameter must be a value of @ref OPAMP_InvertingInput
Kojto 100:cbbeb26dbd92 80 InvertingInput is either VM0 or VM1
Kojto 100:cbbeb26dbd92 81 - In PGA mode: i.e when mode is OPAMP_PGA_MODE
Kojto 100:cbbeb26dbd92 82 & in Follower mode i.e when mode is OPAMP_FOLLOWER_MODE
Kojto 100:cbbeb26dbd92 83 This parameter is Not Applicable */
Kojto 100:cbbeb26dbd92 84
Kojto 100:cbbeb26dbd92 85 uint32_t NonInvertingInput; /*!< Specifies the non inverting input of the opamp:
Kojto 100:cbbeb26dbd92 86 This parameter must be a value of @ref OPAMP_NonInvertingInput
Kojto 100:cbbeb26dbd92 87 NonInvertingInput is either VP0, VP1, VP2 or VP3 */
Kojto 100:cbbeb26dbd92 88
Kojto 100:cbbeb26dbd92 89 uint32_t TimerControlledMuxmode; /*!< Specifies if the Timer controlled Mux mode is enabled or disabled
Kojto 100:cbbeb26dbd92 90 This parameter must be a value of @ref OPAMP_TimerControlledMuxmode */
Kojto 100:cbbeb26dbd92 91
Kojto 100:cbbeb26dbd92 92 uint32_t InvertingInputSecondary; /*!< Specifies the inverting input (secondary) of the opamp when
Kojto 100:cbbeb26dbd92 93 TimerControlledMuxmode is enabled
Kojto 100:cbbeb26dbd92 94 i.e. when TimerControlledMuxmode is OPAMP_TIMERCONTROLLEDMUXMODE_ENABLE
Kojto 100:cbbeb26dbd92 95 - In Standalone mode: i.e when mode is OPAMP_STANDALONE_MODE
Kojto 100:cbbeb26dbd92 96 This parameter must be a value of @ref OPAMP_InvertingInputSecondary
Kojto 100:cbbeb26dbd92 97 InvertingInputSecondary is either VM0 or VM1
Kojto 100:cbbeb26dbd92 98 - In PGA mode: i.e when mode is OPAMP_PGA_MODE
Kojto 100:cbbeb26dbd92 99 & in Follower mode i.e when mode is OPAMP_FOLLOWER_MODE
Kojto 100:cbbeb26dbd92 100 This parameter is Not Applicable */
Kojto 100:cbbeb26dbd92 101
Kojto 100:cbbeb26dbd92 102 uint32_t NonInvertingInputSecondary; /*!< Specifies the non inverting input (secondary) of the opamp when
Kojto 100:cbbeb26dbd92 103 TimerControlledMuxmode is enabled
Kojto 100:cbbeb26dbd92 104 i.e. when TimerControlledMuxmode is OPAMP_TIMERCONTROLLEDMUXMODE_ENABLE
Kojto 100:cbbeb26dbd92 105 This parameter must be a value of @ref OPAMP_NonInvertingInputSecondary
Kojto 100:cbbeb26dbd92 106 NonInvertingInput is either VP0, VP1, VP2 or VP3 */
Kojto 100:cbbeb26dbd92 107
Kojto 100:cbbeb26dbd92 108 uint32_t PgaConnect; /*!< Specifies the inverting pin in PGA mode
Kojto 100:cbbeb26dbd92 109 i.e. when mode is OPAMP_PGA_MODE
Kojto 100:cbbeb26dbd92 110 This parameter must be a value of @ref OPAMP_PgaConnect
Kojto 100:cbbeb26dbd92 111 Either: not connected, connected to VM0, connected to VM1
Kojto 100:cbbeb26dbd92 112 (VM0 or VM1 are typically used for external filtering) */
Kojto 100:cbbeb26dbd92 113
Kojto 100:cbbeb26dbd92 114 uint32_t PgaGain; /*!< Specifies the gain in PGA mode
Kojto 100:cbbeb26dbd92 115 i.e. when mode is OPAMP_PGA_MODE.
Kojto 100:cbbeb26dbd92 116 This parameter must be a value of @ref OPAMP_PgaGain (2, 4, 8 or 16 ) */
Kojto 100:cbbeb26dbd92 117
Kojto 100:cbbeb26dbd92 118 uint32_t UserTrimming; /*!< Specifies the trimming mode
Kojto 100:cbbeb26dbd92 119 This parameter must be a value of @ref OPAMP_UserTrimming
Kojto 100:cbbeb26dbd92 120 UserTrimming is either factory or user trimming */
Kojto 100:cbbeb26dbd92 121
Kojto 100:cbbeb26dbd92 122 uint32_t TrimmingValueP; /*!< Specifies the offset trimming value (PMOS)
Kojto 100:cbbeb26dbd92 123 i.e. when UserTrimming is OPAMP_TRIMMING_USER.
Kojto 100:cbbeb26dbd92 124 This parameter must be a number between Min_Data = 1 and Max_Data = 31 */
Kojto 100:cbbeb26dbd92 125
Kojto 100:cbbeb26dbd92 126 uint32_t TrimmingValueN; /*!< Specifies the offset trimming value (NMOS)
Kojto 100:cbbeb26dbd92 127 i.e. when UserTrimming is OPAMP_TRIMMING_USER.
Kojto 100:cbbeb26dbd92 128 This parameter must be a number between Min_Data = 1 and Max_Data = 31 */
Kojto 100:cbbeb26dbd92 129
Kojto 100:cbbeb26dbd92 130 }OPAMP_InitTypeDef;
Kojto 100:cbbeb26dbd92 131
Kojto 100:cbbeb26dbd92 132 /**
Kojto 100:cbbeb26dbd92 133 * @brief HAL State structures definition
Kojto 100:cbbeb26dbd92 134 */
Kojto 100:cbbeb26dbd92 135
Kojto 100:cbbeb26dbd92 136 typedef enum
Kojto 100:cbbeb26dbd92 137 {
Kojto 100:cbbeb26dbd92 138 HAL_OPAMP_STATE_RESET = 0x00000000, /*!< OPMAP is not yet Initialized */
Kojto 100:cbbeb26dbd92 139
Kojto 100:cbbeb26dbd92 140 HAL_OPAMP_STATE_READY = 0x00000001, /*!< OPAMP is initialized and ready for use */
Kojto 100:cbbeb26dbd92 141 HAL_OPAMP_STATE_CALIBBUSY = 0x00000002, /*!< OPAMP is enabled in auto calibration mode */
Kojto 100:cbbeb26dbd92 142
Kojto 100:cbbeb26dbd92 143 HAL_OPAMP_STATE_BUSY = 0x00000004, /*!< OPAMP is enabled and running in normal mode */
Kojto 100:cbbeb26dbd92 144 HAL_OPAMP_STATE_BUSYLOCKED = 0x00000005, /*!< OPAMP is locked
Kojto 100:cbbeb26dbd92 145 only system reset allows reconfiguring the opamp. */
Kojto 100:cbbeb26dbd92 146
Kojto 100:cbbeb26dbd92 147 }HAL_OPAMP_StateTypeDef;
Kojto 100:cbbeb26dbd92 148
Kojto 100:cbbeb26dbd92 149 /**
Kojto 100:cbbeb26dbd92 150 * @brief OPAMP Handle Structure definition to @brief OPAMP Handle Structure definition
Kojto 100:cbbeb26dbd92 151 */
Kojto 100:cbbeb26dbd92 152 typedef struct
Kojto 100:cbbeb26dbd92 153 {
Kojto 100:cbbeb26dbd92 154 OPAMP_TypeDef *Instance; /*!< OPAMP instance's registers base address */
Kojto 100:cbbeb26dbd92 155 OPAMP_InitTypeDef Init; /*!< OPAMP required parameters */
Kojto 100:cbbeb26dbd92 156 HAL_StatusTypeDef Status; /*!< OPAMP peripheral status */
Kojto 100:cbbeb26dbd92 157 HAL_LockTypeDef Lock; /*!< Locking object */
Kojto 100:cbbeb26dbd92 158 __IO HAL_OPAMP_StateTypeDef State; /*!< OPAMP communication state */
Kojto 100:cbbeb26dbd92 159
Kojto 100:cbbeb26dbd92 160 } OPAMP_HandleTypeDef;
Kojto 100:cbbeb26dbd92 161
Kojto 100:cbbeb26dbd92 162 /**
Kojto 100:cbbeb26dbd92 163 * @brief OPAMP_TrimmingValueTypeDef @brief definition
Kojto 100:cbbeb26dbd92 164 */
Kojto 100:cbbeb26dbd92 165
Kojto 100:cbbeb26dbd92 166 typedef uint32_t OPAMP_TrimmingValueTypeDef;
Kojto 100:cbbeb26dbd92 167 /**
Kojto 100:cbbeb26dbd92 168 * @}
Kojto 100:cbbeb26dbd92 169 */
Kojto 100:cbbeb26dbd92 170
Kojto 100:cbbeb26dbd92 171 /* Exported constants --------------------------------------------------------*/
Kojto 100:cbbeb26dbd92 172 /** @defgroup OPAMP_Exported_Constants OPAMP Exported Constants
Kojto 100:cbbeb26dbd92 173 * @{
Kojto 100:cbbeb26dbd92 174 */
Kojto 100:cbbeb26dbd92 175
Kojto 100:cbbeb26dbd92 176 /** @defgroup CSR_INIT CSR init register Mask
Kojto 100:cbbeb26dbd92 177 * @{
Kojto 100:cbbeb26dbd92 178 */
Kojto 100:cbbeb26dbd92 179 /* Used for Init phase */
Kojto 100:cbbeb26dbd92 180 #define OPAMP_CSR_UPDATE_PARAMETERS_INIT_MASK (OPAMP_CSR_TRIMOFFSETN | OPAMP_CSR_TRIMOFFSETP \
Kojto 100:cbbeb26dbd92 181 | OPAMP_CSR_USERTRIM | OPAMP_CSR_PGGAIN | OPAMP_CSR_VPSSEL \
Kojto 100:cbbeb26dbd92 182 | OPAMP_CSR_VMSSEL | OPAMP_CSR_TCMEN | OPAMP_CSR_VPSEL \
Kojto 100:cbbeb26dbd92 183 | OPAMP_CSR_VPSEL | OPAMP_CSR_FORCEVP)
Kojto 100:cbbeb26dbd92 184
Kojto 100:cbbeb26dbd92 185 /**
Kojto 100:cbbeb26dbd92 186 * @}
Kojto 100:cbbeb26dbd92 187 */
Kojto 100:cbbeb26dbd92 188
Kojto 100:cbbeb26dbd92 189 /** @defgroup OPAMP_Mode OPAMP Mode
Kojto 100:cbbeb26dbd92 190 * @{
Kojto 100:cbbeb26dbd92 191 */
Kojto 100:cbbeb26dbd92 192 #define OPAMP_STANDALONE_MODE ((uint32_t)0x00000000) /*!< standalone mode */
Kojto 100:cbbeb26dbd92 193 #define OPAMP_PGA_MODE OPAMP_CSR_VMSEL_1 /*!< PGA mode */
Kojto 100:cbbeb26dbd92 194 #define OPAMP_FOLLOWER_MODE OPAMP_CSR_VMSEL /*!< follower mode */
Kojto 100:cbbeb26dbd92 195
Kojto 100:cbbeb26dbd92 196
Kojto 100:cbbeb26dbd92 197 #define IS_OPAMP_FUNCTIONAL_NORMALMODE(INPUT) (((INPUT) == OPAMP_STANDALONE_MODE) || \
Kojto 100:cbbeb26dbd92 198 ((INPUT) == OPAMP_PGA_MODE) || \
Kojto 100:cbbeb26dbd92 199 ((INPUT) == OPAMP_FOLLOWER_MODE))
Kojto 100:cbbeb26dbd92 200
Kojto 100:cbbeb26dbd92 201 /**
Kojto 100:cbbeb26dbd92 202 * @}
Kojto 100:cbbeb26dbd92 203 */
Kojto 100:cbbeb26dbd92 204
Kojto 100:cbbeb26dbd92 205 /** @defgroup OPAMP_NonInvertingInput OPAMP Non Inverting Input
Kojto 100:cbbeb26dbd92 206 * @{
Kojto 100:cbbeb26dbd92 207 */
Kojto 100:cbbeb26dbd92 208
Kojto 100:cbbeb26dbd92 209 #define OPAMP_NONINVERTINGINPUT_VP0 OPAMP_CSR_VPSEL /*!< VP0 (PA1 for OPAMP1, PA7 for OPAMP2, PB0 for OPAMP3, PB13 for OPAMP4)
Kojto 100:cbbeb26dbd92 210 connected to OPAMPx non inverting input */
Kojto 100:cbbeb26dbd92 211 #define OPAMP_NONINVERTINGINPUT_VP1 ((uint32_t)0x00000000) /*!< VP1 (PA7 for OPAMP1, PD14 for OPAMP2, PB13 for OPAMP3, PD11 for OPAMP4)
Kojto 100:cbbeb26dbd92 212 connected to OPAMPx non inverting input */
Kojto 100:cbbeb26dbd92 213 #define OPAMP_NONINVERTINGINPUT_VP2 OPAMP_CSR_VPSEL_1 /*!< VP2 (PA3 for OPAMP1, PB0 for OPAMP2, PA1 for OPAMP3, PA4 for OPAMP4)
Kojto 100:cbbeb26dbd92 214 connected to OPAMPx non inverting input */
Kojto 100:cbbeb26dbd92 215 #define OPAMP_NONINVERTINGINPUT_VP3 OPAMP_CSR_VPSEL_0 /*!< vp3 (PA5 for OPAMP1, PB14 for OPAMP2, PA5 for OPAMP3, PB11 for OPAMP4)
Kojto 100:cbbeb26dbd92 216 connected to OPAMPx non inverting input */
Kojto 100:cbbeb26dbd92 217
Kojto 100:cbbeb26dbd92 218 #define IS_OPAMP_NONINVERTING_INPUT(INPUT) (((INPUT) == OPAMP_NONINVERTINGINPUT_VP0) || \
Kojto 100:cbbeb26dbd92 219 ((INPUT) == OPAMP_NONINVERTINGINPUT_VP1) || \
Kojto 100:cbbeb26dbd92 220 ((INPUT) == OPAMP_NONINVERTINGINPUT_VP2) || \
Kojto 100:cbbeb26dbd92 221 ((INPUT) == OPAMP_NONINVERTINGINPUT_VP3))
Kojto 100:cbbeb26dbd92 222
Kojto 100:cbbeb26dbd92 223 /**
Kojto 100:cbbeb26dbd92 224 * @}
Kojto 100:cbbeb26dbd92 225 */
Kojto 100:cbbeb26dbd92 226
Kojto 100:cbbeb26dbd92 227 /** @defgroup OPAMP_InvertingInput OPAMP Inverting Input
Kojto 100:cbbeb26dbd92 228 * @{
Kojto 100:cbbeb26dbd92 229 */
Kojto 100:cbbeb26dbd92 230
Kojto 100:cbbeb26dbd92 231 #define IOPAMP_INVERTINGINPUT_VM0 ((uint32_t)0x00000000) /*!< inverting input connected to VM0 */
Kojto 100:cbbeb26dbd92 232 #define IOPAMP_INVERTINGINPUT_VM1 OPAMP_CSR_VMSEL_0 /*!< inverting input connected to VM1 */
Kojto 100:cbbeb26dbd92 233
Kojto 100:cbbeb26dbd92 234 #define IS_OPAMP_INVERTING_INPUT(INPUT) (((INPUT) == IOPAMP_INVERTINGINPUT_VM0) || \
Kojto 100:cbbeb26dbd92 235 ((INPUT) == IOPAMP_INVERTINGINPUT_VM1))
Kojto 100:cbbeb26dbd92 236
Kojto 100:cbbeb26dbd92 237 /**
Kojto 100:cbbeb26dbd92 238 * @}
Kojto 100:cbbeb26dbd92 239 */
Kojto 100:cbbeb26dbd92 240
Kojto 100:cbbeb26dbd92 241 /** @defgroup OPAMP_TimerControlledMuxmode OPAMP Timer Controlled Mux mode
Kojto 100:cbbeb26dbd92 242 * @{
Kojto 100:cbbeb26dbd92 243 */
Kojto 100:cbbeb26dbd92 244 #define OPAMP_TIMERCONTROLLEDMUXMODE_DISABLE ((uint32_t)0x00000000) /*!< Timer controlled Mux mode disabled */
Kojto 100:cbbeb26dbd92 245 #define OPAMP_TIMERCONTROLLEDMUXMODE_ENABLE OPAMP_CSR_TCMEN /*!< Timer controlled Mux mode enabled */
Kojto 100:cbbeb26dbd92 246
Kojto 100:cbbeb26dbd92 247 #define IS_OPAMP_TIMERCONTROLLED_MUXMODE(MUXMODE) (((MUXMODE) == OPAMP_TIMERCONTROLLEDMUXMODE_DISABLE) || \
Kojto 100:cbbeb26dbd92 248 ((MUXMODE) == OPAMP_TIMERCONTROLLEDMUXMODE_ENABLE))
Kojto 100:cbbeb26dbd92 249 /**
Kojto 100:cbbeb26dbd92 250 * @}
Kojto 100:cbbeb26dbd92 251 */
Kojto 100:cbbeb26dbd92 252
Kojto 100:cbbeb26dbd92 253 /** @defgroup OPAMP_NonInvertingInputSecondary OPAMP Non Inverting Input Secondary
Kojto 100:cbbeb26dbd92 254 * @{
Kojto 100:cbbeb26dbd92 255 */
Kojto 100:cbbeb26dbd92 256
Kojto 100:cbbeb26dbd92 257 #define OPAMP_SEC_NONINVERTINGINPUT_VP0 OPAMP_CSR_VPSSEL /*!< VP0 (PA1 for OPAMP1, PA7 for OPAMP2, PB0 for OPAMP3, PB13 for OPAMP4)
Kojto 100:cbbeb26dbd92 258 connected to OPAMPx non inverting input */
Kojto 100:cbbeb26dbd92 259 #define OPAMP_SEC_NONINVERTINGINPUT_VP1 ((uint32_t)0x00000000) /*!< VP1 (PA7 for OPAMP1, PD14 for OPAMP2, PB13 for OPAMP3, PD11 for OPAMP4)
Kojto 100:cbbeb26dbd92 260 connected to OPAMPx non inverting input */
Kojto 100:cbbeb26dbd92 261 #define OPAMP_SEC_NONINVERTINGINPUT_VP2 OPAMP_CSR_VPSSEL_1 /*!< VP2 (PA3 for OPAMP1, PB0 for OPAMP2, PA1 for OPAMP3, PA4 for OPAMP4)
Kojto 100:cbbeb26dbd92 262 connected to OPAMPx non inverting input */
Kojto 100:cbbeb26dbd92 263 #define OPAMP_SEC_NONINVERTINGINPUT_VP3 OPAMP_CSR_VPSSEL_0 /*!< VP3 (PA5 for OPAMP1, PB14 for OPAMP2, PA5 for OPAMP3, PB11 for OPAMP4)
Kojto 100:cbbeb26dbd92 264 connected to OPAMPx non inverting input */
Kojto 100:cbbeb26dbd92 265
Kojto 100:cbbeb26dbd92 266 #define IS_OPAMP_SEC_NONINVERTINGINPUT(INPUT) (((INPUT) == OPAMP_SEC_NONINVERTINGINPUT_VP0) || \
Kojto 100:cbbeb26dbd92 267 ((INPUT) == OPAMP_SEC_NONINVERTINGINPUT_VP1) || \
Kojto 100:cbbeb26dbd92 268 ((INPUT) == OPAMP_SEC_NONINVERTINGINPUT_VP2) || \
Kojto 100:cbbeb26dbd92 269 ((INPUT) == OPAMP_SEC_NONINVERTINGINPUT_VP3))
Kojto 100:cbbeb26dbd92 270
Kojto 100:cbbeb26dbd92 271 /**
Kojto 100:cbbeb26dbd92 272 * @}
Kojto 100:cbbeb26dbd92 273 */
Kojto 100:cbbeb26dbd92 274
Kojto 100:cbbeb26dbd92 275 /** @defgroup OPAMP_InvertingInputSecondary OPAMP Inverting Input Secondary
Kojto 100:cbbeb26dbd92 276 * @{
Kojto 100:cbbeb26dbd92 277 */
Kojto 100:cbbeb26dbd92 278
Kojto 100:cbbeb26dbd92 279 #define OPAMP_SEC_INVERTINGINPUT_VM0 ((uint32_t)0x00000000) /*!< VM0 (PC5 for OPAMP1 and OPAMP2, PB10 for OPAMP3 and OPAMP4)
Kojto 100:cbbeb26dbd92 280 connected to OPAMPx inverting input */
Kojto 100:cbbeb26dbd92 281 #define OPAMP_SEC_INVERTINGINPUT_VM1 OPAMP_CSR_VMSSEL /*!< VM1 (PA3 for OPAMP1, PA5 for OPAMP2, PB2 for OPAMP3, PD8 for OPAMP4)
Kojto 100:cbbeb26dbd92 282 connected to OPAMPx inverting input */
Kojto 100:cbbeb26dbd92 283
Kojto 100:cbbeb26dbd92 284 #define IS_OPAMP_SEC_INVERTINGINPUT(INPUT) (((INPUT) == OPAMP_SEC_INVERTINGINPUT_VM0) || \
Kojto 100:cbbeb26dbd92 285 ((INPUT) == OPAMP_SEC_INVERTINGINPUT_VM1))
Kojto 100:cbbeb26dbd92 286
Kojto 100:cbbeb26dbd92 287 /**
Kojto 100:cbbeb26dbd92 288 * @}
Kojto 100:cbbeb26dbd92 289 */
Kojto 100:cbbeb26dbd92 290
Kojto 100:cbbeb26dbd92 291 /** @defgroup OPAMP_PgaConnect OPAMP Pga Connect
Kojto 100:cbbeb26dbd92 292 * @{
Kojto 100:cbbeb26dbd92 293 */
Kojto 100:cbbeb26dbd92 294
Kojto 100:cbbeb26dbd92 295 #define OPAMP_PGACONNECT_NO ((uint32_t)0x00000000) /*!< In PGA mode, the non inverting input is not connected */
Kojto 100:cbbeb26dbd92 296 #define OPAMP_PGACONNECT_VM0 OPAMP_CSR_PGGAIN_3 /*!< In PGA mode, the non inverting input is connected to VM0 */
Kojto 100:cbbeb26dbd92 297 #define OPAMP_PGACONNECT_VM1 (OPAMP_CSR_PGGAIN_2 | OPAMP_CSR_PGGAIN_3) /*!< In PGA mode, the non inverting input is connected to VM1 */
Kojto 100:cbbeb26dbd92 298
Kojto 100:cbbeb26dbd92 299 #define IS_OPAMP_PGACONNECT(CONNECT) (((CONNECT) == OPAMP_PGACONNECT_NO) || \
Kojto 100:cbbeb26dbd92 300 ((CONNECT) == OPAMP_PGACONNECT_VM0) || \
Kojto 100:cbbeb26dbd92 301 ((CONNECT) == OPAMP_PGACONNECT_VM1))
Kojto 100:cbbeb26dbd92 302 /**
Kojto 100:cbbeb26dbd92 303 * @}
Kojto 100:cbbeb26dbd92 304 */
Kojto 100:cbbeb26dbd92 305
Kojto 100:cbbeb26dbd92 306
Kojto 100:cbbeb26dbd92 307 /** @defgroup OPAMP_PgaGain OPAMP Pga Gain
Kojto 100:cbbeb26dbd92 308 * @{
Kojto 100:cbbeb26dbd92 309 */
Kojto 100:cbbeb26dbd92 310
Kojto 100:cbbeb26dbd92 311 #define OPAMP_PGA_GAIN_2 ((uint32_t)0x00000000) /*!< PGA gain = 2 */
Kojto 100:cbbeb26dbd92 312 #define OPAMP_PGA_GAIN_4 OPAMP_CSR_PGGAIN_0 /*!< PGA gain = 4 */
Kojto 100:cbbeb26dbd92 313 #define OPAMP_PGA_GAIN_8 OPAMP_CSR_PGGAIN_1 /*!< PGA gain = 8 */
Kojto 100:cbbeb26dbd92 314 #define OPAMP_PGA_GAIN_16 (OPAMP_CSR_PGGAIN_0 | OPAMP_CSR_PGGAIN_1) /*!< PGA gain = 16 */
Kojto 100:cbbeb26dbd92 315
Kojto 100:cbbeb26dbd92 316 #define IS_OPAMP_PGA_GAIN(GAIN) (((GAIN) == OPAMP_PGA_GAIN_2) || \
Kojto 100:cbbeb26dbd92 317 ((GAIN) == OPAMP_PGA_GAIN_4) || \
Kojto 100:cbbeb26dbd92 318 ((GAIN) == OPAMP_PGA_GAIN_8) || \
Kojto 100:cbbeb26dbd92 319 ((GAIN) == OPAMP_PGA_GAIN_16))
Kojto 100:cbbeb26dbd92 320 /**
Kojto 100:cbbeb26dbd92 321 * @}
Kojto 100:cbbeb26dbd92 322 */
Kojto 100:cbbeb26dbd92 323
Kojto 100:cbbeb26dbd92 324 /** @defgroup OPAMP_UserTrimming OPAMP User Trimming
Kojto 100:cbbeb26dbd92 325 * @{
Kojto 100:cbbeb26dbd92 326 */
Kojto 100:cbbeb26dbd92 327
Kojto 100:cbbeb26dbd92 328 #define OPAMP_TRIMMING_FACTORY ((uint32_t)0x00000000) /*!< Factory trimming */
Kojto 100:cbbeb26dbd92 329 #define OPAMP_TRIMMING_USER OPAMP_CSR_USERTRIM /*!< User trimming */
Kojto 100:cbbeb26dbd92 330
Kojto 100:cbbeb26dbd92 331 #define IS_OPAMP_TRIMMING(TRIMMING) (((TRIMMING) == OPAMP_TRIMMING_FACTORY) || \
Kojto 100:cbbeb26dbd92 332 ((TRIMMING) == OPAMP_TRIMMING_USER))
Kojto 100:cbbeb26dbd92 333
Kojto 100:cbbeb26dbd92 334 /** @defgroup OPAMP_FactoryTrimming OPAMP Factory Trimming
Kojto 100:cbbeb26dbd92 335 * @{
Kojto 100:cbbeb26dbd92 336 */
Kojto 100:cbbeb26dbd92 337
Kojto 100:cbbeb26dbd92 338 #define OPAMP_FACTORYTRIMMING_DUMMY ((uint32_t)0xFFFFFFFF) /*!< Dummy trimming value */
Kojto 100:cbbeb26dbd92 339
Kojto 100:cbbeb26dbd92 340 #define OPAMP_FACTORYTRIMMING_N ((uint32_t)0x00000000) /*!< Offset trimming N */
Kojto 100:cbbeb26dbd92 341 #define OPAMP_FACTORYTRIMMING_P ((uint32_t)0x00000001) /*!< Offset trimming P */
Kojto 100:cbbeb26dbd92 342
Kojto 100:cbbeb26dbd92 343 #define IS_OPAMP_FACTORYTRIMMING(TRIMMING) (((TRIMMING) == OPAMP_FACTORYTRIMMING_N) || \
Kojto 100:cbbeb26dbd92 344 ((TRIMMING) == OPAMP_FACTORYTRIMMING_P))
Kojto 100:cbbeb26dbd92 345
Kojto 100:cbbeb26dbd92 346 /**
Kojto 100:cbbeb26dbd92 347 * @}
Kojto 100:cbbeb26dbd92 348 */
Kojto 100:cbbeb26dbd92 349
Kojto 100:cbbeb26dbd92 350
Kojto 100:cbbeb26dbd92 351 /** @defgroup OPAMP_TrimmingValue OPAMP Trimming Value
Kojto 100:cbbeb26dbd92 352 * @{
Kojto 100:cbbeb26dbd92 353 */
Kojto 100:cbbeb26dbd92 354
Kojto 100:cbbeb26dbd92 355 #define IS_OPAMP_TRIMMINGVALUE(TRIMMINGVALUE) ((TRIMMINGVALUE) <= 0x1F)
Kojto 100:cbbeb26dbd92 356
Kojto 100:cbbeb26dbd92 357
Kojto 100:cbbeb26dbd92 358 /**
Kojto 100:cbbeb26dbd92 359 * @}
Kojto 100:cbbeb26dbd92 360 */
Kojto 100:cbbeb26dbd92 361
Kojto 100:cbbeb26dbd92 362
Kojto 100:cbbeb26dbd92 363 /** @defgroup OPAMP_Input OPAMP Input
Kojto 100:cbbeb26dbd92 364 * @{
Kojto 100:cbbeb26dbd92 365 */
Kojto 100:cbbeb26dbd92 366
Kojto 100:cbbeb26dbd92 367 #define OPAMP_INPUT_INVERTING ((uint32_t) 24) /*!< Inverting input */
Kojto 100:cbbeb26dbd92 368 #define OPAMP_INPUT_NONINVERTING ((uint32_t) 19) /*!< Non inverting input */
Kojto 100:cbbeb26dbd92 369
Kojto 100:cbbeb26dbd92 370 #define IS_OPAMP_INPUT(INPUT) (((INPUT) == OPAMP_INPUT_INVERTING) || \
Kojto 100:cbbeb26dbd92 371 ((INPUT) == OPAMP_INPUT_NONINVERTING))
Kojto 100:cbbeb26dbd92 372 /**
Kojto 100:cbbeb26dbd92 373 * @}
Kojto 100:cbbeb26dbd92 374 */
Kojto 100:cbbeb26dbd92 375
Kojto 100:cbbeb26dbd92 376
Kojto 100:cbbeb26dbd92 377 /** @defgroup OPAMP_VREF OPAMP VREF
Kojto 100:cbbeb26dbd92 378 * @{
Kojto 100:cbbeb26dbd92 379 */
Kojto 100:cbbeb26dbd92 380
Kojto 100:cbbeb26dbd92 381 #define OPAMP_VREF_3VDDA ((uint32_t)0x00000000) /*!< OPMAP Vref = 3.3% VDDA */
Kojto 100:cbbeb26dbd92 382 #define OPAMP_VREF_10VDDA OPAMP_CSR_CALSEL_0 /*!< OPMAP Vref = 10% VDDA */
Kojto 100:cbbeb26dbd92 383 #define OPAMP_VREF_50VDDA OPAMP_CSR_CALSEL_1 /*!< OPMAP Vref = 50% VDDA */
Kojto 100:cbbeb26dbd92 384 #define OPAMP_VREF_90VDDA OPAMP_CSR_CALSEL /*!< OPMAP Vref = 90% VDDA */
Kojto 100:cbbeb26dbd92 385
Kojto 100:cbbeb26dbd92 386 #define IS_OPAMP_VREF(VREF) (((VREF) == OPAMP_VREF_3VDDA) || \
Kojto 100:cbbeb26dbd92 387 ((VREF) == OPAMP_VREF_10VDDA) || \
Kojto 100:cbbeb26dbd92 388 ((VREF) == OPAMP_VREF_50VDDA) || \
Kojto 100:cbbeb26dbd92 389 ((VREF) == OPAMP_VREF_90VDDA))
Kojto 100:cbbeb26dbd92 390
Kojto 100:cbbeb26dbd92 391 /**
Kojto 100:cbbeb26dbd92 392 * @}
Kojto 100:cbbeb26dbd92 393 */
Kojto 100:cbbeb26dbd92 394
Kojto 100:cbbeb26dbd92 395 /** @defgroup OPAMP_Vref2ADCforCalib OPAMP Vref2ADCforCalib
Kojto 100:cbbeb26dbd92 396 */
Kojto 100:cbbeb26dbd92 397
Kojto 100:cbbeb26dbd92 398 #define OPAMP_VREF_NOTCONNECTEDTO_ADC ((uint32_t)0x00000000) /*!< VREF not connected to ADC */
Kojto 100:cbbeb26dbd92 399 #define OPAMP_VREF_CONNECTEDTO_ADC ((uint32_t)0x00000001) /*!< VREF not connected to ADC */
Kojto 100:cbbeb26dbd92 400
Kojto 100:cbbeb26dbd92 401 #define IS_OPAMP_ALLOPAMPVREF_CONNECT(CONNECT) (((CONNECT) == OPAMP_VREF_NOTCONNECTEDTO_ADC) || \
Kojto 100:cbbeb26dbd92 402 ((CONNECT) == OPAMP_VREF_CONNECTEDTO_ADC))
Kojto 100:cbbeb26dbd92 403
Kojto 100:cbbeb26dbd92 404
Kojto 100:cbbeb26dbd92 405 /**
Kojto 100:cbbeb26dbd92 406 * @}
Kojto 100:cbbeb26dbd92 407 */
Kojto 100:cbbeb26dbd92 408
Kojto 100:cbbeb26dbd92 409 /**
Kojto 100:cbbeb26dbd92 410 * @}
Kojto 100:cbbeb26dbd92 411 */
Kojto 100:cbbeb26dbd92 412
Kojto 100:cbbeb26dbd92 413 /* Exported macros -----------------------------------------------------------*/
Kojto 100:cbbeb26dbd92 414 /** @defgroup OPAMP_Exported_Macros OPAMP Exported Macros
Kojto 100:cbbeb26dbd92 415 * @{
Kojto 100:cbbeb26dbd92 416 */
Kojto 100:cbbeb26dbd92 417
Kojto 100:cbbeb26dbd92 418 /** @brief Reset OPAMP handle state
Kojto 100:cbbeb26dbd92 419 * @param __HANDLE__: OPAMP handle.
Kojto 100:cbbeb26dbd92 420 * @retval None
Kojto 100:cbbeb26dbd92 421 */
Kojto 100:cbbeb26dbd92 422 #define __HAL_OPAMP_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_OPAMP_STATE_RESET)
Kojto 100:cbbeb26dbd92 423
Kojto 100:cbbeb26dbd92 424 /**
Kojto 100:cbbeb26dbd92 425 * @}
Kojto 100:cbbeb26dbd92 426 */
Kojto 100:cbbeb26dbd92 427
Kojto 100:cbbeb26dbd92 428 /* Include OPAMP HAL Extended module */
Kojto 100:cbbeb26dbd92 429 #include "stm32f3xx_hal_opamp_ex.h"
Kojto 100:cbbeb26dbd92 430
Kojto 100:cbbeb26dbd92 431 /* Exported functions --------------------------------------------------------*/
Kojto 100:cbbeb26dbd92 432 /** @defgroup OPAMP_Exported_Functions OPAMP Exported Functions
Kojto 100:cbbeb26dbd92 433 * @{
Kojto 100:cbbeb26dbd92 434 */
Kojto 100:cbbeb26dbd92 435
Kojto 100:cbbeb26dbd92 436 /** @defgroup OPAMP_Exported_Functions_Group1 Initialization and de-initialization functions
Kojto 100:cbbeb26dbd92 437 * @{
Kojto 100:cbbeb26dbd92 438 */
Kojto 100:cbbeb26dbd92 439
Kojto 100:cbbeb26dbd92 440 /* Initialization/de-initialization functions **********************************/
Kojto 100:cbbeb26dbd92 441 HAL_StatusTypeDef HAL_OPAMP_Init(OPAMP_HandleTypeDef *hopamp);
Kojto 100:cbbeb26dbd92 442 HAL_StatusTypeDef HAL_OPAMP_DeInit (OPAMP_HandleTypeDef *hopamp);
Kojto 100:cbbeb26dbd92 443 void HAL_OPAMP_MspInit(OPAMP_HandleTypeDef *hopamp);
Kojto 100:cbbeb26dbd92 444 void HAL_OPAMP_MspDeInit(OPAMP_HandleTypeDef *hopamp);
Kojto 100:cbbeb26dbd92 445 /**
Kojto 100:cbbeb26dbd92 446 * @}
Kojto 100:cbbeb26dbd92 447 */
Kojto 100:cbbeb26dbd92 448
Kojto 100:cbbeb26dbd92 449
Kojto 100:cbbeb26dbd92 450 /** @defgroup OPAMP_Exported_Functions_Group2 Input and Output operation functions
Kojto 100:cbbeb26dbd92 451 * @{
Kojto 100:cbbeb26dbd92 452 */
Kojto 100:cbbeb26dbd92 453
Kojto 100:cbbeb26dbd92 454 /* I/O operation functions *****************************************************/
Kojto 100:cbbeb26dbd92 455 HAL_StatusTypeDef HAL_OPAMP_Start(OPAMP_HandleTypeDef *hopamp);
Kojto 100:cbbeb26dbd92 456 HAL_StatusTypeDef HAL_OPAMP_Stop(OPAMP_HandleTypeDef *hopamp);
Kojto 100:cbbeb26dbd92 457 HAL_StatusTypeDef HAL_OPAMP_SelfCalibrate(OPAMP_HandleTypeDef *hopamp);
Kojto 100:cbbeb26dbd92 458
Kojto 100:cbbeb26dbd92 459 /**
Kojto 100:cbbeb26dbd92 460 * @}
Kojto 100:cbbeb26dbd92 461 */
Kojto 100:cbbeb26dbd92 462
Kojto 100:cbbeb26dbd92 463 /** @defgroup OPAMP_Exported_Functions_Group3 Peripheral Control functions
Kojto 100:cbbeb26dbd92 464 * @{
Kojto 100:cbbeb26dbd92 465 */
Kojto 100:cbbeb26dbd92 466
Kojto 100:cbbeb26dbd92 467 /* Peripheral Control functions ************************************************/
Kojto 100:cbbeb26dbd92 468 HAL_StatusTypeDef HAL_OPAMP_Lock(OPAMP_HandleTypeDef *hopamp);
Kojto 100:cbbeb26dbd92 469
Kojto 100:cbbeb26dbd92 470 /**
Kojto 100:cbbeb26dbd92 471 * @}
Kojto 100:cbbeb26dbd92 472 */
Kojto 100:cbbeb26dbd92 473
Kojto 100:cbbeb26dbd92 474 /** @defgroup OPAMP_Exported_Functions_Group4 Peripheral State functions
Kojto 100:cbbeb26dbd92 475 * @{
Kojto 100:cbbeb26dbd92 476 */
Kojto 100:cbbeb26dbd92 477
Kojto 100:cbbeb26dbd92 478 /* Peripheral State functions **************************************************/
Kojto 100:cbbeb26dbd92 479 HAL_OPAMP_StateTypeDef HAL_OPAMP_GetState(OPAMP_HandleTypeDef *hopamp);
Kojto 100:cbbeb26dbd92 480 OPAMP_TrimmingValueTypeDef HAL_OPAMP_GetTrimOffset (OPAMP_HandleTypeDef *hopamp, uint32_t trimmingoffset);
Kojto 100:cbbeb26dbd92 481
Kojto 100:cbbeb26dbd92 482 /**
Kojto 100:cbbeb26dbd92 483 * @}
Kojto 100:cbbeb26dbd92 484 */
Kojto 100:cbbeb26dbd92 485
Kojto 100:cbbeb26dbd92 486 /**
Kojto 100:cbbeb26dbd92 487 * @}
Kojto 100:cbbeb26dbd92 488 */
Kojto 100:cbbeb26dbd92 489
Kojto 100:cbbeb26dbd92 490 /**
Kojto 100:cbbeb26dbd92 491 * @}
Kojto 100:cbbeb26dbd92 492 */
Kojto 100:cbbeb26dbd92 493
Kojto 100:cbbeb26dbd92 494 /**
Kojto 100:cbbeb26dbd92 495 * @}
Kojto 100:cbbeb26dbd92 496 */
Kojto 100:cbbeb26dbd92 497
Kojto 100:cbbeb26dbd92 498 #endif /* STM32F302xE || STM32F303xE || STM32F398xx || */
Kojto 100:cbbeb26dbd92 499 /* STM32F302xC || STM32F303xC || STM32F358xx || */
Kojto 100:cbbeb26dbd92 500 /* STM32F303x8 || STM32F334x8 || STM32F328xx || */
Kojto 100:cbbeb26dbd92 501 /* STM32F301x8 || STM32F302x8 || STM32F318xx */
Kojto 100:cbbeb26dbd92 502
Kojto 100:cbbeb26dbd92 503 #ifdef __cplusplus
Kojto 100:cbbeb26dbd92 504 }
Kojto 100:cbbeb26dbd92 505 #endif
Kojto 100:cbbeb26dbd92 506
Kojto 100:cbbeb26dbd92 507 #endif /* __STM32F3xx_HAL_OPAMP_H */
Kojto 100:cbbeb26dbd92 508
Kojto 100:cbbeb26dbd92 509 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/