Module com.pi4j

Class I2CBase<T extends I2CBus>

All Implemented Interfaces:
Describable, Identity, Lifecycle, Extension, I2C, I2CRegisterDataReader, I2CRegisterDataReaderWriter, I2CRegisterDataWriter, IO<I2C,I2CConfig,I2CProvider>, IODataReader, IODataWriter, AutoCloseable, Readable

public abstract class I2CBase<T extends I2CBus> extends IOBase<I2C,I2CConfig,I2CProvider> implements I2C

Abstract I2CBase class.

Version:
$Id: $Id
Author:
Robert Savage (http://www.savagehomeautomation.com)
  • Field Details

    • isOpen

      protected boolean isOpen
    • i2CBus

      protected final T extends I2CBus i2CBus
  • Constructor Details

  • Method Details

    • isOpen

      public boolean isOpen()
      I2C Device Communication State is OPEN
      Specified by:
      isOpen in interface I2C
      Returns:
      The I2C device communication state
    • close

      public void close()

      close.

      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface I2C
    • getRegister

      public I2CRegister getRegister(int address)
      Get an encapsulated interface for reading and writing to a specific I2C device register

      Get an encapsulated interface for reading and writing to a specific I2C device register

      Specified by:
      getRegister in interface I2C
      Parameters:
      address - a int.
      Returns:
      a I2CRegister object.
    • execute

      public <V> V execute(Callable<V> action)
      Description copied from interface: I2C
      Executes the given runnable on the I2C bus, locking the bus for the duration of the given task
      Specified by:
      execute in interface I2C
      Parameters:
      action - the action to perform, returning a value
    • shutdown

      public I2C shutdown(Context context) throws ShutdownException

      shutdown.

      Specified by:
      shutdown in interface Lifecycle<T extends I2CBus>
      Overrides:
      shutdown in class IOBase<I2C,I2CConfig,I2CProvider>
      Parameters:
      context - a Context object.
      Returns:
      a T object.
      Throws:
      ShutdownException - if an error occurs during shutdown.