transferInt8 method
Shifts out len word counts of the data buffer, 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<Int8> result buffer. Be aware to malloc.free the low
level system memory buffers!
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;
}