clean shit

This commit is contained in:
2024-12-29 22:59:07 +08:00
parent 444804efe4
commit 0ebe9c5d16
15 changed files with 104 additions and 131 deletions

View File

@@ -5,44 +5,6 @@
\version 2024-02-22, V2.1.0, firmware for GD32E23x
*/
#include "main.h"
#include <stdio.h>
#include "gd32e23x.h"
#include "systick.h"
#include "gd32e23x_libopt.h"
#include "rs485.h"
#include "led.h"
#include "i2c.h"
#include "ldc1612.h"
#include "board_config.h"
#ifdef SOFTWARE_IIC
#include "soft_i2c.h"
#else
#include "i2c.h"
#endif
void watchdog_init(void) {
/* Enable the LSI clock */
rcu_osci_on(RCU_IRC40K);
rcu_osci_stab_wait(RCU_IRC40K);
/* 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();
}
void reset_mcu(void) {
/* Enable the write access to the FWDGT_CTL register */
FWDGT_CTL = FWDGT_WRITEACCESS_ENABLE;
/* Configure FWDGT to trigger a system reset */
fwdgt_config(50, FWDGT_PSC_DIV4);
/* Reload the counter to trigger the reset */
fwdgt_counter_reload();
}
/*!
\brief main function