readMulti method

Read multi - mraa_gpio_read_multi

Read the GPIO(s) value. Reads the number of pins provided to the initialiseMulti() functionwhich must have been called before using this method.

Implementation

MraaReturnCode readMulti(MraaGpioContext dev, MraaGpioMultiRead values) {
  if (_initialiseMultiPinCount == 0) {
    return MraaReturnCode.errorUnspecified;
  }
  final rawValues = ffi.calloc.allocate<Int32>(_initialiseMultiPinCount);
  var intRet = _impl.mraa_gpio_read_multi(dev, rawValues.cast<Int>());
  if (intRet == Mraa.generalError) {
    intRet = 99; // unspecified
  }
  final typedValues = rawValues.asTypedList(_initialiseMultiPinCount);
  values.values = List<int>.from(typedValues);
  ffi.calloc.free(rawValues);

  return MraaReturnCode.returnCode(intRet);
}