Subversion Repositories dashGPS

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. #include "ref.h"
  2.  
  3. void ref_sin_cos_f32(
  4.   float32_t theta,
  5.   float32_t * pSinVal,
  6.   float32_t * pCosVal)
  7. {
  8.         //theta is given in degrees
  9.         *pSinVal = sinf(theta * 6.28318530717959f / 360.0f);
  10.         *pCosVal = cosf(theta * 6.28318530717959f / 360.0f);
  11. }
  12.  
  13. void ref_sin_cos_q31(
  14.   q31_t theta,
  15.   q31_t * pSinVal,
  16.   q31_t * pCosVal)
  17. {
  18.         //theta is given in the range [-1,1) to represent [-pi,pi)
  19.         *pSinVal = (q31_t)(sinf((float32_t)theta * 3.14159265358979f / 2147483648.0f) * 2147483648.0f);
  20.         *pCosVal = (q31_t)(cosf((float32_t)theta * 3.14159265358979f / 2147483648.0f) * 2147483648.0f);
  21. }
  22.