EasyManua.ls Logo

FTDI LibFT4222 - Page 53

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
52
Product Page
Document Feedback Copyright © Future Technology Devices International Limited
Supported Chip:
FT4222 chip version
Supported
FT4222 Rev A
NO
FT4222 Rev B
YES
FT4222 Rev C
YES
FT4222 Rev D
YES
Summary:
Read data from the specified I
2
C slave device with the specified I
2
C condition.
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 receives the data from the device.
bytesToRead
Number of bytes to read from the device.
sizeTransferred
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.
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
FT4222_INVALID_POINTER: Parameter buffer is NULL
FT4222_INVALID_PARAMETER: bytesToRead is equal to zero
FT4222_FAILED_TO_READ_DEVICE: Failed to read data.
Prerequisite:
FT4222_I2CMaster_Init
Example:
Please refer to the example in FT4222_I2CMaster_WriteEx
I²C combined message support
In a combined message, each read or write begins with a START and the slave address. After the
first START, the subsequent starts are referred to as repeated START bits; repeated START bits are
not preceded by STOP bits, which indicate to the slave the next transfer is part of the same
message.
Start
7 bit
slave
address
write
ACK
8 bit data
ACK
SR
7 bit slave
address
R
ead
ACK
8 bit data
ACK
8 bit data
N
ACK
STOP

Table of Contents