![]() |
RTOS_MSPM0
1.1
ECE445M starter code
|
Data Structures | |
| struct | complex |
| a complex number has a real and imaginary part More... | |
Macros | |
| #define | PI 3.14159265358979323846264338327950288 |
| PI is ratio of circumference to diameter of a circle. | |
Typedefs | |
| typedef struct complex | complex_t |
Functions | |
| void | fft (complex_t *v, int n, complex_t *tmp) |
| fft More... | |
| void | ifft (complex_t *v, int n, complex_t *tmp) |
| Inverse fft. More... | |
| int16_t | fixed_sin (int32_t theta) |
| decimal fixed-point sin More... | |
| int16_t | fixed_cos (int32_t theta) |
| decimal fixed-point cos More... | |
| int32_t | fixed_sin2 (int32_t theta) |
| binary fixed-point sin More... | |
| int32_t | fixed_cos2 (int32_t theta) |
| binary fixed-point cos More... | |
| int32_t | sin540 (int32_t theta) |
| binary fixed-point sin More... | |
| int32_t | cos540 (int32_t theta) |
| binary fixed-point cos More... | |
Variables | |
| float | Real |
| float | Imag |
| int32_t cos540 | ( | int32_t | theta | ) |
binary fixed-point cos
binaryfixed-point cos****************
| theta | 0 to 539, angle is in units 2*pi/540 = 0.011635528 radians (0 to 2pi) |
fft
discrete Fast Fourier Transform, Converts time to frequency domain
Assume the input is real data sampled at fs
Place n measurements into the real part of array v
Set the imaginary part of array v to 0
Call fft() and the results are returned back in array v
If the input is real only, then the transform will contain
Index 0 <= k < n/2 complex components of frequency f=k/fs
E.g., k=0 represents the DC component of the input
Index n/2 <= k < n are complex conjugates of the first half
| v | array of input data in complex form |
| n | size of the two arrays 2, 4, 8, ..., 2048 |
| tmp | temporary array of data in complex form |
| int16_t fixed_cos | ( | int32_t | theta | ) |
decimal fixed-point cos
decimal fixed-point cos****************
| theta | -3142 to 3142, angle is in units radians/1000 |
| int32_t fixed_cos2 | ( | int32_t | theta | ) |
binary fixed-point cos
binaryfixed-point cos****************
| theta | -8192 to 8191, angle is in units 2*pi/16384 radians (-pi to +pi) |
| int16_t fixed_sin | ( | int32_t | theta | ) |
decimal fixed-point sin
decimal fixed-point sin****************
| theta | -3142 to 3142, angle is in units radians/1000 |
| int32_t fixed_sin2 | ( | int32_t | theta | ) |
binary fixed-point sin
binary fixed-point sin****************
| theta | -8192 to 8191, angle is in units 2*pi/16384 radians (-pi to +pi) |
Inverse fft.
discrete Inverse Fast Fourier Transform, Converts frequency to time domain
Assume the input is complex data with components k=0 to n-1
Index 0 <= k < n-1 complex components of frequency f=k/fs
E.g., k=0 represents the DC component of the input
Place n complex values into the array v
Typically the index n/2 <= k < n are complex conjugates of the first half
Call ifft() and the results are returned back in array v
If the input is real only, then the transform will contain
| v | array of input data in complex form |
| n | size of the two arrays 2, 4, 8, ..., 2048 |
| tmp | temporary array of data in complex form |
| int32_t sin540 | ( | int32_t | theta | ) |
binary fixed-point sin
binary fixed-point sin****************
e.g., 359.3degrees (2pi radians) theta=539 sin540(539) = -763 (-0.0116)
e.g., 270 degrees (3pi/4 radians) theta=405 sin540(405) = -65536 (-1)
e.g., 180 degrees (pi radians) theta=270 sin540(270) = 0 (0)
e.g., 90 degrees (pi/2 radians) theta=135 sin540(135) = 65536 (+1)
e.g., 45 degrees (pi/4 radians) theta= 67 sin540(67) = 46071 (sqrt(2)/2)
e.g., 0 degrees (0 radians) theta= 0 sin540(0) = 0 (0)
| theta | 0 to 539, angle is in units 2*pi/540 = 0.011635528 radians (0 to 2pi) |