Quadrature encoder interface library.
Fork of QEI by
Revision 1:aea205976bf8, committed 2015-07-28
- Comitter:
- Hapi_Tech
- Date:
- Tue Jul 28 18:57:19 2015 +0000
- Parent:
- 0:5c2ad81551aa
- Child:
- 2:d811f926cf4a
- Commit message:
- Please confirm include "Pullup etc" intruptin mode set.
Changed in this revision
QEI.cpp | Show annotated file Show diff for this revision Revisions of this file |
QEI.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/QEI.cpp Thu Sep 02 16:48:55 2010 +0000 +++ b/QEI.cpp Tue Jul 28 18:57:19 2015 +0000 @@ -131,15 +131,18 @@ QEI::QEI(PinName channelA, PinName channelB, PinName index, + PinMode intRes, int pulsesPerRev, Encoding encoding) : channelA_(channelA), channelB_(channelB), index_(index) { + pulses_ = 0; revolutions_ = 0; pulsesPerRev_ = pulsesPerRev; encoding_ = encoding; - +channelA_.mode(intRes); +channelB_.mode(intRes); //Workout what the current state is. int chanA = channelA_.read(); int chanB = channelB_.read();
--- a/QEI.h Thu Sep 02 16:48:55 2010 +0000 +++ b/QEI.h Tue Jul 28 18:57:19 2015 +0000 @@ -176,7 +176,7 @@ * of only channel A where as X4 uses them on both * channels. */ - QEI(PinName channelA, PinName channelB, PinName index, int pulsesPerRev, Encoding encoding = X2_ENCODING); + QEI(PinName channelA, PinName channelB, PinName index, PinMode intRes, int pulsesPerRev, Encoding encoding = X2_ENCODING); /** * Reset the encoder.