Application Note
AN_329 User Guide For LibFT4222
Version 1.5
Document Reference No.: FT_001060 Clearance No.: FTDI#406
56
Product Page
Document Feedback Copyright © Future Technology Devices International Limited
Parameters:
Pointer to a variable of type uint16 which receives the address of the I
2
C slave
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_IS_NOT_I2C_MODE: The device is not in i2c slave mode
Prerequisite:
FT4222_I2CSlave_Init
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 slave
ft4222Status = FT4222_I2CSlave_Init(ftHandle);
if (FT4222_OK != ft4222Status)
{
// i2c slave init failed
return;
}
uint8 i2cAddr;
// set new i2c slave addr
i2cAddr =0x25;
ft4222Status = FT4222_I2CSlave_SetAddress(ftHandle, i2cAddr);
if (FT4222_OK != ft4222Status)
{
// i2c slave get addr failed
return;
}
ft4222Status = FT4222_I2CSlave_GetAddress(ftHandle, &i2cAddr);
if (FT4222_OK != ft4222Status)
{
// i2c slave get addr failed
return;
}
FT4222_UnInitialize(ftHandle);
FT_Close(ftHandle);
3.7.3 I
2
C Slave Set Address
FT4222_STATUS FT4222_I2CSlave_SetAddress(FT_HANDLE ftHandle, uint8 addr)