Jared's DAC Code
Dependencies: mbed
Fork of Chemical_Sensor_DMA by
Diff: SignalProcessing.cpp
- Revision:
- 6:63de50ac29be
- Parent:
- 5:1b2dc43e8947
- Child:
- 7:af255a90505e
--- a/SignalProcessing.cpp Fri Nov 06 19:28:49 2015 +0000 +++ b/SignalProcessing.cpp Fri Nov 06 20:50:30 2015 +0000 @@ -11,6 +11,7 @@ float i_mod_pre[pre_compute_length]; float q_mod_pre[pre_compute_length]; //uint16_t out_val_pre[pre_compute_length]; +float filteredLong, filteredLongRef; #define twopi 3.14159265359 * 2 @@ -477,6 +478,7 @@ static uint8_t decimationCounter = 0;//used to keep track of how many samples you have currently decimated + static uint16_t finalAverageCounter = 0; //used to keep track of how many elements to average across static float FIR1K_Sample1_i_DecimatedSum=0; static float FIR1K_Sample1_q_DecimatedSum=0;//when decimating sum up all 10 samples at a time have that be your output value static float FIR1K_Sample2_i_DecimatedSum=0; @@ -535,7 +537,10 @@ finalAverageCounter=0; float mag1 = sqrt(Final_Average1_i*Final_Average1_i+Final_Average1_q*Final_Average1_q); float mag2 = sqrt(Final_Average2_i*Final_Average2_i+Final_Average2_q*Final_Average2_q); - printf("V1: %f\tV2: %f\tRatio: %f\n\r",mag1,mag2,mag2/mag1); + //store filtered values for later reading + filteredLong = mag1; + filteredLongRef = mag2; + Final_Average1_i=0; Final_Average1_q=0;//when decimating sum up all 10 samples at a time have that be your output value Final_Average2_i=0; @@ -714,5 +719,9 @@ filter10K(FIR100K_Sample1_i_Output, FIR100K_Sample1_q_Output, FIR100K_Sample2_i_Output, FIR100K_Sample2_q_Output); } - - +float getFiltered(){ + return filteredLong; +} +float getFilteredRef(){ + return filteredLongRef; +}