EasyManua.ls Logo

FTDI LibFT4222 - I 2 C Master Write Extension

Default Icon
78 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
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:
FT4222 chip version
Supported
FT4222 Rev A
NO
FT4222 Rev B
YES
FT4222 Rev C
YES
FT4222 Rev D
YES
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:
ftHandle
Handle of the device.
slaveAddress
Address of the target I
2
C slave.
flag
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
buffer
Pointer to the buffer that contains the data to be written to the device.
bytesToWrite
Number of bytes to write to the device.
sizeTransferred
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

Table of Contents