25 lines
593 B
C
25 lines
593 B
C
#include "IQmathLib.h" // Include header for IQmath library
|
|
#include "alphabeta_to_abc.h"
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////
|
|
|
|
|
|
#pragma CODE_SECTION(alphabeta_to_abc_calc,".fast_run");
|
|
void alphabeta_to_abc_calc(ALPHABETA_TO_ABC *v)
|
|
{
|
|
static _iq iq_0_5 = _IQ(0.5); // = 1/2
|
|
static _iq iq_sqrt3_2 = _IQ(0.86602540378443864676372317075294); // =sqrt(3)/2
|
|
|
|
v->Ua = v->Ualpha;
|
|
v->Ub = -_IQmpy(iq_0_5,v->Ualpha) + _IQmpy(iq_sqrt3_2,v->Ubeta);
|
|
v->Uc = -_IQmpy(iq_0_5,v->Ualpha) - _IQmpy(iq_sqrt3_2,v->Ubeta);
|
|
|
|
}
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////
|