FOC开环调试成功

This commit is contained in:
cbb
2025-10-16 21:43:34 +08:00
parent 35801d6f48
commit aaee40f36b
12 changed files with 365 additions and 147 deletions
+8
View File
@@ -1,6 +1,7 @@
#include "initial.h"
#include "systick.h"
#include <stdint.h>
#include "Timer.h"
extern u16 adc_value[7];
@@ -117,6 +118,13 @@ u8 watchdog_init(u32 time) {
fwdgt_enable();
return status;
}
/**
* @brief driver输出初始化
*/
void driver_init(void) {
timer1_gpio_config();
timer1_pwm_config();
}
int fputc(int ch, FILE *f) throw() {
usart_data_transmit(EVAL_COM0, (uint8_t)ch);
+2
View File
@@ -19,6 +19,8 @@ int fputc(int ch, FILE *f); // 声明fputc函数以重载标准库实现
u8 tle5210b_init(void);
u8 USART0_init(void);
u8 watchdog_init(u32 time);
void driver_init(void);
#ifdef __cplusplus
}
+1 -2
View File
@@ -34,8 +34,6 @@ OF SUCH DAMAGE.
#include "gd32c10x.h"
#include "systick.h"
#include "initial.h"
#include <cstdio>
volatile static uint32_t delay;
@@ -69,6 +67,7 @@ void delay_1s(uint32_t count)
delay_1ms(1000);
}
}
/*!
\brief delay a time in milliseconds
\param[in] count: count in milliseconds
+5 -3
View File
@@ -48,11 +48,13 @@ void delay_1ms(uint32_t count);
void delay_1s(uint32_t count);
/* delay decrement */
void delay_decrement(void);
void timer_delay_ms(uint32_t ms);
/* 空闲任务计数 */
void idle_task_count(void);
/* 获取CPU使用率 */
uint8_t get_cpu_usage(void);
#ifdef __cplusplus
}
#endif
#endif /* SYSTICK_H */
#endif /* SYSTICK_H */