Commit c0345eaf authored by Nguyen Hong Thiet's avatar Nguyen Hong Thiet Committed by Me No Dev

fix missing the first bit in HC589 shift in (#2448)

parent 71ec3c3e
...@@ -25,11 +25,12 @@ uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder) { ...@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment