Skip to content

Commit 4ea85ec

Browse files
committed
Fix I2C_CommandReadBulk reading one byte too many
1 parent 855a76b commit 4ea85ec

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/bus/i2c/i2c.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ response_t I2C_CommandReadBulk(void) {
768768
I2C_RestartSignal();
769769
I2C_Transmit((device << 1) | 1);
770770

771-
for (uint8_t i = 1; i < count; ++i) {
771+
while (--count) {
772772
UART1_Write(I2C_Receive(I2C_RESPONSE_ACKNOWLEDGE));
773773
}
774774
UART1_Write(I2C_Receive(I2C_RESPONSE_NEGATIVE_ACKNOWLEDGE));

0 commit comments

Comments
 (0)