readI2Cblock method

List<int> readI2Cblock(
  1. int len
)
inherited

Reads a byte array from the I2C bus.

Implementation

List<int> readI2Cblock(int len) {
  autoWait();
  var error = I2Cexception.empty();
  for (var i = 0; i < retry; ++i) {
    try {
      var data = i2c.readBytesReg(hatArduinoI2Caddress, hatRegister, len);
      _updateLastAction();
      return data;
    } on I2Cexception catch (e) {
      error = e;
      sleep(Duration(milliseconds: delay));
    }
  }
  throw error;
}