fix missing the first bit in HC589 shift in (#2448)
This commit is contained in:
parent
71ec3c3e31
commit
c0345eafbf
@ -25,11 +25,12 @@ uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder) {
|
|||||||
uint8_t i;
|
uint8_t i;
|
||||||
|
|
||||||
for(i = 0; i < 8; ++i) {
|
for(i = 0; i < 8; ++i) {
|
||||||
digitalWrite(clockPin, HIGH);
|
//digitalWrite(clockPin, HIGH);
|
||||||
if(bitOrder == LSBFIRST)
|
if(bitOrder == LSBFIRST)
|
||||||
value |= digitalRead(dataPin) << i;
|
value |= digitalRead(dataPin) << i;
|
||||||
else
|
else
|
||||||
value |= digitalRead(dataPin) << (7 - i);
|
value |= digitalRead(dataPin) << (7 - i);
|
||||||
|
digitalWrite(clockPin, HIGH);
|
||||||
digitalWrite(clockPin, LOW);
|
digitalWrite(clockPin, LOW);
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
|
Loading…
Reference in New Issue
Block a user