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