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.
Dependencies: USBDevice mbed-rtos mbed
Fork of JoyStick by
Diff: AnalogInFiltered.cpp
- Revision:
- 5:a0bb17c379ce
- Parent:
- 2:ae7a31a3c618
diff -r 2cc58c173de8 -r a0bb17c379ce AnalogInFiltered.cpp
--- a/AnalogInFiltered.cpp Thu Mar 10 14:05:02 2016 +0000
+++ b/AnalogInFiltered.cpp Wed Jun 22 12:50:16 2016 +0000
@@ -1,23 +1,18 @@
#include "AnalogInFiltered.h"
-AnalogInFiltered::AnalogInFiltered(AnalogFilterInterface *filter, PinName pin, int fuzzyFactor) {
- _ain = new AnalogIn(pin);
- _filter = filter;
- _fuzzyFactor = fuzzyFactor;
- _lastValue=0;
+AnalogInFiltered::AnalogInFiltered(AnalogFilterInterface *filter, PinName pin, int fuzzyFactor) : _ain(new AnalogIn(pin)), _fuzzyFactor(fuzzyFactor), _filter(filter), _lastValue(0) {
}
AnalogInFiltered::~AnalogInFiltered() {
delete(_ain);
- delete(_filter);
}
-void AnalogInFiltered::measure () {
+void AnalogInFiltered::setData (long d) {
_filter->setData(_ain->read_u16() - 32768);
}
-long AnalogInFiltered::getData() {
+long AnalogInFiltered::getData() const {
return _filter->getData();
}
