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.
Fork of Impedance_Fast_Circuitry by
Diff: main.cpp
- Revision:
- 75:8bb94685c80b
- Parent:
- 74:ebc9f09fda11
- Child:
- 76:704fc58ffcd0
--- a/main.cpp Thu Jun 01 22:12:31 2017 +0000 +++ b/main.cpp Fri Jun 02 21:10:22 2017 +0000 @@ -5,7 +5,7 @@ #include "DMA_sampling/dac.h" #include "DMA_sampling/pdb.h" #include "Jareds_DSP/filters_jared.h" - +#include "Jareds_DSP/demodulate.h" // DSP #include "dsp.h" @@ -38,48 +38,7 @@ -/* -// To set up FIR filtering -#define TOTAL_TAPS 20 -#define STATE_LENGTH 51 -#define BUFFER_LENGTH 32 -uint16_t numTaps = TOTAL_TAPS; -float States_50k[4][STATE_LENGTH]= {0}; -float States_6250[8][STATE_LENGTH]= {0}; -float States_781[8][STATE_LENGTH]= {0}; -float Coeffs[TOTAL_TAPS] = {0.0380723866161221, 0.0263930577547015, 0.0332622132972336, 0.0408057838845535, 0.0482178949738844, 0.0551211071268984, 0.0611830030337647, 0.0660392721230197, 0.0694611630329689, 0.0711942672973351, 0.0711942672973351, 0.0694611630329688, 0.0660392721230197, 0.0611830030337647, 0.0551211071268984, 0.0482178949738844, 0.0408057838845535, 0.0332622132972336, 0.0263930577547015, 0.0380723866161221}; -//arm_fir_instance_f32 S = {numTaps, State, Coeffs}; -arm_fir_decimate_instance_f32 filterStruct_50k[4] = {DECIMATION_FACTOR, numTaps, Coeffs, States_50k[0], - DECIMATION_FACTOR, numTaps, Coeffs, States_50k[1], - DECIMATION_FACTOR, numTaps, Coeffs, States_50k[2], - DECIMATION_FACTOR, numTaps, Coeffs, States_50k[3]}; - -arm_fir_decimate_instance_f32 filterStruct_6250[8] = {DECIMATION_FACTOR, numTaps, Coeffs, States_6250[0], - DECIMATION_FACTOR, numTaps, Coeffs, States_6250[1], - DECIMATION_FACTOR, numTaps, Coeffs, States_6250[2], - DECIMATION_FACTOR, numTaps, Coeffs, States_6250[3], - DECIMATION_FACTOR, numTaps, Coeffs, States_6250[4], - DECIMATION_FACTOR, numTaps, Coeffs, States_6250[5], - DECIMATION_FACTOR, numTaps, Coeffs, States_6250[6], - DECIMATION_FACTOR, numTaps, Coeffs, States_6250[7]}; - -arm_fir_decimate_instance_f32 filterStruct_781[8] = {DECIMATION_FACTOR, numTaps, Coeffs, States_781[0], - DECIMATION_FACTOR, numTaps, Coeffs, States_781[1], - DECIMATION_FACTOR, numTaps, Coeffs, States_781[2], - DECIMATION_FACTOR, numTaps, Coeffs, States_781[3], - DECIMATION_FACTOR, numTaps, Coeffs, States_781[4], - DECIMATION_FACTOR, numTaps, Coeffs, States_781[5], - DECIMATION_FACTOR, numTaps, Coeffs, States_781[6], - DECIMATION_FACTOR, numTaps, Coeffs, States_781[7]}; -//filterStruct_50k[0] = {DECIMATION_FACTOR, numTaps, Coeffs, States_50k[0]}; -//filterStruct_50k[1] = {DECIMATION_FACTOR, numTaps, Coeffs, States_50k[1]}; -//filterStruct_50k[2] = {DECIMATION_FACTOR, numTaps, Coeffs, States_50k[2]}; -//filterStruct_50k[3] = {DECIMATION_FACTOR, numTaps, Coeffs, States_50k[3]}; - -float filter_input_array[BUFFER_LENGTH] = {0}; -float filter_output_array[BUFFER_LENGTH] = {0}; -*/ #define pre_compute_length 500 #define demodulation_length 125 #define CarrierFrequency 200 @@ -106,6 +65,7 @@ int main() { pre_compute_tables(); + precompute_tables(); //turn off all LEDs led_blue = 1; led_green = 1; @@ -155,6 +115,7 @@ while(sampling_status == 0)//wait until the ADCs read a new value { status_0 = 1; + //Thread::wait(.0001); } sampling_status = 0;//sets sampling status to 0. DMA sets it to one once ADCs sample status_0 = 0;//Tied to D0. use an O-scope to measure how much free time there is to play with.