Constructor and Description |
---|
FT_4222_I2c_Master(FT_4222_Device ft4222Device) |
Modifier and Type | Method and Description |
---|---|
int |
getMaxTransferSize(int[] pMaxSize)
Get the max size of the transfer packet
|
int |
getStatus(int deviceAddress,
byte[] controllerStatus)
Read the status of the I2C master controller.
|
int |
init(int kbps)
Initialize the FT4222H as an I2C master with the requested I2C speed.
|
int |
read(int deviceAddress,
byte[] buffer,
int sizeToTransfer,
int[] sizeTransferred)
Read data from the specified I2C slave device with START and STOP conditions.
|
int |
readEx(int deviceAddress,
int flag,
byte[] buffer,
int sizeToTransfer,
int[] sizeTransferred)
Read data from the specified I2C slave device with the specified I2C condition.
|
int |
reset()
Reset the I2C master device.
|
int |
write(int deviceAddress,
byte[] buffer,
int sizeToTransfer,
int[] sizeTransferred)
Write data to the specified I2C slave device with START and STOP conditions
|
int |
writeEx(int deviceAddress,
int flag,
byte[] buffer,
int sizeToTransfer,
int[] sizeTransferred)
Write data to the specified I2C slave device with the specified I2C condition.
|
public FT_4222_I2c_Master(FT_4222_Device ft4222Device)
public int init(int kbps)
init
in interface I2cMaster
kbps
- The speed of I2C transmission. It ranges from 60K bps to 3400K bps. By specified speed,
the initial function helps to setup bus speed with the corresponding mode.public int reset()
public int read(int deviceAddress, byte[] buffer, int sizeToTransfer, int[] sizeTransferred)
read
in interface I2cMaster
deviceAddress
- Address of the target I2C slave.buffer
- Buffer array that receives the data from the device.sizeToTransfer
- Number of bytes to read from the device.sizeTransferred
- The actual number of bytes read from the device.public int readEx(int deviceAddress, int flag, byte[] buffer, int sizeToTransfer, int[] sizeTransferred)
readEx
in interface I2cMaster
deviceAddress
- Address of the target I2C slave.flag
- The I2C condition will be sent with this I2C transaction. flags is a bit-mask of
FT_4222_Defines.I2C_MasterFlag.NONE
, FT_4222_Defines.I2C_MasterFlag.START
,
FT_4222_Defines.I2C_MasterFlag.Repeated_START
, FT_4222_Defines.I2C_MasterFlag.STOP
and
FT_4222_Defines.I2C_MasterFlag.START_AND_STOP
.buffer
- Buffer array that receives the data from the device.sizeToTransfer
- Number of bytes to read from the device.sizeTransferred
- The actual number of bytes read from the device.public int write(int deviceAddress, byte[] buffer, int sizeToTransfer, int[] sizeTransferred)
write
in interface I2cMaster
deviceAddress
- Address of the target I2C slave.buffer
- Buffer array that contains the data to be written to the device.sizeToTransfer
- Number of bytes to write to the device.sizeTransferred
- The actual number of bytes written to the device.public int writeEx(int deviceAddress, int flag, byte[] buffer, int sizeToTransfer, int[] sizeTransferred)
writeEx
in interface I2cMaster
deviceAddress
- Address of the target I2C slave.flag
- The I2C condition will be sent with this I2C transaction. flags is a bit-mask of
FT_4222_Defines.I2C_MasterFlag.NONE
, FT_4222_Defines.I2C_MasterFlag.START
,
FT_4222_Defines.I2C_MasterFlag.Repeated_START
, FT_4222_Defines.I2C_MasterFlag.STOP
and
FT_4222_Defines.I2C_MasterFlag.START_AND_STOP
.buffer
- Buffer array that contains the data to be written to the device.sizeToTransfer
- Number of bytes to write to the device.
Max size for full speed USB is 60;
Max size for high speed USB at mode 0 and mode 3 is 508;
Max size for high speed USB at mode 1 and mode 2 is 252;
While writing with START_AND_STOP flag, there is no restriction of the size.sizeTransferred
- The actual number of bytes written to the device.public int getStatus(int deviceAddress, byte[] controllerStatus)
public int getMaxTransferSize(int[] pMaxSize)
pMaxSize
- Max transfer size
Max size for full speed USB is 60;
Max size for high speed USB at mode 0 and mode 3 is 508;
Max size for high speed USB at mode 1 and mode 2 is 252;