diff --git a/src/math/trig.c b/src/math/trig.c index e3f6c719d..da08e74b4 100644 --- a/src/math/trig.c +++ b/src/math/trig.c @@ -9,9 +9,7 @@ #include #include #include -#define _USE_MATH_DEFINES -#include -#include + #define CORDICSINE_TABLE_SIZE 31 /* Compute fixed point cordicsine with table lookup and interpolation * The cordic sine algorithm converges, when the angle is in the range @@ -28,6 +26,9 @@ * +------------------+-----------------+--------+--------+ */ +/* Use a local definition to avoid adding a dependency on */ +#define _M_PI 3.14159265358979323846 /* pi */ + int32_t sin_fixed(int32_t th_rad_fxp) { /*cordic_atan2_lookup_table = atan(2.^-(0:N-1)) N = 31 @@ -47,11 +48,11 @@ int32_t sin_fixed(int32_t th_rad_fxp) /* 652032874 , deg = 69.586061*/ const int32_t CORDICSINE_LUT_Q29FL = Q_CONVERT_FLOAT(1.214505869895220, 29); /* 421657428 , deg = 90.000000 */ - const int32_t CORDICSINE_PIOVERTWO_Q28FL = Q_CONVERT_FLOAT(M_PI / 2, 28); + const int32_t CORDICSINE_PIOVERTWO_Q28FL = Q_CONVERT_FLOAT(_M_PI / 2, 28); /* 843314857, deg = 90.000000 */ - const int32_t CORDICSINE_PIOVERTWO_Q29FL = Q_CONVERT_FLOAT(M_PI / 2, 29); + const int32_t CORDICSINE_PIOVERTWO_Q29FL = Q_CONVERT_FLOAT(_M_PI / 2, 29); /* 1686629713, deg = 90.000000 */ - const int32_t CORDICSINE_PIOVERTWO_Q30FL = Q_CONVERT_FLOAT(M_PI / 2, 30); + const int32_t CORDICSINE_PIOVERTWO_Q30FL = Q_CONVERT_FLOAT(_M_PI / 2, 30); /*Addition or subtraction by a multiple of pi/2 is done in the data type *of the input. When the fraction length is 29, then the quantization error