Application Note
AN_329 User Guide For LibFT4222
Version 1.5
Document Reference No.: FT_001060 Clearance No.: FTDI#406
20
Product Page
Document Feedback Copyright © Future Technology Devices International Limited
HANDLE hRxEvent;
ftStatus = FT_Open(0, &ftHandle);
if (FT_OK != ftStatus)
{
// open failed
return;
}
ft4222Status = FT4222_SPISlave_InitEx(ftHandle, SPI_SLAVE_NO_ACK);
if (FT4222_OK != ft4222Status)
{
// init spi slave failed
return;
}
hRxEvent = CreateEvent(
NULL,
false, // auto-reset event
false, // non-signalled state
NULL );
ft4222Status = FT4222_SetEventNotification(ftHandle, FT4222_EVENT_RXCHAR, hRxEvent);
if (FT4222_OK != ft4222Status)
{
//set event notification failed
return;
}
uint16 rxSize;
uint16 sizeTransferred;
while(1)
{
WaitForSingleObject(hRxEvent, 1000);
ft4222Status = FT4222_SPISlave_GetRxStatus(ftHandle, &rxSize);
if(ft4222Status == FT4222_OK)
{
if(rxSize>0)
{
std::vector<unsigned char> tmpBuf;
tmpBuf.resize(rxSize);
ft4222Status = FT4222_SPISlave_Read(ftHandle, &tmpBuf[0], rxSize,
&sizeTransferred);
// handle receive data
}
}
}
FT_Close(ftHandle);
3.2.10 Get Version
FT4222_STATUS FT4222_GetVersion(FT_HANDLE ftHandle, FT4222_Version* pVersion)
Supported Chip: