Implements a simple leaky integrator integer value filter, handy for fast, simple, ADC output filtering. Implemented as described here: [[http://ece124web.groups.et.byu.net/references/readings/Simple%20Software%20Lowpass%20Filter.pdf|Simple Software Lowpass Filter.pdf]]
Dependents: AVC_20110423 WallBot_Simple AVC_2012
Diff: SimpleFilter.h
- Revision:
- 1:70348515ed2f
- Parent:
- 0:ac15e38daeb5
--- a/SimpleFilter.h Wed Apr 20 08:00:25 2011 +0000 +++ b/SimpleFilter.h Wed Apr 20 16:57:54 2011 +0000 @@ -21,6 +21,18 @@ */ short filter(short value); + /** Read the current value in the filter + * + * @returns the current value in the filter + */ + short value(void); + + /** Shorthand operator for value() + * + * @returns the current value in the filter + */ + operator short() { return value(); } + private: long _filter_value; short _shift;