U2C_SpiConfigSS()

U2C_RESULT U2C_SpiConfigSS(
      HANDLE hDevice,
      ULONG IoNumber,
      BOOL ActiveHigh
);

The U2C_SpiConfigSS() function configures GPIO pin specified by IoNumber as SPI Bus Slave Select (Master Select) signal.

To benefit from Slave Select signal during SPI communication you should use Slave Select aware functions set:

Slave Select pin remains unchanged if you call U2C_SpiReadWrite()U2C_SpiWrite() or U2C_SpiRead() function. 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 signal in such a case.

You can configure any number of pins for Slave Select signal and specify different pins for each SPI transaction.

Parameters:

hDevice

Handle to the U2C-12 device.

IoNumber

GPIO pin to be configured as Slave Select (Master Select) signal.

  • 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

ActiveHigh

This parameter determines the active state of the Slave Select signal (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.

Return values:

U2C_SUCCESS

The Slave Select pin was successfully configured.

U2C_HARDWARE_NOT_FOUND

U2C-12 device referenced by hDevice handle was not found.

U2C_BAD_PARAMETER

IoNumber is out of range.

Rating: 
Голосов пока нет