org.lsst.ccs.drivers.ad
Class I2cBus

java.lang.Object
  extended by org.lsst.ccs.drivers.ad.Cypress
      extended by org.lsst.ccs.drivers.ad.I2cBus
Direct Known Subclasses:
Ad7747Eval

public class I2cBus
extends Cypress

Routines to access an I2C device on an Analog Devices evaluation board

Author:
Owen Saxton

Constructor Summary
I2cBus(org.lsst.ccs.drivers.usb.UsbComm com)
          Constructor
 
Method Summary
 void load(boolean force)
          Loads memory from standard file
 int readRegister(int regnum)
          Reads a register
 int readRegister(int regnum, byte[] data)
          Reads byte array from consecutive registers
 int readRegister2(int regnum)
          Reads 16-bit value from a pair of registers
 int readRegister3(int regnum)
          Reads 24-bit value from a triplet of registers
 void updateRegister(int regnum, int mask, int value)
          Updates a register
 int writeRegister(int regnum, byte[] data)
          Writes byte array to consecutive registers
 void writeRegister(int regnum, int value)
          Writes a register
 
Methods inherited from class org.lsst.ccs.drivers.ad.Cypress
load, readMemory, readMemory, setReset, writeMemory, writeMemory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

I2cBus

public I2cBus(org.lsst.ccs.drivers.usb.UsbComm com)
       throws javax.usb.UsbException
Constructor

Throws:
javax.usb.UsbException
Method Detail

readRegister2

public int readRegister2(int regnum)
                  throws javax.usb.UsbException
Reads 16-bit value from a pair of registers

Parameters:
regnum - The number of the first (high-order) register to read
Returns:
The 16-bit raw value
Throws:
javax.usb.UsbException

readRegister3

public int readRegister3(int regnum)
                  throws javax.usb.UsbException
Reads 24-bit value from a triplet of registers

Parameters:
regnum - The number of the first (high-order) register to read
Returns:
The 24-bit raw value
Throws:
javax.usb.UsbException

readRegister

public int readRegister(int regnum,
                        byte[] data)
                 throws javax.usb.UsbException
Reads byte array from consecutive registers

Parameters:
regnum - The first register to read
data - The array of bytes to read into
timeout - The maximum time to wait (ms), or 0 for no timeout
Returns:
The number of bytes read.
Throws:
javax.usb.UsbException

readRegister

public int readRegister(int regnum)
                 throws javax.usb.UsbException
Reads a register

Parameters:
regnum - The register to read
timeout - The maximum time to wait (ms), or 0 for no timeout
Returns:
The value read
Throws:
javax.usb.UsbException

writeRegister

public int writeRegister(int regnum,
                         byte[] data)
                  throws javax.usb.UsbException
Writes byte array to consecutive registers

Parameters:
regnum - The first register to write
data - The array of bytes to write
Returns:
The number of bytes written.
Throws:
javax.usb.UsbException

writeRegister

public void writeRegister(int regnum,
                          int value)
                   throws javax.usb.UsbException
Writes a register

Parameters:
regnum - The register to write
value - The value to write
Throws:
javax.usb.UsbException

updateRegister

public void updateRegister(int regnum,
                           int mask,
                           int value)
                    throws javax.usb.UsbException
Updates a register

Parameters:
regnum - The register to update
mask - The mask of bits to update
value - The value to write, under the mask
Throws:
javax.usb.UsbException

load

public void load(boolean force)
          throws javax.usb.UsbException
Loads memory from standard file

Parameters:
force - If true, force the load even if memory appears to be already loaded correctly.
Throws:
javax.usb.UsbException


Copyright © 2013 LSST. All Rights Reserved.