wwdgt.c 522 B

12345678910111213141516171819
  1. #include "wwdgt.h"
  2. void watchdog_init(void)
  3. {
  4. rcu_osci_on(RCU_IRC40K); /* 使能IRC40K时钟 */
  5. while(SUCCESS != rcu_osci_stab_wait(RCU_IRC40K)); /* wait till IRC40K is ready */
  6. fwdgt_write_enable();
  7. fwdgt_config(2500, FWDGT_PSC_DIV16); /* 40K / 16 = 2.5 KHz t = 1/2.5 *2500 = 1s; 1S超时 */
  8. fwdgt_write_disable();
  9. // fwdgt_enable();
  10. }
  11. // 独立看门狗喂狗
  12. void feed_fwdg()
  13. {
  14. fwdgt_write_enable();
  15. fwdgt_counter_reload();
  16. fwdgt_write_disable();
  17. }