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
AnalogInFiltered.h@2:ae7a31a3c618, 2013-08-30 (annotated)
- Committer:
- rvt
- Date:
- Fri Aug 30 01:37:49 2013 +0000
- Revision:
- 2:ae7a31a3c618
- Parent:
- 1:5b2ab44eb31f
- Child:
- 5:a0bb17c379ce
Better PushButton handling
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| rvt | 0:33bc88c4ab31 | 1 | #ifndef ANALOGINFILTERED_H |
| rvt | 0:33bc88c4ab31 | 2 | #define ANALOGINFILTERED_H |
| rvt | 0:33bc88c4ab31 | 3 | |
| rvt | 0:33bc88c4ab31 | 4 | #include "mbed.h" |
| rvt | 0:33bc88c4ab31 | 5 | #include "AnalogFilterInterface.h" |
| rvt | 0:33bc88c4ab31 | 6 | |
| rvt | 1:5b2ab44eb31f | 7 | /** |
| rvt | 1:5b2ab44eb31f | 8 | Analog input, this reads a analog value from a PIN and send the data through the filterchain |
| rvt | 1:5b2ab44eb31f | 9 | */ |
| rvt | 0:33bc88c4ab31 | 10 | class AnalogInFiltered { |
| rvt | 0:33bc88c4ab31 | 11 | private: |
| rvt | 0:33bc88c4ab31 | 12 | AnalogIn *_ain; |
| rvt | 0:33bc88c4ab31 | 13 | long _lastValue; |
| rvt | 2:ae7a31a3c618 | 14 | int _fuzzyFactor; |
| rvt | 0:33bc88c4ab31 | 15 | AnalogFilterInterface *_filter; |
| rvt | 0:33bc88c4ab31 | 16 | public: |
| rvt | 1:5b2ab44eb31f | 17 | /** |
| rvt | 1:5b2ab44eb31f | 18 | filter : Failter chain |
| rvt | 1:5b2ab44eb31f | 19 | pin : Analog input to read |
| rvt | 1:5b2ab44eb31f | 20 | */ |
| rvt | 2:ae7a31a3c618 | 21 | AnalogInFiltered(AnalogFilterInterface *filter, PinName pin, int fuzzyFactor); |
| rvt | 0:33bc88c4ab31 | 22 | ~AnalogInFiltered(); |
| rvt | 1:5b2ab44eb31f | 23 | |
| rvt | 1:5b2ab44eb31f | 24 | // Read a value from analog in |
| rvt | 0:33bc88c4ab31 | 25 | void measure (); |
| rvt | 1:5b2ab44eb31f | 26 | |
| rvt | 2:ae7a31a3c618 | 27 | |
| rvt | 2:ae7a31a3c618 | 28 | long getData(); |
| rvt | 2:ae7a31a3c618 | 29 | |
| rvt | 1:5b2ab44eb31f | 30 | |
| rvt | 1:5b2ab44eb31f | 31 | // Test if the input value is changed based on a offset |
| rvt | 2:ae7a31a3c618 | 32 | bool getIsChanged(); |
| rvt | 2:ae7a31a3c618 | 33 | |
| rvt | 2:ae7a31a3c618 | 34 | int getFuzzyFactor(); |
| rvt | 0:33bc88c4ab31 | 35 | }; |
| rvt | 0:33bc88c4ab31 | 36 | |
| rvt | 0:33bc88c4ab31 | 37 | #endif |
