Closed sonelu closed 4 years ago
read_word
is not supposed to be used to read two successive byte registers. SMBus will simply return the first byte register twice.
We implemented a few changes in BaseRegister
by introducing an attribute word
that is default False
and can be switched to True
for real word based registers.
We also allow size > 1 for I2C devices, in which case the read
and write
will make successive calls to read_byte
and write_byte
and compose the value of the register. We also introduced an order
attribute in BaseRegister
that allows handling of low-high register sequence or high-low.
Might be worth checking if other read
or write
functions can be used to speed up the reading of several registers in one go.
If the device has 8 bit defined registers and you have a 'low' and a 'high' value for a measure (ex. for accelerometer or gyro) using i2c
read_word_data
will not work as it will not return the two successive registers, but the first register twice.Need to define a 'byte', 'word' property of the register to deal with 'word' type of registers and be able to read them correctly in i2c.