Class LinuxFsI2CBus

java.lang.Object
com.pi4j.plugin.linuxfs.provider.i2c.LinuxFsI2CBus

public class LinuxFsI2CBus extends Object
  • Field Details

    • DEFAULT_LOCK_ACQUIRE_TIMEOUT

      public static final long DEFAULT_LOCK_ACQUIRE_TIMEOUT
      See Also:
    • DEFAULT_LOCK_ACQUIRE_TIMEOUT_UNITS

      public static final TimeUnit DEFAULT_LOCK_ACQUIRE_TIMEOUT_UNITS
    • logger

      protected org.slf4j.Logger logger
    • file

      protected LinuxFile file
      File handle for this i2c bus
    • lockAquireTimeout

      protected long lockAquireTimeout
    • lockAquireTimeoutUnit

      protected TimeUnit lockAquireTimeoutUnit
  • Constructor Details

    • LinuxFsI2CBus

      public LinuxFsI2CBus(I2CConfig config)
  • Method Details

    • selectBusSlave

      protected void selectBusSlave(I2C i2c) throws IOException
      Selects the slave device if not already selected on this bus. Runs the required ioctl's via JNI.
      Parameters:
      i2c - Device to select
      Throws:
      IOException
    • executeIOCTL

      public int executeIOCTL(I2C i2c, long command, ByteBuffer data, IntBuffer offsets)
      Parameters:
      i2c -
      command - From I2CConstants
      data - values in bytes for all structures, with 4 or 8 byte alignment enforced by filling holes before pointers
      offsets - ByteBuffer: offsets of pointer/ byte offset of pointedToData
      Returns:
      0 if success, else -1
    • execute

      public <R> R execute(I2C i2c, CheckedFunction<LinuxFile,R> action)
    • close

      public void close()