![]() |
RSeries astromech firmware
|
#include <encoder/RotaryEncoder.h>
Decodes the signals from a rotary encoder (quadrature pulses) and translates them into a counter position.
Inheritance diagram for RotaryEncoder:
Collaboration diagram for RotaryEncoder:Public Types | |
| enum | Direction { Direction::kNoRotation = 0, Direction::kClockwise = 1, Direction::kCounterClockwise = -1 } |
| enum | LatchMode { LatchMode::kFour3 = 1, LatchMode::kFour0 = 2, LatchMode::kTwo03 = 3 } |
Public Member Functions | |
| RotaryEncoder (byte pin1, byte pin2, LatchMode mode=LatchMode::kFour0, bool useInterrupt=true) | |
| virtual void | setup () override |
| Subclasses must implement this function to perform any necessary setup that cannot happen in the constructor. More... | |
| virtual void | animate () override |
| Subclasses must implement this function to run through a single frame of animation/activity. More... | |
| void | begin () |
| void | end () |
| bool | hasChanged () |
| Returns true if value has changed since last animated event. More... | |
| long | getValue () |
| Returns current value. More... | |
| bool | isActive () |
| Returns true if recently used (<250ms) More... | |
| Direction | getDirection () |
| Return the direction the knob was rotated last time. More... | |
| void | setValue (long newValue) |
| Sets the current value. More... | |
| uint32_t | getMillisBetweenRotations () const |
| Returns time in milliseconds between the current observed. More... | |
| uint32_t | getRPM () |
| Returns the RPM. More... | |
Public Member Functions inherited from SetupEvent | |
| SetupEvent () | |
| Default Constructor. More... | |
Protected Member Functions | |
| virtual void | interrupt () override |
Additional Inherited Members | |
Static Public Member Functions inherited from SetupEvent | |
| static void | ready () |
| Calls setup() for each created AnimatedEvent subclass. More... | |
|
strong |
|
strong |
|
inline |
|
inlineoverridevirtual |
Subclasses must implement this function to run through a single frame of animation/activity.
Subclasses should not call delay() or otherwise block.
Implements AnimatedEvent.
Reimplemented in AnoRotaryEncoder.
|
inline |
|
inline |
|
inline |
Return the direction the knob was rotated last time.
|
inline |
Returns time in milliseconds between the current observed.
|
inline |
Returns the RPM.
|
inline |
Returns current value.
|
inline |
Returns true if value has changed since last animated event.
|
inlineoverrideprotectedvirtual |
Implements PinInterruptHandler.
|
inline |
Returns true if recently used (<250ms)
|
inlineoverridevirtual |
Subclasses must implement this function to perform any necessary setup that cannot happen in the constructor.
Implements SetupEvent.
|
inline |
Sets the current value.