DRV8313兼容版

refactor(algorithm): 移除冗余头文件
移除不必要的stdint.h头文件引用,统一使用<cstdint>

refactor(sys): 清理系统级头文件依赖
移除未使用的头文件引用,统一整型类型定义,优化初始
化过程中的GPIO配置
This commit is contained in:
cbb
2026-01-24 01:50:39 +08:00
parent 3f24292ac1
commit 1596b2beb0
24 changed files with 76 additions and 64 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
#ifndef __CONFIG_H
#define __CONFIG_H
#include <stdint.h>
#include <cstdint>
// 如果使用CMSIS DSP库,需要定义ARM_MATH_CM4
#define ARM_MATH_CM4
@@ -12,7 +12,7 @@
// 版本号定义 - 可根据实际项目进行调整
constexpr u16 SOFTWARE_VERSION_MAJOR = 26;
constexpr u16 SOFTWARE_VERSION_MINOR = 1;
constexpr u16 SOFTWARE_VERSION_PATCH = 20;
constexpr u16 SOFTWARE_VERSION_PATCH = 24;
constexpr u16 SOFTWARE_VERSION_BUILD = 1;
constexpr u16 HARDWARE_VERSION_MAJOR = 25;
+1 -1
View File
@@ -2,7 +2,7 @@
#define __FLASH_H
#include "gd32c10x.h" // 添加GD32主头文件以确保外设函数声明可用
#include <stdint.h>
#include <cstdint>
// 修改后 - 强制4字节对齐
#define ALIGN_4BYTE(addr) ((addr) & 0xFFFFFFFC) // 4字节对齐
-1
View File
@@ -1,6 +1,5 @@
#include "health.h"
#include "config.h"
#include <stdint.h>
#include "Can.h"
#include "FOC.h"
#include "adc.h"
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef _HEALTH_H
#define _HEALTH_H
#include "stdint.h"
#include <cstdint>
typedef int32_t q16_16_t; // Q16.16格式
// 定点数运算宏
#define Q16_16_ONE 65536 // 1.0 in Q16.16
+2 -2
View File
@@ -162,10 +162,10 @@ void unused_pin_init() {
gpio_init(GPIOB, GPIO_MODE_IPU, GPIO_OSPEED_2MHZ,
GPIO_PIN_6 | GPIO_PIN_7 | GPIO_PIN_15);
gpio_init(GPIOC, GPIO_MODE_IPU, GPIO_OSPEED_2MHZ,
GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15);
GPIO_PIN_14 | GPIO_PIN_15);
gpio_bit_reset(GPIOA, GPIO_PIN_8 | GPIO_PIN_11 | GPIO_PIN_12);
gpio_bit_reset(GPIOB, GPIO_PIN_6 | GPIO_PIN_7 | GPIO_PIN_15);
gpio_bit_reset(GPIOC, GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15);
gpio_bit_reset(GPIOC, GPIO_PIN_14 | GPIO_PIN_15);
}
/*!
+2 -2
View File
@@ -7,8 +7,8 @@ extern "C" {
#include "config.h"
#include "gd32c10x_eval.h"
#include "stdint.h"
#include <stdio.h>
#include <cstdint>
#include <cstdio>
// 任务标志定义
typedef enum {
+1 -1
View File
@@ -38,7 +38,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <cstdint>
/* configure systick */
void systick_config(void);