Application Note
AN_329 User Guide For LibFT4222
Version 1.5
Document Reference No.: FT_001060 Clearance No.: FTDI#406
27
Product Page
Document Feedback Copyright © Future Technology Devices International Limited
Prerequisite:
FT4222_SPIMaster_init
Example:
FT_HANDLE ftHandle = NULL;
FT_STATUS ftStatus;
FT4222_STATUS ft4222Status;
ftStatus = FT_Open(0, &ftHandle);
if (FT_OK != ftStatus)
{
// open failed
return;
}
ft4222Status = FT4222_SPIMaster_Init(ftHandle, SPI_IO_SINGLE, CLK_DIV_4, CLK_IDLE_LOW,
CLK_LEADING, 0x01);
if (FT4222_OK != ft4222Status)
{
// spi master init failed
return;
}
uint8 recvData[10];
uint16 sizeTransferred;
ft4222Status = FT4222_SPIMaster_SingleRead(ftHandle, &recvData[0], 10, &sizeTransferred,
true);
if (FT4222_OK != ft4222Status)
{
// spi master read failed
return;
}
FT4222_UnInitialize(ftHandle);
FT_Close(ftHandle);
3.3.4 SPI Master Single Write
FT4222_STATUS FT4222_SPIMaster_SingleWrite(FT_HANDLE ftHandle, uint8* buffer, uint16
bytesToWrite, uint16* sizeTransferred, BOOL isEndTransaction)
Supported Chip:
Summary:
Under SPI single mode, write data to an SPI slave.
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.