Application Note
AN_329 User Guide For LibFT4222
Version 1.5
Document Reference No.: FT_001060 Clearance No.: FTDI#406
47
Product Page
Document Feedback Copyright © Future Technology Devices International Limited
Return Value:
FT4222_OK if successful, otherwise the return value is an FT error code.
Error code:
FT4222_DEVICE_NOT_SUPPORTED: This device is not a FT4222 chip.
FT4222_I2C_NOT_SUPPORTED_IN_THIS_MODE:I2C is not supported in mode 1 and mode 2.
Example:
FT_HANDLE ftHandle = NULL;
FT_STATUS ftStatus;
FT4222_STATUS ft4222Status;
ftStatus = FT_Open(0, &ftHandle);
if (FT_OK != ftStatus)
{
// open failed
return;
}
// initial i2c master with 1000K bps
ft4222Status = FT4222_I2CMaster_Init(ftHandle, 1000);
if (FT4222_OK != ft4222Status)
{
// i2c master init failed
return;
}
FT4222_UnInitialize(ftHandle);
FT_Close(ftHandle);
3.6.2 I
2
C Master Read
FT4222_STATUS FT4222_I2CMaster_Read(FT_HANDLE ftHandle, uint16 slaveAddress, uint8*
buffer, uint16 bytesToRead, uint16* sizeTransferred)
Supported Chip:
Summary:
Read data from the specified I2C slave device with START and STOP conditions.
Parameters:
Address of the target I
2
C slave.
Pointer to the buffer that receives data from the device.
Number of bytes to read from the device.
Pointer to a variable of type uint16 which receives the number of bytes read
from the device.
Return Value:
FT4222_OK if successful, otherwise the return value is an FT error code.