FTC_STATUS
|
SPI_AddDeviceReadCmd
|
(FTC_HANDLE ftHandle, PFTC_INIT_CONDITION pReadStartCondition, BOOL bClockOutControBitsMSBFirst, BOOL bClockOutControBitsPosEdge, DWORD dwNumControlBitsToWrite, PWriteControlByteBuffer pWriteControlBuffer, DWORD dwNumControlBytesToWrite, BOOL bClockInDataBitsMSBFirst, BOOL bClockInDataBitsPosEdge, DWORD dwNumDataBitsToRead, PReadDataByteBuffer pReadDataBuffer, LPDWORD lpdwNumDataBytesReturned, PFTC_HIGHER_OUTPUT_PINS pHighPinsReadActiveStates)
|
Parameters
ftHandle
|
Handle of the device.
|
pReadStartCondition
|
Pointer to the structure that contains the start output states (low or high) of the clock, data out and signal out/chip select pins of the FT2232C.
|
bClockOutControBitsMSBFirst
|
Clock out control bits most significant bit (MSB) first (TRUE), clock out control bits least significant bit (LSB) first (FALSE).
|
bClockOutControBitsPosEdge
|
Clock out control bits on positive clock edge (TRUE), clock out control bits on negative clock edge (FALSE).
|
dwNumControlBitsToWrite
|
Specifies the number of control bits to be written to an external device. Valid range 2 to 2040. 2040 bits is equivalent to 255 bytes.
|
pWriteControlBuffer
|
Pointer to buffer that contains the control data to be written to an external device. Listed below is an example of control and address bytes:
Control Address byte 1, Control Address byte 2 |
dwNumControlBytesToWrite
|
Specifies the number of control bytes in the write control buffer, which contains all the specified bits to be written to an external device. Valid range 1 to 255 bytes.
|
bClockInDataBitsMSBFirst
|
Clock in data bits most significant bit (MSB) first (TRUE), clock in data bits least significant bit (LSB) first (FALSE).
|
bClockInDataBitsPosEdge
|
Clock in data bits on positive clock edge (TRUE), clock in data bits on negative clock edge (FALSE).
|
dwNumDataBitsToRead
|
Specifies the number of bits to be read from an external device. Valid range 2 to 524280. 524280 bits is equivalent to 64K bytes.
|
pHighPinsReadActiveStates
|
Pointer to the structure that contains which of the 4 upper general purpose input/output pins of a FT2232C, are to be used during a write to an external device. Each GPIO pin that is to be used during a read from an external device must have been previously configured as an output pin (see SPI_SetGPIOs).
|
Return Value
FTC_SUCCESS if successful, otherwise the return value is one of the following FTC error codes:
FTC_INVALID_HANDLE
FTC_NULL_INITIAL_CONDITION_BUFFER_POINTER
FTC_INVALID_NUMBER_CONTROL_BITS
FTC_NULL_WRITE_CONTROL_BUFFER_POINTER
FTC_INVALID_NUMBER_CONTROL_BYTES
FTC_NUMBER_CONTROL_BYTES_TOO_SMALL
FTC_INVALID_NUMBER_DATA_BITS
FTC_NULL_OUTPUT_PINS_BUFFER_POINTER
FTC_INVALID_INIT_CLOCK_PIN_STATE
FTC_INVALID_FT2232C_CHIP_SELECT_PIN
FTC_INVALID_CONFIGURATION_HIGHER_GPIO_PIN
FTC_COMMAND_SEQUENCE_BUFFER_FULL
FTC_INSUFFICIENT_RESOURCES
Remarks
Do not invoke SPI_Write or SPI_Read functions while constructing a sequence of commands as this will clear the sequence of commands and associated data from the internal command buffer.
This command can be used with multiple devices connected.
Calling this function is equivalent to adding the commands and data from a SPI_Read call to the internal command buffer.
This function can be used with SPI_ClearDeviceCmdSequence, SPI_AddDeviceWriteCmd and SPI_ExecuteCmdSequence to buffer a long list of commands and data which can then be sent to the FT2232C in one go. This can provide faster data transfer rates in some applications.
The read start condition, write control buffer and high pins read active states definitions are given in the Appendix.