InputEvents v1.6.0
An easy to use but comprehensive Event Library for Buttons, Encoders, Encoder Buttons, Analog Inputs, Joysticks and Switches.
IEncoderAdapter.h
1
9#ifndef INPUT_EVENTS_IENCODER_ADAPTER_H
10#define INPUT_EVENTS_IENCODER_ADAPTER_H
11
12#include <Arduino.h>
13
14
20
21public:
22
26 virtual ~IEncoderAdapter() = default;
27
36 virtual bool begin(void) = 0;
37
38
44 virtual int32_t getPosition(void) = 0;
45
51 virtual void setPosition(int32_t pos) = 0;
52
53
54
55
56protected:
57
58
59
60};
61
62
63#endif
A lightweight adapter abstract class for encoders.
Definition: IEncoderAdapter.h:19
virtual int32_t getPosition(void)=0
Get the current position as reported by the encoder class.
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.
virtual bool begin(void)=0
For compatibility with the Arduino library convention.
virtual ~IEncoderAdapter()=default
Destructor to ensure predictable behavious if derived classes are destroyed.