14#define jENCODER_MAKE_ISR_MACRO(name) \
15 void name##_jENCODER_ISR() { name.encoderISR(); }
25#define jENCODER_MAKE_ISRS_MACRO(name) \
26 void name##_jENCODER_ISR_A() { name.ISRA(); } \
27 void name##_jENCODER_ISR_B() { name.ISRB(); }
102#if (defined(ESP32) || defined(CORE_TEENSY) || defined(SAMD_SERIES) || defined(ESP8266) || defined(JMOTOR_ENCODER_FORCE_ATTACHINTERRUPT)) && !defined(JMOTOR_ENCODER_FORCE_PINCHANGE)
defines common interface for JEncoder
Definition JEncoder.h:33
virtual float getDistPerCountFactor()
returns a conversion factor between encoder ticks and distance that can be set for the encoder
virtual long getCounter()
returns how far the encoder has turned from the zero position
virtual void setRev(bool _rev)
empty function for directionless encoders to override
Definition JEncoder.h:38
virtual void run()
if an encoder needs to have some code called each loop (like absolute encoder polling encoder and cal...
virtual float getPos()
returns how far the encoder has turned from the zero position converted to distance
virtual float getVel()
calculates velocity in distance per second where distance was set by setdistPerCountFactor()
virtual bool isVelNew()
could be useful for only recalculating a control loop if there's new velocity data
virtual void setDistPerCountFactor(float _factor)
set the conversion factor between encoder ticks and distance
virtual bool hasDirection()
can this encoder measure direction or just speed
virtual long zeroCounter()
reset the counter of how far the encoder has turned