FastPWM library, modified by benkatz
Dependents: WangBoard_MotorScience
Fork of FastPWM3 by
filters.cpp@27:9c0cc4d4a0bf, 2016-06-15 (annotated)
- Committer:
- nki
- Date:
- Wed Jun 15 05:24:05 2016 +0000
- Revision:
- 27:9c0cc4d4a0bf
VFD for induction motor
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nki | 27:9c0cc4d4a0bf | 1 | #include "filters.h" |
nki | 27:9c0cc4d4a0bf | 2 | |
nki | 27:9c0cc4d4a0bf | 3 | MeanFilter::MeanFilter(float strength) { |
nki | 27:9c0cc4d4a0bf | 4 | _strength = strength; |
nki | 27:9c0cc4d4a0bf | 5 | _mean = 0; |
nki | 27:9c0cc4d4a0bf | 6 | } |
nki | 27:9c0cc4d4a0bf | 7 | |
nki | 27:9c0cc4d4a0bf | 8 | float MeanFilter::Update(float x) { |
nki | 27:9c0cc4d4a0bf | 9 | return _mean = _strength * _mean + (1.0f - _strength) * x; |
nki | 27:9c0cc4d4a0bf | 10 | } |