#ifndef _Park_Clark_H__
#define _Park_Clark_H__
#include "foc/foc_type.h"
#include "math/fast_math.h"

/* ·´Park ±ä»» */
static __INLINE void Rev_Park(dq_t *dq, float angle, alpha_beta_t *alpha_bata) {
	float c,s;
	fast_sincos(angle, &s, &c);

	alpha_bata->alpha = dq->d * c - dq->q * s;
	alpha_bata->beta = dq->d * s + dq->q * c;
}

static __INLINE void Clark(float phaseU, float phaseV, float phaseW, alpha_beta_t *alpha_bata){
	alpha_bata->alpha = (2.0f * phaseU - phaseV - phaseW) / 3.0f;
	alpha_bata->beta = (ONE_BY_SQRT3 * (phaseV - phaseW));
}

static __INLINE void Park(alpha_beta_t *alpha_beta, float angle, dq_t *dq) {
	float c,s;
	fast_sincos(angle, &s, &c);

	dq->d = alpha_beta->alpha * c + alpha_beta->beta * s;
	dq->q = -alpha_beta->alpha * s + alpha_beta->beta * c;
}

#endif  /* _Park_Clark_H__ */

