FastPWM library, modified by benkatz
Dependents: WangBoard_MotorScience
Fork of FastPWM3 by
Revision 27:9c0cc4d4a0bf, committed 2016-06-15
- Comitter:
- nki
- Date:
- Wed Jun 15 05:24:05 2016 +0000
- Parent:
- 26:51c979bca21e
- Commit message:
- VFD for induction motor
Changed in this revision
filters.cpp | Show annotated file Show diff for this revision Revisions of this file |
filters.h | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filters.cpp Wed Jun 15 05:24:05 2016 +0000 @@ -0,0 +1,10 @@ +#include "filters.h" + +MeanFilter::MeanFilter(float strength) { + _strength = strength; + _mean = 0; +} + +float MeanFilter::Update(float x) { + return _mean = _strength * _mean + (1.0f - _strength) * x; +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filters.h Wed Jun 15 05:24:05 2016 +0000 @@ -0,0 +1,13 @@ +#ifndef __FILTERS_H +#define __FILTERS_H + +class MeanFilter { +public: + MeanFilter(float strength); + virtual float Update(float x); +private: + float _mean; + float _strength; +}; + +#endif \ No newline at end of file