Application Note
AN_329 User Guide For LibFT4222
Version 1.5
Document Reference No.: FT_001060 Clearance No.: FTDI#406
50
Product Page
Document Feedback Copyright © Future Technology Devices International Limited
}
else
{
// write data failed
}
FT4222_UnInitialize(ftHandle);
FT_Close(ftHandle);
3.6.4 I
2
C Master Write Extension
FT4222_STATUS FT4222_I2CMaster_WriteEx(FT_HANDLE ftHandle, uint16 deviceAddress,
uint8 flag, uint8* buffer, uint16 bytesToWrite, uint16* sizeTransferred)
Supported Chip:
Summary:
I²C defines basic types of transactions, each of which begins with a START and ends with a STOP:
Single message where a master writes data to a slave.
Single message where a master reads data from a slave.
Combined format, where a master issues at least two reads or writes to one or more slaves.
In a combined transaction, each read or write begins with a START and the slave address. The
START conditions after the first are also called repeated START bits. Repeated STARTs are not
preceded by STOP conditions, which is how slaves know that the next message is part of the same
transaction.
This function is supported by the rev B FT4222H or later.
Parameters:
Address of the target I
2
C slave.
The I
2
C condition will be sent with this I
2
C transaction
START = 0x02
Repeated_START = 0x03
Repeated_START will not send master code in HS mode
STOP = 0x04
START_AND_STOP = 0x06
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.
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