Handle reading pulses from encoder.
Definition: QEI.h:84
int prevState_
Definition: QEI.h:194
int pulsesPerRev_
Definition: QEI.h:193
volatile int revolutions_
Definition: QEI.h:200
void setPulses(int newCount)
Set the current pulse count in case you want to init it.
Encoding
Definition: QEI.h:86
@ X4_ENCODING
Definition: QEI.h:88
@ X2_ENCODING
Definition: QEI.h:87
int getCurrentState(void)
Read the state of the encoder.
InterruptIn channelB_
Definition: QEI.h:190
Encoding encoding_
Definition: QEI.h:187
InterruptIn index_
Definition: QEI.h:191
QEI(PinName channelA, PinName channelB, PinName index, int pulsesPerRev, Encoding encoding=X2_ENCODING)
Constructor.
volatile int pulses_
Definition: QEI.h:199
void encode(void)
Update the pulse count.
void reset(void)
Reset the encoder.
InterruptIn channelA_
Definition: QEI.h:189
void index(void)
Called on every rising edge of channel index to update revolution count by one.
int currState_
Definition: QEI.h:195
int getPulses(void)
Read the number of pulses recorded by the encoder.
int getInvalidCount(void)
Read the number of invalid counts.
int getRevolutions(void)
Read the number of revolutions recorded by the encoder on the index channel.
volatile int invalid_
Definition: QEI.h:197
void setRevolutions(int newRevs)
Set the current revolution count in case you want to init it.