Senior Design: Sound Monitor / 4951

Dependencies:   LCD_fonts SPI_TFT_ILI9341 CMSIS_DSP_401_without_cm4 mbed-src SDFileSystem wavfile

Revision:
9:5a860b9c8a6a
Parent:
8:057ff6060e39
Child:
10:0986108f8aa3
diff -r 057ff6060e39 -r 5a860b9c8a6a main.cpp
--- a/main.cpp	Sun Dec 13 16:11:44 2015 +0000
+++ b/main.cpp	Sun Dec 13 16:46:14 2015 +0000
@@ -1,3 +1,4 @@
+#include "main.h" //FROM DFSDM CORE
 #include <math.h>
 #include "stdio.h"
 #include "mbed.h"
@@ -9,6 +10,25 @@
 #include "SDFileSystem.h"
 //#include "main.h"
 #define samplenum 1024
+//FROM DFSDM CORE
+extern void RECORD(void);
+extern void MSE(void);
+extern void COMPARE(void);
+
+extern  float32_t CONTROLPWR[1024]; //CONTROL 0 PWR
+extern  float32_t CONTROLPHS[1024]; //CTONROL 0 PHS
+extern  float32_t CONTROLPWRMSE;//CONTROL PWR MSE
+extern  float32_t CONTROLPHSMSE;//CONTROL PHS MSE
+extern float32_t POWER[1024];
+extern float32_t PHS[1024];
+extern float32_t PWRMSE;
+extern float32_t PHSMSE;
+
+Serial pc(SERIAL_TX, SERIAL_RX);
+//DigitalIn mybutton(USER_BUTTON);
+//DigitalOut myled(LED1);
+//SDFileSystem sd(PC_12, PC_11, PC_10, PD_2, "sd");
+//
  
 DigitalIn ain1(PC_9);
 DigitalIn ain2(PB_15);
@@ -437,19 +457,19 @@
             TFT.foreground(White);
             TFT.locate(40, 240);
             printf(" recording\n  comparison...");
-            
-//            RECORD();       // RECORD CONTROL 0
-//            uint32_t n;
-//            for(n=0;n<1024;n++)
-//            {   CONTROLPWR[n]=POWER[n]; }
-//            for(n=0;n<1024;n++)
-//            {   CONTROLPHS[n]=PHS[n];   }
- 
-//            RECORD();       //RECORD CONTROL 1
-//            MSE();          //MSE BETWEEN CONTROLS
-//            CONTROLPWRMSE=PWRMSE;
-//            CONTROLPHSMSE=PHSMSE;
- 
+            //DFSDM CORE
+                pc.printf("\r\n\r\nEntering AudioRecord_demo()...\r\n");
+                RECORD();   // RECORD CONTROL 0
+                uint32_t n;
+                for(n=0;n<1024;n++)
+                {CONTROLPWR[n]=POWER[n];}
+                for(n=0;n<1024;n++)
+                {CONTROLPHS[n]=PHS[n];}
+                RECORD(); //RECORD CONTROL 1
+                MSE(); //MSE BETWEEN CONTROLS
+                CONTROLPWRMSE=PWRMSE;
+                CONTROLPHSMSE=PHSMSE;
+            //
             TFT.cls();
             comp=1;
             menu=0;
@@ -481,9 +501,9 @@
             while (stage==5)
             {   sum=0;      sum_mse=0;      sum_st=0;
 
-//                RECORD();                       //  microphone here, with interval
-//                MSE();
-//                COMPARE();
+                RECORD();
+                MSE();
+                COMPARE();
 
                 for(abc=0; abc<samplenum; abc++)
                 {   a1 = a[abc];    b1 = b[abc];    sum = sum+a[abc];