Fwdgt.c 530 B

1234567891011121314151617181920212223242526272829303132333435
  1. #include "Fwdgt.h"
  2. #include "stdint.h"
  3. #include "gd32e230x_conf.h"
  4. void Fwdgt_Init(void)
  5. {
  6. uint16_t timeout = 0xFFFFU;
  7. rcu_osci_on(RCU_IRC40K);
  8. while(SUCCESS != rcu_osci_stab_wait(RCU_IRC40K))
  9. {
  10. if(timeout > 0)
  11. timeout--;
  12. else
  13. break;
  14. }
  15. fwdgt_config(2000,FWDGT_PSC_DIV64); //3.2s
  16. fwdgt_write_disable();
  17. fwdgt_enable();
  18. }
  19. void DelFwdgt(void)
  20. {
  21. //fwdgt_disable();
  22. rcu_osci_off(RCU_IRC40K);
  23. }
  24. void Fwdgt_reload(void)
  25. {
  26. fwdgt_write_enable();
  27. fwdgt_counter_reload();
  28. }