fix bit save in byte read
This commit is contained in:
parent
53663ade65
commit
42d4dbdc2d
|
@ -120,12 +120,12 @@ uint8_t read_byte(uint8_t ack)
|
|||
for (bit=0; bit<8; bit++) {
|
||||
delay(); /* wait for SDA to change */
|
||||
release_SCL(); /* SDA should be valid when clock is high */
|
||||
byte <<= 1; /* make place to save the next bit */
|
||||
if (PORTB&SDA) { /* read bit */
|
||||
byte += 1;
|
||||
} else {
|
||||
byte += 0;
|
||||
}
|
||||
byte <<= 1;
|
||||
hold_SCL(); /* set clock to low for SDA to change */
|
||||
}
|
||||
if (ack) {
|
||||
|
|
Loading…
Reference in New Issue