Main Site Documentation

Passing a 7-bit I2C slave address to I2cConnectionSettings


#1

I have a click board attached to a BrainPad running TinyCLR 0.5.0. The board uses 7-bit I2C slave addresses, and then wants the least-significant bit of that byte set to 1 for read and 0 for write. So, when I pass the slave address to the I2cConnectionSettings constructor, do I pass in the 7-bit address right-justified (leaving the most-significant bit at 0), or do I pass in the 7-bit address left-justified and leave the least-significant bit as zero? (In other words, does the software automatically insert the read/write bit at the appropriate times?)

Or, do I treat the read and write as completely separate I2C slave addresses, and just specify the full 8 bits in two different settings, one address for read (LSbit 1) and one for write (LSBit 0)?

The I2C slave address info I’m referring to is page 39 of this datasheet.

Thanks.


#2

You’ll want to specify the 7bit address with no space for the read/write bit. The driver will shift the 7bit address left by one, then or in the read/write byte as needed.


#3

Perfect. Thanks so much.