Closed rbarzic closed 4 years ago
allow direct read from the device without initial register selection. This should match the two possible I2C read supported by the FirmataExpress firmware.
Explanation: With the current code, an I2C write occurs to select a register before the I2C read access. This prevents usage of I2C circuits like an I2C multiplexer (like the tca9548a ) with pymata4. The FirmataExpress supports the two different types of access (with or without the first I2C write) by looking at the number of data passed in the sysex call. (see https://github.com/MrYsLab/FirmataExpress/blob/eff00dba368b10286a6bbfe753b0de44850e1362/examples/FirmataExpress/FirmataExpress.ino#L625)
The pull-request does not change the other I2C read functions but it is very likely that the same documentation update is needed
Before the fix (an simple 1-byte I2C read):
board.i2c_read(I2C_MUX_SLAVE_ADDRESS, 0, 1, i2c_read_callback)
After the fix
board.i2c_read(I2C_MUX_SLAVE_ADDRESS, None, 1, i2c_read_callback)
Thanks for the pull request. I will merge this in the next release sometime in the near future.
allow direct read from the device without initial register selection. This should match the two possible I2C read supported by the FirmataExpress firmware.
Explanation: With the current code, an I2C write occurs to select a register before the I2C read access. This prevents usage of I2C circuits like an I2C multiplexer (like the tca9548a ) with pymata4. The FirmataExpress supports the two different types of access (with or without the first I2C write) by looking at the number of data passed in the sysex call. (see https://github.com/MrYsLab/FirmataExpress/blob/eff00dba368b10286a6bbfe753b0de44850e1362/examples/FirmataExpress/FirmataExpress.ino#L625)
The pull-request does not change the other I2C read functions but it is very likely that the same documentation update is needed
Before the fix (an simple 1-byte I2C read):
After the fix