67 lines
1010 B
C
67 lines
1010 B
C
//
|
|
// 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
|