I2cSlave

com.ftdi.j2xx.interfaces

## Interface I2cSlave

- All Known Implementing Classes:
    FT_4222_I2c_Slave

      public interface I2cSlave

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getAddress(int[] addr)` Get the address of the I2C slave device.
    `int` | `init()` Initialize the device 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.

- - ### Method Detail

    - #### init

          int init()

      Initialize the device as an I2C slave.
      Returns:
        0 if successful, otherwise the return value is an FT error code.

    - #### reset

          int reset()

      Reset the I2C slave device.
      Returns:
        0 if successful, otherwise the return value is an FT error code.

    - #### getAddress

          int getAddress(int[] addr)

      Get the address of the I2C slave device.
      Parameters:
        `addr` - The address of the I2C slave device.
      Returns:
        0 if successful, otherwise the return value is an FT error code.

    - #### setAddress

          int setAddress(int addr)

      Set the address of the I2C slave device.
      Parameters:
        `addr` - The 7-bit address of the I2C slave device.
      Returns:
        0 if successful, otherwise the return value is an FT error code.

    - #### read

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

      Read data from the buffer of I2C slave device.
      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:
        0 if successful, otherwise the return value is an FT error code.

    - #### write

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

      Write data to the I2C slave device.
      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:
        0 if successful, otherwise the return value is an FT error code.

About FTDI | FTDI Licence Terms