U2C_RESULT U2C_SpiWriteSS( HANDLE hDevice, BYTE* pOutBuffer, WORD Length ULONG IoNumber BOOL ActiveHigh );
The U2C_SpiWriteSS() function shifts out (writes) a stream of up to 256 bytes to the SPI slave device.
In contrast to U2C_SpiWrite() function, U2C_SpiWriteSS() 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_SpiWrite() function if you don't want to involve slave device selection into SPI transaction. This can be useful if you want to send 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.
Number of bytes to be shifted out to the SPI slave device. 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 written to the SPI slave device.
U2C-12 device referenced by hDevice handle was not found.
Length or IoNumber parameter is out of range.