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