Interface to a standard tarco sensor. Measure the periode and the cal the speed
Tarco.h
- Committer:
- gert_lauritsen
- Date:
- 2014-09-11
- Revision:
- 8:2e6b17f1da02
- Parent:
- 7:752b8065ce2d
- Child:
- 11:284b87a84cdd
File content as of revision 8:2e6b17f1da02:
#ifndef _Tarco_H #define _Tarco_H #include "mbed.h" #define TarcoRunMean 50 #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 * @param mode * Mode 0 Prescale * Mode 1 Runing mean *************************************************************************************/ 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 public: /******************************************************************************** * 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,callback_type _callback); /******************************************************************************** * gives the tarco value in hz ********************************************************************************/ float Speed(); /******************************************************************************** * gives the tarco value in rotation pr min ********************************************************************************/ float RPM(); }; #endif