Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: AVC_20110423 WallBot_Simple AVC_2012
Revision 1:70348515ed2f, committed 2011-04-20
- Comitter:
- shimniok
- Date:
- Wed Apr 20 16:57:54 2011 +0000
- Parent:
- 0:ac15e38daeb5
- Commit message:
- Fixed major implementation bug. I am an idiot. :)
Changed in this revision
| SimpleFilter.cpp | Show annotated file Show diff for this revision Revisions of this file |
| SimpleFilter.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/SimpleFilter.cpp Wed Apr 20 08:00:25 2011 +0000
+++ b/SimpleFilter.cpp Wed Apr 20 16:57:54 2011 +0000
@@ -6,8 +6,11 @@
short SimpleFilter::filter(short value) {
- _filter_value += value - (_filter_value >> _shift);
- _filter_value >>= _shift;
+ _filter_value += (value - (_filter_value >> _shift));
- return _filter_value;
-}
\ No newline at end of file
+ return _filter_value >> _shift;
+}
+
+short SimpleFilter::value(void) {
+ return _filter_value >> _shift;
+}
--- 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;