mbed official / mbed

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

Committer:
Kojto
Date:
Thu Oct 29 08:40:18 2015 +0000
Revision:
109:9296ab0bfc11
Child:
122:f9eeca106725
Release 109  of the mbed library

Changes:
- new platforms - NUCLEO_F042K6, WIZNWIKI_W7500ECO
- MTS targets - bootloaders update to 0.1.1
- STM F7 - RTC enable fixes
- STM F4 - i2c pending stop before start fix
- STM all targets - analogout normalization fix

Who changed what in which revision?

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