#include #include #define CORDIC_PI 0x80000000 #define CORDIC_PI_2 0x40000000 #define CORDIC_PI_4 0x20000000 #define CORDIC_RESOLUTION 0.000000083819 /////////////////////////////////////////////////////////////////////// ////////////////// This come from propeller2.h //////////////////////// /////////////////////////////////////////////////////////////////////// // cartesian coordinates typedef struct _cartesian { int32_t x, y; } cartesian_t; // polar coordinates typedef struct _polar { uint32_t r, t; } polar_t; // 64 bit counter typedef struct _counter64 { uint32_t low, high; } counter64_t; /* CORDIC instructions */ cartesian_t _rotxy(cartesian_t coord, uint32_t t); cartesian_t _polxy(polar_t coord); polar_t _xypol(cartesian_t coord); //////////////////////////////////////////////////////////////////////// void toPolar (int * abs, int * arg, int real, int imag); void toCartesian(int * real, int * imag, int abs, int arg); void rot (int * real, int * imag, int phi); int rot90degree_cw (int arg); int rot90degree_ccw (int arg); void generate_sin_cos (int * buffer, int bufferlength, int amplitude, int phi_0, int speed, short cos_flag); void dft (int * buffer, int N, int * X_abs, int * X_arg); void hilbert (int * buffer, int N, int * X_abs, int * X_arg); void inversdft (int * buffer, int N, int * X_abs, int * X_arg); cartesian_t dft (int * realbuffer, int bufferlength);