U2C_RESULT U2C_SpiReadWriteSS( HANDLE hDevice, BYTE* pOutBuffer, BYTE* pInBuffer, WORD Length ULONG IoNumber BOOL ActiveHigh );
The U2C_SpiReadWriteSS() function shifts out (writes) and in (reads) a stream of up to 256 bytes to/from the SPI slave device.
In contrast to U2C_SpiReadWrite() function, U2C_SpiReadWriteSS() also selects the SPI slave device to communicate with. Slave Select pin should be preconfigured withU2C_SpiConfigSS() function. You can configure any number of pins for Slave Select signal and specify different pins for each SPI transaction.
Use U2C_SpiReadWrite() function if you don't want to involve slave device selection into SPI transaction. This can be useful if you want to send or receive several buffers through SPI Bus changing Slave Select pin only once. You can use GPIO routines to work with Slave Select pin in such a case.
Handle to the U2C-12 device.
Pointer to the buffer containing the data to be shifted out to the SPI slave device.
Pointer to the buffer that receives the data shifted in from the SPI slave device.
Number of bytes to be transferred via SPI bus. Maximum value is 256.
GPIO pin to be used for SPI slave device selection.
- Numbers 0..7 correspond to Port A pins 0..7
- Numbers 8..15 correspond to Port B pins 0..7
- Number 16..23 correspond to Port C pins 0..7
This parameter determines the active state of the Slave Select pin (state during the SPI transfer). If ActiveHigh is TRUE - Slave Select pin value will be changed from logical "0" to logical "1" before SPI transaction and returned back to logical "0" after the data is transmitted. If ActiveHigh is FALSE - Slave Select pin value will be changed from logical "1" to logical "0" before SPI transaction and returned back to logical "1" after the data is transmitted.
The data was successfully transmitted via SPI bus.
U2C-12 device referenced by hDevice handle was not found.
Length or IoNumber parameter is out of range.