transferInt8 method

Pointer<Uint8> transferInt8(
  1. Pointer<Uint8> data,
  2. bool reuseBuffer,
  3. int len
)

Shifts out len word counts of the data budder, while shifting in the result buffer. If reuseBuffer is true, data will be used the result buffer, for false a new buffer will be created.

Returns a ' Pointer

Implementation

Pointer<Uint8> transferInt8(Pointer<Uint8> data, bool reuseBuffer, int len) {
  Pointer<Uint8> inPtr;
  Pointer<Uint8> outPtr = nullptr;
  if (reuseBuffer) {
    inPtr = outPtr = data;
  } else {
    inPtr = data;
    outPtr = malloc<Uint8>(len);
  }
  _checkError(_nativeTransfer(_spiHandle, inPtr, outPtr, len));
  return outPtr;
}