Elektronikprojekt Grupp 13 / Mbed OS test_fft_grp13

Dependencies:   mbed-dsp

Fork of mbed-os-example-blinky by Elektronikprojekt Grupp 13

main.cpp

Committer:
KlaraBengtsson
Date:
2017-04-10
Revision:
57:d15ff81fbeeb
Parent:
55:360b5bcdf9a7
Child:
58:afa7b146b6bf

File content as of revision 57:d15ff81fbeeb:

#include "mbed.h"

const int FFT_SIZE = 32;
int sampleCounter;

void samplingBegin(){
    sampleCounter = 0;
}

void samplingCallback() {
    //read sample from our created test data
    samples[sampleCounter] = testData[sampleCounter];
    // sätter imaginär till 0
    samples[sampleCounter + 1] = 0.0;
    sampleCounter += 2;
    if (sampleCounter >= FFT_SIZE *2 ) {
        //här är sampling klar, buffert är full
        //skriv kod här   
}    

bool samplingIsDone() {
    //return true;
}

// main() runs in its own thread in the OS
int main() { 

samplingBegin();

S = & arm_cfft_sR_f32_len1024;



while(1) {
    if(samplingIsDone()){
        arm_cfft_f32(S,samples,0,1);
        arm_cmplx_mag_f32(samples,magnitudes,FFT_SIZE);
        samplingBegin();
    }

}
 
}