![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Code has problems. Refer to this repo: https://os.mbed.com/users/igorsk/code/FFT/
main.cpp@0:be659bc4df49, 2017-12-05 (annotated)
- Committer:
- parthchandak02
- Date:
- Tue Dec 05 08:11:10 2017 +0000
- Revision:
- 0:be659bc4df49
initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
parthchandak02 | 0:be659bc4df49 | 1 | #include "mbed.h" |
parthchandak02 | 0:be659bc4df49 | 2 | #include <SerialBase.h> |
parthchandak02 | 0:be659bc4df49 | 3 | |
parthchandak02 | 0:be659bc4df49 | 4 | Timer timer_slow; |
parthchandak02 | 0:be659bc4df49 | 5 | Timer timer_med; |
parthchandak02 | 0:be659bc4df49 | 6 | Timer timer_fast; |
parthchandak02 | 0:be659bc4df49 | 7 | |
parthchandak02 | 0:be659bc4df49 | 8 | Serial pc(USBTX, USBRX); // tx, rx |
parthchandak02 | 0:be659bc4df49 | 9 | |
parthchandak02 | 0:be659bc4df49 | 10 | AnalogOut aout(p18); |
parthchandak02 | 0:be659bc4df49 | 11 | |
parthchandak02 | 0:be659bc4df49 | 12 | void fftR4(short *y, short *x, int N); |
parthchandak02 | 0:be659bc4df49 | 13 | |
parthchandak02 | 0:be659bc4df49 | 14 | short x[512]; // input data 16 bit, 4 byte aligned x0r,x0i,x1r,x1i,.... |
parthchandak02 | 0:be659bc4df49 | 15 | short y[512]; // output data 16 bit,4 byte aligned y0r,y0i,y1r,y1i,.... |
parthchandak02 | 0:be659bc4df49 | 16 | short z[512]; // same format... |
parthchandak02 | 0:be659bc4df49 | 17 | |
parthchandak02 | 0:be659bc4df49 | 18 | int main() |
parthchandak02 | 0:be659bc4df49 | 19 | { |
parthchandak02 | 0:be659bc4df49 | 20 | for (i=0;i<512;i++) |
parthchandak02 | 0:be659bc4df49 | 21 | { |
parthchandak02 | 0:be659bc4df49 | 22 | x[i]=0; |
parthchandak02 | 0:be659bc4df49 | 23 | } |
parthchandak02 | 0:be659bc4df49 | 24 | for (i=0;i<512;i=i+8) |
parthchandak02 | 0:be659bc4df49 | 25 | { |
parthchandak02 | 0:be659bc4df49 | 26 | x[i+0]=16384; |
parthchandak02 | 0:be659bc4df49 | 27 | x[i+2]=16384; |
parthchandak02 | 0:be659bc4df49 | 28 | x[i+4]=-16384; |
parthchandak02 | 0:be659bc4df49 | 29 | x[i+6]=-16384; |
parthchandak02 | 0:be659bc4df49 | 30 | } |
parthchandak02 | 0:be659bc4df49 | 31 | |
parthchandak02 | 0:be659bc4df49 | 32 | fftR4(y, x, 256); |
parthchandak02 | 0:be659bc4df49 | 33 | } |