SpiWriteRead()

Write the specified bytes to the SPI channel and return the response. This function handles CS and allows data to be sent in a single frame or multiple frames.

Syntax


SpiWriteRead(unsigned char channel, unsigned char frameSize, unsigned char numFrames, unsigned char csChan, unsigned char csLL, unsigned char* sendBuffer, unsigned char* recBuffer);

channel
The SPI master channel to write to.

frameSize
The frame size in bytes. CS will be toggled before writing begins and after every frameSize bytes.

numFrames
The number of frames to write.

csChan
The digital output channel to use for CS.

csLL
The CS logic level:

  • 0 - Active Low
  • 1 - Active High

sendBuffer
A pointer to the first element in a byte array containing the data to transmit. The byte array must be at least frameSize*numFrames in size.

recBuffer
A pointer to the first element in a byte array to store the return data. The byte array must be at least frameSize*numFrames in size.

Returns


int status