mbed library sources. Supersedes mbed-src.

Fork of mbed-dev by mbed official

Committer:
<>
Date:
Fri Oct 28 11:17:30 2016 +0100
Revision:
149:156823d33999
Parent:
targets/cmsis/TARGET_STM/TARGET_STM32L4/stm32l4xx_ll_opamp.h@144:ef7eb2e8f9f7
Child:
167:e84263d55307
This updates the lib to the mbed lib v128

NOTE: This release includes a restructuring of the file and directory locations and thus some
include paths in your code may need updating accordingly.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 144:ef7eb2e8f9f7 1 /**
<> 144:ef7eb2e8f9f7 2 ******************************************************************************
<> 144:ef7eb2e8f9f7 3 * @file stm32l4xx_ll_opamp.h
<> 144:ef7eb2e8f9f7 4 * @author MCD Application Team
<> 144:ef7eb2e8f9f7 5 * @version V1.5.1
<> 144:ef7eb2e8f9f7 6 * @date 31-May-2016
<> 144:ef7eb2e8f9f7 7 * @brief Header file of OPAMP LL module.
<> 144:ef7eb2e8f9f7 8 ******************************************************************************
<> 144:ef7eb2e8f9f7 9 * @attention
<> 144:ef7eb2e8f9f7 10 *
<> 144:ef7eb2e8f9f7 11 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
<> 144:ef7eb2e8f9f7 12 *
<> 144:ef7eb2e8f9f7 13 * Redistribution and use in source and binary forms, with or without modification,
<> 144:ef7eb2e8f9f7 14 * are permitted provided that the following conditions are met:
<> 144:ef7eb2e8f9f7 15 * 1. Redistributions of source code must retain the above copyright notice,
<> 144:ef7eb2e8f9f7 16 * this list of conditions and the following disclaimer.
<> 144:ef7eb2e8f9f7 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
<> 144:ef7eb2e8f9f7 18 * this list of conditions and the following disclaimer in the documentation
<> 144:ef7eb2e8f9f7 19 * and/or other materials provided with the distribution.
<> 144:ef7eb2e8f9f7 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
<> 144:ef7eb2e8f9f7 21 * may be used to endorse or promote products derived from this software
<> 144:ef7eb2e8f9f7 22 * without specific prior written permission.
<> 144:ef7eb2e8f9f7 23 *
<> 144:ef7eb2e8f9f7 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
<> 144:ef7eb2e8f9f7 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
<> 144:ef7eb2e8f9f7 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
<> 144:ef7eb2e8f9f7 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
<> 144:ef7eb2e8f9f7 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
<> 144:ef7eb2e8f9f7 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
<> 144:ef7eb2e8f9f7 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
<> 144:ef7eb2e8f9f7 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
<> 144:ef7eb2e8f9f7 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
<> 144:ef7eb2e8f9f7 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<> 144:ef7eb2e8f9f7 34 *
<> 144:ef7eb2e8f9f7 35 ******************************************************************************
<> 144:ef7eb2e8f9f7 36 */
<> 144:ef7eb2e8f9f7 37
<> 144:ef7eb2e8f9f7 38 /* Define to prevent recursive inclusion -------------------------------------*/
<> 144:ef7eb2e8f9f7 39 #ifndef __STM32L4xx_LL_OPAMP_H
<> 144:ef7eb2e8f9f7 40 #define __STM32L4xx_LL_OPAMP_H
<> 144:ef7eb2e8f9f7 41
<> 144:ef7eb2e8f9f7 42 #ifdef __cplusplus
<> 144:ef7eb2e8f9f7 43 extern "C" {
<> 144:ef7eb2e8f9f7 44 #endif
<> 144:ef7eb2e8f9f7 45
<> 144:ef7eb2e8f9f7 46 /* Includes ------------------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 47 #include "stm32l4xx.h"
<> 144:ef7eb2e8f9f7 48
<> 144:ef7eb2e8f9f7 49 /** @addtogroup STM32L4xx_LL_Driver
<> 144:ef7eb2e8f9f7 50 * @{
<> 144:ef7eb2e8f9f7 51 */
<> 144:ef7eb2e8f9f7 52
<> 144:ef7eb2e8f9f7 53 #if defined (OPAMP1) || defined (OPAMP2)
<> 144:ef7eb2e8f9f7 54
<> 144:ef7eb2e8f9f7 55 /** @defgroup OPAMP_LL OPAMP
<> 144:ef7eb2e8f9f7 56 * @{
<> 144:ef7eb2e8f9f7 57 */
<> 144:ef7eb2e8f9f7 58
<> 144:ef7eb2e8f9f7 59 /* Private types -------------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 60 /* Private variables ---------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 61
<> 144:ef7eb2e8f9f7 62 /* Private constants ---------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 63 /** @defgroup OPAMP_LL_Private_Constants OPAMP Private Constants
<> 144:ef7eb2e8f9f7 64 * @{
<> 144:ef7eb2e8f9f7 65 */
<> 144:ef7eb2e8f9f7 66
<> 144:ef7eb2e8f9f7 67 /* Internal mask for OPAMP power mode: */
<> 144:ef7eb2e8f9f7 68 /* To select into literal LL_OPAMP_POWERMODE_x the relevant bits for: */
<> 144:ef7eb2e8f9f7 69 /* - OPAMP power mode into control register */
<> 144:ef7eb2e8f9f7 70 /* - OPAMP trimming register offset */
<> 144:ef7eb2e8f9f7 71
<> 144:ef7eb2e8f9f7 72 /* Internal register offset for OPAMP trimming configuration */
<> 144:ef7eb2e8f9f7 73 #define OPAMP_POWERMODE_OTR_REGOFFSET ((uint32_t)0x00000000U)
<> 144:ef7eb2e8f9f7 74 #define OPAMP_POWERMODE_LPOTR_REGOFFSET ((uint32_t)0x00000001U)
<> 144:ef7eb2e8f9f7 75 #define OPAMP_POWERMODE_OTR_REGOFFSET_MASK (OPAMP_POWERMODE_OTR_REGOFFSET | OPAMP_POWERMODE_LPOTR_REGOFFSET)
<> 144:ef7eb2e8f9f7 76
<> 144:ef7eb2e8f9f7 77 /* Mask for OPAMP power mode into control register */
<> 144:ef7eb2e8f9f7 78 #define OPAMP_POWERMODE_CSR_BIT_MASK (OPAMP_CSR_OPALPM)
<> 144:ef7eb2e8f9f7 79
<> 144:ef7eb2e8f9f7 80 /* Internal mask for OPAMP trimming of transistors differential pair NMOS */
<> 144:ef7eb2e8f9f7 81 /* or PMOS. */
<> 144:ef7eb2e8f9f7 82 /* To select into literal LL_OPAMP_TRIMMING_x the relevant bits for: */
<> 144:ef7eb2e8f9f7 83 /* - OPAMP trimming selection of transistors differential pair */
<> 144:ef7eb2e8f9f7 84 /* - OPAMP trimming values of transistors differential pair */
<> 144:ef7eb2e8f9f7 85 #define OPAMP_TRIMMING_SELECT_MASK (OPAMP1_CSR_CALSEL)
<> 144:ef7eb2e8f9f7 86 #define OPAMP_TRIMMING_VALUE_MASK (OPAMP_OTR_TRIMOFFSETP | OPAMP_OTR_TRIMOFFSETN)
<> 144:ef7eb2e8f9f7 87
<> 144:ef7eb2e8f9f7 88 /**
<> 144:ef7eb2e8f9f7 89 * @}
<> 144:ef7eb2e8f9f7 90 */
<> 144:ef7eb2e8f9f7 91
<> 144:ef7eb2e8f9f7 92
<> 144:ef7eb2e8f9f7 93 /* Private macros ------------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 94 /** @defgroup OPAMP_LL_Private_Macros OPAMP Private Macros
<> 144:ef7eb2e8f9f7 95 * @{
<> 144:ef7eb2e8f9f7 96 */
<> 144:ef7eb2e8f9f7 97
<> 144:ef7eb2e8f9f7 98 /**
<> 144:ef7eb2e8f9f7 99 * @brief Driver macro reserved for internal use: set a pointer to
<> 144:ef7eb2e8f9f7 100 * a register from a register basis from which an offset
<> 144:ef7eb2e8f9f7 101 * is applied.
<> 144:ef7eb2e8f9f7 102 * @param __REG__ Register basis from which the offset is applied.
<> 144:ef7eb2e8f9f7 103 * @param __REG_OFFSET__ Offset to be applied (unit: number of registers).
<> 144:ef7eb2e8f9f7 104 * @retval Register address
<> 144:ef7eb2e8f9f7 105 */
<> 144:ef7eb2e8f9f7 106 #define __OPAMP_PTR_REG_OFFSET(__REG__, __REG_OFFSET__) \
<> 144:ef7eb2e8f9f7 107 ((uint32_t *)((uint32_t) ((uint32_t)(&(__REG__)) + ((__REG_OFFSET__) << 2U))))
<> 144:ef7eb2e8f9f7 108
<> 144:ef7eb2e8f9f7 109
<> 144:ef7eb2e8f9f7 110
<> 144:ef7eb2e8f9f7 111
<> 144:ef7eb2e8f9f7 112 /**
<> 144:ef7eb2e8f9f7 113 * @}
<> 144:ef7eb2e8f9f7 114 */
<> 144:ef7eb2e8f9f7 115
<> 144:ef7eb2e8f9f7 116
<> 144:ef7eb2e8f9f7 117 /* Exported types ------------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 118 #if defined(USE_FULL_LL_DRIVER)
<> 144:ef7eb2e8f9f7 119 /** @defgroup OPAMP_LL_ES_INIT OPAMP Exported Init structure
<> 144:ef7eb2e8f9f7 120 * @{
<> 144:ef7eb2e8f9f7 121 */
<> 144:ef7eb2e8f9f7 122
<> 144:ef7eb2e8f9f7 123 /**
<> 144:ef7eb2e8f9f7 124 * @brief Structure definition of some features of OPAMP instance.
<> 144:ef7eb2e8f9f7 125 */
<> 144:ef7eb2e8f9f7 126 typedef struct
<> 144:ef7eb2e8f9f7 127 {
<> 144:ef7eb2e8f9f7 128 uint32_t PowerMode; /*!< Set OPAMP power mode.
<> 144:ef7eb2e8f9f7 129 This parameter can be a value of @ref OPAMP_LL_EC_POWERMODE
<> 144:ef7eb2e8f9f7 130
<> 144:ef7eb2e8f9f7 131 This feature can be modified afterwards using unitary function @ref LL_OPAMP_SetPowerMode(). */
<> 144:ef7eb2e8f9f7 132
<> 144:ef7eb2e8f9f7 133 uint32_t FunctionalMode; /*!< Set OPAMP functional mode by setting internal connections: OPAMP operation in standalone, follower, ...
<> 144:ef7eb2e8f9f7 134 This parameter can be a value of @ref OPAMP_LL_EC_FUNCTIONAL_MODE
<> 144:ef7eb2e8f9f7 135 @note If OPAMP is configured in mode PGA, the gain can be configured using function @ref LL_OPAMP_SetPGAGain().
<> 144:ef7eb2e8f9f7 136
<> 144:ef7eb2e8f9f7 137 This feature can be modified afterwards using unitary function @ref LL_OPAMP_SetFunctionalMode(). */
<> 144:ef7eb2e8f9f7 138
<> 144:ef7eb2e8f9f7 139 uint32_t InputNonInverting; /*!< Set OPAMP input non-inverting connection.
<> 144:ef7eb2e8f9f7 140 This parameter can be a value of @ref OPAMP_LL_EC_INPUT_NONINVERTING
<> 144:ef7eb2e8f9f7 141
<> 144:ef7eb2e8f9f7 142 This feature can be modified afterwards using unitary function @ref LL_OPAMP_SetInputNonInverting(). */
<> 144:ef7eb2e8f9f7 143
<> 144:ef7eb2e8f9f7 144 uint32_t InputInverting; /*!< Set OPAMP inverting input connection.
<> 144:ef7eb2e8f9f7 145 This parameter can be a value of @ref OPAMP_LL_EC_INPUT_INVERTING
<> 144:ef7eb2e8f9f7 146 @note OPAMP inverting input is used with OPAMP in mode standalone or PGA with external capacitors for filtering circuit. Otherwise (OPAMP in mode follower), OPAMP inverting input is not used (not connected to GPIO pin), this parameter is discarded.
<> 144:ef7eb2e8f9f7 147
<> 144:ef7eb2e8f9f7 148 This feature can be modified afterwards using unitary function @ref LL_OPAMP_SetInputInverting(). */
<> 144:ef7eb2e8f9f7 149
<> 144:ef7eb2e8f9f7 150 } LL_OPAMP_InitTypeDef;
<> 144:ef7eb2e8f9f7 151
<> 144:ef7eb2e8f9f7 152 /**
<> 144:ef7eb2e8f9f7 153 * @}
<> 144:ef7eb2e8f9f7 154 */
<> 144:ef7eb2e8f9f7 155 #endif /* USE_FULL_LL_DRIVER */
<> 144:ef7eb2e8f9f7 156
<> 144:ef7eb2e8f9f7 157 /* Exported constants --------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 158 /** @defgroup OPAMP_LL_Exported_Constants OPAMP Exported Constants
<> 144:ef7eb2e8f9f7 159 * @{
<> 144:ef7eb2e8f9f7 160 */
<> 144:ef7eb2e8f9f7 161
<> 144:ef7eb2e8f9f7 162 /** @defgroup OPAMP_LL_EC_POWERSUPPLY_RANGE OPAMP power supply range
<> 144:ef7eb2e8f9f7 163 * @{
<> 144:ef7eb2e8f9f7 164 */
<> 144:ef7eb2e8f9f7 165 #define LL_OPAMP_POWERSUPPLY_RANGE_LOW ((uint32_t)0x00000000U) /*!< Power supply range low. On STM32L4 serie: Vdda lower than 2.4V. */
<> 144:ef7eb2e8f9f7 166 #define LL_OPAMP_POWERSUPPLY_RANGE_HIGH (OPAMP1_CSR_OPARANGE) /*!< Power supply range high. On STM32L4 serie: Vdda higher than 2.4V. */
<> 144:ef7eb2e8f9f7 167 /**
<> 144:ef7eb2e8f9f7 168 * @}
<> 144:ef7eb2e8f9f7 169 */
<> 144:ef7eb2e8f9f7 170
<> 144:ef7eb2e8f9f7 171 /** @defgroup OPAMP_LL_EC_POWERMODE OPAMP power mode
<> 144:ef7eb2e8f9f7 172 * @{
<> 144:ef7eb2e8f9f7 173 */
<> 144:ef7eb2e8f9f7 174 #define LL_OPAMP_POWERMODE_NORMAL (OPAMP_POWERMODE_OTR_REGOFFSET) /*!< OPAMP power mode normal */
<> 144:ef7eb2e8f9f7 175 #define LL_OPAMP_POWERMODE_LOWPOWER (OPAMP_POWERMODE_LPOTR_REGOFFSET | OPAMP_CSR_OPALPM) /*!< OPAMP power mode low-power */
<> 144:ef7eb2e8f9f7 176 /**
<> 144:ef7eb2e8f9f7 177 * @}
<> 144:ef7eb2e8f9f7 178 */
<> 144:ef7eb2e8f9f7 179
<> 144:ef7eb2e8f9f7 180 /** @defgroup OPAMP_LL_EC_MODE OPAMP mode calibration or functional.
<> 144:ef7eb2e8f9f7 181 * @{
<> 144:ef7eb2e8f9f7 182 */
<> 144:ef7eb2e8f9f7 183 #define LL_OPAMP_MODE_FUNCTIONAL ((uint32_t)0x00000000U) /*!< OPAMP functional mode */
<> 144:ef7eb2e8f9f7 184 #define LL_OPAMP_MODE_CALIBRATION (OPAMP1_CSR_CALON) /*!< OPAMP calibration mode */
<> 144:ef7eb2e8f9f7 185 /**
<> 144:ef7eb2e8f9f7 186 * @}
<> 144:ef7eb2e8f9f7 187 */
<> 144:ef7eb2e8f9f7 188
<> 144:ef7eb2e8f9f7 189 /** @defgroup OPAMP_LL_EC_FUNCTIONAL_MODE OPAMP functional mode
<> 144:ef7eb2e8f9f7 190 * @{
<> 144:ef7eb2e8f9f7 191 */
<> 144:ef7eb2e8f9f7 192 #define LL_OPAMP_MODE_STANDALONE ((uint32_t)0x00000000U) /*!< OPAMP functional mode, OPAMP operation in standalone */
<> 144:ef7eb2e8f9f7 193 #define LL_OPAMP_MODE_FOLLOWER (OPAMP_CSR_OPAMODE_1 | OPAMP_CSR_OPAMODE_0) /*!< OPAMP functional mode, OPAMP operation in follower */
<> 144:ef7eb2e8f9f7 194 #define LL_OPAMP_MODE_PGA (OPAMP_CSR_OPAMODE_1) /*!< OPAMP functional mode, OPAMP operation in PGA */
<> 144:ef7eb2e8f9f7 195 /**
<> 144:ef7eb2e8f9f7 196 * @}
<> 144:ef7eb2e8f9f7 197 */
<> 144:ef7eb2e8f9f7 198
<> 144:ef7eb2e8f9f7 199 /** @defgroup OPAMP_LL_EC_MODE_PGA_GAIN OPAMP PGA gain (relevant when OPAMP is in functional mode PGA)
<> 144:ef7eb2e8f9f7 200 * @{
<> 144:ef7eb2e8f9f7 201 */
<> 144:ef7eb2e8f9f7 202 #define LL_OPAMP_PGA_GAIN_2 ((uint32_t)0x00000000U) /*!< OPAMP PGA gain 2 */
<> 144:ef7eb2e8f9f7 203 #define LL_OPAMP_PGA_GAIN_4 (OPAMP_CSR_PGGAIN_0) /*!< OPAMP PGA gain 4 */
<> 144:ef7eb2e8f9f7 204 #define LL_OPAMP_PGA_GAIN_8 (OPAMP_CSR_PGGAIN_1) /*!< OPAMP PGA gain 8 */
<> 144:ef7eb2e8f9f7 205 #define LL_OPAMP_PGA_GAIN_16 (OPAMP_CSR_PGGAIN_1 | OPAMP_CSR_PGGAIN_0 ) /*!< OPAMP PGA gain 16 */
<> 144:ef7eb2e8f9f7 206 /**
<> 144:ef7eb2e8f9f7 207 * @}
<> 144:ef7eb2e8f9f7 208 */
<> 144:ef7eb2e8f9f7 209
<> 144:ef7eb2e8f9f7 210 /** @defgroup OPAMP_LL_EC_INPUT_NONINVERTING OPAMP input non-inverting
<> 144:ef7eb2e8f9f7 211 * @{
<> 144:ef7eb2e8f9f7 212 */
<> 144:ef7eb2e8f9f7 213 #define LL_OPAMP_INPUT_NONINVERT_IO0 ((uint32_t)0x00000000U) /*!< OPAMP non inverting input connected to GPIO pin */
<> 144:ef7eb2e8f9f7 214 #define LL_OPAMP_INPUT_NONINVERT_DAC1_CH1 (OPAMP1_CSR_VPSEL) /*!< OPAMP non inverting input connected to DAC1 channel1 output */
<> 144:ef7eb2e8f9f7 215 /**
<> 144:ef7eb2e8f9f7 216 * @}
<> 144:ef7eb2e8f9f7 217 */
<> 144:ef7eb2e8f9f7 218
<> 144:ef7eb2e8f9f7 219 /** @defgroup OPAMP_LL_EC_INPUT_INVERTING OPAMP input inverting
<> 144:ef7eb2e8f9f7 220 * @{
<> 144:ef7eb2e8f9f7 221 */
<> 144:ef7eb2e8f9f7 222 #define LL_OPAMP_INPUT_INVERT_IO0 ((uint32_t)0x00000000U) /*!< OPAMP inverting input connected to GPIO pin (valid also in PGA mode for filtering). Note: OPAMP inverting input is used with OPAMP in mode standalone or PGA with external capacitors for filtering circuit. Otherwise (OPAMP in mode follower), OPAMP inverting input is not used (not connected to GPIO pin). */
<> 144:ef7eb2e8f9f7 223 #define LL_OPAMP_INPUT_INVERT_IO1 (OPAMP1_CSR_VMSEL_0) /*!< OPAMP inverting input (low leakage input) connected to GPIO pin (available only on package BGA132). Note: OPAMP inverting input is used with OPAMP in mode standalone or PGA with external capacitors for filtering circuit. Otherwise (OPAMP in mode follower), OPAMP inverting input is not used (not connected to GPIO pin). */
<> 144:ef7eb2e8f9f7 224 #define LL_OPAMP_INPUT_INVERT_CONNECT_NO (OPAMP1_CSR_VMSEL_1) /*!< OPAMP inverting input not externally connected (intended for OPAMP in mode follower or PGA without external capacitors for filtering) */
<> 144:ef7eb2e8f9f7 225 /**
<> 144:ef7eb2e8f9f7 226 * @}
<> 144:ef7eb2e8f9f7 227 */
<> 144:ef7eb2e8f9f7 228
<> 144:ef7eb2e8f9f7 229 /** @defgroup OPAMP_LL_EC_INPUT_LEGACY OPAMP inputs legacy literals name
<> 144:ef7eb2e8f9f7 230 * @{
<> 144:ef7eb2e8f9f7 231 */
<> 144:ef7eb2e8f9f7 232 #define LL_OPAMP_NONINVERTINGINPUT_IO0 LL_OPAMP_INPUT_NONINVERT_IO0
<> 144:ef7eb2e8f9f7 233 #define LL_OPAMP_NONINVERTINGINPUT_DAC_CH LL_OPAMP_INPUT_NONINVERT_DAC1_CH1
<> 144:ef7eb2e8f9f7 234
<> 144:ef7eb2e8f9f7 235 #define LL_OPAMP_INVERTINGINPUT_IO0 LL_OPAMP_INPUT_INVERT_IO0
<> 144:ef7eb2e8f9f7 236 #define LL_OPAMP_INVERTINGINPUT_IO1 LL_OPAMP_INPUT_INVERT_IO1
<> 144:ef7eb2e8f9f7 237 #define LL_OPAMP_INVERTINGINPUT_CONNECT_NO LL_OPAMP_INPUT_INVERT_CONNECT_NO
<> 144:ef7eb2e8f9f7 238 /**
<> 144:ef7eb2e8f9f7 239 * @}
<> 144:ef7eb2e8f9f7 240 */
<> 144:ef7eb2e8f9f7 241
<> 144:ef7eb2e8f9f7 242 /** @defgroup OPAMP_LL_EC_TRIMMING_MODE OPAMP trimming mode
<> 144:ef7eb2e8f9f7 243 * @{
<> 144:ef7eb2e8f9f7 244 */
<> 144:ef7eb2e8f9f7 245 #define LL_OPAMP_TRIMMING_FACTORY ((uint32_t)0x00000000U) /*!< OPAMP trimming factors set to factory values */
<> 144:ef7eb2e8f9f7 246 #define LL_OPAMP_TRIMMING_USER (OPAMP_CSR_USERTRIM) /*!< OPAMP trimming factors set to user values */
<> 144:ef7eb2e8f9f7 247 /**
<> 144:ef7eb2e8f9f7 248 * @}
<> 144:ef7eb2e8f9f7 249 */
<> 144:ef7eb2e8f9f7 250
<> 144:ef7eb2e8f9f7 251 /** @defgroup OPAMP_LL_EC_TRIMMING_TRANSISTORS_DIFF_PAIR OPAMP trimming of transistors differential pair NMOS or PMOS
<> 144:ef7eb2e8f9f7 252 * @{
<> 144:ef7eb2e8f9f7 253 */
<> 144:ef7eb2e8f9f7 254 #define LL_OPAMP_TRIMMING_NMOS (OPAMP_OTR_TRIMOFFSETN) /*!< OPAMP trimming of transistors differential pair NMOS */
<> 144:ef7eb2e8f9f7 255 #define LL_OPAMP_TRIMMING_PMOS (OPAMP_OTR_TRIMOFFSETP | OPAMP1_CSR_CALSEL) /*!< OPAMP trimming of transistors differential pair PMOS */
<> 144:ef7eb2e8f9f7 256 /**
<> 144:ef7eb2e8f9f7 257 * @}
<> 144:ef7eb2e8f9f7 258 */
<> 144:ef7eb2e8f9f7 259
<> 144:ef7eb2e8f9f7 260 /**
<> 144:ef7eb2e8f9f7 261 * @}
<> 144:ef7eb2e8f9f7 262 */
<> 144:ef7eb2e8f9f7 263
<> 144:ef7eb2e8f9f7 264 /* Exported macro ------------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 265 /** @defgroup OPAMP_LL_Exported_Macros OPAMP Exported Macros
<> 144:ef7eb2e8f9f7 266 * @{
<> 144:ef7eb2e8f9f7 267 */
<> 144:ef7eb2e8f9f7 268 /** @defgroup OPAMP_LL_EM_WRITE_READ Common write and read registers macro
<> 144:ef7eb2e8f9f7 269 * @{
<> 144:ef7eb2e8f9f7 270 */
<> 144:ef7eb2e8f9f7 271 /**
<> 144:ef7eb2e8f9f7 272 * @brief Write a value in OPAMP register
<> 144:ef7eb2e8f9f7 273 * @param __INSTANCE__ OPAMP Instance
<> 144:ef7eb2e8f9f7 274 * @param __REG__ Register to be written
<> 144:ef7eb2e8f9f7 275 * @param __VALUE__ Value to be written in the register
<> 144:ef7eb2e8f9f7 276 * @retval None
<> 144:ef7eb2e8f9f7 277 */
<> 144:ef7eb2e8f9f7 278 #define LL_OPAMP_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
<> 144:ef7eb2e8f9f7 279
<> 144:ef7eb2e8f9f7 280 /**
<> 144:ef7eb2e8f9f7 281 * @brief Read a value in OPAMP register
<> 144:ef7eb2e8f9f7 282 * @param __INSTANCE__ OPAMP Instance
<> 144:ef7eb2e8f9f7 283 * @param __REG__ Register to be read
<> 144:ef7eb2e8f9f7 284 * @retval Register value
<> 144:ef7eb2e8f9f7 285 */
<> 144:ef7eb2e8f9f7 286 #define LL_OPAMP_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
<> 144:ef7eb2e8f9f7 287 /**
<> 144:ef7eb2e8f9f7 288 * @}
<> 144:ef7eb2e8f9f7 289 */
<> 144:ef7eb2e8f9f7 290
<> 144:ef7eb2e8f9f7 291 /** @defgroup OPAMP_LL_EM_HELPER_MACRO OPAMP helper macro
<> 144:ef7eb2e8f9f7 292 * @{
<> 144:ef7eb2e8f9f7 293 */
<> 144:ef7eb2e8f9f7 294
<> 144:ef7eb2e8f9f7 295 /**
<> 144:ef7eb2e8f9f7 296 * @brief Helper macro to select the OPAMP common instance
<> 144:ef7eb2e8f9f7 297 * to which is belonging the selected OPAMP instance.
<> 144:ef7eb2e8f9f7 298 * @note OPAMP common register instance can be used to
<> 144:ef7eb2e8f9f7 299 * set parameters common to several OPAMP instances.
<> 144:ef7eb2e8f9f7 300 * Refer to functions having argument "OPAMPxy_COMMON" as parameter.
<> 144:ef7eb2e8f9f7 301 * @param __OPAMPx__ OPAMP instance
<> 144:ef7eb2e8f9f7 302 * @retval OPAMP common instance
<> 144:ef7eb2e8f9f7 303 */
<> 144:ef7eb2e8f9f7 304 #if defined(OPAMP1) && defined(OPAMP2)
<> 144:ef7eb2e8f9f7 305 #define __LL_OPAMP_COMMON_INSTANCE(__OPAMPx__) \
<> 144:ef7eb2e8f9f7 306 (OPAMP12_COMMON)
<> 144:ef7eb2e8f9f7 307 #else
<> 144:ef7eb2e8f9f7 308 #define __LL_OPAMP_COMMON_INSTANCE(__OPAMPx__) \
<> 144:ef7eb2e8f9f7 309 (OPAMP1_COMMON)
<> 144:ef7eb2e8f9f7 310 #endif
<> 144:ef7eb2e8f9f7 311
<> 144:ef7eb2e8f9f7 312 /**
<> 144:ef7eb2e8f9f7 313 * @brief Helper macro to check if all OPAMP instances sharing the same
<> 144:ef7eb2e8f9f7 314 * OPAMP common instance are disabled.
<> 144:ef7eb2e8f9f7 315 * @note This check is required by functions with setting conditioned to
<> 144:ef7eb2e8f9f7 316 * OPAMP state:
<> 144:ef7eb2e8f9f7 317 * All OPAMP instances of the OPAMP common group must be disabled.
<> 144:ef7eb2e8f9f7 318 * Refer to functions having argument "OPAMPxy_COMMON" as parameter.
<> 144:ef7eb2e8f9f7 319 * @retval 0: All OPAMP instances sharing the same OPAMP common instance
<> 144:ef7eb2e8f9f7 320 * are disabled.
<> 144:ef7eb2e8f9f7 321 * 1: At least one OPAMP instance sharing the same OPAMP common instance
<> 144:ef7eb2e8f9f7 322 * is enabled
<> 144:ef7eb2e8f9f7 323 */
<> 144:ef7eb2e8f9f7 324 #if defined(OPAMP1) && defined(OPAMP2)
<> 144:ef7eb2e8f9f7 325 #define __LL_OPAMP_IS_ENABLED_ALL_COMMON_INSTANCE() \
<> 144:ef7eb2e8f9f7 326 (LL_OPAMP_IsEnabled(OPAMP1) | \
<> 144:ef7eb2e8f9f7 327 LL_OPAMP_IsEnabled(OPAMP2) )
<> 144:ef7eb2e8f9f7 328 #else
<> 144:ef7eb2e8f9f7 329 #define __LL_OPAMP_IS_ENABLED_ALL_COMMON_INSTANCE() \
<> 144:ef7eb2e8f9f7 330 (LL_OPAMP_IsEnabled(OPAMP1))
<> 144:ef7eb2e8f9f7 331 #endif
<> 144:ef7eb2e8f9f7 332
<> 144:ef7eb2e8f9f7 333 /**
<> 144:ef7eb2e8f9f7 334 * @}
<> 144:ef7eb2e8f9f7 335 */
<> 144:ef7eb2e8f9f7 336
<> 144:ef7eb2e8f9f7 337 /**
<> 144:ef7eb2e8f9f7 338 * @}
<> 144:ef7eb2e8f9f7 339 */
<> 144:ef7eb2e8f9f7 340
<> 144:ef7eb2e8f9f7 341 /* Exported functions --------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 342 /** @defgroup OPAMP_LL_Exported_Functions OPAMP Exported Functions
<> 144:ef7eb2e8f9f7 343 * @{
<> 144:ef7eb2e8f9f7 344 */
<> 144:ef7eb2e8f9f7 345
<> 144:ef7eb2e8f9f7 346 /** @defgroup OPAMP_LL_EF_Configuration_opamp_common Configuration of OPAMP hierarchical scope: common to several OPAMP instances
<> 144:ef7eb2e8f9f7 347 * @{
<> 144:ef7eb2e8f9f7 348 */
<> 144:ef7eb2e8f9f7 349
<> 144:ef7eb2e8f9f7 350 /**
<> 144:ef7eb2e8f9f7 351 * @brief Set OPAMP power range.
<> 144:ef7eb2e8f9f7 352 * @note The OPAMP power range applies to several OPAMP instances
<> 144:ef7eb2e8f9f7 353 * (if several OPAMP instances available on the selected device).
<> 144:ef7eb2e8f9f7 354 * @note On this STM32 serie, setting of this feature is conditioned to
<> 144:ef7eb2e8f9f7 355 * OPAMP state:
<> 144:ef7eb2e8f9f7 356 * All OPAMP instances of the OPAMP common group must be disabled.
<> 144:ef7eb2e8f9f7 357 * This check can be done with function @ref LL_OPAMP_IsEnabled() for each
<> 144:ef7eb2e8f9f7 358 * OPAMP instance or by using helper macro
<> 144:ef7eb2e8f9f7 359 * @ref __LL_OPAMP_IS_ENABLED_ALL_COMMON_INSTANCE().
<> 144:ef7eb2e8f9f7 360 * @rmtoll CSR OPARANGE LL_OPAMP_SetCommonPowerRange
<> 144:ef7eb2e8f9f7 361 * @param OPAMPxy_COMMON OPAMP common instance
<> 144:ef7eb2e8f9f7 362 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_OPAMP_COMMON_INSTANCE() )
<> 144:ef7eb2e8f9f7 363 * @param PowerRange This parameter can be one of the following values:
<> 144:ef7eb2e8f9f7 364 * @arg @ref LL_OPAMP_POWERSUPPLY_RANGE_LOW
<> 144:ef7eb2e8f9f7 365 * @arg @ref LL_OPAMP_POWERSUPPLY_RANGE_HIGH
<> 144:ef7eb2e8f9f7 366 * @retval None
<> 144:ef7eb2e8f9f7 367 */
<> 144:ef7eb2e8f9f7 368 __STATIC_INLINE void LL_OPAMP_SetCommonPowerRange(OPAMP_Common_TypeDef *OPAMPxy_COMMON, uint32_t PowerRange)
<> 144:ef7eb2e8f9f7 369 {
<> 144:ef7eb2e8f9f7 370 MODIFY_REG(OPAMP1->CSR, OPAMP1_CSR_OPARANGE, PowerRange);
<> 144:ef7eb2e8f9f7 371 }
<> 144:ef7eb2e8f9f7 372
<> 144:ef7eb2e8f9f7 373 /**
<> 144:ef7eb2e8f9f7 374 * @brief Get OPAMP power range.
<> 144:ef7eb2e8f9f7 375 * @note The OPAMP power range applies to several OPAMP instances
<> 144:ef7eb2e8f9f7 376 * (if several OPAMP instances available on the selected device).
<> 144:ef7eb2e8f9f7 377 * @rmtoll CSR OPARANGE LL_OPAMP_GetCommonPowerRange
<> 144:ef7eb2e8f9f7 378 * @param OPAMPxy_COMMON OPAMP common instance
<> 144:ef7eb2e8f9f7 379 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_OPAMP_COMMON_INSTANCE() )
<> 144:ef7eb2e8f9f7 380 * @retval Returned value can be one of the following values:
<> 144:ef7eb2e8f9f7 381 * @arg @ref LL_OPAMP_POWERSUPPLY_RANGE_LOW
<> 144:ef7eb2e8f9f7 382 * @arg @ref LL_OPAMP_POWERSUPPLY_RANGE_HIGH
<> 144:ef7eb2e8f9f7 383 */
<> 144:ef7eb2e8f9f7 384 __STATIC_INLINE uint32_t LL_OPAMP_GetCommonPowerRange(OPAMP_Common_TypeDef *OPAMPxy_COMMON)
<> 144:ef7eb2e8f9f7 385 {
<> 144:ef7eb2e8f9f7 386 return (uint32_t)(READ_BIT(OPAMP1->CSR, OPAMP1_CSR_OPARANGE));
<> 144:ef7eb2e8f9f7 387 }
<> 144:ef7eb2e8f9f7 388
<> 144:ef7eb2e8f9f7 389 /**
<> 144:ef7eb2e8f9f7 390 * @}
<> 144:ef7eb2e8f9f7 391 */
<> 144:ef7eb2e8f9f7 392
<> 144:ef7eb2e8f9f7 393 /** @defgroup OPAMP_LL_EF_CONFIGURATION_OPAMP_INSTANCE Configuration of OPAMP hierarchical scope: OPAMP instance
<> 144:ef7eb2e8f9f7 394 * @{
<> 144:ef7eb2e8f9f7 395 */
<> 144:ef7eb2e8f9f7 396
<> 144:ef7eb2e8f9f7 397 /**
<> 144:ef7eb2e8f9f7 398 * @brief Set OPAMP power mode.
<> 144:ef7eb2e8f9f7 399 * @note The OPAMP must be disabled to change this configuration.
<> 144:ef7eb2e8f9f7 400 * @rmtoll CSR OPALPM LL_OPAMP_SetPowerMode
<> 144:ef7eb2e8f9f7 401 * @param OPAMPx OPAMP instance
<> 144:ef7eb2e8f9f7 402 * @param PowerMode This parameter can be one of the following values:
<> 144:ef7eb2e8f9f7 403 * @arg @ref LL_OPAMP_POWERMODE_NORMAL
<> 144:ef7eb2e8f9f7 404 * @arg @ref LL_OPAMP_POWERMODE_LOWPOWER
<> 144:ef7eb2e8f9f7 405 * @retval None
<> 144:ef7eb2e8f9f7 406 */
<> 144:ef7eb2e8f9f7 407 __STATIC_INLINE void LL_OPAMP_SetPowerMode(OPAMP_TypeDef *OPAMPx, uint32_t PowerMode)
<> 144:ef7eb2e8f9f7 408 {
<> 144:ef7eb2e8f9f7 409 MODIFY_REG(OPAMPx->CSR, OPAMP_CSR_OPALPM, (PowerMode & OPAMP_POWERMODE_CSR_BIT_MASK));
<> 144:ef7eb2e8f9f7 410 }
<> 144:ef7eb2e8f9f7 411
<> 144:ef7eb2e8f9f7 412 /**
<> 144:ef7eb2e8f9f7 413 * @brief Get OPAMP power mode.
<> 144:ef7eb2e8f9f7 414 * @rmtoll CSR OPALPM LL_OPAMP_GetPowerMode
<> 144:ef7eb2e8f9f7 415 * @param OPAMPx OPAMP instance
<> 144:ef7eb2e8f9f7 416 * @retval Returned value can be one of the following values:
<> 144:ef7eb2e8f9f7 417 * @arg @ref LL_OPAMP_POWERMODE_NORMAL
<> 144:ef7eb2e8f9f7 418 * @arg @ref LL_OPAMP_POWERMODE_LOWPOWER
<> 144:ef7eb2e8f9f7 419 */
<> 144:ef7eb2e8f9f7 420 __STATIC_INLINE uint32_t LL_OPAMP_GetPowerMode(OPAMP_TypeDef *OPAMPx)
<> 144:ef7eb2e8f9f7 421 {
<> 144:ef7eb2e8f9f7 422 register uint32_t power_mode = (READ_BIT(OPAMPx->CSR, OPAMP_CSR_OPALPM));
<> 144:ef7eb2e8f9f7 423
<> 144:ef7eb2e8f9f7 424 return (uint32_t)(power_mode | (power_mode >> (POSITION_VAL(OPAMP_CSR_OPALPM))));
<> 144:ef7eb2e8f9f7 425 }
<> 144:ef7eb2e8f9f7 426
<> 144:ef7eb2e8f9f7 427 /**
<> 144:ef7eb2e8f9f7 428 * @brief Set OPAMP mode calibration or functional.
<> 144:ef7eb2e8f9f7 429 * @note OPAMP mode corresponds to functional or calibration mode:
<> 144:ef7eb2e8f9f7 430 * - functional mode: OPAMP operation in standalone, follower, ...
<> 144:ef7eb2e8f9f7 431 * Set functional mode using function
<> 144:ef7eb2e8f9f7 432 * @ref LL_OPAMP_SetFunctionalMode().
<> 144:ef7eb2e8f9f7 433 * - calibration mode: offset calibration of the selected
<> 144:ef7eb2e8f9f7 434 * transistors differential pair NMOS or PMOS.
<> 144:ef7eb2e8f9f7 435 * @note On this STM32 serie, during calibration, OPAMP functional
<> 144:ef7eb2e8f9f7 436 * mode must be set to standalone or follower mode
<> 144:ef7eb2e8f9f7 437 * (in order to open internal connections to resistors
<> 144:ef7eb2e8f9f7 438 * of PGA mode).
<> 144:ef7eb2e8f9f7 439 * Refer to function @ref LL_OPAMP_SetFunctionalMode().
<> 144:ef7eb2e8f9f7 440 * @rmtoll CSR CALON LL_OPAMP_SetMode
<> 144:ef7eb2e8f9f7 441 * @param OPAMPx OPAMP instance
<> 144:ef7eb2e8f9f7 442 * @param Mode This parameter can be one of the following values:
<> 144:ef7eb2e8f9f7 443 * @arg @ref LL_OPAMP_MODE_FUNCTIONAL
<> 144:ef7eb2e8f9f7 444 * @arg @ref LL_OPAMP_MODE_CALIBRATION
<> 144:ef7eb2e8f9f7 445 * @retval None
<> 144:ef7eb2e8f9f7 446 */
<> 144:ef7eb2e8f9f7 447 __STATIC_INLINE void LL_OPAMP_SetMode(OPAMP_TypeDef *OPAMPx, uint32_t Mode)
<> 144:ef7eb2e8f9f7 448 {
<> 144:ef7eb2e8f9f7 449 MODIFY_REG(OPAMPx->CSR, OPAMP_CSR_CALON, Mode);
<> 144:ef7eb2e8f9f7 450 }
<> 144:ef7eb2e8f9f7 451
<> 144:ef7eb2e8f9f7 452 /**
<> 144:ef7eb2e8f9f7 453 * @brief Get OPAMP mode calibration or functional.
<> 144:ef7eb2e8f9f7 454 * @note OPAMP mode corresponds to functional or calibration mode:
<> 144:ef7eb2e8f9f7 455 * - functional mode: OPAMP operation in standalone, follower, ...
<> 144:ef7eb2e8f9f7 456 * Set functional mode using function
<> 144:ef7eb2e8f9f7 457 * @ref LL_OPAMP_SetFunctionalMode().
<> 144:ef7eb2e8f9f7 458 * - calibration mode: offset calibration of the selected
<> 144:ef7eb2e8f9f7 459 * transistors differential pair NMOS or PMOS.
<> 144:ef7eb2e8f9f7 460 * @rmtoll CSR CALON LL_OPAMP_GetMode
<> 144:ef7eb2e8f9f7 461 * @param OPAMPx OPAMP instance
<> 144:ef7eb2e8f9f7 462 * @retval Returned value can be one of the following values:
<> 144:ef7eb2e8f9f7 463 * @arg @ref LL_OPAMP_MODE_FUNCTIONAL
<> 144:ef7eb2e8f9f7 464 * @arg @ref LL_OPAMP_MODE_CALIBRATION
<> 144:ef7eb2e8f9f7 465 */
<> 144:ef7eb2e8f9f7 466 __STATIC_INLINE uint32_t LL_OPAMP_GetMode(OPAMP_TypeDef *OPAMPx)
<> 144:ef7eb2e8f9f7 467 {
<> 144:ef7eb2e8f9f7 468 return (uint32_t)(READ_BIT(OPAMPx->CSR, OPAMP_CSR_CALON));
<> 144:ef7eb2e8f9f7 469 }
<> 144:ef7eb2e8f9f7 470
<> 144:ef7eb2e8f9f7 471 /**
<> 144:ef7eb2e8f9f7 472 * @brief Set OPAMP functional mode by setting internal connections.
<> 144:ef7eb2e8f9f7 473 * OPAMP operation in standalone, follower, ...
<> 144:ef7eb2e8f9f7 474 * @note This function reset bit of calibration mode to ensure
<> 144:ef7eb2e8f9f7 475 * to be in functional mode, in order to have OPAMP parameters
<> 144:ef7eb2e8f9f7 476 * (inputs selection, ...) set with the corresponding OPAMP mode
<> 144:ef7eb2e8f9f7 477 * to be effective.
<> 144:ef7eb2e8f9f7 478 * @rmtoll CSR OPAMODE LL_OPAMP_SetFunctionalMode
<> 144:ef7eb2e8f9f7 479 * @param OPAMPx OPAMP instance
<> 144:ef7eb2e8f9f7 480 * @param FunctionalMode This parameter can be one of the following values:
<> 144:ef7eb2e8f9f7 481 * @arg @ref LL_OPAMP_MODE_STANDALONE
<> 144:ef7eb2e8f9f7 482 * @arg @ref LL_OPAMP_MODE_FOLLOWER
<> 144:ef7eb2e8f9f7 483 * @arg @ref LL_OPAMP_MODE_PGA
<> 144:ef7eb2e8f9f7 484 * @retval None
<> 144:ef7eb2e8f9f7 485 */
<> 144:ef7eb2e8f9f7 486 __STATIC_INLINE void LL_OPAMP_SetFunctionalMode(OPAMP_TypeDef *OPAMPx, uint32_t FunctionalMode)
<> 144:ef7eb2e8f9f7 487 {
<> 144:ef7eb2e8f9f7 488 /* Note: Bit OPAMP_CSR_CALON reset to ensure to be in functional mode */
<> 144:ef7eb2e8f9f7 489 MODIFY_REG(OPAMPx->CSR, OPAMP_CSR_OPAMODE | OPAMP_CSR_CALON, FunctionalMode);
<> 144:ef7eb2e8f9f7 490 }
<> 144:ef7eb2e8f9f7 491
<> 144:ef7eb2e8f9f7 492 /**
<> 144:ef7eb2e8f9f7 493 * @brief Get OPAMP functional mode from setting of internal connections.
<> 144:ef7eb2e8f9f7 494 * OPAMP operation in standalone, follower, ...
<> 144:ef7eb2e8f9f7 495 * @rmtoll CSR OPAMODE LL_OPAMP_GetFunctionalMode
<> 144:ef7eb2e8f9f7 496 * @param OPAMPx OPAMP instance
<> 144:ef7eb2e8f9f7 497 * @retval Returned value can be one of the following values:
<> 144:ef7eb2e8f9f7 498 * @arg @ref LL_OPAMP_MODE_STANDALONE
<> 144:ef7eb2e8f9f7 499 * @arg @ref LL_OPAMP_MODE_FOLLOWER
<> 144:ef7eb2e8f9f7 500 * @arg @ref LL_OPAMP_MODE_PGA
<> 144:ef7eb2e8f9f7 501 */
<> 144:ef7eb2e8f9f7 502 __STATIC_INLINE uint32_t LL_OPAMP_GetFunctionalMode(OPAMP_TypeDef *OPAMPx)
<> 144:ef7eb2e8f9f7 503 {
<> 144:ef7eb2e8f9f7 504 return (uint32_t)(READ_BIT(OPAMPx->CSR, OPAMP_CSR_OPAMODE));
<> 144:ef7eb2e8f9f7 505 }
<> 144:ef7eb2e8f9f7 506
<> 144:ef7eb2e8f9f7 507 /**
<> 144:ef7eb2e8f9f7 508 * @brief Set OPAMP PGA gain.
<> 144:ef7eb2e8f9f7 509 * @note Preliminarily, OPAMP must be set in mode PGA
<> 144:ef7eb2e8f9f7 510 * using function @ref LL_OPAMP_SetFunctionalMode().
<> 144:ef7eb2e8f9f7 511 * @rmtoll CSR PGGAIN LL_OPAMP_SetPGAGain
<> 144:ef7eb2e8f9f7 512 * @param OPAMPx OPAMP instance
<> 144:ef7eb2e8f9f7 513 * @param PGAGain This parameter can be one of the following values:
<> 144:ef7eb2e8f9f7 514 * @arg @ref LL_OPAMP_PGA_GAIN_2
<> 144:ef7eb2e8f9f7 515 * @arg @ref LL_OPAMP_PGA_GAIN_4
<> 144:ef7eb2e8f9f7 516 * @arg @ref LL_OPAMP_PGA_GAIN_8
<> 144:ef7eb2e8f9f7 517 * @arg @ref LL_OPAMP_PGA_GAIN_16
<> 144:ef7eb2e8f9f7 518 * @retval None
<> 144:ef7eb2e8f9f7 519 */
<> 144:ef7eb2e8f9f7 520 __STATIC_INLINE void LL_OPAMP_SetPGAGain(OPAMP_TypeDef *OPAMPx, uint32_t PGAGain)
<> 144:ef7eb2e8f9f7 521 {
<> 144:ef7eb2e8f9f7 522 MODIFY_REG(OPAMPx->CSR, OPAMP_CSR_PGGAIN, PGAGain);
<> 144:ef7eb2e8f9f7 523 }
<> 144:ef7eb2e8f9f7 524
<> 144:ef7eb2e8f9f7 525 /**
<> 144:ef7eb2e8f9f7 526 * @brief Get OPAMP PGA gain.
<> 144:ef7eb2e8f9f7 527 * @note Preliminarily, OPAMP must be set in mode PGA
<> 144:ef7eb2e8f9f7 528 * using function @ref LL_OPAMP_SetFunctionalMode().
<> 144:ef7eb2e8f9f7 529 * @rmtoll CSR PGGAIN LL_OPAMP_GetPGAGain
<> 144:ef7eb2e8f9f7 530 * @param OPAMPx OPAMP instance
<> 144:ef7eb2e8f9f7 531 * @retval Returned value can be one of the following values:
<> 144:ef7eb2e8f9f7 532 * @arg @ref LL_OPAMP_PGA_GAIN_2
<> 144:ef7eb2e8f9f7 533 * @arg @ref LL_OPAMP_PGA_GAIN_4
<> 144:ef7eb2e8f9f7 534 * @arg @ref LL_OPAMP_PGA_GAIN_8
<> 144:ef7eb2e8f9f7 535 * @arg @ref LL_OPAMP_PGA_GAIN_16
<> 144:ef7eb2e8f9f7 536 */
<> 144:ef7eb2e8f9f7 537 __STATIC_INLINE uint32_t LL_OPAMP_GetPGAGain(OPAMP_TypeDef *OPAMPx)
<> 144:ef7eb2e8f9f7 538 {
<> 144:ef7eb2e8f9f7 539 return (uint32_t)(READ_BIT(OPAMPx->CSR, OPAMP_CSR_PGGAIN));
<> 144:ef7eb2e8f9f7 540 }
<> 144:ef7eb2e8f9f7 541
<> 144:ef7eb2e8f9f7 542 /**
<> 144:ef7eb2e8f9f7 543 * @}
<> 144:ef7eb2e8f9f7 544 */
<> 144:ef7eb2e8f9f7 545
<> 144:ef7eb2e8f9f7 546 /** @defgroup OPAMP_LL_EF_CONFIGURATION_INPUTS Configuration of OPAMP inputs
<> 144:ef7eb2e8f9f7 547 * @{
<> 144:ef7eb2e8f9f7 548 */
<> 144:ef7eb2e8f9f7 549
<> 144:ef7eb2e8f9f7 550 /**
<> 144:ef7eb2e8f9f7 551 * @brief Set OPAMP non-inverting input connection.
<> 144:ef7eb2e8f9f7 552 * @rmtoll CSR VPSEL LL_OPAMP_SetInputNonInverting
<> 144:ef7eb2e8f9f7 553 * @param OPAMPx OPAMP instance
<> 144:ef7eb2e8f9f7 554 * @param InputNonInverting This parameter can be one of the following values:
<> 144:ef7eb2e8f9f7 555 * @arg @ref LL_OPAMP_INPUT_NONINVERT_IO0
<> 144:ef7eb2e8f9f7 556 * @arg @ref LL_OPAMP_INPUT_NONINVERT_DAC1_CH1
<> 144:ef7eb2e8f9f7 557 * @retval None
<> 144:ef7eb2e8f9f7 558 */
<> 144:ef7eb2e8f9f7 559 __STATIC_INLINE void LL_OPAMP_SetInputNonInverting(OPAMP_TypeDef *OPAMPx, uint32_t InputNonInverting)
<> 144:ef7eb2e8f9f7 560 {
<> 144:ef7eb2e8f9f7 561 MODIFY_REG(OPAMPx->CSR, OPAMP_CSR_VPSEL, InputNonInverting);
<> 144:ef7eb2e8f9f7 562 }
<> 144:ef7eb2e8f9f7 563
<> 144:ef7eb2e8f9f7 564 /**
<> 144:ef7eb2e8f9f7 565 * @brief Get OPAMP non-inverting input connection.
<> 144:ef7eb2e8f9f7 566 * @rmtoll CSR VPSEL LL_OPAMP_GetInputNonInverting
<> 144:ef7eb2e8f9f7 567 * @param OPAMPx OPAMP instance
<> 144:ef7eb2e8f9f7 568 * @retval Returned value can be one of the following values:
<> 144:ef7eb2e8f9f7 569 * @arg @ref LL_OPAMP_INPUT_NONINVERT_IO0
<> 144:ef7eb2e8f9f7 570 * @arg @ref LL_OPAMP_INPUT_NONINVERT_DAC1_CH1
<> 144:ef7eb2e8f9f7 571 */
<> 144:ef7eb2e8f9f7 572 __STATIC_INLINE uint32_t LL_OPAMP_GetInputNonInverting(OPAMP_TypeDef *OPAMPx)
<> 144:ef7eb2e8f9f7 573 {
<> 144:ef7eb2e8f9f7 574 return (uint32_t)(READ_BIT(OPAMPx->CSR, OPAMP_CSR_VPSEL));
<> 144:ef7eb2e8f9f7 575 }
<> 144:ef7eb2e8f9f7 576
<> 144:ef7eb2e8f9f7 577 /**
<> 144:ef7eb2e8f9f7 578 * @brief Set OPAMP inverting input connection.
<> 144:ef7eb2e8f9f7 579 * @note OPAMP inverting input is used with OPAMP in mode standalone
<> 144:ef7eb2e8f9f7 580 * or PGA with external capacitors for filtering circuit.
<> 144:ef7eb2e8f9f7 581 * Otherwise (OPAMP in mode follower), OPAMP inverting input
<> 144:ef7eb2e8f9f7 582 * is not used (not connected to GPIO pin).
<> 144:ef7eb2e8f9f7 583 * @rmtoll CSR VMSEL LL_OPAMP_SetInputInverting
<> 144:ef7eb2e8f9f7 584 * @param OPAMPx OPAMP instance
<> 144:ef7eb2e8f9f7 585 * @param InputInverting This parameter can be one of the following values:
<> 144:ef7eb2e8f9f7 586 * @arg @ref LL_OPAMP_INPUT_INVERT_IO0
<> 144:ef7eb2e8f9f7 587 * @arg @ref LL_OPAMP_INPUT_INVERT_IO1
<> 144:ef7eb2e8f9f7 588 * @arg @ref LL_OPAMP_INPUT_INVERT_CONNECT_NO
<> 144:ef7eb2e8f9f7 589 * @retval None
<> 144:ef7eb2e8f9f7 590 */
<> 144:ef7eb2e8f9f7 591 __STATIC_INLINE void LL_OPAMP_SetInputInverting(OPAMP_TypeDef *OPAMPx, uint32_t InputInverting)
<> 144:ef7eb2e8f9f7 592 {
<> 144:ef7eb2e8f9f7 593 MODIFY_REG(OPAMPx->CSR, OPAMP_CSR_VMSEL, InputInverting);
<> 144:ef7eb2e8f9f7 594 }
<> 144:ef7eb2e8f9f7 595
<> 144:ef7eb2e8f9f7 596 /**
<> 144:ef7eb2e8f9f7 597 * @brief Get OPAMP inverting input connection.
<> 144:ef7eb2e8f9f7 598 * @rmtoll CSR VMSEL LL_OPAMP_GetInputInverting
<> 144:ef7eb2e8f9f7 599 * @param OPAMPx OPAMP instance
<> 144:ef7eb2e8f9f7 600 * @retval Returned value can be one of the following values:
<> 144:ef7eb2e8f9f7 601 * @arg @ref LL_OPAMP_INPUT_INVERT_IO0
<> 144:ef7eb2e8f9f7 602 * @arg @ref LL_OPAMP_INPUT_INVERT_IO1
<> 144:ef7eb2e8f9f7 603 * @arg @ref LL_OPAMP_INPUT_INVERT_CONNECT_NO
<> 144:ef7eb2e8f9f7 604 */
<> 144:ef7eb2e8f9f7 605 __STATIC_INLINE uint32_t LL_OPAMP_GetInputInverting(OPAMP_TypeDef *OPAMPx)
<> 144:ef7eb2e8f9f7 606 {
<> 144:ef7eb2e8f9f7 607 return (uint32_t)(READ_BIT(OPAMPx->CSR, OPAMP_CSR_VMSEL));
<> 144:ef7eb2e8f9f7 608 }
<> 144:ef7eb2e8f9f7 609
<> 144:ef7eb2e8f9f7 610 /**
<> 144:ef7eb2e8f9f7 611 * @}
<> 144:ef7eb2e8f9f7 612 */
<> 144:ef7eb2e8f9f7 613
<> 144:ef7eb2e8f9f7 614 /** @defgroup OPAMP_LL_EF_Configuration_Legacy_Functions Configuration of OPAMP, legacy functions name
<> 144:ef7eb2e8f9f7 615 * @{
<> 144:ef7eb2e8f9f7 616 */
<> 144:ef7eb2e8f9f7 617 /* Old functions name kept for legacy purpose, to be replaced by the */
<> 144:ef7eb2e8f9f7 618 /* current functions name. */
<> 144:ef7eb2e8f9f7 619 __STATIC_INLINE void LL_OPAMP_SetNonInvertingInput(OPAMP_TypeDef *OPAMPx, uint32_t NonInvertingInput)
<> 144:ef7eb2e8f9f7 620 {
<> 144:ef7eb2e8f9f7 621 LL_OPAMP_SetInputNonInverting(OPAMPx, NonInvertingInput);
<> 144:ef7eb2e8f9f7 622 }
<> 144:ef7eb2e8f9f7 623
<> 144:ef7eb2e8f9f7 624 __STATIC_INLINE void LL_OPAMP_SetInvertingInput(OPAMP_TypeDef *OPAMPx, uint32_t InvertingInput)
<> 144:ef7eb2e8f9f7 625 {
<> 144:ef7eb2e8f9f7 626 LL_OPAMP_SetInputInverting(OPAMPx, InvertingInput);
<> 144:ef7eb2e8f9f7 627 }
<> 144:ef7eb2e8f9f7 628
<> 144:ef7eb2e8f9f7 629 /**
<> 144:ef7eb2e8f9f7 630 * @}
<> 144:ef7eb2e8f9f7 631 */
<> 144:ef7eb2e8f9f7 632
<> 144:ef7eb2e8f9f7 633 /** @defgroup OPAMP_LL_EF_OPAMP_TRIMMING Configuration and operation of OPAMP trimming
<> 144:ef7eb2e8f9f7 634 * @{
<> 144:ef7eb2e8f9f7 635 */
<> 144:ef7eb2e8f9f7 636
<> 144:ef7eb2e8f9f7 637 /**
<> 144:ef7eb2e8f9f7 638 * @brief Set OPAMP trimming mode.
<> 144:ef7eb2e8f9f7 639 * @rmtoll CSR USERTRIM LL_OPAMP_SetTrimmingMode
<> 144:ef7eb2e8f9f7 640 * @param OPAMPx OPAMP instance
<> 144:ef7eb2e8f9f7 641 * @param TrimmingMode This parameter can be one of the following values:
<> 144:ef7eb2e8f9f7 642 * @arg @ref LL_OPAMP_TRIMMING_FACTORY
<> 144:ef7eb2e8f9f7 643 * @arg @ref LL_OPAMP_TRIMMING_USER
<> 144:ef7eb2e8f9f7 644 * @retval None
<> 144:ef7eb2e8f9f7 645 */
<> 144:ef7eb2e8f9f7 646 __STATIC_INLINE void LL_OPAMP_SetTrimmingMode(OPAMP_TypeDef *OPAMPx, uint32_t TrimmingMode)
<> 144:ef7eb2e8f9f7 647 {
<> 144:ef7eb2e8f9f7 648 MODIFY_REG(OPAMPx->CSR, OPAMP_CSR_USERTRIM, TrimmingMode);
<> 144:ef7eb2e8f9f7 649 }
<> 144:ef7eb2e8f9f7 650
<> 144:ef7eb2e8f9f7 651 /**
<> 144:ef7eb2e8f9f7 652 * @brief Get OPAMP trimming mode.
<> 144:ef7eb2e8f9f7 653 * @rmtoll CSR USERTRIM LL_OPAMP_GetTrimmingMode
<> 144:ef7eb2e8f9f7 654 * @param OPAMPx OPAMP instance
<> 144:ef7eb2e8f9f7 655 * @retval Returned value can be one of the following values:
<> 144:ef7eb2e8f9f7 656 * @arg @ref LL_OPAMP_TRIMMING_FACTORY
<> 144:ef7eb2e8f9f7 657 * @arg @ref LL_OPAMP_TRIMMING_USER
<> 144:ef7eb2e8f9f7 658 */
<> 144:ef7eb2e8f9f7 659 __STATIC_INLINE uint32_t LL_OPAMP_GetTrimmingMode(OPAMP_TypeDef *OPAMPx)
<> 144:ef7eb2e8f9f7 660 {
<> 144:ef7eb2e8f9f7 661 return (uint32_t)(READ_BIT(OPAMPx->CSR, OPAMP_CSR_USERTRIM));
<> 144:ef7eb2e8f9f7 662 }
<> 144:ef7eb2e8f9f7 663
<> 144:ef7eb2e8f9f7 664 /**
<> 144:ef7eb2e8f9f7 665 * @brief Set OPAMP offset to calibrate the selected transistors
<> 144:ef7eb2e8f9f7 666 * differential pair NMOS or PMOS.
<> 144:ef7eb2e8f9f7 667 * @note Preliminarily, OPAMP must be set in mode calibration
<> 144:ef7eb2e8f9f7 668 * using function @ref LL_OPAMP_SetMode().
<> 144:ef7eb2e8f9f7 669 * @rmtoll CSR CALSEL LL_OPAMP_SetCalibrationSelection
<> 144:ef7eb2e8f9f7 670 * @param OPAMPx OPAMP instance
<> 144:ef7eb2e8f9f7 671 * @param TransistorsDiffPair This parameter can be one of the following values:
<> 144:ef7eb2e8f9f7 672 * @arg @ref LL_OPAMP_TRIMMING_NMOS
<> 144:ef7eb2e8f9f7 673 * @arg @ref LL_OPAMP_TRIMMING_PMOS
<> 144:ef7eb2e8f9f7 674 * @retval None
<> 144:ef7eb2e8f9f7 675 */
<> 144:ef7eb2e8f9f7 676 __STATIC_INLINE void LL_OPAMP_SetCalibrationSelection(OPAMP_TypeDef *OPAMPx, uint32_t TransistorsDiffPair)
<> 144:ef7eb2e8f9f7 677 {
<> 144:ef7eb2e8f9f7 678 /* Parameter used with mask "OPAMP_TRIMMING_SELECT_MASK" because */
<> 144:ef7eb2e8f9f7 679 /* containing other bits reserved for other purpose. */
<> 144:ef7eb2e8f9f7 680 MODIFY_REG(OPAMPx->CSR, OPAMP_CSR_CALSEL, (TransistorsDiffPair & OPAMP_TRIMMING_SELECT_MASK));
<> 144:ef7eb2e8f9f7 681 }
<> 144:ef7eb2e8f9f7 682
<> 144:ef7eb2e8f9f7 683 /**
<> 144:ef7eb2e8f9f7 684 * @brief Get OPAMP offset to calibrate the selected transistors
<> 144:ef7eb2e8f9f7 685 * differential pair NMOS or PMOS.
<> 144:ef7eb2e8f9f7 686 * @note Preliminarily, OPAMP must be set in mode calibration
<> 144:ef7eb2e8f9f7 687 * using function @ref LL_OPAMP_SetMode().
<> 144:ef7eb2e8f9f7 688 * @rmtoll CSR CALSEL LL_OPAMP_GetCalibrationSelection
<> 144:ef7eb2e8f9f7 689 * @param OPAMPx OPAMP instance
<> 144:ef7eb2e8f9f7 690 * @retval Returned value can be one of the following values:
<> 144:ef7eb2e8f9f7 691 * @arg @ref LL_OPAMP_TRIMMING_NMOS
<> 144:ef7eb2e8f9f7 692 * @arg @ref LL_OPAMP_TRIMMING_PMOS
<> 144:ef7eb2e8f9f7 693 */
<> 144:ef7eb2e8f9f7 694 __STATIC_INLINE uint32_t LL_OPAMP_GetCalibrationSelection(OPAMP_TypeDef *OPAMPx)
<> 144:ef7eb2e8f9f7 695 {
<> 144:ef7eb2e8f9f7 696 register uint32_t CalibrationSelection = (uint32_t)(READ_BIT(OPAMPx->CSR, OPAMP_CSR_CALSEL));
<> 144:ef7eb2e8f9f7 697
<> 144:ef7eb2e8f9f7 698 return (CalibrationSelection |
<> 144:ef7eb2e8f9f7 699 ((OPAMP_OTR_TRIMOFFSETN) << (POSITION_VAL(OPAMP_OTR_TRIMOFFSETP) * (CalibrationSelection && OPAMP1_CSR_CALSEL))));
<> 144:ef7eb2e8f9f7 700 }
<> 144:ef7eb2e8f9f7 701
<> 144:ef7eb2e8f9f7 702 /**
<> 144:ef7eb2e8f9f7 703 * @brief Get OPAMP calibration result of toggling output.
<> 144:ef7eb2e8f9f7 704 * @note This functions returns:
<> 144:ef7eb2e8f9f7 705 * 0 if OPAMP calibration output is reset
<> 144:ef7eb2e8f9f7 706 * 1 if OPAMP calibration output is set
<> 144:ef7eb2e8f9f7 707 * @rmtoll CSR CALOUT LL_OPAMP_IsCalibrationOutputSet
<> 144:ef7eb2e8f9f7 708 * @param OPAMPx OPAMP instance
<> 144:ef7eb2e8f9f7 709 * @retval State of bit (1 or 0).
<> 144:ef7eb2e8f9f7 710 */
<> 144:ef7eb2e8f9f7 711 __STATIC_INLINE uint32_t LL_OPAMP_IsCalibrationOutputSet(OPAMP_TypeDef *OPAMPx)
<> 144:ef7eb2e8f9f7 712 {
<> 144:ef7eb2e8f9f7 713 return (READ_BIT(OPAMPx->CSR, OPAMP_CSR_CALOUT) == OPAMP_CSR_CALOUT);
<> 144:ef7eb2e8f9f7 714 }
<> 144:ef7eb2e8f9f7 715
<> 144:ef7eb2e8f9f7 716 /**
<> 144:ef7eb2e8f9f7 717 * @brief Set OPAMP trimming factor for the selected transistors
<> 144:ef7eb2e8f9f7 718 * differential pair NMOS or PMOS, corresponding to the selected
<> 144:ef7eb2e8f9f7 719 * power mode.
<> 144:ef7eb2e8f9f7 720 * @rmtoll OTR TRIMOFFSETN LL_OPAMP_SetTrimmingValue\n
<> 144:ef7eb2e8f9f7 721 * OTR TRIMOFFSETP LL_OPAMP_SetTrimmingValue\n
<> 144:ef7eb2e8f9f7 722 * LPOTR TRIMLPOFFSETN LL_OPAMP_SetTrimmingValue\n
<> 144:ef7eb2e8f9f7 723 * LPOTR TRIMLPOFFSETP LL_OPAMP_SetTrimmingValue
<> 144:ef7eb2e8f9f7 724 * @param OPAMPx OPAMP instance
<> 144:ef7eb2e8f9f7 725 * @param PowerMode This parameter can be one of the following values:
<> 144:ef7eb2e8f9f7 726 * @arg @ref LL_OPAMP_POWERMODE_NORMAL
<> 144:ef7eb2e8f9f7 727 * @arg @ref LL_OPAMP_POWERMODE_LOWPOWER
<> 144:ef7eb2e8f9f7 728 * @param TransistorsDiffPair This parameter can be one of the following values:
<> 144:ef7eb2e8f9f7 729 * @arg @ref LL_OPAMP_TRIMMING_NMOS
<> 144:ef7eb2e8f9f7 730 * @arg @ref LL_OPAMP_TRIMMING_PMOS
<> 144:ef7eb2e8f9f7 731 * @param TrimmingValue 0x00...0x1F
<> 144:ef7eb2e8f9f7 732 * @retval None
<> 144:ef7eb2e8f9f7 733 */
<> 144:ef7eb2e8f9f7 734 __STATIC_INLINE void LL_OPAMP_SetTrimmingValue(OPAMP_TypeDef* OPAMPx, uint32_t PowerMode, uint32_t TransistorsDiffPair, uint32_t TrimmingValue)
<> 144:ef7eb2e8f9f7 735 {
<> 144:ef7eb2e8f9f7 736 register uint32_t *preg = __OPAMP_PTR_REG_OFFSET(OPAMPx->OTR, (PowerMode & OPAMP_POWERMODE_OTR_REGOFFSET_MASK));
<> 144:ef7eb2e8f9f7 737
<> 144:ef7eb2e8f9f7 738 /* Set bits with position in register depending on parameter */
<> 144:ef7eb2e8f9f7 739 /* "TransistorsDiffPair". */
<> 144:ef7eb2e8f9f7 740 /* Parameter used with mask "OPAMP_TRIMMING_VALUE_MASK" because */
<> 144:ef7eb2e8f9f7 741 /* containing other bits reserved for other purpose. */
<> 144:ef7eb2e8f9f7 742 MODIFY_REG(*preg,
<> 144:ef7eb2e8f9f7 743 (TransistorsDiffPair & OPAMP_TRIMMING_VALUE_MASK),
<> 144:ef7eb2e8f9f7 744 TrimmingValue << (POSITION_VAL(TransistorsDiffPair & OPAMP_TRIMMING_VALUE_MASK)));
<> 144:ef7eb2e8f9f7 745 }
<> 144:ef7eb2e8f9f7 746
<> 144:ef7eb2e8f9f7 747 /**
<> 144:ef7eb2e8f9f7 748 * @brief Get OPAMP trimming factor for the selected transistors
<> 144:ef7eb2e8f9f7 749 * differential pair NMOS or PMOS, corresponding to the selected
<> 144:ef7eb2e8f9f7 750 * power mode.
<> 144:ef7eb2e8f9f7 751 * @rmtoll OTR TRIMOFFSETN LL_OPAMP_SetTrimmingValue\n
<> 144:ef7eb2e8f9f7 752 * OTR TRIMOFFSETP LL_OPAMP_SetTrimmingValue\n
<> 144:ef7eb2e8f9f7 753 * LPOTR TRIMLPOFFSETN LL_OPAMP_SetTrimmingValue\n
<> 144:ef7eb2e8f9f7 754 * LPOTR TRIMLPOFFSETP LL_OPAMP_SetTrimmingValue
<> 144:ef7eb2e8f9f7 755 * @param OPAMPx OPAMP instance
<> 144:ef7eb2e8f9f7 756 * @param PowerMode This parameter can be one of the following values:
<> 144:ef7eb2e8f9f7 757 * @arg @ref LL_OPAMP_POWERMODE_NORMAL
<> 144:ef7eb2e8f9f7 758 * @arg @ref LL_OPAMP_POWERMODE_LOWPOWER
<> 144:ef7eb2e8f9f7 759 * @param TransistorsDiffPair This parameter can be one of the following values:
<> 144:ef7eb2e8f9f7 760 * @arg @ref LL_OPAMP_TRIMMING_NMOS
<> 144:ef7eb2e8f9f7 761 * @arg @ref LL_OPAMP_TRIMMING_PMOS
<> 144:ef7eb2e8f9f7 762 * @retval 0x0...0x1F
<> 144:ef7eb2e8f9f7 763 */
<> 144:ef7eb2e8f9f7 764 __STATIC_INLINE uint32_t LL_OPAMP_GetTrimmingValue(OPAMP_TypeDef* OPAMPx, uint32_t PowerMode, uint32_t TransistorsDiffPair)
<> 144:ef7eb2e8f9f7 765 {
<> 144:ef7eb2e8f9f7 766 register uint32_t *preg = __OPAMP_PTR_REG_OFFSET(OPAMPx->OTR, (PowerMode & OPAMP_POWERMODE_OTR_REGOFFSET_MASK));
<> 144:ef7eb2e8f9f7 767
<> 144:ef7eb2e8f9f7 768 /* Retrieve bits with position in register depending on parameter */
<> 144:ef7eb2e8f9f7 769 /* "TransistorsDiffPair". */
<> 144:ef7eb2e8f9f7 770 /* Parameter used with mask "OPAMP_TRIMMING_VALUE_MASK" because */
<> 144:ef7eb2e8f9f7 771 /* containing other bits reserved for other purpose. */
<> 144:ef7eb2e8f9f7 772 return (uint32_t)(READ_BIT(*preg, (TransistorsDiffPair & OPAMP_TRIMMING_VALUE_MASK))
<> 144:ef7eb2e8f9f7 773 >> (POSITION_VAL(TransistorsDiffPair & OPAMP_TRIMMING_VALUE_MASK))
<> 144:ef7eb2e8f9f7 774 );
<> 144:ef7eb2e8f9f7 775 }
<> 144:ef7eb2e8f9f7 776
<> 144:ef7eb2e8f9f7 777 /**
<> 144:ef7eb2e8f9f7 778 * @}
<> 144:ef7eb2e8f9f7 779 */
<> 144:ef7eb2e8f9f7 780
<> 144:ef7eb2e8f9f7 781 /** @defgroup OPAMP_LL_EF_OPERATION Operation on OPAMP instance
<> 144:ef7eb2e8f9f7 782 * @{
<> 144:ef7eb2e8f9f7 783 */
<> 144:ef7eb2e8f9f7 784 /**
<> 144:ef7eb2e8f9f7 785 * @brief Enable OPAMP instance.
<> 144:ef7eb2e8f9f7 786 * @note After enable from off state, OPAMP requires a delay
<> 144:ef7eb2e8f9f7 787 * to fullfill wake up time specification.
<> 144:ef7eb2e8f9f7 788 * Refer to device datasheet, parameter "tWAKEUP".
<> 144:ef7eb2e8f9f7 789 * @rmtoll CSR OPAMPXEN LL_OPAMP_Enable
<> 144:ef7eb2e8f9f7 790 * @param OPAMPx OPAMP instance
<> 144:ef7eb2e8f9f7 791 * @retval None
<> 144:ef7eb2e8f9f7 792 */
<> 144:ef7eb2e8f9f7 793 __STATIC_INLINE void LL_OPAMP_Enable(OPAMP_TypeDef *OPAMPx)
<> 144:ef7eb2e8f9f7 794 {
<> 144:ef7eb2e8f9f7 795 SET_BIT(OPAMPx->CSR, OPAMP_CSR_OPAMPxEN);
<> 144:ef7eb2e8f9f7 796 }
<> 144:ef7eb2e8f9f7 797
<> 144:ef7eb2e8f9f7 798 /**
<> 144:ef7eb2e8f9f7 799 * @brief Disable OPAMP instance.
<> 144:ef7eb2e8f9f7 800 * @rmtoll CSR OPAMPXEN LL_OPAMP_Disable
<> 144:ef7eb2e8f9f7 801 * @param OPAMPx OPAMP instance
<> 144:ef7eb2e8f9f7 802 * @retval None
<> 144:ef7eb2e8f9f7 803 */
<> 144:ef7eb2e8f9f7 804 __STATIC_INLINE void LL_OPAMP_Disable(OPAMP_TypeDef *OPAMPx)
<> 144:ef7eb2e8f9f7 805 {
<> 144:ef7eb2e8f9f7 806 CLEAR_BIT(OPAMPx->CSR, OPAMP_CSR_OPAMPxEN);
<> 144:ef7eb2e8f9f7 807 }
<> 144:ef7eb2e8f9f7 808
<> 144:ef7eb2e8f9f7 809 /**
<> 144:ef7eb2e8f9f7 810 * @brief Get OPAMP instance enable state
<> 144:ef7eb2e8f9f7 811 * (0: OPAMP is disabled, 1: OPAMP is enabled)
<> 144:ef7eb2e8f9f7 812 * @rmtoll CSR OPAMPXEN LL_OPAMP_IsEnabled
<> 144:ef7eb2e8f9f7 813 * @param OPAMPx OPAMP instance
<> 144:ef7eb2e8f9f7 814 * @retval State of bit (1 or 0).
<> 144:ef7eb2e8f9f7 815 */
<> 144:ef7eb2e8f9f7 816 __STATIC_INLINE uint32_t LL_OPAMP_IsEnabled(OPAMP_TypeDef *OPAMPx)
<> 144:ef7eb2e8f9f7 817 {
<> 144:ef7eb2e8f9f7 818 return (READ_BIT(OPAMPx->CSR, OPAMP_CSR_OPAMPxEN) == (OPAMP_CSR_OPAMPxEN));
<> 144:ef7eb2e8f9f7 819 }
<> 144:ef7eb2e8f9f7 820
<> 144:ef7eb2e8f9f7 821 /**
<> 144:ef7eb2e8f9f7 822 * @}
<> 144:ef7eb2e8f9f7 823 */
<> 144:ef7eb2e8f9f7 824
<> 144:ef7eb2e8f9f7 825 #if defined(USE_FULL_LL_DRIVER)
<> 144:ef7eb2e8f9f7 826 /** @defgroup OPAMP_LL_EF_Init Initialization and de-initialization functions
<> 144:ef7eb2e8f9f7 827 * @{
<> 144:ef7eb2e8f9f7 828 */
<> 144:ef7eb2e8f9f7 829
<> 144:ef7eb2e8f9f7 830 ErrorStatus LL_OPAMP_DeInit(OPAMP_TypeDef *OPAMPx);
<> 144:ef7eb2e8f9f7 831 ErrorStatus LL_OPAMP_Init(OPAMP_TypeDef *OPAMPx, LL_OPAMP_InitTypeDef *OPAMP_InitStruct);
<> 144:ef7eb2e8f9f7 832 void LL_OPAMP_StructInit(LL_OPAMP_InitTypeDef *OPAMP_InitStruct);
<> 144:ef7eb2e8f9f7 833
<> 144:ef7eb2e8f9f7 834 /**
<> 144:ef7eb2e8f9f7 835 * @}
<> 144:ef7eb2e8f9f7 836 */
<> 144:ef7eb2e8f9f7 837 #endif /* USE_FULL_LL_DRIVER */
<> 144:ef7eb2e8f9f7 838
<> 144:ef7eb2e8f9f7 839 /**
<> 144:ef7eb2e8f9f7 840 * @}
<> 144:ef7eb2e8f9f7 841 */
<> 144:ef7eb2e8f9f7 842
<> 144:ef7eb2e8f9f7 843 /**
<> 144:ef7eb2e8f9f7 844 * @}
<> 144:ef7eb2e8f9f7 845 */
<> 144:ef7eb2e8f9f7 846
<> 144:ef7eb2e8f9f7 847 #endif /* OPAMP1 || OPAMP2 */
<> 144:ef7eb2e8f9f7 848
<> 144:ef7eb2e8f9f7 849 /**
<> 144:ef7eb2e8f9f7 850 * @}
<> 144:ef7eb2e8f9f7 851 */
<> 144:ef7eb2e8f9f7 852
<> 144:ef7eb2e8f9f7 853 #ifdef __cplusplus
<> 144:ef7eb2e8f9f7 854 }
<> 144:ef7eb2e8f9f7 855 #endif
<> 144:ef7eb2e8f9f7 856
<> 144:ef7eb2e8f9f7 857 #endif /* __STM32L4xx_LL_OPAMP_H */
<> 144:ef7eb2e8f9f7 858
<> 144:ef7eb2e8f9f7 859 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/