firmata/protocol

I2C read request doesn't contemplate registers

Closed this issue · 2 comments

Yesterday we were trying to perform an I²C read request with @bhagman and we couldn't find the way to specify a register.

As specified in the protocol:

0  START_SYSEX (0xF0)
1  I2C_REQUEST (0x76)
2  slave address (LSB)
3  slave address (MSB) + read/write and address mode bits
     {bit 7: always 0}
     {bit 6: auto restart transmission, 0 = stop (default), 1 = restart}
     {bit 5: address mode, 1 = 10-bit mode}
     {bits 4-3: read/write, 00 = write, 01 = read once, 10 = read continuously, 11 = stop reading}
     {bits 2-0: slave address MSB in 10-bit mode, not used in 7-bit mode}
4  data 0 (LSB)
5  data 0 (MSB)
6  data 1 (LSB)
7  data 1 (MSB)
...
n  END_SYSEX (0xF7)

Are we missing something or is the protocol lacking a register field?

Register is part of the data packet. Typically the first data byte (data 0 LSB + MSB). You can see read and write examples here:

Thanks!