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@1:5b2ab44eb31f, 2013-08-28 (annotated)
- Committer:
- rvt
- Date:
- Wed Aug 28 13:12:39 2013 +0000
- Revision:
- 1:5b2ab44eb31f
- Parent:
- 0:33bc88c4ab31
- Child:
- 2:ae7a31a3c618
Code cleanup
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 | 0:33bc88c4ab31 | 14 | AnalogFilterInterface *_filter; |
| rvt | 0:33bc88c4ab31 | 15 | public: |
| rvt | 1:5b2ab44eb31f | 16 | /** |
| rvt | 1:5b2ab44eb31f | 17 | filter : Failter chain |
| rvt | 1:5b2ab44eb31f | 18 | pin : Analog input to read |
| rvt | 1:5b2ab44eb31f | 19 | */ |
| rvt | 0:33bc88c4ab31 | 20 | AnalogInFiltered(AnalogFilterInterface *filter, PinName pin); |
| rvt | 0:33bc88c4ab31 | 21 | ~AnalogInFiltered(); |
| rvt | 1:5b2ab44eb31f | 22 | |
| rvt | 1:5b2ab44eb31f | 23 | // Read a value from analog in |
| rvt | 0:33bc88c4ab31 | 24 | void measure (); |
| rvt | 1:5b2ab44eb31f | 25 | |
| rvt | 1:5b2ab44eb31f | 26 | // Return the filtered value |
| rvt | 0:33bc88c4ab31 | 27 | long getValue(); |
| rvt | 1:5b2ab44eb31f | 28 | |
| rvt | 1:5b2ab44eb31f | 29 | // Test if the input value is changed based on a offset |
| rvt | 0:33bc88c4ab31 | 30 | bool getIsChanged(int offSet); |
| rvt | 0:33bc88c4ab31 | 31 | }; |
| rvt | 0:33bc88c4ab31 | 32 | |
| rvt | 0:33bc88c4ab31 | 33 | #endif |
