matejdro wrote:I had some problems with I2CTransaction (returning always 0), while getData currently works.
gloomyandy wrote:Hi Sven.
There are cases when getData is not suitable.... getData assumes that the read operation on a device requires that a register address needs to be sent (there is no version of getData without a register parameter), so it will always perform a 1 byte write of this address to the device before issuing a read.
As to i2cTransaction returning zero, I'm rather puzzled by that. I can't really see any case in which this can happen (assuming the read parameters are correct), either the read will fail (in which case you get a negative status code), or it works (in which case you get the length of the read returned). There is really no way for an i2c device to not provide the number of bytes requested other than by issuing an error...
Users browsing this forum: No registered users and 4 guests