Has this code (the working version) been posted on the code site at all? I have tried using the version here and got the InvalidOperationExceptions in the constructor - I can fix it, but rather than to that myself I would happily opt to use the tested working code ;D
Xarren … Actually, the software I2C is really slow. With no added delays, the serial clock is only about 1.5 KHz. But it does work, and allows me to connect multiple identical sensors (all of which use the same address) to a single Domino.
Gus … I was already thinking about writing an RLP version of the driver. It wouldn’t fit on a Domino, but I have a Cobra that I can try it out on. That should be much faster … maybe even fast enough that I’ll have to worry about getting the serial clock rate right!
Nope, the class stands most away from the hardware… I need to read and write the bytes which are read. In the reading I need to process the bytes, this to see the number of bytes to actually read…
@ Gus: Yes, for the SoftwareI2C, but if you want a custom protocol on the hardware I2C, and the I2CDevice from Microsoft.SPOT.Hardware is too slow, the only way out would be RLP…
@ iwritecode: Have you tried the I2CDevice already?
But that’s still reading and writing blocks of data…
For reading I first need to check a status byte… If its 0x00 then I can continue read, otherwise I have to abort and try again. Then I need to read the data size, and then need to read the number of bytes specified + CRC…
Not possible with both current solutions I believe
Create a read transaction for 1 byte, and use that transaction to read status and later on, to read the data length. Then you setup an other read transaction that matches the requested length+CRC length, and use that transaction to read the rest of your data.
Oh I see, it’s a very custom protocol you have there! What device are you talking with, if I might ask? Do you have a datasheet we can see? If it is your own hardware, I would switch to a normal serial protocol like RS232.