1 2 #ifndef __FAU_H_ 3 #define __FAU_H_ 4 5 #define RANGE 2147483648U //2^31 6 #define CORDIC_F_31 0xD2C90A46 // CORDIC gain F 7 8 /************************************************************************** 9 * Function Name : HAL_CORDIC_CosSin( precision 1 ) 10 * Description : calculate the sin & cos value of the input angle 11 * Input : - angle_para : input angle data in radians, divided by π[range[-1,1],Q31 format]; 12 * Output : - * cos_data : the cos value of the input angle[range[-1,1],Q31 format] 13 - * sin_data : the sin value of the input angle[range[-1,1],Q31 format] 14 * Return : None 15 **************************************************************************/ 16 void HAL_CORDIC_CosSin_1(int angle_para, int* cos_data, int* sin_data); 17 /************************************************************************** 18 * Function Name : HAL_CORDIC_CosSin( precision 2 ) 19 * Description : calculate the sin & cos value of the input angle 20 * Input : - angle_para : input angle data in radians, divided by π[range[-1,1],Q31 format]; 21 * Output : - * cos_data : the cos value of the input angle[range[-1,1],Q31 format] 22 - * sin_data : the sin value of the input angle[range[-1,1],Q31 format] 23 * Return : None 24 **************************************************************************/ 25 void HAL_CORDIC_CosSin_2(int angle_para, int* cos_data, int* sin_data); 26 /************************************************************************** 27 * Function Name : HAL_CORDIC_CosSin( precision 3 ) 28 * Description : calculate the sin & cos value of the input angle 29 * Input : - angle_para : input angle data in radians, divided by π[range[-1,1],Q31 format]; 30 * Output : - * cos_data : the cos value of the input angle[range[-1,1],Q31 format] 31 - * sin_data : the sin value of the input angle[range[-1,1],Q31 format] 32 * Return : None 33 **************************************************************************/ 34 void HAL_CORDIC_CosSin_3(int angle_para, int* cos_data, int* sin_data); 35 /************************************************************************** 36 * Function Name : HAL_CORDIC_CosSin( precision 4 ) 37 * Description : calculate the sin & cos value of the input angle 38 * Input : - angle_para : input angle data in radians, divided by π[range[-1,1],Q31 format]; 39 * Output : - * cos_data : the cos value of the input angle[range[-1,1],Q31 format] 40 - * sin_data : the sin value of the input angle[range[-1,1],Q31 format] 41 * Return : None 42 **************************************************************************/ 43 void HAL_CORDIC_CosSin_4(int angle_para, int* cos_data, int* sin_data); 44 /************************************************************************** 45 * Function Name : HAL_CORDIC_CosSin( precision 5 ) 46 * Description : calculate the sin & cos value of the input angle 47 * Input : - angle_para : input angle data in radians, divided by π[range[-1,1],Q31 format]; 48 * Output : - * cos_data : the cos value of the input angle[range[-1,1],Q31 format] 49 - * sin_data : the sin value of the input angle[range[-1,1],Q31 format] 50 * Return : None 51 **************************************************************************/ 52 void HAL_CORDIC_CosSin_5(int angle_para, int* cos_data, int* sin_data); 53 /************************************************************************** 54 * Function Name : HAL_CORDIC_CosSin( precision 6 ) 55 * Description : calculate the sin & cos value of the input angle 56 * Input : - angle_para : input angle data in radians, divided by π[range[-1,1],Q31 format]; 57 * Output : - * cos_data : the cos value of the input angle[range[-1,1],Q31 format] 58 - * sin_data : the sin value of the input angle[range[-1,1],Q31 format] 59 * Return : None 60 **************************************************************************/ 61 void HAL_CORDIC_CosSin_6(int angle_para, int* cos_data, int* sin_data); 62 /************************************************************************** 63 * Function Name : HAL_CORDIC_CosSin( precision 7 ) 64 * Description : calculate the sin & cos value of the input angle 65 * Input : - angle_para : input angle data in radians, divided by π[range[-1,1],Q31 format]; 66 * Output : - * cos_data : the cos value of the input angle[range[-1,1],Q31 format] 67 - * sin_data : the sin value of the input angle[range[-1,1],Q31 format] 68 * Return : None 69 **************************************************************************/ 70 void HAL_CORDIC_CosSin_7(int angle_para, int* cos_data, int* sin_data); 71 /************************************************************************** 72 * Function Name : HAL_CORDIC_CosSin( precision 8 ) 73 * Description : calculate the sin & cos value of the input angle 74 * Input : - angle_para : input angle data in radians, divided by π[range[-1,1],Q31 format]; 75 * Output : - * cos_data : the cos value of the input angle[range[-1,1],Q31 format] 76 - * sin_data : the sin value of the input angle[range[-1,1],Q31 format] 77 * Return : None 78 **************************************************************************/ 79 void HAL_CORDIC_CosSin_8(int angle_para, int* cos_data, int* sin_data); 80 81 /************************************************************************** 82 * Function Name : HAL_CORDIC_AtanSqrt( precision 1 ) 83 * Description : calculate the atan & sqrt value of the input x,y 84 * Input : - x : input x data[range[-1,1],Q31 format]; 85 * : - y : input y data[range[-1,1],Q31 format]; 86 : - precision : the precison used in calculation 87 * Output : - * sqrt_data : the sqrt value of the input x,y[Q31 format] 88 - * atan_data : the atan value of the input x,y[Q31 format] 89 * Return : None 90 **************************************************************************/ 91 void HAL_CORDIC_AtanSqrt_1(int x, int y, int*sqrt_data, int* atan_data); 92 /************************************************************************** 93 * Function Name : HAL_CORDIC_AtanSqrt( precision 2 ) 94 * Description : calculate the atan & sqrt value of the input x,y 95 * Input : - x : input x data[range[-1,1],Q31 format]; 96 * : - y : input y data[range[-1,1],Q31 format]; 97 : - precision : the precison used in calculation 98 * Output : - * sqrt_data : the sqrt value of the input x,y[Q31 format] 99 - * atan_data : the atan value of the input x,y[Q31 format] 100 * Return : None 101 **************************************************************************/ 102 void HAL_CORDIC_AtanSqrt_2(int x, int y, int*sqrt_data, int* atan_data); 103 /************************************************************************** 104 * Function Name : HAL_CORDIC_AtanSqrt( precision 3 ) 105 * Description : calculate the atan & sqrt value of the input x,y 106 * Input : - x : input x data[range[-1,1],Q31 format]; 107 * : - y : input y data[range[-1,1],Q31 format]; 108 : - precision : the precison used in calculation 109 * Output : - * sqrt_data : the sqrt value of the input x,y[Q31 format] 110 - * atan_data : the atan value of the input x,y[Q31 format] 111 * Return : None 112 **************************************************************************/ 113 void HAL_CORDIC_AtanSqrt_3(int x, int y, int*sqrt_data, int* atan_data); 114 /************************************************************************** 115 * Function Name : HAL_CORDIC_AtanSqrt( precision 4 ) 116 * Description : calculate the atan & sqrt value of the input x,y 117 * Input : - x : input x data[range[-1,1],Q31 format]; 118 * : - y : input y data[range[-1,1],Q31 format]; 119 : - precision : the precison used in calculation 120 * Output : - * sqrt_data : the sqrt value of the input x,y[Q31 format] 121 - * atan_data : the atan value of the input x,y[Q31 format] 122 * Return : None 123 **************************************************************************/ 124 void HAL_CORDIC_AtanSqrt_4(int x, int y, int*sqrt_data, int* atan_data); 125 /************************************************************************** 126 * Function Name : HAL_CORDIC_AtanSqrt( precision 5 ) 127 * Description : calculate the atan & sqrt value of the input x,y 128 * Input : - x : input x data[range[-1,1],Q31 format]; 129 * : - y : input y data[range[-1,1],Q31 format]; 130 : - precision : the precison used in calculation 131 * Output : - * sqrt_data : the sqrt value of the input x,y[Q31 format] 132 - * atan_data : the atan value of the input x,y[Q31 format] 133 * Return : None 134 **************************************************************************/ 135 void HAL_CORDIC_AtanSqrt_5(int x, int y, int*sqrt_data, int* atan_data); 136 /************************************************************************** 137 * Function Name : HAL_CORDIC_AtanSqrt( precision 6 ) 138 * Description : calculate the atan & sqrt value of the input x,y 139 * Input : - x : input x data[range[-1,1],Q31 format]; 140 * : - y : input y data[range[-1,1],Q31 format]; 141 : - precision : the precison used in calculation 142 * Output : - * sqrt_data : the sqrt value of the input x,y[Q31 format] 143 - * atan_data : the atan value of the input x,y[Q31 format] 144 * Return : None 145 **************************************************************************/ 146 void HAL_CORDIC_AtanSqrt_6(int x, int y, int*sqrt_data, int* atan_data); 147 /************************************************************************** 148 * Function Name : HAL_CORDIC_AtanSqrt( precision 7 ) 149 * Description : calculate the atan & sqrt value of the input x,y 150 * Input : - x : input x data[range[-1,1],Q31 format]; 151 * : - y : input y data[range[-1,1],Q31 format]; 152 : - precision : the precison used in calculation 153 * Output : - * sqrt_data : the sqrt value of the input x,y[Q31 format] 154 - * atan_data : the atan value of the input x,y[Q31 format] 155 * Return : None 156 **************************************************************************/ 157 void HAL_CORDIC_AtanSqrt_7(int x, int y, int*sqrt_data, int* atan_data); 158 /************************************************************************** 159 * Function Name : HAL_CORDIC_AtanSqrt( precision 8 ) 160 * Description : calculate the atan & sqrt value of the input x,y 161 * Input : - x : input x data[range[-1,1],Q31 format]; 162 * : - y : input y data[range[-1,1],Q31 format]; 163 : - precision : the precison used in calculation 164 * Output : - * sqrt_data : the sqrt value of the input x,y[Q31 format] 165 - * atan_data : the atan value of the input x,y[Q31 format] 166 * Return : None 167 **************************************************************************/ 168 void HAL_CORDIC_AtanSqrt_8(int x, int y, int*sqrt_data, int* atan_data); 169 170 #endif