gobot
gobot copied to clipboard
i2c/smBus ReadBlockData() not implemented
According to the Kernel specification it should be possible to implement this function. The opposite "WriteBlockData()" is still implemented.
Following drivers could be simplified:
- th02_driver.go
- mpu6050_driver.go
- mpl115a2_driver.go and for getData()
- l3gd20h_driver.go
- HMC5883L in ReadRawData()
- ccs811_driver.go, an implementation of read block data, also used in all 3 bmpx80 and bme280 drivers
- adxl345_driver.go
That sounds like a great idea!
While rework of PCA9501 i2c driver (see #786 ), I found that all implementations of Read*Data() in digispark (and also in firmata) are wrong implemented, regarding to the Kernel specification and the implementation of sys-fs driver.
Read Byte (Comm==Register) S Addr Wr [A] Comm [A] Sr Addr Rd [A] [Data] NA P We have implemented in "ReadByteData()": S Addr Wr [A] Comm [A] P S Addr Rd [A] [Data] NA P
Read Word S Addr Wr [A] Comm [A] Sr Addr Rd [A] [DataLow] A [DataHigh] NA P Implemented in "ReadWordData()": S Addr Wr [A] Data [A] P S Addr Rd [A] [DataLow] A [DataHigh] NA P
In general most chips support both sequences, but unfortunately not all, e.g. PCA9501, which only support the "Read Byte".
At least the littlewire interface, used for digispark, support the skip of stop condition ("P"), so the change is generally no problem.
Hi @deadprogram , because I'm not familiar with firmata in general and with client "writes an arbitrary Sysex command to the microcontroller" in special, I'm just marked the wrong implemented commands with an TODO and will create a new issue for this special behavior.
part of release v2.0.0