/********************************************************************************************************* * Module : fwdgt * Abstract : * Version : 1.0.0 * Author : Leopul(COPYRIGHT 2025 ~ 2027 Leopul. All rights reserved.) * Complete : 2025-04-09 * Content : None * Note : None *********************************************************************************************************/ #include "fwdgt.h" #include "common.h" #include "board_cfg.h" #include "gd32e23x.h" static void feed_dog(void); void fwdgt_Init(void) { board_t * board = get_board(); #if OPEN_WATCH_DOG uint16_t timeout = 0xFFFFU; rcu_osci_on(RCU_IRC40K); while(SUCCESS != rcu_osci_stab_wait(RCU_IRC40K)) { if(timeout > 0) timeout--; else break; } fwdgt_config(2000,FWDGT_PSC_DIV64); //800ms fwdgt_write_disable(); fwdgt_enable(); #endif board->feed_dog = feed_dog; } static void feed_dog(void) { #if OPEN_WATCH_DOG fwdgt_write_enable(); fwdgt_counter_reload(); #endif }