12345678910111213141516171819 |
- #include "wwdgt.h"
- void watchdog_init(void)
- {
- rcu_osci_on(RCU_IRC40K); /* 使能IRC40K时钟 */
- while(SUCCESS != rcu_osci_stab_wait(RCU_IRC40K)); /* wait till IRC40K is ready */
- fwdgt_write_enable();
- fwdgt_config(2500, FWDGT_PSC_DIV16); /* 40K / 16 = 2.5 KHz t = 1/2.5 *2500 = 1s; 1S超时 */
- fwdgt_write_disable();
- // fwdgt_enable();
- }
- // 独立看门狗喂狗
- void feed_fwdg()
- {
- fwdgt_write_enable();
- fwdgt_counter_reload();
- fwdgt_write_disable();
- }
|