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

Revision:
8:2e6b17f1da02
Parent:
7:752b8065ce2d
Child:
11:284b87a84cdd
--- a/Tarco.h	Fri Mar 07 08:01:26 2014 +0000
+++ b/Tarco.h	Thu Sep 11 07:43:31 2014 +0000
@@ -3,7 +3,11 @@
 
 #include "mbed.h"
 #define TarcoRunMean 50
-#define PulsPrRotation 24
+#define PulsPrRotation 23
+#define HirthMode 2
+#define SwitchAuto 1
+#define RunMeanSwitchAuto 0
+typedef void (*callback_type)(int);
 /************************************************************************************* 
 *  Tarco sensor on the SwitchAuto
 *  Have 2 mode to measure the rotation
@@ -14,13 +18,14 @@
 class Tarco {
 private:
     InterruptIn _tarcosensor;
+    callback_type callback;
     int AdvPeriode[TarcoRunMean]; //running mean for tarco
     Timer t; //time for one rotation
 
     char tarcomode;
     float lastfrekvens;
     int lastperiode;
-    
+    void Hird();
     void RunMeanMeasure(); //Measure the tarco from a one puls /rotation source
     void Rotationtimer();   //measure tarco by dividing input frekvens with 24
     
@@ -33,7 +38,7 @@
     * 0: Standard Prescale to one measure pr rotation
     * 1: Running mean
      ********************************************************************************/
-    Tarco(PinName tarcosignal,char mode);
+    Tarco(PinName tarcosignal,char mode,callback_type _callback);
     
     /********************************************************************************
     * gives the tarco value in hz