Main Site Documentation

What's the difference between I2CDevice.CreateReadTransaction() and new I2CDevice.I2CReadTransaction()


#1

I’m looking into the I2C API, and I’m getting a bit confused. There seem to be multiple ways to create an I2C transaction.

I can either use the static I2CDevice.CreateReadTransaction method ( http://msdn.microsoft.com/en-us/library/ee432174.aspx ), or create a new I2CDevice.I2CReadTransaction object ( http://msdn.microsoft.com/en-us/library/ee434124.aspx ). I’m puzzled as to what the difference is. Both take the same number of arguments.

I asked this on StackOverflow as well, but got no response: http://stackoverflow.com/q/6138853/102441

Which should I use, and why?


#2

Maybe this would help? http://wiki.tinyclr.com/index.php?title=I2C_-_EEPROM


#3

Not really. I’ve managed to write the code, and I think I’ve worked out how Microsoft intended the transactions to be used (ie create them once, use them over and over again). I’d just like to know whether the code for I2CDevice does this behind the scenes, or if there’s more going on:


public static I2CWriteTransaction CreateWriteTransaction (byte[] buffer)
{
	return new I2CWriteTransaction(buffer)
}

To me, writing such a method seems like a serious mistake on microsoft’s part. Even from a shorthand point of view, it only saves one character.