mbed library sources

Dependents:   Marvino mbot

Fork of mbed-src by mbed official

Committer:
jaerts
Date:
Tue Dec 22 13:22:16 2015 +0000
Revision:
637:ed69428d4850
Parent:
610:813dcc80987e
Add very shady LPC1768 CAN Filter implementation

Who changed what in which revision?

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