The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Wed Jun 21 17:31:38 2017 +0100
Revision:
145:64910690c574
Parent:
128:9bcdf88f62b0
Release 145 of the mbed library.

Who changed what in which revision?

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