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:
Kojto
Date:
Tue Feb 14 11:24:20 2017 +0000
Revision:
136:ef9c61f8c49f
Parent:
128:9bcdf88f62b0
Child:
165:d1b4690b3f8b
Release 136 of the mbed library

Ports for Upcoming Targets


Fixes and Changes

3432: Target STM USBHOST support https://github.com/ARMmbed/mbed-os/pull/3432
3181: NUCLEO_F207ZG extending PeripheralPins.c: all available alternate functions can be used now https://github.com/ARMmbed/mbed-os/pull/3181
3626: NUCLEO_F412ZG : Add USB Device +Host https://github.com/ARMmbed/mbed-os/pull/3626
3628: Fix warnings https://github.com/ARMmbed/mbed-os/pull/3628
3629: STM32: L0 LL layer https://github.com/ARMmbed/mbed-os/pull/3629
3632: IDE Export support for platform VK_RZ_A1H https://github.com/ARMmbed/mbed-os/pull/3632
3642: Missing IRQ pin fix for platform VK_RZ_A1H https://github.com/ARMmbed/mbed-os/pull/3642
3664: Fix ncs36510 sleep definitions https://github.com/ARMmbed/mbed-os/pull/3664
3655: [STM32F4] Modify folder structure https://github.com/ARMmbed/mbed-os/pull/3655
3657: [STM32L4] Modify folder structure https://github.com/ARMmbed/mbed-os/pull/3657
3658: [STM32F3] Modify folder structure https://github.com/ARMmbed/mbed-os/pull/3658
3685: STM32: I2C: reset state machine https://github.com/ARMmbed/mbed-os/pull/3685
3692: uVisor: Standardize available legacy heap and stack https://github.com/ARMmbed/mbed-os/pull/3692
3621: Fix for #2884, LPC824: export to LPCXpresso, target running with wron https://github.com/ARMmbed/mbed-os/pull/3621
3649: [STM32F7] Modify folder structure https://github.com/ARMmbed/mbed-os/pull/3649
3695: Enforce device_name is valid in targets.json https://github.com/ARMmbed/mbed-os/pull/3695
3723: NCS36510: spi_format function bug fix https://github.com/ARMmbed/mbed-os/pull/3723

Who changed what in which revision?

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