jamesbowman / i2cdriver

I2CDriver open source tools
https://i2cdriver.com/
BSD 3-Clause "New" or "Revised" License
187 stars 57 forks source link

i2c_read() should use 'a' command for reads > 64 bytes #34

Open jamesbowman opened 4 years ago

jamesbowman commented 4 years ago

https://github.com/jamesbowman/i2cdriver/blob/23b12eec6e0a7bb2dabf018e05e8244fe662ec0c/c/common/i2cdriver.c#L358

This code is does not work for reads of > 64 bytes, because the read command NAKs the final byte.

Instead, it should use the 'a' command (read with ACK) to read the prefix, before a final read-with-NAK for the last 1-64 bytes.