510
个编辑
更改
无编辑摘要
也就是说独立看门狗完全是独立运行,不受其他部分程序影响。
''<span class="tlid-translation-gender-indicator translation-gender-indicator"></span><span class="tlid-translation-gender-indicator translation-gender-indicator"></span><span class="tlid-translation-gender-indicator translation-gender-indicator"></span><span class="tlid-translation-gender-indicator translation-gender-indicator"></span><span class="tlid-translation-gender-indicator translation-gender-indicator"></span><span class="tlid-translation-gender-indicator translation-gender-indicator"></span><span class="tlid-translation-gender-indicator translation-gender-indicator"></span><span class="tlid-translation-gender-indicator translation-gender-indicator"></span><span class="tlid-translation-gender-indicator translation-gender-indicator"></span><span class="tlid-translation-gender-indicator translation-gender-indicator"></span>''
=== 硬件设计 ===
}
}
</syntaxhighlight>独立看门狗喂狗函数,也就是清除计数值。窗口看门狗初始化,使能窗口看门狗时钟,使能中断。<syntaxhighlight lang="c++" line="1" start="5767">void IWDG_FeedHAL_WWDG_MspInit(void){ HAL_IWDG_Refresh(&hiwdg); // 喂狗}</syntaxhighlight>初始化按键S2(PC2引脚)为一般上拉输入。<syntaxhighlight lang="c++" line="1" start="72">void IWDG_FeedIO_Init(voidWWDG_HandleTypeDef *hwwdg)
{
}
</syntaxhighlight>检测当前S2引脚电平,并且返回当前电平状态。窗口看门狗唤醒中断回调函数,我们可以在这个函数中去调用喂狗的函数。<syntaxhighlight lang="c++" line="1" start="9483">uint8_t IWDG_FeedIO_Readvoid HAL_WWDG_EarlyWakeupCallback(voidWWDG_HandleTypeDef* hwwdg)
{
}
</syntaxhighlight>