37 lines
1.5 KiB
C
37 lines
1.5 KiB
C
//
|
|
// Created by ZK on 2023/3/16.
|
|
//
|
|
|
|
#ifndef BOOOOMFOC_STSPIN32G4_EVB_SVPWM_H
|
|
#define BOOOOMFOC_STSPIN32G4_EVB_SVPWM_H
|
|
|
|
#include "arm_math.h"
|
|
|
|
//#define M_PI (3.14159265358f)
|
|
#define M_2PI (6.28318530716f)
|
|
#define ONE_BY_SQRT3 (0.57735026919f)
|
|
#define TWO_BY_SQRT3 (2.0f * 0.57735026919f)
|
|
#define SQRT3_BY_2 (0.86602540378f)
|
|
|
|
#define SQ(x) ((x) * (x))
|
|
#define ABS(x) ((x) > 0 ? (x) : -(x))
|
|
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
|
|
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
|
|
#define CLAMP(x, lower, upper) (MIN(upper, MAX(x, lower)))
|
|
#define FLOAT_EQU(floatA, floatB) ((ABS((floatA) - (floatB))) < 0.000001f)
|
|
|
|
//extern inline void clarke_transform(float Ia, float Ib, float Ic, float *Ialpha, float *Ibeta);
|
|
//
|
|
//extern inline void park_transform(float Ialpha, float Ibeta, float Theta, float *Id, float *Iq);
|
|
|
|
extern void clarke_transform(float Ia, float Ib, float Ic, float *Ialpha, float *Ibeta);
|
|
|
|
extern void park_transform(float Ialpha, float Ibeta, float Theta, float *Id, float *Iq);
|
|
|
|
extern void inversePark(float ud, float uq, float Theta, float *uAlpha, float *uBeta);
|
|
|
|
extern int SVPWM(float uAlpha, float uBeta, float *tA, float *tB, float *tC);
|
|
|
|
|
|
#endif //BOOOOMFOC_STSPIN32G4_EVB_SVPWM_H
|