org.lsst.ccs.drivers.ad
Class SpiBus

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

public abstract class SpiBus
extends Cypress

Routines to access a SPI device on an Analog Devices evaluation board

Author:
Owen Saxton

Constructor Summary
SpiBus(org.lsst.ccs.drivers.usb.UsbComm com)
          Constructor
 
Method Summary
abstract  int commReg(int regnum, boolean read)
          Generates communications register value
 int getRdyTimeout(int period)
          Gets the RDY timeout period
 void load(boolean force)
          Loads memory from standard file
 int readRegister(int regnum, int size)
          Reads a register
 void setRdyTimeout(int period)
          Sets the RDY timeout period
 void updateRegister(int regnum, int size, int mask, int value)
          Updates a register
 void writeRegister(int regnum, int size, 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

SpiBus

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

Throws:
javax.usb.UsbException
Method Detail

commReg

public abstract int commReg(int regnum,
                            boolean read)
Generates communications register value

Parameters:
regnum - The register number.
read - True for a read operation, false for a write.
Returns:
The (8-bit) value to be put into the communications register.

setRdyTimeout

public void setRdyTimeout(int period)
Sets the RDY timeout period

Parameters:
period - The timeout period in units of ~82 microseconds, up to a maximum of 65535.

getRdyTimeout

public int getRdyTimeout(int period)
Gets the RDY timeout period

Returns:
The timeout period in units of ~82 microseconds.

readRegister

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

Parameters:
regnum - The register to read
size - The register size (bytes)
Returns:
The value read
Throws:
javax.usb.UsbException

writeRegister

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

Parameters:
regnum - The register to write
size - The register size (bytes)
value - The value to write
Throws:
javax.usb.UsbException

updateRegister

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

Parameters:
regnum - The register to update
size - The register size (bytes)
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.