Fix when i2c read ack condition happens

This commit is contained in:
Jeremy Soller 2020-10-21 09:01:58 -06:00
parent 4b16b738f9
commit ab571da499
No known key found for this signature in database
GPG Key ID: E988B49EE78A7FB1

View File

@ -99,7 +99,7 @@ int i2c_read(uint8_t * data, int length) {
int i;
for (i = 0; i < length; i++) {
bool ack = (i + 1) == length;
bool ack = (i + 1) < length;
res = i2c_read_byte(ack);
if (res < 0) return res;
data[i] = (uint8_t)res;