public SPIResult SpiTransfer(List <byte> bytes, bool select = true, bool optimizeDataLine = false) { #if NUSBIO2 var r = new SPIResult(); var tmpReadBuffer = new byte[bytes.Count]; var ok = Nusbio2NAL.SPI_Helper_SingleReadWrite(bytes.ToArray(), tmpReadBuffer, bytes.Count); if (ok) { r.Buffer = tmpReadBuffer.ToList(); r.Succeeded = true; } return(r); #else return(this._spi.Transfer(bytes, select, optimizeDataLine)); #endif }
private SPIResult SpiTransfer(List <byte> buffer, bool writeRead) { #if NUSBIO2 var r = new SPIResult(); if (writeRead) { var tmpReadBuffer = new byte[buffer.Count]; var ok = Nusbio2NAL.SPI_Helper_SingleReadWrite(buffer.ToArray(), tmpReadBuffer, buffer.Count); if (ok) { r.Buffer = tmpReadBuffer.ToList(); r.Succeeded = true; } } else { r.Succeeded = Nusbio2NAL.SPI_Helper_Write(buffer.ToArray(), buffer.Count); } return(r); #else return(this._spi.Transfer(buffer)); #endif }