Using the QuickUSB Library
QuickUsbWriteReadSpi
Purpose
Simultaneously write and read a block of data to and from the specified
SPI slave port.
Parameters
hDevice: A HANDLE that was returned from a call to QuickUsbOpen.
portNum: The SPI device address (nSS line) to write to and read from
data:
A pointer to the buffer that contains the data to send and in
which to place the received data.
length:
The number of bytes to send and receive. The maximum length
is 64 bytes.
Returns
A non-zero value if successful, 0 otherwise. In addition, the data buffer is
filled with the received data and the length is set to the number of bytes
actually received on success. Both data and length are left unchanged if
the function failed.
Notes
This function uses the data buffer for both writing data to the SPI and to
store read data from the SPI. Therefore, the data buffer will always be
overwritten on each call to this function.
SPI-Compatible
Port
69