41 lines
750 B
C
41 lines
750 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_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_DBGMCU);
|
|
SET_BIT(DBGMCU->APB1FZR1, DBGMCU_APB1FZR1_DBG_IWDG_STOP);
|
|
}
|
|
|
|
/**
|
|
* @brief 调试模式恢复看门狗
|
|
* @return {*}
|
|
* @note
|
|
*/
|
|
void debug_unfreeze_watchdog(void)
|
|
{
|
|
CLEAR_BIT(DBGMCU->APB1FZR1, DBGMCU_APB1FZR1_DBG_IWDG_STOP);
|
|
}
|