writeWord method

void writeWord(
  1. int address,
  2. int wordValue, [
  3. BitOrder order = BitOrder.msbLast
])

Writes a wordValue to the I2C device with the address and the bit order.

Some I2C devices can directly be written without an explicit register.

Implementation

void writeWord(int address, int wordValue,
    [BitOrder order = BitOrder.msbLast]) {
  var data = <I2Cmsg>[];
  var array = <int>[];
  if (order == BitOrder.msbLast) {
    array = [wordValue & 0xff, wordValue >> 8];
  } else {
    array = [wordValue >> 8, wordValue & 0xff];
  }
  data.add(I2Cmsg.buffer(address, [], array));
  var result = transfer(data);
  result.dispose();
}