20#ifndef __STM32H7xx_LL_OPAMP_H
21#define __STM32H7xx_LL_OPAMP_H
34#if defined (OPAMP1) || defined (OPAMP2)
56#define OPAMP_POWERMODE_OTR_REGOFFSET 0x00000000U
57#define OPAMP_POWERMODE_HSOTR_REGOFFSET 0x00000001U
58#define OPAMP_POWERMODE_OTR_REGOFFSET_MASK (OPAMP_POWERMODE_OTR_REGOFFSET | OPAMP_POWERMODE_HSOTR_REGOFFSET)
61#define OPAMP_POWERMODE_CSR_BIT_MASK (OPAMP_CSR_OPAHSM)
68#define OPAMP_TRIMMING_SELECT_MASK 0x00030000U
69#define OPAMP_TRIMMING_VALUE_MASK (OPAMP_OTR_TRIMOFFSETP | OPAMP_OTR_TRIMOFFSETN)
90#define __OPAMP_PTR_REG_OFFSET(__REG__, __REG_OFFSET__) \
91 ((__IO uint32_t *)((uint32_t) ((uint32_t)(&(__REG__)) + ((__REG_OFFSET__) << 2U))))
101#if defined(USE_FULL_LL_DRIVER) || defined(__rtems__)
118 uint32_t FunctionalMode;
124 uint32_t InputNonInverting;
129 uint32_t InputInverting;
135} LL_OPAMP_InitTypeDef;
152#define LL_OPAMP_MODE_FUNCTIONAL 0x00000000U
153#define LL_OPAMP_MODE_CALIBRATION (OPAMP_CSR_CALON)
162#define LL_OPAMP_MODE_STANDALONE 0x00000000U
163#define LL_OPAMP_MODE_FOLLOWER (OPAMP_CSR_VMSEL_1 | OPAMP_CSR_VMSEL_0)
164#define LL_OPAMP_MODE_PGA (OPAMP_CSR_VMSEL_1)
165#define LL_OPAMP_MODE_PGA_IO0 (OPAMP_CSR_PGGAIN_2|OPAMP_CSR_VMSEL_1)
166#define LL_OPAMP_MODE_PGA_IO0_BIAS (OPAMP_CSR_PGGAIN_3|OPAMP_CSR_VMSEL_1)
169#define LL_OPAMP_MODE_PGA_IO0_IO1_BIAS (OPAMP_CSR_PGGAIN_3|OPAMP_CSR_PGGAIN_2|OPAMP_CSR_VMSEL_1)
188#define LL_OPAMP_PGA_GAIN_2_OR_MINUS_1 0x00000000U
189#define LL_OPAMP_PGA_GAIN_4_OR_MINUS_3 ( OPAMP_CSR_PGGAIN_0)
190#define LL_OPAMP_PGA_GAIN_8_OR_MINUS_7 ( OPAMP_CSR_PGGAIN_1 )
191#define LL_OPAMP_PGA_GAIN_16_OR_MINUS_15 ( OPAMP_CSR_PGGAIN_1 | OPAMP_CSR_PGGAIN_0)
200#define LL_OPAMP_INPUT_NONINVERT_IO0 0x00000000U
203#define LL_OPAMP_INPUT_NONINVERT_DAC OPAMP_CSR_VPSEL_0
207#define LL_OPAMP_INPUT_NONINVERT_DAC2 OPAMP_CSR_VPSEL_1
221#define LL_OPAMP_INPUT_INVERT_IO0 0x00000000U
224#define LL_OPAMP_INPUT_INVERT_IO1 OPAMP_CSR_VMSEL_0
227#define LL_OPAMP_INPUT_INVERT_CONNECT_NO OPAMP_CSR_VMSEL_1
239#define LL_OPAMP_POWERMODE_NORMAL (OPAMP_POWERMODE_OTR_REGOFFSET)
240#define LL_OPAMP_POWERMODE_HIGHSPEED (OPAMP_POWERMODE_HSOTR_REGOFFSET | OPAMP_CSR_OPAHSM)
249#define LL_OPAMP_TRIMMING_FACTORY 0x00000000U
250#define LL_OPAMP_TRIMMING_USER OPAMP_CSR_USERTRIM
259#define LL_OPAMP_TRIMMING_NMOS_VREF_90PC_VDDA (OPAMP_OTR_TRIMOFFSETN | ((OPAMP_CSR_CALSEL_1 | OPAMP_CSR_CALSEL_0) << 4))
260#define LL_OPAMP_TRIMMING_NMOS_VREF_50PC_VDDA (OPAMP_OTR_TRIMOFFSETN | (OPAMP_CSR_CALSEL_1 << 4))
261#define LL_OPAMP_TRIMMING_PMOS_VREF_10PC_VDDA (OPAMP_OTR_TRIMOFFSETP | (OPAMP_CSR_CALSEL_0 << 4))
262#define LL_OPAMP_TRIMMING_PMOS_VREF_3_3PC_VDDA (OPAMP_OTR_TRIMOFFSETP )
263#define LL_OPAMP_TRIMMING_NMOS (LL_OPAMP_TRIMMING_NMOS_VREF_90PC_VDDA)
264#define LL_OPAMP_TRIMMING_PMOS (LL_OPAMP_TRIMMING_PMOS_VREF_10PC_VDDA)
287#define LL_OPAMP_DELAY_STARTUP_US (3U)
312#define LL_OPAMP_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG((__INSTANCE__)->__REG__, (__VALUE__))
320#define LL_OPAMP_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
338#if defined(OPAMP1) && defined(OPAMP2)
339#define __LL_OPAMP_COMMON_INSTANCE(__OPAMPx__) \
355#if defined(OPAMP1) && defined(OPAMP2)
356#define __LL_OPAMP_IS_ENABLED_ALL_COMMON_INSTANCE() \
357 (LL_OPAMP_IsEnabled(OPAMP1) | \
358 LL_OPAMP_IsEnabled(OPAMP2) )
395__STATIC_INLINE
void LL_OPAMP_SetMode(
OPAMP_TypeDef *OPAMPx, uint32_t Mode)
414__STATIC_INLINE uint32_t LL_OPAMP_GetMode(
OPAMP_TypeDef *OPAMPx)
437__STATIC_INLINE
void LL_OPAMP_SetFunctionalMode(
OPAMP_TypeDef *OPAMPx, uint32_t FunctionalMode)
456__STATIC_INLINE uint32_t LL_OPAMP_GetFunctionalMode(
OPAMP_TypeDef *OPAMPx)
474__STATIC_INLINE
void LL_OPAMP_SetPGAGain(
OPAMP_TypeDef *OPAMPx, uint32_t PGAGain)
491__STATIC_INLINE uint32_t LL_OPAMP_GetPGAGain(
OPAMP_TypeDef *OPAMPx)
506__STATIC_INLINE
void LL_OPAMP_SetPowerMode(
OPAMP_TypeDef *OPAMPx, uint32_t PowerMode)
520__STATIC_INLINE uint32_t LL_OPAMP_GetPowerMode(
OPAMP_TypeDef *OPAMPx)
524 return (uint32_t)(power_mode | (power_mode >> (OPAMP_CSR_OPAHSM_Pos)));
545__STATIC_INLINE
void LL_OPAMP_SetInputNonInverting(
OPAMP_TypeDef *OPAMPx, uint32_t InputNonInverting)
559__STATIC_INLINE uint32_t LL_OPAMP_GetInputNonInverting(
OPAMP_TypeDef *OPAMPx)
578__STATIC_INLINE
void LL_OPAMP_SetInputInverting(
OPAMP_TypeDef *OPAMPx, uint32_t InputInverting)
595__STATIC_INLINE uint32_t LL_OPAMP_GetInputInverting(
OPAMP_TypeDef *OPAMPx)
622__STATIC_INLINE
void LL_OPAMP_SetTrimmingMode(
OPAMP_TypeDef *OPAMPx, uint32_t TrimmingMode)
635__STATIC_INLINE uint32_t LL_OPAMP_GetTrimmingMode(
OPAMP_TypeDef *OPAMPx)
658__STATIC_INLINE
void LL_OPAMP_SetCalibrationSelection(
OPAMP_TypeDef *OPAMPx, uint32_t TransistorsDiffPair)
662 MODIFY_REG(OPAMPx->
CSR,
OPAMP_CSR_CALSEL, ((TransistorsDiffPair & OPAMP_TRIMMING_SELECT_MASK) >> 4));
682__STATIC_INLINE uint32_t LL_OPAMP_GetCalibrationSelection(
OPAMP_TypeDef *OPAMPx)
686 return (uint32_t)((CalibrationSelection << 4)|
699__STATIC_INLINE uint32_t LL_OPAMP_IsCalibrationOutputSet(
OPAMP_TypeDef *OPAMPx)
722__STATIC_INLINE
void LL_OPAMP_SetTrimmingValue(
OPAMP_TypeDef* OPAMPx, uint32_t PowerMode, uint32_t TransistorsDiffPair, uint32_t TrimmingValue)
724 __IO uint32_t *preg = __OPAMP_PTR_REG_OFFSET(OPAMPx->
OTR, (PowerMode & OPAMP_POWERMODE_OTR_REGOFFSET_MASK));
731 (TransistorsDiffPair & OPAMP_TRIMMING_VALUE_MASK) << 1U,
732 TrimmingValue << ((TransistorsDiffPair == LL_OPAMP_TRIMMING_NMOS) ? OPAMP_OTR_TRIMOFFSETN_Pos : OPAMP_OTR_TRIMOFFSETP_Pos));
752__STATIC_INLINE uint32_t LL_OPAMP_GetTrimmingValue(
OPAMP_TypeDef* OPAMPx, uint32_t PowerMode, uint32_t TransistorsDiffPair)
754 const __IO uint32_t *preg = __OPAMP_PTR_REG_OFFSET(OPAMPx->
OTR, (PowerMode & OPAMP_POWERMODE_OTR_REGOFFSET_MASK));
760 return (uint32_t)(READ_BIT(*preg, (TransistorsDiffPair & OPAMP_TRIMMING_VALUE_MASK))
761 >> ((TransistorsDiffPair == LL_OPAMP_TRIMMING_NMOS) ? OPAMP_OTR_TRIMOFFSETN_Pos : OPAMP_OTR_TRIMOFFSETP_Pos));
804__STATIC_INLINE uint32_t LL_OPAMP_IsEnabled(
OPAMP_TypeDef *OPAMPx)
812#if defined(USE_FULL_LL_DRIVER) || defined(__rtems__)
819ErrorStatus LL_OPAMP_Init(
OPAMP_TypeDef *OPAMPx, LL_OPAMP_InitTypeDef *OPAMP_InitStruct);
820void LL_OPAMP_StructInit(LL_OPAMP_InitTypeDef *OPAMP_InitStruct);
#define __IO
Definition: core_cm4.h:239
#define OPAMP_CSR_OPAHSM
Definition: stm32h723xx.h:13838
#define OPAMP_CSR_CALSEL_1
Definition: stm32h723xx.h:13847
#define OPAMP_CSR_VPSEL
Definition: stm32h723xx.h:13826
#define OPAMP_CSR_VMSEL_0
Definition: stm32h723xx.h:13833
#define OPAMP_CSR_USERTRIM
Definition: stm32h723xx.h:13859
#define OPAMP_CSR_OPAMPxEN
Definition: stm32h723xx.h:13819
#define OPAMP_OTR_TRIMOFFSETP
Definition: stm32h723xx.h:13975
#define OPAMP_OTR_TRIMOFFSETN
Definition: stm32h723xx.h:13972
#define OPAMP_CSR_PGGAIN_1
Definition: stm32h723xx.h:13853
#define OPAMP_CSR_CALOUT
Definition: stm32h723xx.h:13865
#define OPAMP_CSR_PGGAIN_3
Definition: stm32h723xx.h:13855
#define OPAMP_CSR_PGGAIN_2
Definition: stm32h723xx.h:13854
#define OPAMP_CSR_CALSEL
Definition: stm32h723xx.h:13845
#define OPAMP_CSR_CALON
Definition: stm32h723xx.h:13841
#define OPAMP_CSR_VMSEL
Definition: stm32h723xx.h:13832
#define OPAMP_CSR_PGGAIN_0
Definition: stm32h723xx.h:13852
CMSIS STM32H7xx Device Peripheral Access Layer Header File.
Operational Amplifier (OPAMP)
Definition: stm32h723xx.h:1083
__IO uint32_t OTR
Definition: stm32h723xx.h:1085
__IO uint32_t CSR
Definition: stm32h723xx.h:1084