TUKS MCU Introductory course / TUKS-COURSE-TIMER
Committer:
elmot
Date:
Fri Feb 24 21:13:56 2017 +0000
Revision:
1:d0dfbce63a89
Ready-to-copy

Who changed what in which revision?

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