mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Tue Jun 24 14:45:08 2014 +0100
Revision:
237:f3da66175598
Child:
375:3d36234a1087
Synchronized with git revision 8ef659bca81f12dfc896b5a7af7c2abbd1a1b8b7

Full URL: https://github.com/mbedmicro/mbed/commit/8ef659bca81f12dfc896b5a7af7c2abbd1a1b8b7/

[NUCLEO_F334R8] Add platform files

Who changed what in which revision?

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