counts digital frequency based on interrupt and timer, triggers on rising edge
Diff: FrequencyCounter.h
- Revision:
- 0:91a906dbf731
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FrequencyCounter.h Tue Aug 09 20:03:10 2016 +0000 @@ -0,0 +1,26 @@ +#ifndef FREQUENCY_COUNTER_H_DECL +#define FREQUENCY_COUNTER_H_DECL + +#include <mbed.h> + +class FrequencyCounter { + //mbed classes + Timer _mtime; + InterruptIn _cPin; + + double _lastTime; + double _fq; + double _iircoef; + void _irqs(void); + +public: + + FrequencyCounter(PinName); + double getFrequency(); + double getTime(); + void setIIRCoeff(double); + void start(); + void stop(); +}; +#endif +