U2C_RESULT U2C_SpiReadSS( HANDLE hDevice, BYTE* pInBuffer, WORD Length ULONG IoNumber BOOL ActiveHigh );
The U2C_SpiReadSS() function shifts in (reads) a stream of up to 256 bytes from the SPI slave device.
In contrast to U2C_SpiRead() function, U2C_SpiReadSS() 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_SpiRead() function if you don't want to involve slave device selection into SPI transaction. This can be useful if you want to 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 that receives the data shifted in from the SPI slave device.
Number of bytes to be shifted in. 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 read.
U2C-12 device referenced by hDevice handle was not found.
Length or IoNumber parameter is out of range.