Interface to a standard tarco sensor. Measure the periode and the cal the speed
Diff: Tarco.h
- Revision:
- 14:07d968decc76
- Parent:
- 13:4b58c9730bc7
--- a/Tarco.h Wed Mar 09 13:24:26 2016 +0000 +++ b/Tarco.h Fri Apr 15 12:44:00 2016 +0000 @@ -3,11 +3,8 @@ #include "mbed.h" #define TarcoRunMean 50 -#define PulsPrRotation 23 -#define HirthMode 2 -#define SwitchAuto 1 -#define RunMeanSwitchAuto 0 -//typedef void (*callback_type)(int); +#define PulsPrRotation 24 +#define PulsTimeOut 200 //200ms /************************************************************************************* * Tarco sensor on the SwitchAuto * Have 2 mode to measure the rotation @@ -18,16 +15,11 @@ class Tarco { private: InterruptIn _tarcosensor; - // callback_type callback; - int AdvPeriode[TarcoRunMean]; //running mean for tarco + int AdvPeriode; //running mean for tarco Timer t; //time for one rotation - - char tarcomode; + Ticker TimeOut; + bool GettingPuls; float lastfrekvens; - float advfrekvens; - 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 void TarcoTimeout(); public: @@ -39,14 +31,9 @@ * 0: Standard Prescale to one measure pr rotation * 1: Running mean ********************************************************************************/ - Tarco(PinName tarcosignal,char mode); + Tarco(PinName tarcosignal); /******************************************************************************** - * gives the tarco value in hz - ********************************************************************************/ - - float Speed(); - /******************************************************************************** * gives the tarco value in rotation pr min ********************************************************************************/