|
Mutila: Mouse's Utilities for Arduino
Oft-used utilities: debouncing buttons, averaging samples, and so on.
|
#include <QuantizedPot.h>
Public Member Functions | |
| QuantizedPot (const uint8_t pin, int8_t maxRanges) | |
| ~QuantizedPot () | |
| int8_t | addRange (int start, int end) |
| void | begin (uint8_t threshold=AbstractDebouncedButton::DefaultThreshold, uint8_t delay=AbstractDebouncedButton::DefaultButtonDelay) |
| void | update () |
| int8_t | value () |
| int | velocity () |
Protected Member Functions | |
| int8_t | _value () |
| void | setState (int8_t newState) |
Protected Attributes | |
| const uint8_t | _pin |
| int8_t | _rangeMax |
| int8_t | _rangeCount |
| NumericRange< int > ** | _ranges |
| uint8_t | _threshold |
| uint8_t | _delay |
| uint32_t | _lastUpdate |
| uint8_t | _counter |
| int8_t | _state |
| uint32_t | _lastStateChange |
| int | _lastRaw |
| int | _velocity |
Use potential divider to select values based on specified ranges.
Definition at line 10 of file QuantizedPot.h.
| QuantizedPot::QuantizedPot | ( | const uint8_t | pin, |
| int8_t | maxRanges | ||
| ) |
Constructor.
| pin | the analog input pin to monitor (e.g. A0) |
| maxRanges | the maximum number of ranges we will want in our object |
Definition at line 7 of file QuantizedPot.cpp.
| QuantizedPot::~QuantizedPot | ( | ) |
|
protected |
Instantaneous value.
Definition at line 78 of file QuantizedPot.cpp.

| int8_t QuantizedPot::addRange | ( | int | start, |
| int | end | ||
| ) |
Add a range to the object. Cannot add more than maxRanges (from constructor)
| start | the first valid number of the range |
| end | the last valid number of the range (not inclusive) |
Definition at line 36 of file QuantizedPot.cpp.
| void QuantizedPot::begin | ( | uint8_t | threshold = AbstractDebouncedButton::DefaultThreshold, |
| uint8_t | delay = AbstractDebouncedButton::DefaultButtonDelay |
||
| ) |
Initializtion.
| threshold | debouncing threshold (see DebouncedButton for details) |
| delay | debouncing delay (see DebouncedButton for details) |
Definition at line 50 of file QuantizedPot.cpp.
| void QuantizedPot::update | ( | ) |
Allocate Timeslice.
This method must be called frequently - usually from loop()
Definition at line 58 of file QuantizedPot.cpp.

| int8_t QuantizedPot::value | ( | ) |
Get value.
Definition at line 73 of file QuantizedPot.cpp.
|
inline |
Get velocity
How far the current measurement is from the last measurement
Definition at line 59 of file QuantizedPot.h.
1.8.15