fix bit save in byte read

This commit is contained in:
King Kévin 2014-08-02 14:09:17 -07:00
parent 53663ade65
commit 42d4dbdc2d
1 changed files with 1 additions and 1 deletions

View File

@ -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) {