STM32L4xx_HAL_Driver  1.14.0
Initialization and de-initialization functions

Functions

ErrorStatus LL_OPAMP_DeInit (OPAMP_TypeDef *OPAMPx)
 De-initialize registers of the selected OPAMP instance to their default reset values. More...
 
ErrorStatus LL_OPAMP_Init (OPAMP_TypeDef *OPAMPx, LL_OPAMP_InitTypeDef *OPAMP_InitStruct)
 Initialize some features of OPAMP instance. More...
 
void LL_OPAMP_StructInit (LL_OPAMP_InitTypeDef *OPAMP_InitStruct)
 Set each LL_OPAMP_InitTypeDef field to default value. More...
 

Detailed Description

Function Documentation

◆ LL_OPAMP_DeInit()

ErrorStatus LL_OPAMP_DeInit ( OPAMP_TypeDef *  OPAMPx)

De-initialize registers of the selected OPAMP instance to their default reset values.

Parameters
OPAMPxOPAMP instance
Return values
AnErrorStatus enumeration value:
  • SUCCESS: OPAMP registers are de-initialized
  • ERROR: OPAMP registers are not de-initialized

Definition at line 105 of file stm32l4xx_ll_opamp.c.

106 {
107  ErrorStatus status = SUCCESS;
108 
109  /* Check the parameters */
110  assert_param(IS_OPAMP_ALL_INSTANCE(OPAMPx));
111 
112  LL_OPAMP_WriteReg(OPAMPx, CSR, 0x00000000U);
113 
114  return status;
115 }
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ LL_OPAMP_Init()

ErrorStatus LL_OPAMP_Init ( OPAMP_TypeDef *  OPAMPx,
LL_OPAMP_InitTypeDef OPAMP_InitStruct 
)

Initialize some features of OPAMP instance.

Note
This function reset bit of calibration mode to ensure to be in functional mode, in order to have OPAMP parameters (inputs selection, ...) set with the corresponding OPAMP mode to be effective.
This function configures features of the selected OPAMP instance. Some features are also available at scope OPAMP common instance (common to several OPAMP instances). Refer to functions having argument "OPAMPxy_COMMON" as parameter.
Parameters
OPAMPxOPAMP instance
OPAMP_InitStructPointer to a LL_OPAMP_InitTypeDef structure
Return values
AnErrorStatus enumeration value:
  • SUCCESS: OPAMP registers are initialized
  • ERROR: OPAMP registers are not initialized

Definition at line 133 of file stm32l4xx_ll_opamp.c.

134 {
135  /* Check the parameters */
136  assert_param(IS_OPAMP_ALL_INSTANCE(OPAMPx));
137  assert_param(IS_LL_OPAMP_POWER_MODE(OPAMP_InitStruct->PowerMode));
138  assert_param(IS_LL_OPAMP_FUNCTIONAL_MODE(OPAMP_InitStruct->FunctionalMode));
139  assert_param(IS_LL_OPAMP_INPUT_NONINVERTING(OPAMPx, OPAMP_InitStruct->InputNonInverting));
140 
141  /* Note: OPAMP inverting input can be used with OPAMP in mode standalone */
142  /* or PGA with external capacitors for filtering circuit. */
143  /* Otherwise (OPAMP in mode follower), OPAMP inverting input is */
144  /* not used (not connected to GPIO pin). */
145  if(OPAMP_InitStruct->FunctionalMode != LL_OPAMP_MODE_FOLLOWER)
146  {
147  assert_param(IS_LL_OPAMP_INPUT_INVERTING(OPAMPx, OPAMP_InitStruct->InputInverting));
148  }
149 
150  /* Configuration of OPAMP instance : */
151  /* - PowerMode */
152  /* - Functional mode */
153  /* - Input non-inverting */
154  /* - Input inverting */
155  /* Note: Bit OPAMP_CSR_CALON reset to ensure to be in functional mode. */
156  if(OPAMP_InitStruct->FunctionalMode != LL_OPAMP_MODE_FOLLOWER)
157  {
158  MODIFY_REG(OPAMPx->CSR,
159  OPAMP_CSR_OPALPM
160  | OPAMP_CSR_OPAMODE
161  | OPAMP_CSR_CALON
162  | OPAMP_CSR_VMSEL
163  | OPAMP_CSR_VPSEL
164  ,
165  (OPAMP_InitStruct->PowerMode & OPAMP_POWERMODE_CSR_BIT_MASK)
166  | OPAMP_InitStruct->FunctionalMode
167  | OPAMP_InitStruct->InputNonInverting
168  | OPAMP_InitStruct->InputInverting
169  );
170  }
171  else
172  {
173  MODIFY_REG(OPAMPx->CSR,
174  OPAMP_CSR_OPALPM
175  | OPAMP_CSR_OPAMODE
176  | OPAMP_CSR_CALON
177  | OPAMP_CSR_VMSEL
178  | OPAMP_CSR_VPSEL
179  ,
180  (OPAMP_InitStruct->PowerMode & OPAMP_POWERMODE_CSR_BIT_MASK)
181  | LL_OPAMP_MODE_FOLLOWER
182  | OPAMP_InitStruct->InputNonInverting
183  | LL_OPAMP_INPUT_INVERT_CONNECT_NO
184  );
185  }
186 
187  return SUCCESS;
188 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ LL_OPAMP_StructInit()

void LL_OPAMP_StructInit ( LL_OPAMP_InitTypeDef OPAMP_InitStruct)

Set each LL_OPAMP_InitTypeDef field to default value.

Parameters
OPAMP_InitStructpointer to a LL_OPAMP_InitTypeDef structure whose fields will be set to default values.
Return values
None

Definition at line 196 of file stm32l4xx_ll_opamp.c.

197 {
198  /* Set OPAMP_InitStruct fields to default values */
199  OPAMP_InitStruct->PowerMode = LL_OPAMP_POWERMODE_NORMAL;
200  OPAMP_InitStruct->FunctionalMode = LL_OPAMP_MODE_FOLLOWER;
201  OPAMP_InitStruct->InputNonInverting = LL_OPAMP_INPUT_NONINVERT_IO0;
202  /* Note: Parameter discarded if OPAMP in functional mode follower, */
203  /* set anyway to its default value. */
204  OPAMP_InitStruct->InputInverting = LL_OPAMP_INPUT_INVERT_CONNECT_NO;
205 }