de.wagner_ibw.iow.i2c
Class PCF8570

java.lang.Object
  |
  +--de.wagner_ibw.iow.i2c.AbstractI2CDevice
        |
        +--de.wagner_ibw.iow.i2c.PCF8570
All Implemented Interfaces:
I2CDevice

public class PCF8570
extends AbstractI2CDevice

This is the implementation of the PCF8570P device, "256 x 8-bit static low-voltage RAM".

Since:
0.9.4
Author:
Thomas Wagner

Field Summary
static int CLASS
          Group 1 part of slave address for PCF8570 (PCF8570 device specific constant).
static java.lang.String NAME
          PCF8570 device specific constants.
 int RAM_SIZE
          Capacity of this RAM.
 
Fields inherited from class de.wagner_ibw.iow.i2c.AbstractI2CDevice
MAX_I2C_LENGTH
 
Constructor Summary
PCF8570(int deviceAddress)
          Constructor
 
Method Summary
 boolean equals(java.lang.Object o)
          Indicates whether some other PCF8570 object is "equal to" this one.
 void fillRam(int pattern)
          Fills the whole ram with the specified pattern.
 int hashCode()
          Returns a hash code value for this PCF8570 object.
 int read(int address)
           
 int[] readPage(int address, int length)
           
 void setIowDevice(AbstractIowDevice iow)
          Sets the reference to an IO-Warrior device for write report operations.
 java.lang.String toString()
          Returns Information about this PCF8570 as String.
 void write(int address, int data)
           
 void writePage(int address, int[] data)
           
 
Methods inherited from class de.wagner_ibw.iow.i2c.AbstractI2CDevice
getI2cAddress, getName, readI2C, reportReceived, setMonitor, writeI2C
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME

public static final java.lang.String NAME
PCF8570 device specific constants.

See Also:
Constant Field Values

RAM_SIZE

public final int RAM_SIZE
Capacity of this RAM.

See Also:
Constant Field Values

CLASS

public static final int CLASS
Group 1 part of slave address for PCF8570 (PCF8570 device specific constant).

See Also:
Constant Field Values
Constructor Detail

PCF8570

public PCF8570(int deviceAddress)
        throws java.lang.Exception
Constructor

Parameters:
deviceAddress - Group 2 part of slave address (possible values 0...7).
Throws:
java.lang.Exception - If anything goes wrong.
Method Detail

read

public int read(int address)
         throws java.lang.Exception,
                java.lang.IllegalArgumentException
Parameters:
address -
Returns:
read value
Throws:
java.lang.Exception - If any transmission error occurred.
java.lang.IllegalArgumentException

write

public void write(int address,
                  int data)
           throws java.lang.Exception,
                  java.lang.IllegalArgumentException
Parameters:
address -
data -
Throws:
java.lang.Exception - If any transmission error occurred.
java.lang.IllegalArgumentException

writePage

public void writePage(int address,
                      int[] data)
               throws java.lang.Exception,
                      java.lang.IllegalArgumentException
Parameters:
address -
data -
Throws:
java.lang.Exception - If any transmission error occurred.
java.lang.IllegalArgumentException

readPage

public int[] readPage(int address,
                      int length)
               throws java.lang.Exception,
                      java.lang.IllegalArgumentException
java.lang.Exception
java.lang.IllegalArgumentException

fillRam

public void fillRam(int pattern)
             throws java.lang.Exception
Fills the whole ram with the specified pattern.

Parameters:
pattern - Pattern that fills the ram.
Throws:
java.lang.Exception - If any transmission error occurred.

setIowDevice

public void setIowDevice(AbstractIowDevice iow)
Description copied from interface: I2CDevice
Sets the reference to an IO-Warrior device for write report operations.

Specified by:
setIowDevice in interface I2CDevice
Specified by:
setIowDevice in class AbstractI2CDevice
Parameters:
iow - Instance of an IO-Warrior device.

toString

public java.lang.String toString()
Returns Information about this PCF8570 as String.

Overrides:
toString in class AbstractI2CDevice
Returns:
String representation of information about this PCF8570. (slave address, temperatures, ...).

equals

public boolean equals(java.lang.Object o)
Indicates whether some other PCF8570 object is "equal to" this one. Criterias are the i2c device class and i2c device address (in I2CAddress).

Overrides:
equals in class AbstractI2CDevice
Returns:
True if this object is the same as the obj argument; false otherwise.

hashCode

public int hashCode()
Returns a hash code value for this PCF8570 object. It is derived from the i2c device class and i2c device address.

Overrides:
hashCode in class AbstractI2CDevice
Returns:
a hash code value for this object.