InputEvents v1.6.0
An easy to use but comprehensive Event Library for Buttons, Encoders, Encoder Buttons, Analog Inputs, Joysticks and Switches.
Public Member Functions | List of all members
IEncoderAdapter Class Referenceabstract

Description

A lightweight adapter abstract class for encoders.

#include <IEncoderAdapter.h>

Inheritance diagram for IEncoderAdapter:
Inheritance graph
[legend]

Public Member Functions

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...
 

Member Function Documentation

◆ begin()

virtual bool IEncoderAdapter::begin ( void  )
pure virtual

For compatibility with the Arduino library convention.

Must be implemented (but can be empty) as some libraries require it. Can return a boolean to indicate if initialisation has failed.

Returns
true The initialisation was successful.
false The initialisation was failed.

Implemented in ExpanderEncoderAdapter, SlowExpanderEncoderAdapter, and PjrcEncoderAdapter.

◆ getPosition()

virtual int32_t IEncoderAdapter::getPosition ( void  )
pure virtual

Get the current position as reported by the encoder class.

Returns
int32_t The position. May be positive or negative.

Implemented in BaseTableEncoderAdapter, SlowExpanderEncoderAdapter, and PjrcEncoderAdapter.

◆ setPosition()

virtual void IEncoderAdapter::setPosition ( int32_t  pos)
pure virtual

Set the a new position of the encoder. For some libraries this may only allow it to be set to 0.

Parameters
posThe desired new position.

Implemented in BaseTableEncoderAdapter, PjrcEncoderAdapter, and SlowExpanderEncoderAdapter.


The documentation for this class was generated from the following file: