Non-variable (TESTEDandWORKING)

Dependencies:   mbed-rtos mbed

Fork of ELEC347_Coursework by CMST

Revision:
11:7efb6e4759cc
Parent:
7:6cb27cce4c50
Child:
13:db76473a3d76
--- a/Filter.hpp	Thu Nov 30 10:18:21 2017 +0000
+++ b/Filter.hpp	Sat Dec 02 13:35:40 2017 +0000
@@ -1,12 +1,7 @@
-//#define Fs  35000       //Frequency of Sample Rate in Hz
-//#define N       5       //Number of Nodes N
-
 class FILTER
 {
 private:
-    // calculate_equation();//calculated the value of the equation
 
-    //Can be interrupt driven
     int _Fs;
     int _Fo;
     double _Boost;
@@ -14,11 +9,7 @@
     double _Wo_d;
     double _Wo_d2;
     float _Com_Den;
-    float _NC0;
-    float _NC1;
-    float _NC2;
-    float _DC1;
-    float _DC2;
+    float _NC0,_NC1,_NC2,_DC1,_DC2;
     
     float _FilterOutput;
     float _centreTap; //internal node of filter
@@ -35,17 +26,22 @@
     float _a3;
     float _a4;
 
+    //Filter Parameters
     float _G;
     float _k;
     float _Wo;
-
-    float _xn;     //this value is the input value
-    float _xnm1;
+    
+    //Filter input Variables
+    
+    float _xn;//Current Filter input valuew
+    float _xnm1;//Old filter inputs
     float _xnm2;
     float _xnm3;
     float _xnm4;
 
-    float _yn;
+    //Filter Output Variables
+    
+    float _yn;//Current Filter Output Value
     float _ynm1;
     float _ynm2;
     float _ynm3;
@@ -53,29 +49,25 @@
 
 
 public:
-    FILTER(int Fs, int Fo, double Boost, int Q);    //Constuctor
-    ~FILTER();                                      //Destuctor
+    FILTER(int Fs, int Fo, double Boost, int Q);//Constuctor
+    ~FILTER();//Destuctor
 
-    //Constuct filter
-    
-    void Define_Filter();               //Calculates the coefficeints of the filter
-    
-    void Print_Filter();                //Print Filter Coefficients
-    
-    void Update_Fo(int Fo_New);                   //Update Centre Frequency
-    int Get_Fo();
-    
-    void Update_Boost(double Boost_New);
-    double Get_Boost();
-    
-    void Update_Q(int Q_New);    
-    int Get_Q();
+    void Define_Filter();//Calculates the coefficeints of the filter    
+    void Print_Filter();//Print Filter Coefficients
     
     //Setters
-    void setvalue(float RAW_input);     //xn sample input
+    
+    void setvalue(float RAW_input);//Sets the latest xn sample input value
+    void Update_Boost(double Boost_New);//Updates the Boost Value 
+    void Update_Q(int Q_New);//Sets the Value of Q
+    void Update_Fo(int Fo_New);//Update Centre Frequency
 
     //Getters
-    float getvalue(void);               //returns yn
+    float getvalue(void);//returns yn
+    double Get_Boost();//Gets the Boost Value
+    int Get_Q();//Gets the value of Q
+    int Get_Fo();   //Gets the current value of Centre Frequency
 };
 
 
+