Interface to a standard tarco sensor. Measure the periode and the cal the speed

Revision:
7:752b8065ce2d
Parent:
6:2ad5029f7b1a
Child:
8:2e6b17f1da02
--- a/Tarco.h	Wed Nov 20 13:29:29 2013 +0000
+++ b/Tarco.h	Fri Mar 07 08:01:26 2014 +0000
@@ -1,42 +1,48 @@
-#include "mbed.h"
-
 #ifndef _Tarco_H
 #define _Tarco_H
+
+#include "mbed.h"
 #define TarcoRunMean 50
-
+#define PulsPrRotation 24
+/************************************************************************************* 
+*  Tarco sensor on the SwitchAuto
+*  Have 2 mode to measure the rotation
+*  @param mode
+*  Mode 0 Prescale
+*  Mode 1 Runing mean
+*************************************************************************************/
 class Tarco {
-
 private:
     InterruptIn _tarcosensor;
-    void click(); //Measure the tarco from a one puls /rotation source
-    void fsk();   //measure tarco from a fsk source
-    int p1,p2;
     int AdvPeriode[TarcoRunMean]; //running mean for tarco
     Timer t; //time for one rotation
-    Timer fsktime; //time between fsk pulse
-    int pulsvariation, lastpuls, count;
+
     char tarcomode;
     float lastfrekvens;
     int lastperiode;
+    
+    void RunMeanMeasure(); //Measure the tarco from a one puls /rotation source
+    void Rotationtimer();   //measure tarco by dividing input frekvens with 24
+    
 public:
-    // ********************************************************************************
-    // Constructor
-    // @param flowsignal   The pin which is connected to the flowsensor.
-    //
-    // change the mode of the tarco
-    // 0: Standard One click/rotation
-    // 1: FSK modulated 
-    // ********************************************************************************
+    /********************************************************************************
+    * Constructor
+    * @param flowsignal   The pin which is connected to the flowsensor.
+    *
+    * change the mode of the tarco
+    * 0: Standard Prescale to one measure pr rotation
+    * 1: Running mean
+     ********************************************************************************/
     Tarco(PinName tarcosignal,char mode);
     
-    // ********************************************************************************
-    // gives the tarco value in hz
-    // ********************************************************************************
+    /********************************************************************************
+    * gives the tarco value in hz
+    ********************************************************************************/
 
     float Speed();
-    // ********************************************************************************
-    // gives the tarco value in rotation pr min
-    // ********************************************************************************
+    /********************************************************************************
+    * gives the tarco value in rotation pr min
+    ********************************************************************************/
 
     float RPM();
 };