Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed-dsp
Fork of mbed-os-example-blinky by
Diff: main.cpp
- Revision:
- 52:d5c59769e1de
- Parent:
- 51:837137ab83ed
- Child:
- 53:3187ccbe0cca
--- a/main.cpp Wed Apr 05 14:06:32 2017 +0000 +++ b/main.cpp Wed Apr 05 15:11:42 2017 +0000 @@ -53,13 +53,39 @@ complex c3 = c1 + c2; pc.printf("hello \n"); + + //...Inside your signal processing function // Allocate memory for signal data - complex *pSignal = new complex[1024]; + complex *pSignal_1 = new complex[1024]; + complex *pSignal_2 = new complex[1024]; //...Fill signal array with data // Apply FFT - CFFT::Forward(pSignal, 1024); + CFFT::Forward(pSignal_1, 1024); + CFFT::Forward(pSignal_2, 1024); + //...Utilize transform result + complex *corrSignal = new complex[1024]; + startCorr = corrSignal; + for( i=0; i<1024; i++){ + *corrSignal = (*pSignal_1) * (*pSignal_2); + corrSignal++; + pSignal_1++; + pSignal_2++; + } + + int counter = 0; + int maxPos = 0; //delay i form av antal sample + complex maxValue = (0,0); + for(i=0; i<1024; i++){ + if (*corrSignal > abs(maxValue) ){ + maxValue = *corrSignal; + maxPos = counter; + } + counter++; + corrSignal++; + } + // Free memory delete[] pSignal;