HARMcksL: ARM HAL toolbox (yet STM32 oriented) 1.6
SMFSW collection of HAL hacks for STM32
Loading...
Searching...
No Matches
WDG_ex.c File Reference

Extensions for WDG peripherals. More...

#include "sarmfsw.h"
#include "WDG_ex.h"
Include dependency graph for WDG_ex.c:

Macros

#define REG_APB1   DBGMCU->APB1FZ
 
#define NAME_DBG   DBGMCU_
 
#define NAME_APB1   APB1_FZ
 

Functions

bool WDG_get_state_IWDG (void)
 Get IWDG status.
 
bool WDG_get_state_WWDG (void)
 Get IWDG status.
 
void WDG_init_check (void)
 Check IWDG & WWDG status.
 
void WDG_refresh (void)
 Refresh IWDG & WWDG.
 
void WDG_freeze (void)
 Freeze IWDG & WWDG.
 
void WDG_unfreeze (void)
 Unfreeze IWDG & WWDG.
 
void WDG_save_cfg (void)
 Save IWDG & WWDG configuration.
 
HAL_StatusTypeDef WDG_restore_cfg (void)
 Restore saved IWDG & WWDG configuration.
 
HAL_StatusTypeDef set_IWDG_Period_us (IWDG_HandleTypeDef *const pIwdg, const uint32_t per)
 Set IWDG period (in us)
 
uint32_t get_IWDG_Period_us (const IWDG_HandleTypeDef *const pIwdg)
 Get IWDG period (in us)
 

Detailed Description

Extensions for WDG peripherals.

Author
SMFSW

This module is mostly meant for debug target purposes, giving the ability to call freeze/unfreeze watchdogs functions no matter the build target, watchdogs being unfrozen only when they were enabled in the first place.

Warning
Watchdogs cannot be frozen while code is running, freeze will on be relevant when execution is paused, thus no freezing possible for a time consuming operation. Workaround is to save the watchdogs configurations, modify temporarily confiruation, then restore the configuration back, using WDG_save_cfg & WDG_restore_cfg.
For this module to work properly, WDG_init_check have to be called once at the end of your init routine prior to use freeze/unfreeze functions.

Macro Definition Documentation

◆ NAME_APB1

#define NAME_APB1   APB1_FZ

◆ NAME_DBG

#define NAME_DBG   DBGMCU_

◆ REG_APB1

#define REG_APB1   DBGMCU->APB1FZ

Function Documentation

◆ get_IWDG_Period_us()

uint32_t get_IWDG_Period_us ( const IWDG_HandleTypeDef *const pIwdg)

Get IWDG period (in us)

Parameters
[in]pIwdg- Pointer to IWDG instance
Returns
Period (in us)
Here is the caller graph for this function:

◆ set_IWDG_Period_us()

HAL_StatusTypeDef set_IWDG_Period_us ( IWDG_HandleTypeDef *const pIwdg,
const uint32_t per )

Set IWDG period (in us)

Warning
125us granularity for a 32KHz clock with minimum prescaler of 4 (typical STM32 IWDG architecture)
Parameters
[in,out]pIwdg- Pointer to IWDG instance
[in]per- Period (in us)
Returns
HAL Status
Here is the caller graph for this function:

◆ WDG_freeze()

void WDG_freeze ( void )

Freeze IWDG & WWDG.

Note
Watchdogs will be frozen only if enabled by init (checked by WDG_init_check).

◆ WDG_get_state_IWDG()

bool WDG_get_state_IWDG ( void )

Get IWDG status.

Returns
IWDG enabled state
Here is the caller graph for this function:

◆ WDG_get_state_WWDG()

bool WDG_get_state_WWDG ( void )

Get IWDG status.

Returns
WWDG enabled state
Here is the caller graph for this function:

◆ WDG_init_check()

void WDG_init_check ( void )

Check IWDG & WWDG status.

Warning
This function have to be called once at the end of your init routine prior to use WDG_freeze & WDG_unfreeze functions.
Here is the call graph for this function:

◆ WDG_refresh()

void WDG_refresh ( void )

Refresh IWDG & WWDG.

◆ WDG_restore_cfg()

HAL_StatusTypeDef WDG_restore_cfg ( void )

Restore saved IWDG & WWDG configuration.

Returns
HAL Status

◆ WDG_save_cfg()

void WDG_save_cfg ( void )

Save IWDG & WWDG configuration.

Here is the caller graph for this function:

◆ WDG_unfreeze()

void WDG_unfreeze ( void )

Unfreeze IWDG & WWDG.

Note
Watchdogs will be unfrozen only if enabled by init (checked by WDG_init_check).