Your browser does not allow scripts
Please click here to view a static table of contents without scripts
SPI_SetGPIOs
Return to Introduction  Previous page  Next page
Controls the use of the 4 upper general purpose input/output pins of the FT2232C device.

FTC_STATUS
SPI_SetGPIOs
(FTC_HANDLE ftHandle, PFTC_CHIP_SELECT_PINS pChipSelectsDisableStates, PFTC_INPUT_OUTPUT_PINS pHighInputOutputPinsData)




Parameters
ftHandle
Handle of the device.
pChipSelectsDisableStates
Pointer to a structure that contains the disable states for the 5 chip select pins of the FT2232C.
pHighInputOutputPinsData
Pointer to a structure that contains the data that is used to control the upper 4 GPIO pins of the FT2232C.




Return Value
FTC_SUCCESS if successful, otherwise the return value is one of the following FTC error codes:

   FTC_INVALID_HANDLE
   FTC_NULL_INPUT_OUTPUT_BUFFER_POINTER
   FTC_
FAILED_TO_COMPLETE_COMMAND
   FTC_IO_ERROR



Remarks
This function provides complete control over the state of the 4 upper general purpose input/output (GPIO) pins (ACBUS 0 - ACBUS3). They can be configured to be inputs, low outputs or high outputs. The state of the pins can be read using the SPI_GetGPIOs function.

This function is also used to set the disabled states for the chip select pins (ADBUS3 - ADBUS7).

The definitions of
FTC_CHIP_SELECT_PINS and FTC_INPUT_OUTPUT_PINS structures are given in the Appendix.



Example

FTC_STATUS Status = FTC_SUCCESS;
FTC_HANDLE ftHandle;
FTC_CHIP_SELECT_PINS ChipSelectsDisableStates;
FTC_INPUT_OUTPUT_PINS HighInputOutputPins;

// Set chip select pin states (ADBUS3 - ADBUS7)
ChipSelectsDisableStates.bADBUS3ChipSelectPinState = false;
ChipSelectsDisableStates.bADBUS4GPIOL1PinState = false;
ChipSelectsDisableStates.bADBUS5GPIOL2PinState = false;
ChipSelectsDisableStates.bADBUS6GPIOL3PinState = false;
ChipSelectsDisableStates.bADBUS7GPIOL4PinState = false;

// Set GPIO pin states (ACBUS0 - ACBUS3)
HighInputOutputPins.bPin1InputOutputState = true;
HighInputOutputPins.bPin1LowHighState = false;
HighInputOutputPins.bPin2InputOutputState = true;
HighInputOutputPins.bPin2LowHighState = false;
HighInputOutputPins.bPin3InputOutputState = true;
HighInputOutputPins.bPin3LowHighState = false;
HighInputOutputPins.bPin4InputOutputState = true;
HighInputOutputPins.bPin4LowHighState = false;

Status = SPI_SetGPIOs(ftHandle, &ChipSelectsDisableStates, &HighInputOutputPins);