Elektronikprojekt Grupp 13 / Mbed OS test_fft_grp13

Dependencies:   mbed-dsp

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

Revision:
59:2cd4e73320cb
Parent:
58:afa7b146b6bf
Child:
60:a83a5a34050b
--- a/main.cpp	Mon Apr 10 10:16:14 2017 +0000
+++ b/main.cpp	Mon Apr 10 11:12:38 2017 +0000
@@ -1,28 +1,34 @@
 #include "mbed.h"
+#include "arm_math.h"
+#include "arm_const_structs.h"
 
 const int FFT_SIZE = 32;
 int sampleCounter;
 float samples[FFT_SIZE*2];
 float magnitudes[FFT_SIZE];
-int SAMPLE_RATE_HZ = 10 000;
+//int SAMPLE_RATE_HZ = 10000;
+
+//static const float testData[FFT_SIZE/2];       //vår test data
+float testData = {10, 20, 30, 40, 50, 60, 70, 80, 10, 20, 30, 40, 50, 60, 70, 80,10, 20, 30, 40, 50, 60, 70, 80, 10, 20, 30, 40, 50, 60, 70, 80};
 
 void samplingBegin(){
     sampleCounter = 0;
+    //sätt hårdvaru inställningar här om det behövs
 }
 
 void samplingCallback() {
-    //read sample from our created test data
-    samples[sampleCounter] = testData[sampleCounter];
+    //läs 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   
+        //skriv hårdvaru kod här   
 }    
 
 bool samplingIsDone() {
-    //return true;
+    return (sampleCounter >= FFT_SIZE*2);
 }
 
 // main() runs in its own thread in the OS
@@ -30,7 +36,7 @@
 
 samplingBegin();
 
-S = & arm_cfft_sR_f32_len1024;
+S = & arm_cfft_sR_f32_len32;
 
 
 
@@ -41,6 +47,4 @@
         samplingBegin();
     }
 
-}
- 
 }
\ No newline at end of file