SPIMaster_TransferSequential Function
Header: #include <applibs/spi.h>
Performs a sequence of half-duplex read or write transfers using the SPI master interface. This function enables chip select once before the sequence, and disables it when it ends. This function does not support simultaneously reading and writing in a single transfer.
static inline ssize_t SPIMaster_TransferSequential(int fd, const SPIMaster_Transfer *transfers, size_t transferCount);
Parameters
fd
The file descriptor for the SPI master interface.transfers
An array of SPIMaster_Transfer structures that specify the transfer operations. You must call SPIMaster_InitTransfers to initialize the array with default settings before filling it.transferCount
The number of transfer structures in thetransfers
array.
Return value
Returns the number of bytes transferred; or -1 for failure, in which case errno
is set to the error value.
Remarks
Each call to SPIMaster_TransferSequential is limited to at most 4096 bytes to read, and 4096 bytes to write, independent of the number of actual transfers. To transfer additional data, you need to call this function multiple times. Note that chip select will be asserted multiple times in this case.
Application manifest requirements
To access individual SPI interfaces, your application must identify them in the SpiMaster field of the application manifest.