11//
22// FILE: rotaryDecoder.cpp
33// AUTHOR: Rob Tillaart
4- // VERSION: 0.1.1
4+ // VERSION: 0.1.3
55// DATE: 2021-05-08
66// PURPOSE: rotary decoder library for Arduino
77// URL: https://github.com/RobTillaart/rotaryDecoder
8- //
9- // HISTORY:
10- // 0.1.0 2021-05-08 initial version
11- // 0.1.1 2021-11-15 update build-CI, readme.md
12- // improve readability of code
13- // 0.1.2 2021-12-27 update library.json, license, minor edits
148
159
1610#include " rotaryDecoder.h"
1711
1812
1913// ///////////////////////////////////////////////////
2014//
21- // CONSTRUCTORS
15+ // CONSTRUCTORS
2216//
2317rotaryDecoder::rotaryDecoder (const int8_t address, TwoWire *wire)
2418{
@@ -91,7 +85,7 @@ bool rotaryDecoder::update()
9185 uint8_t change = (_lastPos[i] << 2 ) | currentpos;
9286 switch (change)
9387 {
94- case 0b0001 : // fall through..
88+ case 0b0001 : // fall through..
9589 case 0b0111 :
9690 case 0b1110 :
9791 case 0b1000 :
@@ -125,7 +119,7 @@ bool rotaryDecoder::updateSingle()
125119 uint8_t change = (_lastPos[i] << 2 ) | currentpos;
126120 switch (change)
127121 {
128- case 0b0001 : // fall through..
122+ case 0b0001 : // fall through..
129123 case 0b0111 :
130124 case 0b1110 :
131125 case 0b1000 :
@@ -150,12 +144,16 @@ bool rotaryDecoder::updateSingle()
150144}
151145
152146
147+ // ///////////////////////////////////////////////////
148+ //
149+ // PRIVATE
150+ //
153151uint8_t rotaryDecoder::_read8 ()
154152{
155153 _wire->requestFrom (_address, (uint8_t )1 );
156154 return _wire->read ();
157155}
158156
159157
160- // -- END OF FILE --
158+ // -- END OF FILE --
161159
0 commit comments