STM32L4xx_HAL_Driver  1.14.0
Initialization and Configuration functions

Initialization and Configuration functions. More...

Functions

HAL_StatusTypeDef HAL_WWDG_Init (WWDG_HandleTypeDef *hwwdg)
 Initialize the WWDG according to the specified. parameters in the WWDG_InitTypeDef of associated handle. More...
 
void HAL_WWDG_MspInit (WWDG_HandleTypeDef *hwwdg)
 Initialize the WWDG MSP. More...
 
HAL_StatusTypeDef HAL_WWDG_RegisterCallback (WWDG_HandleTypeDef *hwwdg, HAL_WWDG_CallbackIDTypeDef CallbackID, pWWDG_CallbackTypeDef pCallback)
 Register a User WWDG Callback To be used instead of the weak (surcharged) predefined callback. More...
 
HAL_StatusTypeDef HAL_WWDG_UnRegisterCallback (WWDG_HandleTypeDef *hwwdg, HAL_WWDG_CallbackIDTypeDef CallbackID)
 Unregister a WWDG Callback WWDG Callback is redirected to the weak (surcharged) predefined callback. More...
 

Detailed Description

Initialization and Configuration functions.

  ==============================================================================
          ##### Initialization and Configuration functions #####
  ==============================================================================
  [..]
    This section provides functions allowing to:
      (+) Initialize and start the WWDG according to the specified parameters
          in the WWDG_InitTypeDef of associated handle.
      (+) Initialize the WWDG MSP.

Function Documentation

◆ HAL_WWDG_Init()

HAL_StatusTypeDef HAL_WWDG_Init ( WWDG_HandleTypeDef hwwdg)

Initialize the WWDG according to the specified. parameters in the WWDG_InitTypeDef of associated handle.

Parameters
hwwdgpointer to a WWDG_HandleTypeDef structure that contains the configuration information for the specified WWDG module.
Return values
HALstatus

Definition at line 164 of file stm32l4xx_hal_wwdg.c.

165 {
166  /* Check the WWDG handle allocation */
167  if (hwwdg == NULL)
168  {
169  return HAL_ERROR;
170  }
171 
172  /* Check the parameters */
173  assert_param(IS_WWDG_ALL_INSTANCE(hwwdg->Instance));
174  assert_param(IS_WWDG_PRESCALER(hwwdg->Init.Prescaler));
175  assert_param(IS_WWDG_WINDOW(hwwdg->Init.Window));
176  assert_param(IS_WWDG_COUNTER(hwwdg->Init.Counter));
177  assert_param(IS_WWDG_EWI_MODE(hwwdg->Init.EWIMode));
178 
179 #if (USE_HAL_WWDG_REGISTER_CALLBACKS == 1)
180  /* Reset Callback pointers */
181  if(hwwdg->EwiCallback == NULL)
182  {
184  }
185 
186  if(hwwdg->MspInitCallback == NULL)
187  {
189  }
190 
191  /* Init the low level hardware */
192  hwwdg->MspInitCallback(hwwdg);
193 #else
194  /* Init the low level hardware */
195  HAL_WWDG_MspInit(hwwdg);
196 #endif
197 
198  /* Set WWDG Counter */
199  WRITE_REG(hwwdg->Instance->CR, (WWDG_CR_WDGA | hwwdg->Init.Counter));
200 
201  /* Set WWDG Prescaler and Window */
202  WRITE_REG(hwwdg->Instance->CFR, (hwwdg->Init.EWIMode | hwwdg->Init.Prescaler | hwwdg->Init.Window));
203 
204  /* Return function status */
205  return HAL_OK;
206 }
void HAL_WWDG_MspInit(WWDG_HandleTypeDef *hwwdg)
Initialize the WWDG MSP.
void(* MspInitCallback)(struct __WWDG_HandleTypeDef *hwwdg)
WWDG_InitTypeDef Init
return HAL_OK
void(* EwiCallback)(struct __WWDG_HandleTypeDef *hwwdg)
void HAL_WWDG_EarlyWakeupCallback(WWDG_HandleTypeDef *hwwdg)
WWDG Early Wakeup callback.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_WWDG_MspInit()

__weak void HAL_WWDG_MspInit ( WWDG_HandleTypeDef hwwdg)

Initialize the WWDG MSP.

Parameters
hwwdgpointer to a WWDG_HandleTypeDef structure that contains the configuration information for the specified WWDG module.
Note
When rewriting this function in user file, mechanism may be added to avoid multiple initialize when HAL_WWDG_Init function is called again to change parameters.
Return values
None

Definition at line 218 of file stm32l4xx_hal_wwdg.c.

219 {
220  /* Prevent unused argument(s) compilation warning */
221  UNUSED(hwwdg);
222 
223  /* NOTE: This function should not be modified, when the callback is needed,
224  the HAL_WWDG_MspInit could be implemented in the user file
225  */
226 }

◆ HAL_WWDG_RegisterCallback()

HAL_StatusTypeDef HAL_WWDG_RegisterCallback ( WWDG_HandleTypeDef hwwdg,
HAL_WWDG_CallbackIDTypeDef  CallbackID,
pWWDG_CallbackTypeDef  pCallback 
)

Register a User WWDG Callback To be used instead of the weak (surcharged) predefined callback.

Parameters
hwwdgWWDG handle
CallbackIDID of the callback to be registered This parameter can be one of the following values:
pCallbackpointer to the Callback function
Return values
status

Definition at line 241 of file stm32l4xx_hal_wwdg.c.

242 {
243  HAL_StatusTypeDef status = HAL_OK;
244 
245  if(pCallback == NULL)
246  {
247  status = HAL_ERROR;
248  }
249  else
250  {
251  switch(CallbackID)
252  {
253  case HAL_WWDG_EWI_CB_ID:
254  hwwdg->EwiCallback = pCallback;
255  break;
256 
258  hwwdg->MspInitCallback = pCallback;
259  break;
260 
261  default:
262  status = HAL_ERROR;
263  break;
264  }
265  }
266 
267  return status;
268 }
void(* MspInitCallback)(struct __WWDG_HandleTypeDef *hwwdg)
return HAL_OK
void(* EwiCallback)(struct __WWDG_HandleTypeDef *hwwdg)

◆ HAL_WWDG_UnRegisterCallback()

HAL_StatusTypeDef HAL_WWDG_UnRegisterCallback ( WWDG_HandleTypeDef hwwdg,
HAL_WWDG_CallbackIDTypeDef  CallbackID 
)

Unregister a WWDG Callback WWDG Callback is redirected to the weak (surcharged) predefined callback.

Parameters
hwwdgWWDG handle
CallbackIDID of the callback to be registered This parameter can be one of the following values:
Return values
status

Definition at line 281 of file stm32l4xx_hal_wwdg.c.

282 {
283  HAL_StatusTypeDef status = HAL_OK;
284 
285  switch(CallbackID)
286  {
287  case HAL_WWDG_EWI_CB_ID:
289  break;
290 
293  break;
294 
295  default:
296  status = HAL_ERROR;
297  break;
298  }
299 
300  return status;
301 }
void HAL_WWDG_MspInit(WWDG_HandleTypeDef *hwwdg)
Initialize the WWDG MSP.
void(* MspInitCallback)(struct __WWDG_HandleTypeDef *hwwdg)
return HAL_OK
void(* EwiCallback)(struct __WWDG_HandleTypeDef *hwwdg)
void HAL_WWDG_EarlyWakeupCallback(WWDG_HandleTypeDef *hwwdg)
WWDG Early Wakeup callback.