STM32L4xx_HAL_Driver  1.14.0
Configuration and operation of OPAMP trimming

Functions

__STATIC_INLINE void LL_OPAMP_SetTrimmingMode (OPAMP_TypeDef *OPAMPx, uint32_t TrimmingMode)
 Set OPAMP trimming mode. CSR USERTRIM LL_OPAMP_SetTrimmingMode. More...
 
__STATIC_INLINE uint32_t LL_OPAMP_GetTrimmingMode (OPAMP_TypeDef *OPAMPx)
 Get OPAMP trimming mode. CSR USERTRIM LL_OPAMP_GetTrimmingMode. More...
 
__STATIC_INLINE void LL_OPAMP_SetCalibrationSelection (OPAMP_TypeDef *OPAMPx, uint32_t TransistorsDiffPair)
 Set OPAMP offset to calibrate the selected transistors differential pair NMOS or PMOS. More...
 
__STATIC_INLINE uint32_t LL_OPAMP_GetCalibrationSelection (OPAMP_TypeDef *OPAMPx)
 Get OPAMP offset to calibrate the selected transistors differential pair NMOS or PMOS. More...
 
__STATIC_INLINE uint32_t LL_OPAMP_IsCalibrationOutputSet (OPAMP_TypeDef *OPAMPx)
 Get OPAMP calibration result of toggling output. More...
 
__STATIC_INLINE void LL_OPAMP_SetTrimmingValue (OPAMP_TypeDef *OPAMPx, uint32_t PowerMode, uint32_t TransistorsDiffPair, uint32_t TrimmingValue)
 Set OPAMP trimming factor for the selected transistors differential pair NMOS or PMOS, corresponding to the selected power mode. OTR TRIMOFFSETN LL_OPAMP_SetTrimmingValue
OTR TRIMOFFSETP LL_OPAMP_SetTrimmingValue
LPOTR TRIMLPOFFSETN LL_OPAMP_SetTrimmingValue
LPOTR TRIMLPOFFSETP LL_OPAMP_SetTrimmingValue. More...
 
__STATIC_INLINE uint32_t LL_OPAMP_GetTrimmingValue (OPAMP_TypeDef *OPAMPx, uint32_t PowerMode, uint32_t TransistorsDiffPair)
 Get OPAMP trimming factor for the selected transistors differential pair NMOS or PMOS, corresponding to the selected power mode. OTR TRIMOFFSETN LL_OPAMP_GetTrimmingValue
OTR TRIMOFFSETP LL_OPAMP_GetTrimmingValue
LPOTR TRIMLPOFFSETN LL_OPAMP_GetTrimmingValue
LPOTR TRIMLPOFFSETP LL_OPAMP_GetTrimmingValue. More...
 

Detailed Description

Function Documentation

◆ LL_OPAMP_GetCalibrationSelection()

__STATIC_INLINE uint32_t LL_OPAMP_GetCalibrationSelection ( OPAMP_TypeDef *  OPAMPx)

Get OPAMP offset to calibrate the selected transistors differential pair NMOS or PMOS.

Note
Preliminarily, OPAMP must be set in mode calibration using function LL_OPAMP_SetMode(). CSR CALSEL LL_OPAMP_GetCalibrationSelection
Parameters
OPAMPxOPAMP instance
Return values
Returnedvalue can be one of the following values:
  • LL_OPAMP_TRIMMING_NMOS
  • LL_OPAMP_TRIMMING_PMOS

Definition at line 708 of file stm32l4xx_ll_opamp.h.

709 {
710  register uint32_t CalibrationSelection = (uint32_t)(READ_BIT(OPAMPx->CSR, OPAMP_CSR_CALSEL));
711 
712  return (CalibrationSelection |
713  (((CalibrationSelection & OPAMP_CSR_CALSEL) == 0UL) ? OPAMP_OTR_TRIMOFFSETN : OPAMP_OTR_TRIMOFFSETP));
714 }

◆ LL_OPAMP_GetTrimmingMode()

__STATIC_INLINE uint32_t LL_OPAMP_GetTrimmingMode ( OPAMP_TypeDef *  OPAMPx)

Get OPAMP trimming mode. CSR USERTRIM LL_OPAMP_GetTrimmingMode.

Parameters
OPAMPxOPAMP instance
Return values
Returnedvalue can be one of the following values:
  • LL_OPAMP_TRIMMING_FACTORY
  • LL_OPAMP_TRIMMING_USER

Definition at line 673 of file stm32l4xx_ll_opamp.h.

674 {
675  return (uint32_t)(READ_BIT(OPAMPx->CSR, OPAMP_CSR_USERTRIM));
676 }

◆ LL_OPAMP_GetTrimmingValue()

__STATIC_INLINE uint32_t LL_OPAMP_GetTrimmingValue ( OPAMP_TypeDef *  OPAMPx,
uint32_t  PowerMode,
uint32_t  TransistorsDiffPair 
)

Get OPAMP trimming factor for the selected transistors differential pair NMOS or PMOS, corresponding to the selected power mode. OTR TRIMOFFSETN LL_OPAMP_GetTrimmingValue
OTR TRIMOFFSETP LL_OPAMP_GetTrimmingValue
LPOTR TRIMLPOFFSETN LL_OPAMP_GetTrimmingValue
LPOTR TRIMLPOFFSETP LL_OPAMP_GetTrimmingValue.

Parameters
OPAMPxOPAMP instance
PowerModeThis parameter can be one of the following values:
  • LL_OPAMP_POWERMODE_NORMAL
  • LL_OPAMP_POWERMODE_LOWPOWER
TransistorsDiffPairThis parameter can be one of the following values:
  • LL_OPAMP_TRIMMING_NMOS
  • LL_OPAMP_TRIMMING_PMOS
Return values
0x0...0x1F

Definition at line 778 of file stm32l4xx_ll_opamp.h.

779 {
780  register const uint32_t *preg = __OPAMP_PTR_REG_OFFSET(OPAMPx->OTR, (PowerMode & OPAMP_POWERMODE_OTR_REGOFFSET_MASK));
781 
782  /* Retrieve bits with position in register depending on parameter */
783  /* "TransistorsDiffPair". */
784  /* Parameter used with mask "OPAMP_TRIMMING_VALUE_MASK" because */
785  /* containing other bits reserved for other purpose. */
786  return (uint32_t)(READ_BIT(*preg, (TransistorsDiffPair & OPAMP_TRIMMING_VALUE_MASK))
787  >> ((TransistorsDiffPair == LL_OPAMP_TRIMMING_NMOS) ? OPAMP_OTR_TRIMOFFSETN_Pos : OPAMP_OTR_TRIMOFFSETP_Pos));
788 }

◆ LL_OPAMP_IsCalibrationOutputSet()

__STATIC_INLINE uint32_t LL_OPAMP_IsCalibrationOutputSet ( OPAMP_TypeDef *  OPAMPx)

Get OPAMP calibration result of toggling output.

Note
This functions returns: 0 if OPAMP calibration output is reset 1 if OPAMP calibration output is set CSR CALOUT LL_OPAMP_IsCalibrationOutputSet
Parameters
OPAMPxOPAMP instance
Return values
Stateof bit (1 or 0).

Definition at line 725 of file stm32l4xx_ll_opamp.h.

726 {
727  return ((READ_BIT(OPAMPx->CSR, OPAMP_CSR_CALOUT) == OPAMP_CSR_CALOUT) ? 1UL : 0UL);
728 }

◆ LL_OPAMP_SetCalibrationSelection()

__STATIC_INLINE void LL_OPAMP_SetCalibrationSelection ( OPAMP_TypeDef *  OPAMPx,
uint32_t  TransistorsDiffPair 
)

Set OPAMP offset to calibrate the selected transistors differential pair NMOS or PMOS.

Note
Preliminarily, OPAMP must be set in mode calibration using function LL_OPAMP_SetMode(). CSR CALSEL LL_OPAMP_SetCalibrationSelection
Parameters
OPAMPxOPAMP instance
TransistorsDiffPairThis parameter can be one of the following values:
  • LL_OPAMP_TRIMMING_NMOS
  • LL_OPAMP_TRIMMING_PMOS
Return values
None

Definition at line 690 of file stm32l4xx_ll_opamp.h.

691 {
692  /* Parameter used with mask "OPAMP_TRIMMING_SELECT_MASK" because */
693  /* containing other bits reserved for other purpose. */
694  MODIFY_REG(OPAMPx->CSR, OPAMP_CSR_CALSEL, (TransistorsDiffPair & OPAMP_TRIMMING_SELECT_MASK));
695 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_OPAMP_SetTrimmingMode()

__STATIC_INLINE void LL_OPAMP_SetTrimmingMode ( OPAMP_TypeDef *  OPAMPx,
uint32_t  TrimmingMode 
)

Set OPAMP trimming mode. CSR USERTRIM LL_OPAMP_SetTrimmingMode.

Parameters
OPAMPxOPAMP instance
TrimmingModeThis parameter can be one of the following values:
  • LL_OPAMP_TRIMMING_FACTORY
  • LL_OPAMP_TRIMMING_USER
Return values
None

Definition at line 660 of file stm32l4xx_ll_opamp.h.

661 {
662  MODIFY_REG(OPAMPx->CSR, OPAMP_CSR_USERTRIM, TrimmingMode);
663 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_OPAMP_SetTrimmingValue()

__STATIC_INLINE void LL_OPAMP_SetTrimmingValue ( OPAMP_TypeDef *  OPAMPx,
uint32_t  PowerMode,
uint32_t  TransistorsDiffPair,
uint32_t  TrimmingValue 
)

Set OPAMP trimming factor for the selected transistors differential pair NMOS or PMOS, corresponding to the selected power mode. OTR TRIMOFFSETN LL_OPAMP_SetTrimmingValue
OTR TRIMOFFSETP LL_OPAMP_SetTrimmingValue
LPOTR TRIMLPOFFSETN LL_OPAMP_SetTrimmingValue
LPOTR TRIMLPOFFSETP LL_OPAMP_SetTrimmingValue.

Parameters
OPAMPxOPAMP instance
PowerModeThis parameter can be one of the following values:
  • LL_OPAMP_POWERMODE_NORMAL
  • LL_OPAMP_POWERMODE_LOWPOWER
TransistorsDiffPairThis parameter can be one of the following values:
  • LL_OPAMP_TRIMMING_NMOS
  • LL_OPAMP_TRIMMING_PMOS
TrimmingValue0x00...0x1F
Return values
None

Definition at line 748 of file stm32l4xx_ll_opamp.h.

749 {
750  register uint32_t *preg = __OPAMP_PTR_REG_OFFSET(OPAMPx->OTR, (PowerMode & OPAMP_POWERMODE_OTR_REGOFFSET_MASK));
751 
752  /* Set bits with position in register depending on parameter */
753  /* "TransistorsDiffPair". */
754  /* Parameter used with mask "OPAMP_TRIMMING_VALUE_MASK" because */
755  /* containing other bits reserved for other purpose. */
756  MODIFY_REG(*preg,
757  (TransistorsDiffPair & OPAMP_TRIMMING_VALUE_MASK),
758  TrimmingValue << ((TransistorsDiffPair == LL_OPAMP_TRIMMING_NMOS) ? OPAMP_OTR_TRIMOFFSETN_Pos : OPAMP_OTR_TRIMOFFSETP_Pos));
759 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)