TUKS MCU Introductory course / TUKS-COURSE-TIMER
Committer:
elmot
Date:
Fri Feb 24 21:13:56 2017 +0000
Revision:
1:d0dfbce63a89
Ready-to-copy

Who changed what in which revision?

UserRevisionLine numberNew contents of line
elmot 1:d0dfbce63a89 1 /**
elmot 1:d0dfbce63a89 2 ******************************************************************************
elmot 1:d0dfbce63a89 3 * @file stm32l4xx_hal_opamp.h
elmot 1:d0dfbce63a89 4 * @author MCD Application Team
elmot 1:d0dfbce63a89 5 * @version V1.5.1
elmot 1:d0dfbce63a89 6 * @date 31-May-2016
elmot 1:d0dfbce63a89 7 * @brief Header file of OPAMP HAL module.
elmot 1:d0dfbce63a89 8 ******************************************************************************
elmot 1:d0dfbce63a89 9 * @attention
elmot 1:d0dfbce63a89 10 *
elmot 1:d0dfbce63a89 11 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
elmot 1:d0dfbce63a89 12 *
elmot 1:d0dfbce63a89 13 * Redistribution and use in source and binary forms, with or without modification,
elmot 1:d0dfbce63a89 14 * are permitted provided that the following conditions are met:
elmot 1:d0dfbce63a89 15 * 1. Redistributions of source code must retain the above copyright notice,
elmot 1:d0dfbce63a89 16 * this list of conditions and the following disclaimer.
elmot 1:d0dfbce63a89 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
elmot 1:d0dfbce63a89 18 * this list of conditions and the following disclaimer in the documentation
elmot 1:d0dfbce63a89 19 * and/or other materials provided with the distribution.
elmot 1:d0dfbce63a89 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
elmot 1:d0dfbce63a89 21 * may be used to endorse or promote products derived from this software
elmot 1:d0dfbce63a89 22 * without specific prior written permission.
elmot 1:d0dfbce63a89 23 *
elmot 1:d0dfbce63a89 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
elmot 1:d0dfbce63a89 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
elmot 1:d0dfbce63a89 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
elmot 1:d0dfbce63a89 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
elmot 1:d0dfbce63a89 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
elmot 1:d0dfbce63a89 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
elmot 1:d0dfbce63a89 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
elmot 1:d0dfbce63a89 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
elmot 1:d0dfbce63a89 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
elmot 1:d0dfbce63a89 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
elmot 1:d0dfbce63a89 34 *
elmot 1:d0dfbce63a89 35 ******************************************************************************
elmot 1:d0dfbce63a89 36 */
elmot 1:d0dfbce63a89 37
elmot 1:d0dfbce63a89 38 /* Define to prevent recursive inclusion -------------------------------------*/
elmot 1:d0dfbce63a89 39 #ifndef __STM32L4xx_HAL_OPAMP_H
elmot 1:d0dfbce63a89 40 #define __STM32L4xx_HAL_OPAMP_H
elmot 1:d0dfbce63a89 41
elmot 1:d0dfbce63a89 42 #ifdef __cplusplus
elmot 1:d0dfbce63a89 43 extern "C" {
elmot 1:d0dfbce63a89 44 #endif
elmot 1:d0dfbce63a89 45
elmot 1:d0dfbce63a89 46 /* Includes ------------------------------------------------------------------*/
elmot 1:d0dfbce63a89 47 #include "stm32l4xx_hal_def.h"
elmot 1:d0dfbce63a89 48
elmot 1:d0dfbce63a89 49 /** @addtogroup STM32L4xx_HAL_Driver
elmot 1:d0dfbce63a89 50 * @{
elmot 1:d0dfbce63a89 51 */
elmot 1:d0dfbce63a89 52
elmot 1:d0dfbce63a89 53 /** @addtogroup OPAMP
elmot 1:d0dfbce63a89 54 * @{
elmot 1:d0dfbce63a89 55 */
elmot 1:d0dfbce63a89 56
elmot 1:d0dfbce63a89 57 /* Exported types ------------------------------------------------------------*/
elmot 1:d0dfbce63a89 58
elmot 1:d0dfbce63a89 59 /** @defgroup OPAMP_Exported_Types OPAMP Exported Types
elmot 1:d0dfbce63a89 60 * @{
elmot 1:d0dfbce63a89 61 */
elmot 1:d0dfbce63a89 62
elmot 1:d0dfbce63a89 63 /**
elmot 1:d0dfbce63a89 64 * @brief OPAMP Init structure definition
elmot 1:d0dfbce63a89 65 */
elmot 1:d0dfbce63a89 66
elmot 1:d0dfbce63a89 67 typedef struct
elmot 1:d0dfbce63a89 68 {
elmot 1:d0dfbce63a89 69 uint32_t PowerSupplyRange; /*!< Specifies the power supply range: above or under 2.4V.
elmot 1:d0dfbce63a89 70 This parameter must be a value of @ref OPAMP_PowerSupplyRange
elmot 1:d0dfbce63a89 71 Caution: This parameter is common to all OPAMP instances: a modification of this parameter for the selected OPAMP impacts the other OPAMP instances. */
elmot 1:d0dfbce63a89 72
elmot 1:d0dfbce63a89 73 uint32_t PowerMode; /*!< Specifies the power mode Normal or Low-Power.
elmot 1:d0dfbce63a89 74 This parameter must be a value of @ref OPAMP_PowerMode */
elmot 1:d0dfbce63a89 75
elmot 1:d0dfbce63a89 76 uint32_t Mode; /*!< Specifies the OPAMP mode
elmot 1:d0dfbce63a89 77 This parameter must be a value of @ref OPAMP_Mode
elmot 1:d0dfbce63a89 78 mode is either Standalone, - Follower or PGA */
elmot 1:d0dfbce63a89 79
elmot 1:d0dfbce63a89 80 uint32_t InvertingInput; /*!< Specifies the inverting input in Standalone & PGA modes
elmot 1:d0dfbce63a89 81 - In Standalone mode: i.e. when mode is OPAMP_STANDALONE_MODE
elmot 1:d0dfbce63a89 82 & PGA mode: i.e. when mode is OPAMP_PGA_MODE
elmot 1:d0dfbce63a89 83 This parameter must be a value of @ref OPAMP_InvertingInput
elmot 1:d0dfbce63a89 84 - In Follower mode i.e. when mode is OPAMP_FOLLOWER_MODE
elmot 1:d0dfbce63a89 85 This parameter is Not Applicable */
elmot 1:d0dfbce63a89 86
elmot 1:d0dfbce63a89 87 uint32_t NonInvertingInput; /*!< Specifies the non inverting input of the opamp:
elmot 1:d0dfbce63a89 88 This parameter must be a value of @ref OPAMP_NonInvertingInput */
elmot 1:d0dfbce63a89 89
elmot 1:d0dfbce63a89 90 uint32_t PgaGain; /*!< Specifies the gain in PGA mode
elmot 1:d0dfbce63a89 91 i.e. when mode is OPAMP_PGA_MODE.
elmot 1:d0dfbce63a89 92 This parameter must be a value of @ref OPAMP_PgaGain (2, 4, 8 or 16 ) */
elmot 1:d0dfbce63a89 93
elmot 1:d0dfbce63a89 94 uint32_t UserTrimming; /*!< Specifies the trimming mode
elmot 1:d0dfbce63a89 95 This parameter must be a value of @ref OPAMP_UserTrimming
elmot 1:d0dfbce63a89 96 UserTrimming is either factory or user trimming.*/
elmot 1:d0dfbce63a89 97
elmot 1:d0dfbce63a89 98 uint32_t TrimmingValueP; /*!< Specifies the offset trimming value (PMOS)
elmot 1:d0dfbce63a89 99 i.e. when UserTrimming is OPAMP_TRIMMING_USER.
elmot 1:d0dfbce63a89 100 This parameter must be a number between Min_Data = 0 and Max_Data = 31
elmot 1:d0dfbce63a89 101 16 is typical default value */
elmot 1:d0dfbce63a89 102
elmot 1:d0dfbce63a89 103 uint32_t TrimmingValueN; /*!< Specifies the offset trimming value (NMOS)
elmot 1:d0dfbce63a89 104 i.e. when UserTrimming is OPAMP_TRIMMING_USER.
elmot 1:d0dfbce63a89 105 This parameter must be a number between Min_Data = 0 and Max_Data = 31
elmot 1:d0dfbce63a89 106 16 is typical default value */
elmot 1:d0dfbce63a89 107
elmot 1:d0dfbce63a89 108 uint32_t TrimmingValuePLowPower; /*!< Specifies the offset trimming value (PMOS)
elmot 1:d0dfbce63a89 109 i.e. when UserTrimming is OPAMP_TRIMMING_USER.
elmot 1:d0dfbce63a89 110 This parameter must be a number between Min_Data = 0 and Max_Data = 31
elmot 1:d0dfbce63a89 111 16 is typical default value */
elmot 1:d0dfbce63a89 112
elmot 1:d0dfbce63a89 113 uint32_t TrimmingValueNLowPower; /*!< Specifies the offset trimming value (NMOS)
elmot 1:d0dfbce63a89 114 i.e. when UserTrimming is OPAMP_TRIMMING_USER.
elmot 1:d0dfbce63a89 115 This parameter must be a number between Min_Data = 0 and Max_Data = 31
elmot 1:d0dfbce63a89 116 16 is typical default value */
elmot 1:d0dfbce63a89 117
elmot 1:d0dfbce63a89 118 }OPAMP_InitTypeDef;
elmot 1:d0dfbce63a89 119
elmot 1:d0dfbce63a89 120 /**
elmot 1:d0dfbce63a89 121 * @brief HAL State structures definition
elmot 1:d0dfbce63a89 122 */
elmot 1:d0dfbce63a89 123
elmot 1:d0dfbce63a89 124 typedef enum
elmot 1:d0dfbce63a89 125 {
elmot 1:d0dfbce63a89 126 HAL_OPAMP_STATE_RESET = 0x00000000, /*!< OPAMP is not yet Initialized */
elmot 1:d0dfbce63a89 127
elmot 1:d0dfbce63a89 128 HAL_OPAMP_STATE_READY = 0x00000001, /*!< OPAMP is initialized and ready for use */
elmot 1:d0dfbce63a89 129 HAL_OPAMP_STATE_CALIBBUSY = 0x00000002, /*!< OPAMP is enabled in auto calibration mode */
elmot 1:d0dfbce63a89 130
elmot 1:d0dfbce63a89 131 HAL_OPAMP_STATE_BUSY = 0x00000004, /*!< OPAMP is enabled and running in normal mode */
elmot 1:d0dfbce63a89 132 HAL_OPAMP_STATE_BUSYLOCKED = 0x00000005 /*!< OPAMP is locked
elmot 1:d0dfbce63a89 133 only system reset allows reconfiguring the opamp. */
elmot 1:d0dfbce63a89 134
elmot 1:d0dfbce63a89 135 }HAL_OPAMP_StateTypeDef;
elmot 1:d0dfbce63a89 136
elmot 1:d0dfbce63a89 137 /**
elmot 1:d0dfbce63a89 138 * @brief OPAMP Handle Structure definition
elmot 1:d0dfbce63a89 139 */
elmot 1:d0dfbce63a89 140 typedef struct
elmot 1:d0dfbce63a89 141 {
elmot 1:d0dfbce63a89 142 OPAMP_TypeDef *Instance; /*!< OPAMP instance's registers base address */
elmot 1:d0dfbce63a89 143 OPAMP_InitTypeDef Init; /*!< OPAMP required parameters */
elmot 1:d0dfbce63a89 144 HAL_StatusTypeDef Status; /*!< OPAMP peripheral status */
elmot 1:d0dfbce63a89 145 HAL_LockTypeDef Lock; /*!< Locking object */
elmot 1:d0dfbce63a89 146 __IO HAL_OPAMP_StateTypeDef State; /*!< OPAMP communication state */
elmot 1:d0dfbce63a89 147
elmot 1:d0dfbce63a89 148 } OPAMP_HandleTypeDef;
elmot 1:d0dfbce63a89 149
elmot 1:d0dfbce63a89 150 /**
elmot 1:d0dfbce63a89 151 * @brief HAl_OPAMP_TrimmingValueTypeDef definition
elmot 1:d0dfbce63a89 152 */
elmot 1:d0dfbce63a89 153
elmot 1:d0dfbce63a89 154 typedef uint32_t HAL_OPAMP_TrimmingValueTypeDef;
elmot 1:d0dfbce63a89 155
elmot 1:d0dfbce63a89 156 /**
elmot 1:d0dfbce63a89 157 * @}
elmot 1:d0dfbce63a89 158 */
elmot 1:d0dfbce63a89 159
elmot 1:d0dfbce63a89 160 /* Exported constants --------------------------------------------------------*/
elmot 1:d0dfbce63a89 161
elmot 1:d0dfbce63a89 162 /** @defgroup OPAMP_Exported_Constants OPAMP Exported Constants
elmot 1:d0dfbce63a89 163 * @{
elmot 1:d0dfbce63a89 164 */
elmot 1:d0dfbce63a89 165
elmot 1:d0dfbce63a89 166 /** @defgroup OPAMP_Mode OPAMP Mode
elmot 1:d0dfbce63a89 167 * @{
elmot 1:d0dfbce63a89 168 */
elmot 1:d0dfbce63a89 169 #define OPAMP_STANDALONE_MODE ((uint32_t)0x00000000) /*!< standalone mode */
elmot 1:d0dfbce63a89 170 #define OPAMP_PGA_MODE OPAMP_CSR_OPAMODE_1 /*!< PGA mode */
elmot 1:d0dfbce63a89 171 #define OPAMP_FOLLOWER_MODE OPAMP_CSR_OPAMODE /*!< follower mode */
elmot 1:d0dfbce63a89 172
elmot 1:d0dfbce63a89 173 /**
elmot 1:d0dfbce63a89 174 * @}
elmot 1:d0dfbce63a89 175 */
elmot 1:d0dfbce63a89 176
elmot 1:d0dfbce63a89 177 /** @defgroup OPAMP_NonInvertingInput OPAMP Non Inverting Input
elmot 1:d0dfbce63a89 178 * @{
elmot 1:d0dfbce63a89 179 */
elmot 1:d0dfbce63a89 180
elmot 1:d0dfbce63a89 181 #define OPAMP_NONINVERTINGINPUT_IO0 ((uint32_t)0x00000000) /*!< OPAMP non-inverting input connected to dedicated IO pin */
elmot 1:d0dfbce63a89 182 #define OPAMP_NONINVERTINGINPUT_DAC_CH OPAMP_CSR_VPSEL /*!< OPAMP non-inverting input connected internally to DAC channel */
elmot 1:d0dfbce63a89 183
elmot 1:d0dfbce63a89 184 /**
elmot 1:d0dfbce63a89 185 * @}
elmot 1:d0dfbce63a89 186 */
elmot 1:d0dfbce63a89 187
elmot 1:d0dfbce63a89 188 /** @defgroup OPAMP_InvertingInput OPAMP Inverting Input
elmot 1:d0dfbce63a89 189 * @{
elmot 1:d0dfbce63a89 190 */
elmot 1:d0dfbce63a89 191
elmot 1:d0dfbce63a89 192 #define OPAMP_INVERTINGINPUT_IO0 ((uint32_t)0x00000000) /*!< OPAMP inverting input connected to dedicated IO pin low-leakage */
elmot 1:d0dfbce63a89 193 #define OPAMP_INVERTINGINPUT_IO1 OPAMP_CSR_VMSEL_0 /*!< OPAMP inverting input connected to alternative IO pin available on some device packages */
elmot 1:d0dfbce63a89 194 #define OPAMP_INVERTINGINPUT_CONNECT_NO OPAMP_CSR_VMSEL_1 /*!< OPAMP inverting input not connected externally (PGA mode only) */
elmot 1:d0dfbce63a89 195
elmot 1:d0dfbce63a89 196 /**
elmot 1:d0dfbce63a89 197 * @}
elmot 1:d0dfbce63a89 198 */
elmot 1:d0dfbce63a89 199
elmot 1:d0dfbce63a89 200 /** @defgroup OPAMP_PgaGain OPAMP Pga Gain
elmot 1:d0dfbce63a89 201 * @{
elmot 1:d0dfbce63a89 202 */
elmot 1:d0dfbce63a89 203
elmot 1:d0dfbce63a89 204 #define OPAMP_PGA_GAIN_2 ((uint32_t)0x00000000) /*!< PGA gain = 2 */
elmot 1:d0dfbce63a89 205 #define OPAMP_PGA_GAIN_4 OPAMP_CSR_PGGAIN_0 /*!< PGA gain = 4 */
elmot 1:d0dfbce63a89 206 #define OPAMP_PGA_GAIN_8 OPAMP_CSR_PGGAIN_1 /*!< PGA gain = 8 */
elmot 1:d0dfbce63a89 207 #define OPAMP_PGA_GAIN_16 (OPAMP_CSR_PGGAIN_0 | OPAMP_CSR_PGGAIN_1) /*!< PGA gain = 16 */
elmot 1:d0dfbce63a89 208
elmot 1:d0dfbce63a89 209 /**
elmot 1:d0dfbce63a89 210 * @}
elmot 1:d0dfbce63a89 211 */
elmot 1:d0dfbce63a89 212
elmot 1:d0dfbce63a89 213 /** @defgroup OPAMP_PowerMode OPAMP PowerMode
elmot 1:d0dfbce63a89 214 * @{
elmot 1:d0dfbce63a89 215 */
elmot 1:d0dfbce63a89 216 #define OPAMP_POWERMODE_NORMAL ((uint32_t)0x00000000)
elmot 1:d0dfbce63a89 217 #define OPAMP_POWERMODE_LOWPOWER OPAMP_CSR_OPALPM
elmot 1:d0dfbce63a89 218
elmot 1:d0dfbce63a89 219 /**
elmot 1:d0dfbce63a89 220 * @}
elmot 1:d0dfbce63a89 221 */
elmot 1:d0dfbce63a89 222
elmot 1:d0dfbce63a89 223 /** @defgroup OPAMP_PowerSupplyRange OPAMP PowerSupplyRange
elmot 1:d0dfbce63a89 224 * @{
elmot 1:d0dfbce63a89 225 */
elmot 1:d0dfbce63a89 226 #define OPAMP_POWERSUPPLY_LOW ((uint32_t)0x00000000) /*!< Power supply range low (VDDA lower than 2.4V) */
elmot 1:d0dfbce63a89 227 #define OPAMP_POWERSUPPLY_HIGH OPAMP1_CSR_OPARANGE /*!< Power supply range high (VDDA higher than 2.4V) */
elmot 1:d0dfbce63a89 228
elmot 1:d0dfbce63a89 229 /**
elmot 1:d0dfbce63a89 230 * @}
elmot 1:d0dfbce63a89 231 */
elmot 1:d0dfbce63a89 232
elmot 1:d0dfbce63a89 233 /** @defgroup OPAMP_UserTrimming OPAMP User Trimming
elmot 1:d0dfbce63a89 234 * @{
elmot 1:d0dfbce63a89 235 */
elmot 1:d0dfbce63a89 236 #define OPAMP_TRIMMING_FACTORY ((uint32_t)0x00000000) /*!< Factory trimming */
elmot 1:d0dfbce63a89 237 #define OPAMP_TRIMMING_USER OPAMP_CSR_USERTRIM /*!< User trimming */
elmot 1:d0dfbce63a89 238
elmot 1:d0dfbce63a89 239 #define IS_OPAMP_TRIMMING(TRIMMING) (((TRIMMING) == OPAMP_TRIMMING_FACTORY) || \
elmot 1:d0dfbce63a89 240 ((TRIMMING) == OPAMP_TRIMMING_USER))
elmot 1:d0dfbce63a89 241 /**
elmot 1:d0dfbce63a89 242 * @}
elmot 1:d0dfbce63a89 243 */
elmot 1:d0dfbce63a89 244
elmot 1:d0dfbce63a89 245 /** @defgroup OPAMP_FactoryTrimming OPAMP Factory Trimming
elmot 1:d0dfbce63a89 246 * @{
elmot 1:d0dfbce63a89 247 */
elmot 1:d0dfbce63a89 248 #define OPAMP_FACTORYTRIMMING_DUMMY ((uint32_t)0xFFFFFFFF) /*!< Dummy value if trimming value could not be retrieved */
elmot 1:d0dfbce63a89 249
elmot 1:d0dfbce63a89 250 #define OPAMP_FACTORYTRIMMING_N ((uint32_t)0x00000000) /*!< Offset trimming N */
elmot 1:d0dfbce63a89 251 #define OPAMP_FACTORYTRIMMING_P ((uint32_t)0x00000001) /*!< Offset trimming P */
elmot 1:d0dfbce63a89 252
elmot 1:d0dfbce63a89 253 /**
elmot 1:d0dfbce63a89 254 * @}
elmot 1:d0dfbce63a89 255 */
elmot 1:d0dfbce63a89 256
elmot 1:d0dfbce63a89 257 /**
elmot 1:d0dfbce63a89 258 * @}
elmot 1:d0dfbce63a89 259 */
elmot 1:d0dfbce63a89 260
elmot 1:d0dfbce63a89 261 /* Private constants ---------------------------------------------------------*/
elmot 1:d0dfbce63a89 262 /** @defgroup OPAMP_Private_Constants OPAMP Private Constants
elmot 1:d0dfbce63a89 263 * @brief OPAMP Private constants and defines
elmot 1:d0dfbce63a89 264 * @{
elmot 1:d0dfbce63a89 265 */
elmot 1:d0dfbce63a89 266
elmot 1:d0dfbce63a89 267 /* NONINVERTING bit position in OTR & LPOTR */
elmot 1:d0dfbce63a89 268 #define OPAMP_INPUT_NONINVERTING ((uint32_t) 8) /*!< Non inverting input */
elmot 1:d0dfbce63a89 269
elmot 1:d0dfbce63a89 270 /* Offset trimming time: during calibration, minimum time needed between two */
elmot 1:d0dfbce63a89 271 /* steps to have 1 mV accuracy. */
elmot 1:d0dfbce63a89 272 /* Refer to datasheet, electrical characteristics: parameter tOFFTRIM Typ=1ms.*/
elmot 1:d0dfbce63a89 273 /* Unit: ms. */
elmot 1:d0dfbce63a89 274 #define OPAMP_TRIMMING_DELAY ((uint32_t) 1)
elmot 1:d0dfbce63a89 275
elmot 1:d0dfbce63a89 276 /**
elmot 1:d0dfbce63a89 277 * @}
elmot 1:d0dfbce63a89 278 */
elmot 1:d0dfbce63a89 279
elmot 1:d0dfbce63a89 280 /* Exported macros -----------------------------------------------------------*/
elmot 1:d0dfbce63a89 281 /** @defgroup OPAMP_Exported_Macros OPAMP Exported Macros
elmot 1:d0dfbce63a89 282 * @{
elmot 1:d0dfbce63a89 283 */
elmot 1:d0dfbce63a89 284
elmot 1:d0dfbce63a89 285 /** @brief Reset OPAMP handle state.
elmot 1:d0dfbce63a89 286 * @param __HANDLE__: OPAMP handle.
elmot 1:d0dfbce63a89 287 * @retval None
elmot 1:d0dfbce63a89 288 */
elmot 1:d0dfbce63a89 289 #define __HAL_OPAMP_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_OPAMP_STATE_RESET)
elmot 1:d0dfbce63a89 290
elmot 1:d0dfbce63a89 291 /**
elmot 1:d0dfbce63a89 292 * @}
elmot 1:d0dfbce63a89 293 */
elmot 1:d0dfbce63a89 294
elmot 1:d0dfbce63a89 295 /* Private macro -------------------------------------------------------------*/
elmot 1:d0dfbce63a89 296
elmot 1:d0dfbce63a89 297 /** @defgroup OPAMP_Private_Macros OPAMP Private Macros
elmot 1:d0dfbce63a89 298 * @{
elmot 1:d0dfbce63a89 299 */
elmot 1:d0dfbce63a89 300
elmot 1:d0dfbce63a89 301 #define IS_OPAMP_FUNCTIONAL_NORMALMODE(INPUT) (((INPUT) == OPAMP_STANDALONE_MODE) || \
elmot 1:d0dfbce63a89 302 ((INPUT) == OPAMP_PGA_MODE) || \
elmot 1:d0dfbce63a89 303 ((INPUT) == OPAMP_FOLLOWER_MODE))
elmot 1:d0dfbce63a89 304
elmot 1:d0dfbce63a89 305 #if defined (STM32L471xx) || defined (STM32L475xx) || defined (STM32L476xx) || defined (STM32L485xx) || defined (STM32L486xx)
elmot 1:d0dfbce63a89 306 #define IS_OPAMP_INVERTING_INPUT_STANDALONE(INPUT) (((INPUT) == OPAMP_INVERTINGINPUT_IO0) || \
elmot 1:d0dfbce63a89 307 ((INPUT) == OPAMP_INVERTINGINPUT_IO1))
elmot 1:d0dfbce63a89 308 #endif
elmot 1:d0dfbce63a89 309 #if defined (STM32L431xx) || defined (STM32L432xx) || defined (STM32L433xx) || defined (STM32L442xx) || defined (STM32L443xx)
elmot 1:d0dfbce63a89 310 #define IS_OPAMP_INVERTING_INPUT_STANDALONE(INPUT) ((INPUT) == OPAMP_INVERTINGINPUT_IO0)
elmot 1:d0dfbce63a89 311 #endif
elmot 1:d0dfbce63a89 312
elmot 1:d0dfbce63a89 313 #define IS_OPAMP_NONINVERTING_INPUT(INPUT) (((INPUT) == OPAMP_NONINVERTINGINPUT_IO0) || \
elmot 1:d0dfbce63a89 314 ((INPUT) == OPAMP_NONINVERTINGINPUT_DAC_CH))
elmot 1:d0dfbce63a89 315
elmot 1:d0dfbce63a89 316 #if defined (STM32L471xx) || defined (STM32L475xx) || defined (STM32L476xx) || defined (STM32L485xx) || defined (STM32L486xx)
elmot 1:d0dfbce63a89 317 #define IS_OPAMP_INVERTING_INPUT_PGA(INPUT) (((INPUT) == OPAMP_INVERTINGINPUT_IO0) || \
elmot 1:d0dfbce63a89 318 ((INPUT) == OPAMP_INVERTINGINPUT_IO1)|| \
elmot 1:d0dfbce63a89 319 ((INPUT) == OPAMP_INVERTINGINPUT_CONNECT_NO))
elmot 1:d0dfbce63a89 320 #endif
elmot 1:d0dfbce63a89 321 #if defined (STM32L431xx) || defined (STM32L432xx) || defined (STM32L433xx) || defined (STM32L442xx) || defined (STM32L443xx)
elmot 1:d0dfbce63a89 322 #define IS_OPAMP_INVERTING_INPUT_PGA(INPUT) (((INPUT) == OPAMP_INVERTINGINPUT_IO0) || \
elmot 1:d0dfbce63a89 323 ((INPUT) == OPAMP_INVERTINGINPUT_CONNECT_NO))
elmot 1:d0dfbce63a89 324 #endif
elmot 1:d0dfbce63a89 325
elmot 1:d0dfbce63a89 326 #define IS_OPAMP_PGA_GAIN(GAIN) (((GAIN) == OPAMP_PGA_GAIN_2) || \
elmot 1:d0dfbce63a89 327 ((GAIN) == OPAMP_PGA_GAIN_4) || \
elmot 1:d0dfbce63a89 328 ((GAIN) == OPAMP_PGA_GAIN_8) || \
elmot 1:d0dfbce63a89 329 ((GAIN) == OPAMP_PGA_GAIN_16))
elmot 1:d0dfbce63a89 330
elmot 1:d0dfbce63a89 331 #define IS_OPAMP_POWERMODE(TRIMMING) (((TRIMMING) == OPAMP_POWERMODE_NORMAL) || \
elmot 1:d0dfbce63a89 332 ((TRIMMING) == OPAMP_POWERMODE_LOWPOWER) )
elmot 1:d0dfbce63a89 333
elmot 1:d0dfbce63a89 334 #define IS_OPAMP_POWER_SUPPLY_RANGE(RANGE) (((RANGE) == OPAMP_POWERSUPPLY_LOW) || \
elmot 1:d0dfbce63a89 335 ((RANGE) == OPAMP_POWERSUPPLY_HIGH) )
elmot 1:d0dfbce63a89 336
elmot 1:d0dfbce63a89 337 #define IS_OPAMP_TRIMMING(TRIMMING) (((TRIMMING) == OPAMP_TRIMMING_FACTORY) || \
elmot 1:d0dfbce63a89 338 ((TRIMMING) == OPAMP_TRIMMING_USER))
elmot 1:d0dfbce63a89 339
elmot 1:d0dfbce63a89 340
elmot 1:d0dfbce63a89 341 #define IS_OPAMP_TRIMMINGVALUE(TRIMMINGVALUE) ((TRIMMINGVALUE) <= 0x1F)
elmot 1:d0dfbce63a89 342
elmot 1:d0dfbce63a89 343 #define IS_OPAMP_FACTORYTRIMMING(TRIMMING) (((TRIMMING) == OPAMP_FACTORYTRIMMING_N) || \
elmot 1:d0dfbce63a89 344 ((TRIMMING) == OPAMP_FACTORYTRIMMING_P))
elmot 1:d0dfbce63a89 345
elmot 1:d0dfbce63a89 346 /**
elmot 1:d0dfbce63a89 347 * @}
elmot 1:d0dfbce63a89 348 */
elmot 1:d0dfbce63a89 349
elmot 1:d0dfbce63a89 350 /* Include OPAMP HAL Extended module */
elmot 1:d0dfbce63a89 351 #include "stm32l4xx_hal_opamp_ex.h"
elmot 1:d0dfbce63a89 352
elmot 1:d0dfbce63a89 353 /* Exported functions --------------------------------------------------------*/
elmot 1:d0dfbce63a89 354 /** @addtogroup OPAMP_Exported_Functions
elmot 1:d0dfbce63a89 355 * @{
elmot 1:d0dfbce63a89 356 */
elmot 1:d0dfbce63a89 357
elmot 1:d0dfbce63a89 358 /** @addtogroup OPAMP_Exported_Functions_Group1
elmot 1:d0dfbce63a89 359 * @{
elmot 1:d0dfbce63a89 360 */
elmot 1:d0dfbce63a89 361 /* Initialization/de-initialization functions **********************************/
elmot 1:d0dfbce63a89 362 HAL_StatusTypeDef HAL_OPAMP_Init(OPAMP_HandleTypeDef *hopamp);
elmot 1:d0dfbce63a89 363 HAL_StatusTypeDef HAL_OPAMP_DeInit (OPAMP_HandleTypeDef *hopamp);
elmot 1:d0dfbce63a89 364 void HAL_OPAMP_MspInit(OPAMP_HandleTypeDef *hopamp);
elmot 1:d0dfbce63a89 365 void HAL_OPAMP_MspDeInit(OPAMP_HandleTypeDef *hopamp);
elmot 1:d0dfbce63a89 366 /**
elmot 1:d0dfbce63a89 367 * @}
elmot 1:d0dfbce63a89 368 */
elmot 1:d0dfbce63a89 369
elmot 1:d0dfbce63a89 370 /** @addtogroup OPAMP_Exported_Functions_Group2
elmot 1:d0dfbce63a89 371 * @{
elmot 1:d0dfbce63a89 372 */
elmot 1:d0dfbce63a89 373
elmot 1:d0dfbce63a89 374 /* I/O operation functions *****************************************************/
elmot 1:d0dfbce63a89 375 HAL_StatusTypeDef HAL_OPAMP_Start(OPAMP_HandleTypeDef *hopamp);
elmot 1:d0dfbce63a89 376 HAL_StatusTypeDef HAL_OPAMP_Stop(OPAMP_HandleTypeDef *hopamp);
elmot 1:d0dfbce63a89 377 HAL_StatusTypeDef HAL_OPAMP_SelfCalibrate(OPAMP_HandleTypeDef *hopamp);
elmot 1:d0dfbce63a89 378
elmot 1:d0dfbce63a89 379 /**
elmot 1:d0dfbce63a89 380 * @}
elmot 1:d0dfbce63a89 381 */
elmot 1:d0dfbce63a89 382
elmot 1:d0dfbce63a89 383 /** @addtogroup OPAMP_Exported_Functions_Group3
elmot 1:d0dfbce63a89 384 * @{
elmot 1:d0dfbce63a89 385 */
elmot 1:d0dfbce63a89 386
elmot 1:d0dfbce63a89 387 /* Peripheral Control functions ************************************************/
elmot 1:d0dfbce63a89 388 HAL_StatusTypeDef HAL_OPAMP_Lock(OPAMP_HandleTypeDef *hopamp);
elmot 1:d0dfbce63a89 389 HAL_OPAMP_TrimmingValueTypeDef HAL_OPAMP_GetTrimOffset (OPAMP_HandleTypeDef *hopamp, uint32_t trimmingoffset);
elmot 1:d0dfbce63a89 390
elmot 1:d0dfbce63a89 391 /**
elmot 1:d0dfbce63a89 392 * @}
elmot 1:d0dfbce63a89 393 */
elmot 1:d0dfbce63a89 394
elmot 1:d0dfbce63a89 395 /** @addtogroup OPAMP_Exported_Functions_Group4
elmot 1:d0dfbce63a89 396 * @{
elmot 1:d0dfbce63a89 397 */
elmot 1:d0dfbce63a89 398
elmot 1:d0dfbce63a89 399 /* Peripheral State functions **************************************************/
elmot 1:d0dfbce63a89 400 HAL_OPAMP_StateTypeDef HAL_OPAMP_GetState(OPAMP_HandleTypeDef *hopamp);
elmot 1:d0dfbce63a89 401
elmot 1:d0dfbce63a89 402 /**
elmot 1:d0dfbce63a89 403 * @}
elmot 1:d0dfbce63a89 404 */
elmot 1:d0dfbce63a89 405
elmot 1:d0dfbce63a89 406 /**
elmot 1:d0dfbce63a89 407 * @}
elmot 1:d0dfbce63a89 408 */
elmot 1:d0dfbce63a89 409
elmot 1:d0dfbce63a89 410 /**
elmot 1:d0dfbce63a89 411 * @}
elmot 1:d0dfbce63a89 412 */
elmot 1:d0dfbce63a89 413
elmot 1:d0dfbce63a89 414 /**
elmot 1:d0dfbce63a89 415 * @}
elmot 1:d0dfbce63a89 416 */
elmot 1:d0dfbce63a89 417
elmot 1:d0dfbce63a89 418 #ifdef __cplusplus
elmot 1:d0dfbce63a89 419 }
elmot 1:d0dfbce63a89 420 #endif
elmot 1:d0dfbce63a89 421
elmot 1:d0dfbce63a89 422 #endif /* __STM32L4xx_HAL_OPAMP_H */
elmot 1:d0dfbce63a89 423
elmot 1:d0dfbce63a89 424 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/