de.wagner_ibw.iow.i2c
Class AT24C128

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

public class AT24C128
extends AbstractI2CDevice

This is the implementation of the AT24C128 device, "16 KByte EEPROM" by ATMEL.

Since:
0.9.5
Author:
Thomas Wagner

Field Summary
static int CLASS
          Group 1 part of slave address for AT24C128 (AT24C128 device specific constant).
 int EEPROM_SIZE
          Capacity of this EEPROM in byte.
 int MAX_PAGE_SIZE
          Maximum page size for block write operations.
static java.lang.String NAME
          AT24C128 device specific constants.
 
Fields inherited from class de.wagner_ibw.iow.i2c.AbstractI2CDevice
MAX_I2C_LENGTH
 
Constructor Summary
AT24C128(int deviceAddress)
          Constructor
 
Method Summary
 boolean equals(java.lang.Object o)
          Indicates whether some other AT24C128 object is "equal to" this one.
 void fillEeprom(int pattern)
          Fills the whole eeprom with the specified pattern.
 int hashCode()
          Returns a hash code value for this AT24C128 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 AT24C128 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
AT24C128 device specific constants.

See Also:
Constant Field Values

EEPROM_SIZE

public final int EEPROM_SIZE
Capacity of this EEPROM in byte.

See Also:
Constant Field Values

MAX_PAGE_SIZE

public final int MAX_PAGE_SIZE
Maximum page size for block write operations.

See Also:
Constant Field Values

CLASS

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

See Also:
Constant Field Values
Constructor Detail

AT24C128

public AT24C128(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

fillEeprom

public void fillEeprom(int pattern)
                throws java.lang.Exception
Fills the whole eeprom 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 AT24C128 as String.

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

equals

public boolean equals(java.lang.Object o)
Indicates whether some other AT24C128 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 AT24C128 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.