cork.net.i2c
Class I2CLineDriver

cork.net.i2c.I2CLineDriver
All Implemented Interfaces:
Device, I2CBusMaster

public final class I2CLineDriver
implements I2CBusMaster, Device

Default I2C Bus Master. Drives the physical I2C lines for the devices. This class should not be called directly, instead use the methods in the AbstractI2CDevice.

Version:
0.2.0
Author:
Brill Pappin , Elliot West

Method Summary
 void assertEvent(boolean active)
          Line change even listener.
 java.lang.String getDeviceDestription()
          Gets the destription attribute of the Device object
 java.lang.String getDeviceName()
          Gets the title attribute of the Device object
 void read(I2CDevice device, int id, int[] buffer, int count)
          Reads data from the specified ID.
 void setBusIdalClockTick(boolean ticks)
          Sets the busIdalClockTick attribute of the I2CLineDriver object
 void start(I2CDevice device)
          Description of the Method
 void stop(I2CDevice device)
          Signals stop communication on the bus.
 void tick(I2CDevice device)
          ticks the SCL line once.
 void triggerEvent()
          idle clock ticks...
 void write(I2CDevice device, int id, int[] buffer, int count)
          Writes data to the specified ID.
 
Methods inherited from interface cork.net.i2c.I2CBusMaster
capture, isCaptured, release
 

Method Detail

triggerEvent

public void triggerEvent()
idle clock ticks... this was added to support interrupts from I2C devices, as well as trying to interface the Devantech hardware, which seems to have trouble with the bus.
Since:
0.1.0

tick

public void tick(I2CDevice device)
          throws I2CException
ticks the SCL line once.
Specified by:
tick in interface I2CBusMaster
Parameters:
device - Description of Parameter
Throws:
I2CException - Description of Exception
Since:
0.2.0

stop

public void stop(I2CDevice device)
          throws I2CException
Signals stop communication on the bus.
Specified by:
stop in interface I2CBusMaster
Parameters:
device - the device calling the method. the device must have first captured the bus master.
Throws:
I2CException - Description of Exception
Since:
0.2.0

assertEvent

public void assertEvent(boolean active)
Line change even listener. Used with the waitForACK() method.
Parameters:
active - Description of Parameter
Since:
0.2.0

read

public void read(I2CDevice device,
                 int id,
                 int[] buffer,
                 int count)
          throws I2CException
Reads data from the specified ID. The capture and start method must have been called first.
Specified by:
read in interface I2CBusMaster
Parameters:
id - the id we're addressing the bytes to.
buffer - the buffer that the bytes will be added to.
count - the number of bytes to read into the buffer.
device - the device wishing to read the BusMaster. This device must have first captured the BusMaster.
Throws:
I2CException - throws an I2CException is the device has not captured the BusMaster. Also thrown if the or if there was some other problem reading from the bus.
Since:
0.2.0

write

public void write(I2CDevice device,
                  int id,
                  int[] buffer,
                  int count)
           throws I2CException,
                  java.lang.ArrayIndexOutOfBoundsException
Writes data to the specified ID. The capture and start method must have been called first.
Specified by:
write in interface I2CBusMaster
Parameters:
id - the id we're addressing the bytes to.
buffer - the buffer the the bytes will be written from.
count - the number of bytes ro write.
device - the device wishing to write the BusMaster. This device must have first captured the BusMaster.
Throws:
I2CException - throws an I2CException is the device has not captured the BusMaster. or if there was some other problem writing to the bus.
java.lang.ArrayIndexOutOfBoundsException - if the count is larger than the buffer, or the count os less than 1.
Since:
0.2.0

start

public void start(I2CDevice device)
           throws I2CException
Description of the Method
Specified by:
start in interface I2CBusMaster
Parameters:
device - Description of Parameter
Throws:
I2CException - Description of Exception
Since:
0.2.0

getDeviceName

public java.lang.String getDeviceName()
Gets the title attribute of the Device object
Specified by:
getDeviceName in interface Device
Returns:
The title value
Since:
0.1.0

getDeviceDestription

public java.lang.String getDeviceDestription()
Gets the destription attribute of the Device object
Specified by:
getDeviceDestription in interface Device
Returns:
The destription value
Since:
0.1.0

setBusIdalClockTick

public void setBusIdalClockTick(boolean ticks)
Sets the busIdalClockTick attribute of the I2CLineDriver object
Parameters:
ticks - The new busIdalClockTick value
Since: