public void Write(byte addressToWriteTo, byte valueToWrite) { I2CDevice.I2CTransaction[] transaction; transaction = new I2CDevice.I2CTransaction[] { I2CDevice.CreateWriteTransaction(new byte[] { addressToWriteTo, valueToWrite }) }; int result = I2CBus.Execute(myConfig, transaction, Timeout); }
public byte[] Read(byte addressToReadFrom, int responseLength = 1) { var buffer = new byte[responseLength]; I2CDevice.I2CTransaction[] transaction; transaction = new I2CDevice.I2CTransaction[] { I2CDevice.CreateWriteTransaction(new byte[] { addressToReadFrom }), I2CDevice.CreateReadTransaction(buffer) }; int result = I2CBus.Execute(myConfig, transaction, Timeout); return(buffer); }