generated from hulk/gd32e23x_template
测试提交
This commit is contained in:
parent
6c9543648f
commit
7a7ed3e369
17
src/main.c
17
src/main.c
@ -20,17 +20,24 @@ uint32_t g_eddy_current_value_uint32;
|
||||
|
||||
void watchdog_init(void) {
|
||||
/* Enable the LSI clock */
|
||||
rcu_osci_on(RCU_IRC8M);
|
||||
rcu_osci_stab_wait(RCU_IRC8M);
|
||||
rcu_osci_on(RCU_IRC40K);
|
||||
rcu_osci_stab_wait(RCU_IRC40K);
|
||||
|
||||
/* Enable the FWDGT clock */
|
||||
rcu_periph_clock_enable(RCU_WWDGT);
|
||||
// rcu_periph_clock_enable(RCU_FWDGT);
|
||||
|
||||
/* Configure FWDGT counter clock: 40KHz(IRC40K) / 256 = 0.15625 KHz */
|
||||
fwdgt_config(156, FWDGT_PSC_DIV256); // Set timeout to 4 seconds (625 / 0.15625 KHz)
|
||||
/* Configure FWDGT counter clock: 40KHz(IRC40K) / 64 = 0.625 KHz */
|
||||
fwdgt_config(625, FWDGT_PSC_DIV64); // Set timeout to 1 seconds (625 / 0.625 KHz)
|
||||
|
||||
/* Enable FWDGT */
|
||||
fwdgt_enable();
|
||||
|
||||
if(RESET != rcu_flag_get(RCU_FLAG_FWDGTRST)){
|
||||
// gd_eval_led_on(LED2);
|
||||
rcu_all_reset_flag_clear();
|
||||
|
||||
// while(1);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
|
Loading…
x
Reference in New Issue
Block a user