HAL_FAU.h 11 KB

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