com.ftdi.j2xx.ft4222

## Class FT_4222_I2c_Slave

- java.lang.Object
- - com.ftdi.j2xx.ft4222.FT_4222_I2c_Slave

- All Implemented Interfaces:
    I2cSlave

      public class FT_4222_I2c_Slave
      extends java.lang.Object
      implements I2cSlave

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FT_4222_I2c_Slave(FT_4222_Device ft4222Device)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getAddress(int[] addr)` Get the address of the I2C slave device.
    `int` | `init()` Initialize FT4222H as an I2C slave.
    `int` | `read(byte[] buffer, int sizeToTransfer, int[] sizeTransferred)` Read data from the buffer of I2C slave device.
    `int` | `reset()` Reset the I2C slave device.
    `int` | `setAddress(int addr)` Set the address of the I2C slave device.
    `int` | `write(byte[] buffer, int sizeToTransfer, int[] sizeTransferred)` Write data to the I2C slave device.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### FT_4222_I2c_Slave

          public FT_4222_I2c_Slave(FT_4222_Device ft4222Device)

  - ### Method Detail

    - #### init

          public int init()

      Initialize FT4222H as an I2C slave.
      Specified by:
        `init` in interface `I2cSlave`
      Returns:
        FT4222_OK if successful, otherwise the return value is an FT error code.

    - #### reset

          public int reset()

      Reset the I2C slave device.
      Specified by:
        `reset` in interface `I2cSlave`
      Returns:
        FT4222_OK if successful, otherwise the return value is an FT error code.

    - #### getAddress

          public int getAddress(int[] addr)

      Get the address of the I2C slave device.
      Specified by:
        `getAddress` in interface `I2cSlave`
      Parameters:
        `addr` - The address of the I2C slave device.
      Returns:
        FT4222_OK if successful, otherwise the return value is an FT error code.

    - #### setAddress

          public int setAddress(int addr)

      Set the address of the I2C slave device.
      Specified by:
        `setAddress` in interface `I2cSlave`
      Parameters:
        `addr` - The 7-bit address of the I2C slave device.
      Returns:
        FT4222_OK if successful, otherwise the return value is an FT error code.

    - #### read

          public int read(byte[] buffer,
                 int sizeToTransfer,
                 int[] sizeTransferred)

      Read data from the buffer of I2C slave device.
      Specified by:
        `read` in interface `I2cSlave`
      Parameters:
        `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.
      Returns:
        FT4222_OK if successful, otherwise the return value is an FT error code.

    - #### write

          public int write(byte[] buffer,
                  int sizeToTransfer,
                  int[] sizeTransferred)

      Write data to the I2C slave device.
      Specified by:
        `write` in interface `I2cSlave`
      Parameters:
        `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.
      Returns:
        FT4222_OK if successful, otherwise the return value is an FT error code.

About FTDI | FTDI Licence Terms