Application Note
AN_329 User Guide For LibFT4222
Version 1.5
Document Reference No.: FT_001060 Clearance No.: FTDI#406
41
Product Page
Document Feedback Copyright © Future Technology Devices International Limited
if(rxSize>0)
{
recvBuf.resize(rxSize);
if(FT4222_SPISlave_Read(ftHandle,&recvBuf[0], rxSize, &sizeTransferred)==
FT4222_OK)
{
// get data
}
else
{
// get data failed
}
}
}
}
FT4222_UnInitialize(ftHandle);
FT_Close(ftHandle);
3.4.6 SPI Slave Write
FT4222_STATUS FT4222_SPISlave_Write(FT_HANDLE ftHandle, uint8* buffer, uint16
bytesToWrite, uint16* sizeTransferred)
Supported Chip:
Summary:
Write data to the transmit queue of the SPI slave device.
For some reasons, support lib will append a dummy byte (0x00) at the first byte automatically.
This additional byte exists at all of the three transfer methods.
Parameters:
Pointer to the buffer that contains the data to be written to the device.
Number of bytes to write to the device.
Pointer to a variable of type uint16 which receives the number of bytes written
to the device.
Return Value:
FT4222_OK if successful, otherwise the return value is an FT error code.
Error code:
FT4222_DEVICE_NOT_OPENED: The initialization API is not called
FT4222_DEVICE_NOT_SUPPORTED: This device is not a FT4222 chip.
FT4222_IS_NOT_SPI_MODE: The device is not in spi slave mode.
FT4222_INVALID_POINTER: The parameter buffer or sizeTransferred is NULL.
FT4222_INVALID_PARAMETER: Parameter bytesToWrite is equal to zero.