40 lines
703 B
C
40 lines
703 B
C
#include "iwdgs.h"
|
|
|
|
/**
|
|
* @brief 检查判断CPU复位是否是看门狗复位
|
|
* @return {BOOL}
|
|
* @note
|
|
*/
|
|
BOOL check_watchdog_reset(void)
|
|
{
|
|
if (LL_RCC_IsActiveFlag_IWDGRST() == SET) // cpu is reset due to iwdg
|
|
{
|
|
LL_RCC_ClearResetFlags(); // clear flag
|
|
return TRUE;
|
|
}
|
|
else
|
|
{
|
|
return FALSE;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @brief 调试模式冻结看门狗
|
|
* @return {*}
|
|
* @note
|
|
*/
|
|
void debug_freeze_watchdog(void)
|
|
{
|
|
LL_DBGMCU_APB1_GRP1_FreezePeriph(LL_DBGMCU_APB1_GRP1_IWDG_STOP);
|
|
}
|
|
|
|
/**
|
|
* @brief 调试模式恢复看门狗
|
|
* @return {*}
|
|
* @note
|
|
*/
|
|
void debug_unfreeze_watchdog(void)
|
|
{
|
|
LL_DBGMCU_APB1_GRP1_UnFreezePeriph(LL_DBGMCU_APB1_GRP1_IWDG_STOP);
|
|
}
|