![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Non-variable (TESTEDandWORKING)
Fork of ELEC347_Coursework by
Diff: main.cpp
- Revision:
- 11:7efb6e4759cc
- Parent:
- 10:3495fff88da7
- Child:
- 12:d522a7a061d6
diff -r 3495fff88da7 -r 7efb6e4759cc main.cpp --- a/main.cpp Thu Nov 30 10:18:21 2017 +0000 +++ b/main.cpp Sat Dec 02 13:35:40 2017 +0000 @@ -10,15 +10,15 @@ DigitalOut SampLED(LED1); //Digital Output (GREEN LED is PB_3, D13 You can use an Oscilloscope on This pin to confirm sample rate) //Analog Inputs -AnalogIn QDEF(PA_7); -AnalogIn BDEF(PA_6); -AnalogIn FDEF(PA_5); +AnalogIn QDEF(PA_7); // Q Factor +AnalogIn BDEF(PA_6); // Boost Level +AnalogIn FDEF(PA_5); //Centre Frequency AnalogIn Ain(PA_1); //Analog Input (Signal Input 0 to +3 Volts) AnalogOut Aout(PA_4); //Analog Output (Signal Input 0 to +3 Volts) //Declare Tickers Ticker sample_timer; -Ticker coeff_change; + //Declare Threads Thread t1; @@ -34,7 +34,7 @@ //Declare Filter FILTER BP_filter(48000,10000,-16,2); //Create object of type Filter(Fs,Fo,Boost,Q) -//Declare Fixed Variables +//Declare Variables float Fo = 1; float Boost = 0; float Q = 1; @@ -51,9 +51,12 @@ int main() { - t2.start(sampler); - t1.start(coeff_update); - printf("Hello"); + t2.start(sampler);//Start the Sampler timed interrupt + t1.start(coeff_update);//Update the coeffiecients of the filter + while(1) + { + + } } @@ -78,7 +81,7 @@ BP_filter.Define_Filter(); //Calculate the coefficients //BP_filter.Print_Filter(); //Print the ceofficients printf("Q = %d \t Boost = %f \t Fo = %d\n\r", BP_filter.Get_Q(), BP_filter.Get_Boost(), BP_filter.Get_Fo()); - Thread::wait(1000); + Thread::wait(1000);//Sleep the thread for 1 second then re runs the coefficient calculation } } @@ -94,6 +97,6 @@ SampLED = 0; //LED Indicates end of sampling - Thread::wait(sample_rate/1000); + Thread::wait(sample_rate/1000);//Look at this } -} \ No newline at end of file +}