Application Note
AN_329 User Guide For LibFT4222
Version 1.5
Document Reference No.: FT_001060 Clearance No.: FTDI#406
39
Product Page
Document Feedback Copyright © Future Technology Devices International Limited
// init spi slave failed
return;
}
// set spi cpol and cpha to mode 3
if (FT4222_OK != FT4222_SPISlave_SetMode(ftHandle, CLK_IDLE_HIGH, CLK_TRAILING))
{
// set spi mode failed
return;
}
FT4222_UnInitialize(ftHandle);
FT_Close(ftHandle);
3.4.4 SPI Slave Get Rx Status
FT4222_STATUS FT4222_SPISlave_GetRxStatus(FT_HANDLE ftHandle, uint16* pRxSize)
Summary:
Get number of bytes in the receive queue.
Supported Chip:
Parameters:
Pointer to a variable of type uint16 which receives the number of bytes in the
receive queue.
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 pRxSize is NULL.
Prerequisite:
FT4222_SPISlave_InitEx or FT4222_SPISlave_Init
Example:
Please refer to the example in FT4222_SPISlave_Read.
3.4.5 SPI Slave Read
FT4222_STATUS FT4222_SPISlave_Read(FT_HANDLE ftHandle, uint8* buffer, uint16
bytesToRead, uint16* sizeOfRead).