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