This commit is contained in:
2024-05-08 03:04:20 +08:00
commit a58a15aa26
293 changed files with 194341 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
//
// Created by ZK on 2023/3/14.
//
#include "Angle.h"
//#define EncoderName MT6816
float32_t getAngle_MT6816() {
// printf("Test");
return M_PI;
}
float32_t getAngle_AS5600() {
// printf("Test");
return 0.0f;
}
bool Data_Init(tData *data) {
switch (data->Angle.EncoderModel) {
case MT6816:
data->Angle.getAngle = getAngle_MT6816;
break;
case AS5600:
data->Angle.getAngle = getAngle_AS5600;
break;
}
return 0;
}

View File

@@ -0,0 +1,66 @@
//
// Created by ZK on 2023/3/14.
//
#ifndef BOOOOMFOC_STSPIN32G4_EVB_ANGLE_H
#define BOOOOMFOC_STSPIN32G4_EVB_ANGLE_H
#include "APP_Main.h"
typedef enum {
MT6816,
AS5600
} tEncoderModel;
typedef struct {
tEncoderModel EncoderModel;
float32_t (*getAngle)();
} tAngle;
typedef struct {
tAngle Angle;
float32_t (*Angle_Init)();
} tData;
float32_t getAngle_MT6816();
float32_t getAngle_AS5600();
bool Data_Init(tData *data);
typedef struct sMT6825 {
bool no_mag;
bool over_speed;
uint32_t angle;
uint8_t rx_err_count;
uint8_t check_err_count;
} tMT6825;
typedef struct sEncoder {
int raw;
int count_in_cpr;
int count_in_cpr_prev;
int64_t shadow_count;
// pll use
float pos_cpr_counts;
float vel_estimate_counts;
float pos;
float vel;
float phase;
float phase_vel;
float pll_kp;
float pll_ki;
float interpolation;
float snap_threshold;
} tEncoder;
#endif //BOOOOMFOC_STSPIN32G4_EVB_ANGLE_H

View File

@@ -0,0 +1,5 @@
//
// Created by ZK on 2023/3/14.
//
#include "MT6816.h"

View File

@@ -0,0 +1,8 @@
//
// Created by ZK on 2023/3/14.
//
#ifndef BOOOOMFOC_STSPIN32G4_EVB_MT6816_H
#define BOOOOMFOC_STSPIN32G4_EVB_MT6816_H
#endif //BOOOOMFOC_STSPIN32G4_EVB_MT6816_H

View File

@@ -0,0 +1,5 @@
//
// Created by ZK on 2023/3/14.
//
#include "Current.h"

View File

@@ -0,0 +1,8 @@
//
// Created by ZK on 2023/3/14.
//
#ifndef BOOOOMFOC_STSPIN32G4_EVB_CURRENT_H
#define BOOOOMFOC_STSPIN32G4_EVB_CURRENT_H
#endif //BOOOOMFOC_STSPIN32G4_EVB_CURRENT_H

View File

@@ -0,0 +1,21 @@
//
// Created by ZK on 2023/3/14.
//
#include "InteriorADC.h"
bool InteriorADC_Init(void) {
//使能ADC注入
HAL_ADCEx_Calibration_Start(&hadc1, ADC_SINGLE_ENDED);
HAL_ADCEx_Calibration_Start(&hadc2, ADC_SINGLE_ENDED);
HAL_Delay(100);
HAL_ADCEx_InjectedStart(&hadc1);
__HAL_ADC_ENABLE_IT(&hadc1, ADC_IT_JEOC);
HAL_ADCEx_InjectedStart(&hadc2);
__HAL_ADC_ENABLE_IT(&hadc2, ADC_IT_JEOC);
return 0;//返回值为零表示初始化成功
}

View File

@@ -0,0 +1,12 @@
//
// Created by ZK on 2023/3/14.
//
#ifndef BOOOOMFOC_STSPIN32G4_EVB_INTERIORADC_H
#define BOOOOMFOC_STSPIN32G4_EVB_INTERIORADC_H
#include "APP_Main.h"
bool InteriorADC_Init(void);
#endif //BOOOOMFOC_STSPIN32G4_EVB_INTERIORADC_H

5
BoooomCTL/Data/Data.c Normal file
View File

@@ -0,0 +1,5 @@
//
// Created by ZK on 2023/3/14.
//
#include "Data.h"

8
BoooomCTL/Data/Data.h Normal file
View File

@@ -0,0 +1,8 @@
//
// Created by ZK on 2023/3/14.
//
#ifndef BOOOOMFOC_STSPIN32G4_EVB_DATA_H
#define BOOOOMFOC_STSPIN32G4_EVB_DATA_H
#endif //BOOOOMFOC_STSPIN32G4_EVB_DATA_H

View File

@@ -0,0 +1,5 @@
//
// Created by ZK on 2023/3/14.
//
#include "Temperature.h"

View File

@@ -0,0 +1,8 @@
//
// Created by ZK on 2023/3/14.
//
#ifndef BOOOOMFOC_STSPIN32G4_EVB_TEMPERATURE_H
#define BOOOOMFOC_STSPIN32G4_EVB_TEMPERATURE_H
#endif //BOOOOMFOC_STSPIN32G4_EVB_TEMPERATURE_H

View File

@@ -0,0 +1,5 @@
//
// Created by ZK on 2023/3/14.
//
#include "Voltage.h"

View File

@@ -0,0 +1,8 @@
//
// Created by ZK on 2023/3/14.
//
#ifndef BOOOOMFOC_STSPIN32G4_EVB_VOLTAGE_H
#define BOOOOMFOC_STSPIN32G4_EVB_VOLTAGE_H
#endif //BOOOOMFOC_STSPIN32G4_EVB_VOLTAGE_H