Updated and Validated
[betaflight.git] / lib / main / STM32F3 / Drivers / STM32F3xx_HAL_Driver / Inc / stm32f3xx_ll_opamp.h
blobcb20141a4b1f088397dfaa4abab59275a6d81386
1 /**
2 ******************************************************************************
3 * @file stm32f3xx_ll_opamp.h
4 * @author MCD Application Team
5 * @brief Header file of OPAMP LL module.
6 ******************************************************************************
7 * @attention
9 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
11 * Redistribution and use in source and binary forms, with or without modification,
12 * are permitted provided that the following conditions are met:
13 * 1. Redistributions of source code must retain the above copyright notice,
14 * this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 * 3. Neither the name of STMicroelectronics nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 ******************************************************************************
36 /* Define to prevent recursive inclusion -------------------------------------*/
37 #ifndef __STM32F3xx_LL_OPAMP_H
38 #define __STM32F3xx_LL_OPAMP_H
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
44 /* Includes ------------------------------------------------------------------*/
45 #include "stm32f3xx.h"
47 /** @addtogroup STM32F3xx_LL_Driver
48 * @{
51 #if defined (OPAMP1) || defined (OPAMP2) || defined (OPAMP3) || defined (OPAMP4)
53 /** @defgroup OPAMP_LL OPAMP
54 * @{
57 /* Private types -------------------------------------------------------------*/
58 /* Private variables ---------------------------------------------------------*/
60 /* Private constants ---------------------------------------------------------*/
61 /** @defgroup OPAMP_LL_Private_Constants OPAMP Private Constants
62 * @{
65 /* Internal mask for OPAMP trimming of transistors differential pair NMOS */
66 /* or PMOS. */
67 /* To select into literal LL_OPAMP_TRIMMING_x the relevant bits for: */
68 /* - OPAMP trimming selection of transistors differential pair */
69 /* - OPAMP trimming values of transistors differential pair */
70 #define OPAMP_TRIMMING_SELECT_MASK (OPAMP_CSR_CALSEL)
71 #define OPAMP_TRIMMING_VALUE_MASK (OPAMP_CSR_TRIMOFFSETN | OPAMP_CSR_TRIMOFFSETP)
73 /**
74 * @}
78 /* Private macros ------------------------------------------------------------*/
79 /** @defgroup OPAMP_LL_Private_Macros OPAMP Private Macros
80 * @{
83 /**
84 * @brief Driver macro reserved for internal use: set a pointer to
85 * a register from a register basis from which an offset
86 * is applied.
87 * @param __REG__ Register basis from which the offset is applied.
88 * @param __REG_OFFSET__ Offset to be applied (unit: number of registers).
89 * @retval Register address
91 #define __OPAMP_PTR_REG_OFFSET(__REG__, __REG_OFFSET__) \
92 ((uint32_t *)((uint32_t) ((uint32_t)(&(__REG__)) + ((__REG_OFFSET__) << 2U))))
97 /**
98 * @}
102 /* Exported types ------------------------------------------------------------*/
103 #if defined(USE_FULL_LL_DRIVER)
104 /** @defgroup OPAMP_LL_ES_INIT OPAMP Exported Init structure
105 * @{
109 * @brief Structure definition of some features of OPAMP instance.
111 typedef struct
113 uint32_t FunctionalMode; /*!< Set OPAMP functional mode by setting internal connections: OPAMP operation in standalone, follower, ...
114 This parameter can be a value of @ref OPAMP_LL_EC_FUNCTIONAL_MODE
115 @note If OPAMP is configured in mode PGA, the gain can be configured using function @ref LL_OPAMP_SetPGAGain().
117 This feature can be modified afterwards using unitary function @ref LL_OPAMP_SetFunctionalMode(). */
119 uint32_t InputNonInverting; /*!< Set OPAMP input non-inverting connection.
120 This parameter can be a value of @ref OPAMP_LL_EC_INPUT_NONINVERTING
122 This feature can be modified afterwards using unitary function @ref LL_OPAMP_SetInputNonInverting(). */
124 uint32_t InputInverting; /*!< Set OPAMP inverting input connection.
125 This parameter can be a value of @ref OPAMP_LL_EC_INPUT_INVERTING
126 @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.
128 This feature can be modified afterwards using unitary function @ref LL_OPAMP_SetInputInverting(). */
130 } LL_OPAMP_InitTypeDef;
133 * @}
135 #endif /* USE_FULL_LL_DRIVER */
137 /* Exported constants --------------------------------------------------------*/
138 /** @defgroup OPAMP_LL_Exported_Constants OPAMP Exported Constants
139 * @{
142 /** @defgroup OPAMP_LL_EC_MODE OPAMP mode calibration or functional.
143 * @{
145 #define LL_OPAMP_MODE_FUNCTIONAL ((uint32_t)0x00000000U) /*!< OPAMP functional mode */
146 #define LL_OPAMP_MODE_CALIBRATION (OPAMP_CSR_CALON) /*!< OPAMP calibration mode */
148 * @}
151 /** @defgroup OPAMP_LL_EC_FUNCTIONAL_MODE OPAMP functional mode
152 * @{
154 #define LL_OPAMP_MODE_STANDALONE ((uint32_t)0x00000000U) /*!< OPAMP functional mode, OPAMP operation in standalone */
155 #define LL_OPAMP_MODE_FOLLOWER (OPAMP_CSR_VMSEL_1 | OPAMP_CSR_VMSEL_0) /*!< OPAMP functional mode, OPAMP operation in follower */
156 #define LL_OPAMP_MODE_PGA (OPAMP_CSR_VMSEL_1) /*!< OPAMP functional mode, OPAMP operation in PGA */
157 #define LL_OPAMP_MODE_PGA_EXT_FILT_IO0 (OPAMP_CSR_PGGAIN_3 | OPAMP_CSR_VMSEL_1) /*!< OPAMP functional mode, OPAMP operation in PGA with external filtering on OPAMP input IO0. */
158 #define LL_OPAMP_MODE_PGA_EXT_FILT_IO1 (OPAMP_CSR_PGGAIN_3 | OPAMP_CSR_PGGAIN_2 | OPAMP_CSR_VMSEL_1) /*!< OPAMP functional mode, OPAMP operation in PGA with external filtering on OPAMP input IO1. */
160 * @}
163 /** @defgroup OPAMP_LL_EC_MODE_PGA_GAIN OPAMP PGA gain (relevant when OPAMP is in functional mode PGA)
164 * @{
166 #define LL_OPAMP_PGA_GAIN_2 ((uint32_t)0x00000000U) /*!< OPAMP PGA gain 2 */
167 #define LL_OPAMP_PGA_GAIN_4 (OPAMP_CSR_PGGAIN_0) /*!< OPAMP PGA gain 4 */
168 #define LL_OPAMP_PGA_GAIN_8 (OPAMP_CSR_PGGAIN_1) /*!< OPAMP PGA gain 8 */
169 #define LL_OPAMP_PGA_GAIN_16 (OPAMP_CSR_PGGAIN_1 | OPAMP_CSR_PGGAIN_0 ) /*!< OPAMP PGA gain 16 */
171 * @}
174 /** @defgroup OPAMP_LL_EC_INPUT_NONINVERTING OPAMP input non-inverting
175 * @{
177 #define LL_OPAMP_INPUT_NONINVERT_IO0 (OPAMP_CSR_VPSEL) /*!< OPAMP non inverting input connected to GPIO pin (pin PA1 for OPAMP1, pin PA7 for OPAMP2, pin PB0 for OPAMP3, pin PB13 for OPAMP4) */
178 #define LL_OPAMP_INPUT_NONINVERT_IO1 ((uint32_t)0x00000000) /*!< OPAMP non inverting input connected to GPIO pin (pin PA7 for OPAMP1, pin PD14 for OPAMP2, pin PB13 for OPAMP3, pin PD11 for OPAMP4) */
179 #define LL_OPAMP_INPUT_NONINVERT_IO2 (OPAMP_CSR_VPSEL_1) /*!< OPAMP non inverting input connected to GPIO pin (pin PA3 for OPAMP1, pin PB0 for OPAMP2, pin PA1 for OPAMP3, pin PB11 for OPAMP4) */
180 #define LL_OPAMP_INPUT_NONINVERT_IO3 (OPAMP_CSR_VPSEL_0) /*!< OPAMP non inverting input connected to GPIO pin (pin PA5 for OPAMP1, pin PB14 for OPAMP2, pin PA5 for OPAMP3, pin PA4 for OPAMP4) */
181 #define LL_OPAMP_INPUT_NONINV_DAC1_CH1 (LL_OPAMP_INPUT_NONINVERT_IO3) /*!< OPAMP non inverting input connected to DAC1 channel1 output (specific to OPAMP instances: OPAMP4) */
182 #define LL_OPAMP_INPUT_NONINV_DAC1_CH2 (LL_OPAMP_INPUT_NONINVERT_IO3) /*!< OPAMP non inverting input connected to DAC1 channel2 output (specific to OPAMP instances: OPAMP1, OPAMP3) */
184 * @}
187 /** @defgroup OPAMP_LL_EC_INPUT_INVERTING OPAMP input inverting
188 * @{
190 #define LL_OPAMP_INPUT_INVERT_IO0 ((uint32_t)0x00000000U) /*!< OPAMP inverting input connected to GPIO pin (pin PC5 for OPAMP1, pin PC5 for OPAMP2, pin PB10 for OPAMP3, pin PB10 for OPAMP4). 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). */
191 #define LL_OPAMP_INPUT_INVERT_IO1 (OPAMP_CSR_VMSEL_0) /*!< OPAMP inverting input connected to GPIO pin (pin PA3 for OPAMP1, pin PA5 for OPAMP2, pin PB2 for OPAMP3, pin PD8 for OPAMP4). 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). */
192 #define LL_OPAMP_INPUT_INVERT_CONNECT_NO (OPAMP_CSR_VMSEL_1) /*!< OPAMP inverting input not externally connected (intended for OPAMP in mode follower or PGA without external capacitors for filtering). Note: On this STM32 serie, this literal include cases of value 0x11 for mode follower and value 0x10 for mode PGA. */
194 * @}
197 /** @defgroup OPAMP_LL_EC_INPUT_NONINVERTING_SECONDARY OPAMP input non-inverting secondary
198 * @{
200 #define LL_OPAMP_INPUT_NONINVERT_IO0_SEC (LL_OPAMP_INPUT_NONINVERT_IO0 << (OPAMP_CSR_VPSSEL_Pos - OPAMP_CSR_VPSEL_Pos)) /*!< OPAMP non inverting input secondary connected to GPIO pin (pin PA1 for OPAMP1, pin PA7 for OPAMP2, pin PB0 for OPAMP3, pin PB13 for OPAMP4) */
201 #define LL_OPAMP_INPUT_NONINVERT_IO1_SEC (LL_OPAMP_INPUT_NONINVERT_IO1 << (OPAMP_CSR_VPSSEL_Pos - OPAMP_CSR_VPSEL_Pos)) /*!< OPAMP non inverting input secondary connected to GPIO pin (pin PA7 for OPAMP1, pin PD14 for OPAMP2, pin PB13 for OPAMP3, pin PD11 for OPAMP4) */
202 #define LL_OPAMP_INPUT_NONINVERT_IO2_SEC (LL_OPAMP_INPUT_NONINVERT_IO2 << (OPAMP_CSR_VPSSEL_Pos - OPAMP_CSR_VPSEL_Pos)) /*!< OPAMP non inverting input secondary connected to GPIO pin (pin PA3 for OPAMP1, pin PB0 for OPAMP2, pin PA1 for OPAMP3, pin PB11 for OPAMP4) */
203 #define LL_OPAMP_INPUT_NONINVERT_IO3_SEC (LL_OPAMP_INPUT_NONINVERT_IO3 << (OPAMP_CSR_VPSSEL_Pos - OPAMP_CSR_VPSEL_Pos)) /*!< OPAMP non inverting input secondary connected to GPIO pin (pin PA5 for OPAMP1, pin PD14 for OPAMP2, pin PA5 for OPAMP3, pin PA4 for OPAMP4) */
204 #define LL_OPAMP_INPUT_NONINV_DAC1_CH1_SEC (LL_OPAMP_INPUT_NONINV_DAC1_CH1 << (OPAMP_CSR_VPSSEL_Pos - OPAMP_CSR_VPSEL_Pos)) /*!< OPAMP non inverting input secondary connected to DAC1 channel1 output (specific to OPAMP instances: OPAMP4) */
205 #define LL_OPAMP_INPUT_NONINV_DAC1_CH2_SEC (LL_OPAMP_INPUT_NONINV_DAC1_CH2 << (OPAMP_CSR_VPSSEL_Pos - OPAMP_CSR_VPSEL_Pos)) /*!< OPAMP non inverting input secondary connected to DAC1 channel2 output (specific to OPAMP instances: OPAMP1, OPAMP3) */
208 * @}
211 /** @defgroup OPAMP_LL_EC_INPUT_INVERTING_SECONDARY OPAMP input inverting secondary
212 * @{
214 #define LL_OPAMP_INPUT_INVERT_IO0_SEC (LL_OPAMP_INPUT_INVERT_IO0 << (OPAMP_CSR_VMSSEL_Pos - OPAMP_CSR_VMSEL_Pos)) /*!< OPAMP inverting input secondary connected to GPIO pin (pin PC5 for OPAMP1, pin PC5 for OPAMP2, pin PB10 for OPAMP3, pin PB10 for OPAMP4). 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). */
215 #define LL_OPAMP_INPUT_INVERT_IO1_SEC (LL_OPAMP_INPUT_INVERT_IO1 << (OPAMP_CSR_VMSSEL_Pos - OPAMP_CSR_VMSEL_Pos)) /*!< OPAMP inverting input secondary connected to GPIO pin (pin PA3 for OPAMP1, pin PA5 for OPAMP2, pin PB2 for OPAMP3, pin PD8 for OPAMP4). 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). */
217 * @}
220 /** @defgroup OPAMP_LL_EC_INPUT_MUX_MODE OPAMP inputs multiplexer mode
221 * @{
223 #define LL_OPAMP_INPUT_MUX_DISABLE ((uint32_t)0x00000000U) /*!< OPAMP inputs multiplexer mode dosabled. */
224 #define LL_OPAMP_INPUT_MUX_TIM1_CH6 (OPAMP_CSR_TCMEN) /*!< OPAMP inputs multiplexer mode enabled, controlled by TIM1 CC6. */
226 * @}
229 /** @defgroup OPAMP_LL_EC_VREF_OUTPUT OPAMP internal reference voltage path state to output
230 * @{
232 #define LL_OPAMP_VREF_OUTPUT_DISABLE ((uint32_t)0x00000000U) /*!< OPAMP internal reference voltage path to output is disabled. */
233 #define LL_OPAMP_VREF_OUTPUT_ENABLE (OPAMP_CSR_TSTREF) /*!< OPAMP internal reference voltage path to output is enabled. */
235 * @}
238 /** @defgroup OPAMP_LL_EC_TRIMMING_MODE OPAMP trimming mode
239 * @{
241 #define LL_OPAMP_TRIMMING_FACTORY ((uint32_t)0x00000000U) /*!< OPAMP trimming factors set to factory values */
242 #define LL_OPAMP_TRIMMING_USER (OPAMP_CSR_USERTRIM) /*!< OPAMP trimming factors set to user values */
244 * @}
247 /** @defgroup OPAMP_LL_EC_TRIMMING_TRANSISTORS_DIFF_PAIR OPAMP trimming of transistors differential pair NMOS or PMOS
248 * @{
250 #define LL_OPAMP_TRIMMING_NMOS_VREF_90PC_VDDA (OPAMP_CSR_TRIMOFFSETN | OPAMP_CSR_CALSEL_1 | OPAMP_CSR_CALSEL_0) /*!< OPAMP trimming of transistors differential pair NMOS (internal reference voltage set to 0.9*Vdda). Default parameters to be used for calibration using two trimming steps (one with each transistors differential pair NMOS and PMOS). */
251 #define LL_OPAMP_TRIMMING_NMOS_VREF_50PC_VDDA (OPAMP_CSR_TRIMOFFSETN | OPAMP_CSR_CALSEL_1 ) /*!< OPAMP trimming of transistors differential pair NMOS (internal reference voltage set to 0.5*Vdda). */
252 #define LL_OPAMP_TRIMMING_PMOS_VREF_10PC_VDDA (OPAMP_CSR_TRIMOFFSETP | OPAMP_CSR_CALSEL_0) /*!< OPAMP trimming of transistors differential pair PMOS (internal reference voltage set to 0.1*Vdda). Default parameters to be used for calibration using two trimming steps (one with each transistors differential pair NMOS and PMOS). */
253 #define LL_OPAMP_TRIMMING_PMOS_VREF_3_3PC_VDDA (OPAMP_CSR_TRIMOFFSETP ) /*!< OPAMP trimming of transistors differential pair PMOS (internal reference voltage set to 0.33*Vdda). */
254 #define LL_OPAMP_TRIMMING_NMOS (LL_OPAMP_TRIMMING_NMOS_VREF_90PC_VDDA) /*!< OPAMP trimming of transistors differential pair NMOS (internal reference voltage set to 0.9*Vdda). Default parameters to be used for calibration using two trimming steps (one with each transistors differential pair NMOS and PMOS). */
255 #define LL_OPAMP_TRIMMING_PMOS (LL_OPAMP_TRIMMING_PMOS_VREF_10PC_VDDA) /*!< OPAMP trimming of transistors differential pair PMOS (internal reference voltage set to 0.1*Vdda). Default parameters to be used for calibration using two trimming steps (one with each transistors differential pair NMOS and PMOS). */
257 * @}
260 /** @defgroup OPAMP_LL_EC_HW_DELAYS Definitions of OPAMP hardware constraints delays
261 * @note Only OPAMP IP HW delays are defined in OPAMP LL driver driver,
262 * not timeout values.
263 * For details on delays values, refer to descriptions in source code
264 * above each literal definition.
265 * @{
268 /* Delay for OPAMP startup time (transition from state disable to enable). */
269 /* Note: OPAMP startup time depends on board application environment: */
270 /* impedance connected to OPAMP output. */
271 /* The delay below is specified under conditions: */
272 /* - OPAMP in functional mode follower */
273 /* - load impedance of 4kOhm (min), 50pF (max) */
274 /* Literal set to maximum value (refer to device datasheet, */
275 /* parameter "tWAKEUP"). */
276 /* Unit: us */
277 #define LL_OPAMP_DELAY_STARTUP_US ((uint32_t) 5U) /*!< Delay for OPAMP startup time */
280 * @}
284 * @}
287 /* Exported macro ------------------------------------------------------------*/
288 /** @defgroup OPAMP_LL_Exported_Macros OPAMP Exported Macros
289 * @{
291 /** @defgroup OPAMP_LL_EM_WRITE_READ Common write and read registers macro
292 * @{
295 * @brief Write a value in OPAMP register
296 * @param __INSTANCE__ OPAMP Instance
297 * @param __REG__ Register to be written
298 * @param __VALUE__ Value to be written in the register
299 * @retval None
301 #define LL_OPAMP_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
304 * @brief Read a value in OPAMP register
305 * @param __INSTANCE__ OPAMP Instance
306 * @param __REG__ Register to be read
307 * @retval Register value
309 #define LL_OPAMP_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
311 * @}
315 * @}
318 /* Exported functions --------------------------------------------------------*/
319 /** @defgroup OPAMP_LL_Exported_Functions OPAMP Exported Functions
320 * @{
323 /** @defgroup OPAMP_LL_EF_CONFIGURATION_OPAMP_INSTANCE Configuration of OPAMP hierarchical scope: OPAMP instance
324 * @{
328 * @brief Set OPAMP mode calibration or functional.
329 * @note OPAMP mode corresponds to functional or calibration mode:
330 * - functional mode: OPAMP operation in standalone, follower, ...
331 * Set functional mode using function
332 * @ref LL_OPAMP_SetFunctionalMode().
333 * - calibration mode: offset calibration of the selected
334 * transistors differential pair NMOS or PMOS.
335 * @rmtoll CSR CALON LL_OPAMP_SetMode
336 * @param OPAMPx OPAMP instance
337 * @param Mode This parameter can be one of the following values:
338 * @arg @ref LL_OPAMP_MODE_FUNCTIONAL
339 * @arg @ref LL_OPAMP_MODE_CALIBRATION
340 * @retval None
342 __STATIC_INLINE void LL_OPAMP_SetMode(OPAMP_TypeDef *OPAMPx, uint32_t Mode)
344 MODIFY_REG(OPAMPx->CSR, OPAMP_CSR_CALON, Mode);
348 * @brief Get OPAMP mode calibration or functional.
349 * @note OPAMP mode corresponds to functional or calibration mode:
350 * - functional mode: OPAMP operation in standalone, follower, ...
351 * Set functional mode using function
352 * @ref LL_OPAMP_SetFunctionalMode().
353 * - calibration mode: offset calibration of the selected
354 * transistors differential pair NMOS or PMOS.
355 * @rmtoll CSR CALON LL_OPAMP_GetMode
356 * @param OPAMPx OPAMP instance
357 * @retval Returned value can be one of the following values:
358 * @arg @ref LL_OPAMP_MODE_FUNCTIONAL
359 * @arg @ref LL_OPAMP_MODE_CALIBRATION
361 __STATIC_INLINE uint32_t LL_OPAMP_GetMode(OPAMP_TypeDef *OPAMPx)
363 return (uint32_t)(READ_BIT(OPAMPx->CSR, OPAMP_CSR_CALON));
367 * @brief Set OPAMP functional mode by setting internal connections.
368 * OPAMP operation in standalone, follower, ...
369 * @note This function reset bit of calibration mode to ensure
370 * to be in functional mode, in order to have OPAMP parameters
371 * (inputs selection, ...) set with the corresponding OPAMP mode
372 * to be effective.
373 * @rmtoll CSR VMSEL LL_OPAMP_SetFunctionalMode
374 * @param OPAMPx OPAMP instance
375 * @param FunctionalMode This parameter can be one of the following values:
376 * @arg @ref LL_OPAMP_MODE_STANDALONE
377 * @arg @ref LL_OPAMP_MODE_FOLLOWER
378 * @arg @ref LL_OPAMP_MODE_PGA
379 * @arg @ref LL_OPAMP_MODE_PGA_EXT_FILT_IO0
380 * @arg @ref LL_OPAMP_MODE_PGA_EXT_FILT_IO1
381 * @retval None
383 __STATIC_INLINE void LL_OPAMP_SetFunctionalMode(OPAMP_TypeDef *OPAMPx, uint32_t FunctionalMode)
385 /* Note: Bit OPAMP_CSR_CALON reset to ensure to be in functional mode */
386 MODIFY_REG(OPAMPx->CSR, OPAMP_CSR_PGGAIN_3 | OPAMP_CSR_PGGAIN_2 | OPAMP_CSR_VMSEL | OPAMP_CSR_CALON, FunctionalMode);
390 * @brief Get OPAMP functional mode from setting of internal connections.
391 * OPAMP operation in standalone, follower, ...
392 * @rmtoll CSR VMSEL LL_OPAMP_GetFunctionalMode
393 * @param OPAMPx OPAMP instance
394 * @retval Returned value can be one of the following values:
395 * @arg @ref LL_OPAMP_MODE_STANDALONE
396 * @arg @ref LL_OPAMP_MODE_FOLLOWER
397 * @arg @ref LL_OPAMP_MODE_PGA
398 * @arg @ref LL_OPAMP_MODE_PGA_EXT_FILT_IO0
399 * @arg @ref LL_OPAMP_MODE_PGA_EXT_FILT_IO1
401 __STATIC_INLINE uint32_t LL_OPAMP_GetFunctionalMode(OPAMP_TypeDef *OPAMPx)
403 return (uint32_t)(READ_BIT(OPAMPx->CSR, OPAMP_CSR_PGGAIN_3 | OPAMP_CSR_PGGAIN_2 | OPAMP_CSR_VMSEL));
407 * @brief Set OPAMP PGA gain.
408 * @note Preliminarily, OPAMP must be set in mode PGA
409 * using function @ref LL_OPAMP_SetFunctionalMode().
410 * @rmtoll CSR PGGAIN LL_OPAMP_SetPGAGain
411 * @param OPAMPx OPAMP instance
412 * @param PGAGain This parameter can be one of the following values:
413 * @arg @ref LL_OPAMP_PGA_GAIN_2
414 * @arg @ref LL_OPAMP_PGA_GAIN_4
415 * @arg @ref LL_OPAMP_PGA_GAIN_8
416 * @arg @ref LL_OPAMP_PGA_GAIN_16
417 * @retval None
419 __STATIC_INLINE void LL_OPAMP_SetPGAGain(OPAMP_TypeDef *OPAMPx, uint32_t PGAGain)
421 MODIFY_REG(OPAMPx->CSR, OPAMP_CSR_PGGAIN_1 | OPAMP_CSR_PGGAIN_0, PGAGain);
425 * @brief Get OPAMP PGA gain.
426 * @note Preliminarily, OPAMP must be set in mode PGA
427 * using function @ref LL_OPAMP_SetFunctionalMode().
428 * @rmtoll CSR PGGAIN LL_OPAMP_GetPGAGain
429 * @param OPAMPx OPAMP instance
430 * @retval Returned value can be one of the following values:
431 * @arg @ref LL_OPAMP_PGA_GAIN_2
432 * @arg @ref LL_OPAMP_PGA_GAIN_4
433 * @arg @ref LL_OPAMP_PGA_GAIN_8
434 * @arg @ref LL_OPAMP_PGA_GAIN_16
436 __STATIC_INLINE uint32_t LL_OPAMP_GetPGAGain(OPAMP_TypeDef *OPAMPx)
438 return (uint32_t)(READ_BIT(OPAMPx->CSR, OPAMP_CSR_PGGAIN_1 | OPAMP_CSR_PGGAIN_0));
442 * @}
445 /** @defgroup OPAMP_LL_EF_CONFIGURATION_INPUTS Configuration of OPAMP inputs
446 * @{
450 * @brief Set OPAMP non-inverting input connection.
451 * @rmtoll CSR VPSEL LL_OPAMP_SetInputNonInverting
452 * @param OPAMPx OPAMP instance
453 * @param InputNonInverting This parameter can be one of the following values:
454 * @arg @ref LL_OPAMP_INPUT_NONINVERT_IO0
455 * @arg @ref LL_OPAMP_INPUT_NONINVERT_IO1
456 * @arg @ref LL_OPAMP_INPUT_NONINVERT_IO2
457 * @arg @ref LL_OPAMP_INPUT_NONINVERT_IO3
458 * @arg @ref LL_OPAMP_INPUT_NONINV_DAC1_CH1 (1)
459 * @arg @ref LL_OPAMP_INPUT_NONINV_DAC1_CH2 (2)
461 * (1) Parameter specific to OPAMP instances: OPAMP4.\n
462 * (2) Parameter specific to OPAMP instances: OPAMP1, OPAMP3.
463 * @retval None
465 __STATIC_INLINE void LL_OPAMP_SetInputNonInverting(OPAMP_TypeDef *OPAMPx, uint32_t InputNonInverting)
467 MODIFY_REG(OPAMPx->CSR, OPAMP_CSR_VPSEL, InputNonInverting);
471 * @brief Get OPAMP non-inverting input connection.
472 * @rmtoll CSR VPSEL LL_OPAMP_GetInputNonInverting
473 * @param OPAMPx OPAMP instance
474 * @retval Returned value can be one of the following values:
475 * @arg @ref LL_OPAMP_INPUT_NONINVERT_IO0
476 * @arg @ref LL_OPAMP_INPUT_NONINVERT_IO1
477 * @arg @ref LL_OPAMP_INPUT_NONINVERT_IO2
478 * @arg @ref LL_OPAMP_INPUT_NONINVERT_IO3
479 * @arg @ref LL_OPAMP_INPUT_NONINV_DAC1_CH1 (1)
480 * @arg @ref LL_OPAMP_INPUT_NONINV_DAC1_CH2 (2)
482 * (1) Parameter specific to OPAMP instances: OPAMP4.\n
483 * (2) Parameter specific to OPAMP instances: OPAMP1, OPAMP3.
485 __STATIC_INLINE uint32_t LL_OPAMP_GetInputNonInverting(OPAMP_TypeDef *OPAMPx)
487 return (uint32_t)(READ_BIT(OPAMPx->CSR, OPAMP_CSR_VPSEL));
491 * @brief Set OPAMP inverting input connection.
492 * @note OPAMP inverting input is used with OPAMP in mode standalone
493 * or PGA with external capacitors for filtering circuit.
494 * Otherwise (OPAMP in mode follower), OPAMP inverting input
495 * is not used (not connected to GPIO pin).
496 * @rmtoll CSR VMSEL LL_OPAMP_SetInputInverting
497 * @param OPAMPx OPAMP instance
498 * @param InputInverting This parameter can be one of the following values:
499 * @arg @ref LL_OPAMP_INPUT_INVERT_IO0
500 * @arg @ref LL_OPAMP_INPUT_INVERT_IO1
501 * @arg @ref LL_OPAMP_INPUT_INVERT_CONNECT_NO
502 * @retval None
504 __STATIC_INLINE void LL_OPAMP_SetInputInverting(OPAMP_TypeDef *OPAMPx, uint32_t InputInverting)
506 /* Manage cases of OPAMP inverting input not connected (0x10 and 0x11) */
507 /* to not modify OPAMP mode follower or PGA. */
508 /* Bit OPAMP_CSR_VMSEL_1 is set by OPAMP mode (follower, PGA). */
509 MODIFY_REG(OPAMPx->CSR, (~(InputInverting >> 1)) & OPAMP_CSR_VMSEL_0, InputInverting);
513 * @brief Get OPAMP inverting input connection.
514 * @rmtoll CSR VMSEL LL_OPAMP_GetInputInverting
515 * @param OPAMPx OPAMP instance
516 * @retval Returned value can be one of the following values:
517 * @arg @ref LL_OPAMP_INPUT_INVERT_IO0
518 * @arg @ref LL_OPAMP_INPUT_INVERT_IO1
519 * @arg @ref LL_OPAMP_INPUT_INVERT_CONNECT_NO
521 __STATIC_INLINE uint32_t LL_OPAMP_GetInputInverting(OPAMP_TypeDef *OPAMPx)
523 register uint32_t input_inverting = READ_BIT(OPAMPx->CSR, OPAMP_CSR_VMSEL);
525 /* Manage cases 0x10 and 0x11 to return the same value: OPAMP inverting */
526 /* input not connected. */
527 return (input_inverting & ~((input_inverting >> 1) & OPAMP_CSR_VMSEL_0));
531 * @brief Set OPAMP non-inverting input secondary connection.
532 * @rmtoll CSR VPSSEL LL_OPAMP_SetInputNonInvertingSecondary
533 * @param OPAMPx OPAMP instance
534 * @param InputNonInverting This parameter can be one of the following values:
535 * @arg @ref LL_OPAMP_INPUT_NONINVERT_IO0_SEC
536 * @arg @ref LL_OPAMP_INPUT_NONINVERT_IO1_SEC
537 * @arg @ref LL_OPAMP_INPUT_NONINVERT_IO2_SEC
538 * @arg @ref LL_OPAMP_INPUT_NONINVERT_IO3_SEC
539 * @arg @ref LL_OPAMP_INPUT_NONINV_DAC1_CH1_SEC (1)
540 * @arg @ref LL_OPAMP_INPUT_NONINV_DAC1_CH2_SEC (2)
542 * (1) Parameter specific to OPAMP instances: OPAMP4.\n
543 * (2) Parameter specific to OPAMP instances: OPAMP1, OPAMP3.
544 * @retval None
546 __STATIC_INLINE void LL_OPAMP_SetInputNonInvertingSecondary(OPAMP_TypeDef *OPAMPx, uint32_t InputNonInverting)
548 MODIFY_REG(OPAMPx->CSR, OPAMP_CSR_VPSSEL, InputNonInverting);
552 * @brief Get OPAMP non-inverting input secondary connection.
553 * @rmtoll CSR VPSSEL LL_OPAMP_GetInputNonInvertingSecondary
554 * @param OPAMPx OPAMP instance
555 * @retval Returned value can be one of the following values:
556 * @arg @ref LL_OPAMP_INPUT_NONINVERT_IO0_SEC
557 * @arg @ref LL_OPAMP_INPUT_NONINVERT_IO1_SEC
558 * @arg @ref LL_OPAMP_INPUT_NONINVERT_IO2_SEC
559 * @arg @ref LL_OPAMP_INPUT_NONINVERT_IO3_SEC
560 * @arg @ref LL_OPAMP_INPUT_NONINV_DAC1_CH1_SEC (1)
561 * @arg @ref LL_OPAMP_INPUT_NONINV_DAC1_CH2_SEC (2)
563 * (1) Parameter specific to OPAMP instances: OPAMP4.\n
564 * (2) Parameter specific to OPAMP instances: OPAMP1, OPAMP3.
566 __STATIC_INLINE uint32_t LL_OPAMP_GetInputNonInvertingSecondary(OPAMP_TypeDef *OPAMPx)
568 return (uint32_t)(READ_BIT(OPAMPx->CSR, OPAMP_CSR_VPSSEL));
572 * @brief Set OPAMP inverting input secondary connection.
573 * @note OPAMP inverting input is used with OPAMP in mode standalone
574 * or PGA with external capacitors for filtering circuit.
575 * Otherwise (OPAMP in mode follower), OPAMP inverting input
576 * is not used (not connected to GPIO pin).
577 * @rmtoll CSR VMSSEL LL_OPAMP_SetInputInvertingSecondary
578 * @param OPAMPx OPAMP instance
579 * @param InputInverting This parameter can be one of the following values:
580 * @arg @ref LL_OPAMP_INPUT_INVERT_IO0_SEC
581 * @arg @ref LL_OPAMP_INPUT_INVERT_IO1_SEC
582 * @retval None
584 __STATIC_INLINE void LL_OPAMP_SetInputInvertingSecondary (OPAMP_TypeDef *OPAMPx, uint32_t InputInverting)
586 MODIFY_REG(OPAMPx->CSR, OPAMP_CSR_VMSSEL, InputInverting);
590 * @brief Get OPAMP inverting input secondary connection.
591 * @rmtoll CSR VMSSEL LL_OPAMP_GetInputInvertingSecondary
592 * @param OPAMPx OPAMP instance
593 * @retval Returned value can be one of the following values:
594 * @arg @ref LL_OPAMP_INPUT_INVERT_IO0_SEC
595 * @arg @ref LL_OPAMP_INPUT_INVERT_IO1_SEC
597 __STATIC_INLINE uint32_t LL_OPAMP_GetInputInvertingSecondary(OPAMP_TypeDef *OPAMPx)
599 return (uint32_t)(READ_BIT(OPAMPx->CSR, OPAMP_CSR_VMSSEL));
603 * @brief Set OPAMP inputs multiplexer mode.
604 * @rmtoll CSR TCMEN LL_OPAMP_SetInputsMuxMode
605 * @param OPAMPx OPAMP instance
606 * @param InputsMuxMode This parameter can be one of the following values:
607 * @arg @ref LL_OPAMP_INPUT_MUX_DISABLE
608 * @arg @ref LL_OPAMP_INPUT_MUX_TIM1_CH6
609 * @retval None
611 __STATIC_INLINE void LL_OPAMP_SetInputsMuxMode(OPAMP_TypeDef *OPAMPx, uint32_t InputsMuxMode)
613 MODIFY_REG(OPAMPx->CSR, OPAMP_CSR_TCMEN, InputsMuxMode);
617 * @brief Get OPAMP inputs multiplexer mode.
618 * @rmtoll CSR TCMEN LL_OPAMP_GetInputsMuxMode
619 * @param OPAMPx OPAMP instance
620 * @retval Returned value can be one of the following values:
621 * @arg @ref LL_OPAMP_INPUT_MUX_DISABLE
622 * @arg @ref LL_OPAMP_INPUT_MUX_TIM1_CH6
624 __STATIC_INLINE uint32_t LL_OPAMP_GetInputsMuxMode(OPAMP_TypeDef *OPAMPx)
626 return (uint32_t)(READ_BIT(OPAMPx->CSR, OPAMP_CSR_TCMEN));
630 * @}
633 /** @defgroup OPAMP_LL_EF_OPAMP_TRIMMING Configuration and operation of OPAMP trimming
634 * @{
638 * @brief Set OPAMP trimming mode.
639 * @rmtoll CSR USERTRIM LL_OPAMP_SetTrimmingMode
640 * @param OPAMPx OPAMP instance
641 * @param TrimmingMode This parameter can be one of the following values:
642 * @arg @ref LL_OPAMP_TRIMMING_FACTORY
643 * @arg @ref LL_OPAMP_TRIMMING_USER
644 * @retval None
646 __STATIC_INLINE void LL_OPAMP_SetTrimmingMode(OPAMP_TypeDef *OPAMPx, uint32_t TrimmingMode)
648 MODIFY_REG(OPAMPx->CSR, OPAMP_CSR_USERTRIM, TrimmingMode);
652 * @brief Get OPAMP trimming mode.
653 * @rmtoll CSR USERTRIM LL_OPAMP_GetTrimmingMode
654 * @param OPAMPx OPAMP instance
655 * @retval Returned value can be one of the following values:
656 * @arg @ref LL_OPAMP_TRIMMING_FACTORY
657 * @arg @ref LL_OPAMP_TRIMMING_USER
659 __STATIC_INLINE uint32_t LL_OPAMP_GetTrimmingMode(OPAMP_TypeDef *OPAMPx)
661 return (uint32_t)(READ_BIT(OPAMPx->CSR, OPAMP_CSR_USERTRIM));
665 * @brief Set OPAMP offset to calibrate the selected transistors
666 * differential pair NMOS or PMOS.
667 * @note Preliminarily, OPAMP must be set in mode calibration
668 * using function @ref LL_OPAMP_SetMode().
669 * @rmtoll CSR CALSEL LL_OPAMP_SetCalibrationSelection
670 * @param OPAMPx OPAMP instance
671 * @param TransistorsDiffPair This parameter can be one of the following values:
672 * @arg @ref LL_OPAMP_TRIMMING_NMOS (1)
673 * @arg @ref LL_OPAMP_TRIMMING_PMOS (1)
674 * @arg @ref LL_OPAMP_TRIMMING_NMOS_VREF_50PC_VDDA
675 * @arg @ref LL_OPAMP_TRIMMING_PMOS_VREF_3_3PC_VDDA
677 * (1) Default parameters to be used for calibration
678 * using two trimming steps (one with each transistors differential
679 * pair NMOS and PMOS)
680 * @retval None
682 __STATIC_INLINE void LL_OPAMP_SetCalibrationSelection(OPAMP_TypeDef *OPAMPx, uint32_t TransistorsDiffPair)
684 /* Parameter used with mask "OPAMP_TRIMMING_SELECT_MASK" because */
685 /* containing other bits reserved for other purpose. */
686 MODIFY_REG(OPAMPx->CSR, OPAMP_CSR_CALSEL, (TransistorsDiffPair & OPAMP_TRIMMING_SELECT_MASK));
690 * @brief Get OPAMP offset to calibrate the selected transistors
691 * differential pair NMOS or PMOS.
692 * @note Preliminarily, OPAMP must be set in mode calibration
693 * using function @ref LL_OPAMP_SetMode().
694 * @rmtoll CSR CALSEL LL_OPAMP_GetCalibrationSelection
695 * @param OPAMPx OPAMP instance
696 * @retval Returned value can be one of the following values:
697 * @arg @ref LL_OPAMP_TRIMMING_NMOS (1)
698 * @arg @ref LL_OPAMP_TRIMMING_PMOS (1)
699 * @arg @ref LL_OPAMP_TRIMMING_NMOS_VREF_50PC_VDDA
700 * @arg @ref LL_OPAMP_TRIMMING_PMOS_VREF_3_3PC_VDDA
702 * (1) Default parameters to be used for calibration
703 * using two trimming steps (one with each transistors differential
704 * pair NMOS and PMOS)
706 __STATIC_INLINE uint32_t LL_OPAMP_GetCalibrationSelection(OPAMP_TypeDef *OPAMPx)
708 register uint32_t CalibrationSelection = (uint32_t)(READ_BIT(OPAMPx->CSR, OPAMP_CSR_CALSEL));
710 return (CalibrationSelection |
711 ((OPAMP_CSR_TRIMOFFSETN) << (POSITION_VAL(OPAMP_CSR_TRIMOFFSETP) * (CalibrationSelection && OPAMP_CSR_CALSEL))));
715 * @brief Set OPAMP calibration internal reference voltage to output.
716 * @rmtoll CSR TSTREF LL_OPAMP_SetCalibrationVrefOutput
717 * @param OPAMPx OPAMP instance
718 * @param CalibrationVrefOutput This parameter can be one of the following values:
719 * @arg @ref LL_OPAMP_VREF_OUTPUT_DISABLE
720 * @arg @ref LL_OPAMP_VREF_OUTPUT_ENABLE
721 * @retval None
723 __STATIC_INLINE void LL_OPAMP_SetCalibrationVrefOutput(OPAMP_TypeDef *OPAMPx, uint32_t CalibrationVrefOutput)
725 MODIFY_REG(OPAMPx->CSR, OPAMP_CSR_TSTREF, CalibrationVrefOutput);
729 * @brief Get OPAMP calibration internal reference voltage to output.
730 * @rmtoll CSR TSTREF LL_OPAMP_GetCalibrationVrefOutput
731 * @param OPAMPx OPAMP instance
732 * @retval Returned value can be one of the following values:
733 * @arg @ref LL_OPAMP_VREF_OUTPUT_DISABLE
734 * @arg @ref LL_OPAMP_VREF_OUTPUT_ENABLE
736 __STATIC_INLINE uint32_t LL_OPAMP_GetCalibrationVrefOutput(OPAMP_TypeDef *OPAMPx)
738 return (uint32_t)(READ_BIT(OPAMPx->CSR, OPAMP_CSR_TSTREF));
742 * @brief Get OPAMP calibration result of toggling output.
743 * @note This functions returns:
744 * 0 if OPAMP calibration output is reset
745 * 1 if OPAMP calibration output is set
746 * @rmtoll CSR OUTCAL LL_OPAMP_IsCalibrationOutputSet
747 * @param OPAMPx OPAMP instance
748 * @retval State of bit (1 or 0).
750 __STATIC_INLINE uint32_t LL_OPAMP_IsCalibrationOutputSet(OPAMP_TypeDef *OPAMPx)
752 return (READ_BIT(OPAMPx->CSR, OPAMP_CSR_OUTCAL) == OPAMP_CSR_OUTCAL);
756 * @brief Set OPAMP trimming factor for the selected transistors
757 * differential pair NMOS or PMOS, corresponding to the selected
758 * power mode.
759 * @rmtoll CSR TRIMOFFSETN LL_OPAMP_SetTrimmingValue\n
760 * CSR TRIMOFFSETP LL_OPAMP_SetTrimmingValue
761 * @param OPAMPx OPAMP instance
762 * @param TransistorsDiffPair This parameter can be one of the following values:
763 * @arg @ref LL_OPAMP_TRIMMING_NMOS
764 * @arg @ref LL_OPAMP_TRIMMING_PMOS
765 * @param TrimmingValue 0x00...0x1F
766 * @retval None
768 __STATIC_INLINE void LL_OPAMP_SetTrimmingValue(OPAMP_TypeDef* OPAMPx, uint32_t TransistorsDiffPair, uint32_t TrimmingValue)
770 MODIFY_REG(OPAMPx->CSR,
771 (TransistorsDiffPair & OPAMP_TRIMMING_VALUE_MASK),
772 TrimmingValue << (POSITION_VAL(TransistorsDiffPair & OPAMP_TRIMMING_VALUE_MASK)));
776 * @brief Get OPAMP trimming factor for the selected transistors
777 * differential pair NMOS or PMOS, corresponding to the selected
778 * power mode.
779 * @rmtoll CSR TRIMOFFSETN LL_OPAMP_GetTrimmingValue\n
780 * CSR TRIMOFFSETP LL_OPAMP_GetTrimmingValue
781 * @param OPAMPx OPAMP instance
782 * @param TransistorsDiffPair This parameter can be one of the following values:
783 * @arg @ref LL_OPAMP_TRIMMING_NMOS
784 * @arg @ref LL_OPAMP_TRIMMING_PMOS
785 * @retval 0x0...0x1F
787 __STATIC_INLINE uint32_t LL_OPAMP_GetTrimmingValue(OPAMP_TypeDef* OPAMPx, uint32_t TransistorsDiffPair)
789 return (uint32_t)(READ_BIT(OPAMPx->CSR, (TransistorsDiffPair & OPAMP_TRIMMING_VALUE_MASK))
790 >> (POSITION_VAL(TransistorsDiffPair & OPAMP_TRIMMING_VALUE_MASK))
795 * @}
798 /** @defgroup OPAMP_LL_EF_OPERATION Operation on OPAMP instance
799 * @{
802 * @brief Enable OPAMP instance.
803 * @note After enable from off state, OPAMP requires a delay
804 * to fullfill wake up time specification.
805 * Refer to device datasheet, parameter "tWAKEUP".
806 * @rmtoll CSR OPAMPXEN LL_OPAMP_Enable
807 * @param OPAMPx OPAMP instance
808 * @retval None
810 __STATIC_INLINE void LL_OPAMP_Enable(OPAMP_TypeDef *OPAMPx)
812 SET_BIT(OPAMPx->CSR, OPAMP_CSR_OPAMPxEN);
816 * @brief Disable OPAMP instance.
817 * @rmtoll CSR OPAMPXEN LL_OPAMP_Disable
818 * @param OPAMPx OPAMP instance
819 * @retval None
821 __STATIC_INLINE void LL_OPAMP_Disable(OPAMP_TypeDef *OPAMPx)
823 CLEAR_BIT(OPAMPx->CSR, OPAMP_CSR_OPAMPxEN);
827 * @brief Get OPAMP instance enable state
828 * (0: OPAMP is disabled, 1: OPAMP is enabled)
829 * @rmtoll CSR OPAMPXEN LL_OPAMP_IsEnabled
830 * @param OPAMPx OPAMP instance
831 * @retval State of bit (1 or 0).
833 __STATIC_INLINE uint32_t LL_OPAMP_IsEnabled(OPAMP_TypeDef *OPAMPx)
835 return (READ_BIT(OPAMPx->CSR, OPAMP_CSR_OPAMPxEN) == (OPAMP_CSR_OPAMPxEN));
839 * @brief Lock OPAMP instance.
840 * @note Once locked, OPAMP configuration can be accessed in read-only.
841 * @note The only way to unlock the OPAMP is a device hardware reset.
842 * @rmtoll CSR LOCK LL_OPAMP_Lock
843 * @param OPAMPx OPAMP instance
844 * @retval None
846 __STATIC_INLINE void LL_OPAMP_Lock(OPAMP_TypeDef *OPAMPx)
848 SET_BIT(OPAMPx->CSR, OPAMP_CSR_LOCK);
852 * @brief Get OPAMP lock state
853 * (0: OPAMP is unlocked, 1: OPAMP is locked).
854 * @note Once locked, OPAMP configuration can be accessed in read-only.
855 * @note The only way to unlock the OPAMP is a device hardware reset.
856 * @rmtoll CSR LOCK LL_OPAMP_IsLocked
857 * @param OPAMPx OPAMP instance
858 * @retval State of bit (1 or 0).
860 __STATIC_INLINE uint32_t LL_OPAMP_IsLocked(OPAMP_TypeDef *OPAMPx)
862 return (READ_BIT(OPAMPx->CSR, OPAMP_CSR_LOCK) == (OPAMP_CSR_LOCK));
866 * @}
869 #if defined(USE_FULL_LL_DRIVER)
870 /** @defgroup OPAMP_LL_EF_Init Initialization and de-initialization functions
871 * @{
874 ErrorStatus LL_OPAMP_DeInit(OPAMP_TypeDef *OPAMPx);
875 ErrorStatus LL_OPAMP_Init(OPAMP_TypeDef *OPAMPx, LL_OPAMP_InitTypeDef *OPAMP_InitStruct);
876 void LL_OPAMP_StructInit(LL_OPAMP_InitTypeDef *OPAMP_InitStruct);
879 * @}
881 #endif /* USE_FULL_LL_DRIVER */
884 * @}
888 * @}
891 #endif /* OPAMP1 || OPAMP2 || OPAMP3 || OPAMP4 */
894 * @}
897 #ifdef __cplusplus
899 #endif
901 #endif /* __STM32F3xx_LL_OPAMP_H */
903 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/