com.ftdi.j2xx.protocol

## Class FT_Spi_Slave

- java.lang.Object
- - java.lang.Thread
  - - com.ftdi.j2xx.protocol.SpiSlaveThread
    - - com.ftdi.j2xx.protocol.FT_Spi_Slave

- All Implemented Interfaces:
    java.lang.Runnable

      public class FT_Spi_Slave
      extends com.ftdi.j2xx.protocol.SpiSlaveThread

  FT SPI Slave Protocol

  Example of using the FT SPI Slave Protocol

  Init

  ------------------------------------------------

  mSPISlave = mFT4222Device0.getSpiSlaveDevice();

  FT_4222_Spi_Slave ft4222_spi_ext = (FT_4222_Spi_Slave) mSPISlave;

  if(ft4222_spi_ext != null)

  ft4222_spi_ext.setDrivingStrength(SPI_DrivingStrength.DS_12MA, SPI_DrivingStrength.DS_16MA, SPI_DrivingStrength.DS_16MA);

  mFTSPISlave = new FT_Spi_Slave(mSPISlave);

  mFTSPISlave.open();

  mFTSPISlave.registerSpiSlaveListener(this);

  Listener

  ------------------------------------------------

  Version:
    1.0

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class java.lang.Thread

      `java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler`

  - ### Field Summary

    - ### Fields inherited from class com.ftdi.j2xx.protocol.SpiSlaveThread

      `THREAD_DESTORYED, THREAD_INIT, THREAD_RUNNING`

    - ### Fields inherited from class java.lang.Thread

      `MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FT_Spi_Slave(SpiSlave pSlaveInterface)` FT SPI Slave Protocol Constructor

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `close()` Close FTDI SPI Slave protocol device
    `int` | `open()` Open FTDI SPI Slave protocol device
    `void` | `registerSpiSlaveListener(SpiSlaveListener pListener)` Register SPI Slave action listener
    `int` | `write(byte[] wrBuf)` Write data to end device

    - ### Methods inherited from class com.ftdi.j2xx.protocol.SpiSlaveThread

      `run, sendMessage`

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

      `activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield`

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

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

- - ### Constructor Detail

    - #### FT_Spi_Slave

          public FT_Spi_Slave(SpiSlave pSlaveInterface)

      FT SPI Slave Protocol Constructor
      Parameters:
        `pSlaveInterface` - a spi interface used for the protocol

  - ### Method Detail

    - #### registerSpiSlaveListener

          public void registerSpiSlaveListener(SpiSlaveListener pListener)

      Register SPI Slave action listener
      Parameters:
        `pListener` - SpiSlaveListener listener

    - #### open

          public int open()

      Open FTDI SPI Slave protocol device
      Returns:
        return true iff there's no error occurred

    - #### close

          public int close()

      Close FTDI SPI Slave protocol device
      Returns:
        return true iff there's no error occurred

    - #### write

          public int write(byte[] wrBuf)

      Write data to end device
      Parameters:
        `wrBuf` - buffer to write to end device
      Returns:
        return true iff there's no error occurred

About FTDI | FTDI Licence Terms