V001. 2017_11_30 10:21 Working code from Tuesday's lab session.

Dependencies:   mbed-rtos mbed

Fork of 2017_11_28_ELEC347_Coursework by Chris Hills

DSP Coursework ELEC347 2017-2018 Group members: Matthew Thewsey, Thomas Morris, Samuel Waggett, Christopher Hills .

Committer:
mwthewsey
Date:
Tue Nov 28 09:41:07 2017 +0000
Revision:
1:b088b771a591
Parent:
0:d39a06ca6bf1
Child:
2:f6e49378dd8a
First working version;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mwthewsey 0:d39a06ca6bf1 1 //#define Fs 35000 //Frequency of Sample Rate in Hz
mwthewsey 0:d39a06ca6bf1 2 //#define N 5 //Number of Nodes N
mwthewsey 0:d39a06ca6bf1 3
mwthewsey 0:d39a06ca6bf1 4 class FILTER
mwthewsey 0:d39a06ca6bf1 5 {
mwthewsey 0:d39a06ca6bf1 6 private:
mwthewsey 0:d39a06ca6bf1 7 // calculate_equation();//calculated the value of the equation
mwthewsey 0:d39a06ca6bf1 8
mwthewsey 0:d39a06ca6bf1 9 //Can be interrupt driven
mwthewsey 0:d39a06ca6bf1 10 int _Fs;
mwthewsey 0:d39a06ca6bf1 11 int _Fo;
mwthewsey 0:d39a06ca6bf1 12 int _Boost;
mwthewsey 0:d39a06ca6bf1 13 int _Q;
mwthewsey 0:d39a06ca6bf1 14
mwthewsey 0:d39a06ca6bf1 15 float FilterOutput;
mwthewsey 0:d39a06ca6bf1 16 float _centreTap; //internal node of filter
mwthewsey 0:d39a06ca6bf1 17 float _b0;
mwthewsey 0:d39a06ca6bf1 18 float _b1;
mwthewsey 0:d39a06ca6bf1 19 float _b2;
mwthewsey 0:d39a06ca6bf1 20 float _b3;
mwthewsey 0:d39a06ca6bf1 21 float _b4;
mwthewsey 0:d39a06ca6bf1 22
mwthewsey 0:d39a06ca6bf1 23 // A - Denominator coefficients
mwthewsey 0:d39a06ca6bf1 24 float _a0;
mwthewsey 0:d39a06ca6bf1 25 float _a1;
mwthewsey 0:d39a06ca6bf1 26 float _a2;
mwthewsey 0:d39a06ca6bf1 27 float _a3;
mwthewsey 0:d39a06ca6bf1 28 float _a4;
mwthewsey 0:d39a06ca6bf1 29
mwthewsey 0:d39a06ca6bf1 30 float _G;
mwthewsey 0:d39a06ca6bf1 31 float _k;
mwthewsey 0:d39a06ca6bf1 32 float _Wo;
mwthewsey 0:d39a06ca6bf1 33
mwthewsey 0:d39a06ca6bf1 34 float _xn; //this value is the input value
mwthewsey 0:d39a06ca6bf1 35 float _xnm1;
mwthewsey 0:d39a06ca6bf1 36 float _xnm2;
mwthewsey 0:d39a06ca6bf1 37 float _xnm3;
mwthewsey 0:d39a06ca6bf1 38 float _xnm4;
mwthewsey 0:d39a06ca6bf1 39
mwthewsey 0:d39a06ca6bf1 40 float _yn;
mwthewsey 0:d39a06ca6bf1 41 float _ynm1;
mwthewsey 0:d39a06ca6bf1 42 float _ynm2;
mwthewsey 0:d39a06ca6bf1 43 float _ynm3;
mwthewsey 0:d39a06ca6bf1 44 float _ynm4;
mwthewsey 0:d39a06ca6bf1 45
mwthewsey 0:d39a06ca6bf1 46
mwthewsey 0:d39a06ca6bf1 47 public:
mwthewsey 0:d39a06ca6bf1 48 FILTER(int Fs, int Fo, int Boost, int Q); //Constuctor
mwthewsey 0:d39a06ca6bf1 49 ~FILTER(); //deConstuctor
mwthewsey 0:d39a06ca6bf1 50
mwthewsey 0:d39a06ca6bf1 51 //setters
mwthewsey 0:d39a06ca6bf1 52 void setvalue(int RAW_input); //xn sample input
mwthewsey 0:d39a06ca6bf1 53
mwthewsey 0:d39a06ca6bf1 54 //getters
mwthewsey 0:d39a06ca6bf1 55 float getvalue(void); //returns yn
mwthewsey 0:d39a06ca6bf1 56
mwthewsey 0:d39a06ca6bf1 57 };
mwthewsey 0:d39a06ca6bf1 58
mwthewsey 0:d39a06ca6bf1 59
mwthewsey 1:b088b771a591 60 https://os.mbed.com/users/thomasmorris/code/ELEC347_CourseWork/