![]() |
InputEvents v1.6.0
An easy to use but comprehensive Event Library for Buttons, Encoders, Encoder Buttons, Analog Inputs, Joysticks and Switches.
|
A base class for encoder adapters that uses a quadrature encoder table to determine posion changes from pins.
#include <BaseTableEncoderAdapter.h>

Public Member Functions | |
| virtual int32_t | getPosition () override |
| Get the current position of the encoder. More... | |
| virtual void | setPosition (int32_t pos) |
| Set the a new position of the encoder. For some libraries this may only allow it to be set to 0. More... | |
| virtual void | update () |
| Update position using the table. | |
Public Member Functions inherited from IEncoderAdapter | |
| virtual | ~IEncoderAdapter ()=default |
| Destructor to ensure predictable behavious if derived classes are destroyed. | |
| virtual bool | begin (void)=0 |
| For compatibility with the Arduino library convention. More... | |
| virtual int32_t | getPosition (void)=0 |
| Get the current position as reported by the encoder class. More... | |
| virtual void | setPosition (int32_t pos)=0 |
| Set the a new position of the encoder. For some libraries this may only allow it to be set to 0. More... | |
Protected Member Functions | |
| virtual uint8_t | readPin (uint8_t pin) const =0 |
| Concrete implementations must provide a method to read pin values. More... | |
Protected Attributes | |
| uint8_t | _pinA |
| uint8_t | _pinB |
| uint8_t | _prevState = 0 |
| int32_t | _position = 0 |
| bool | _externalUpdate = false |
| Some implementations may allow the update via an interupt. | |
Static Protected Attributes | |
| static constexpr int8_t | table [16] |
|
inlineoverridevirtual |
|
protectedpure virtual |
Concrete implementations must provide a method to read pin values.
| pin |
Implemented in ExpanderEncoderAdapter.
|
inlinevirtual |
Set the a new position of the encoder. For some libraries this may only allow it to be set to 0.
| pos | The desired new position. |
Implements IEncoderAdapter.
|
staticconstexprprotected |