cork.module.devantech
Class SRF08

java.lang.Object
  |
  +--cork.device.AbstractDevice
        |
        +--cork.net.i2c.AbstractI2CDevice
              |
              +--cork.module.devantech.SRF08
All Implemented Interfaces:
Device, I2CDevice

public class SRF08
extends AbstractI2CDevice

Software driver for the Devontech SRF08 Range Finder.

Version:
0.1.1
Author:
Brill Pappin

Field Summary
static int ADDRESS_E0
          This is the DEFAULT SHIPPING ADDRESS.
static int ADDRESS_E2
          Possible address for the SRF08
static int ADDRESS_E4
          Possible address for the SRF08
static int ADDRESS_E6
          Possible address for the SRF08
static int ADDRESS_E8
          Possible address for the SRF08
static int ADDRESS_EA
          Possible address for the SRF08
static int ADDRESS_EC
          Possible address for the SRF08
static int ADDRESS_EE
          Possible address for the SRF08
static int ADDRESS_F0
          Possible address for the SRF08
static int ADDRESS_F2
          Possible address for the SRF08
static int ADDRESS_F4
          Possible address for the SRF08
static int ADDRESS_F6
          Possible address for the SRF08
static int ADDRESS_F8
          Possible address for the SRF08
static int ADDRESS_FA
          Possible address for the SRF08
static int ADDRESS_FC
          Possible address for the SRF08
static int ADDRESS_FE
          Possible address for the SRF08
static int ADDRESS_GENERAL_BROADCAST
          General broadcast address for all SRF08's on the bus.
static int COMMAND_ANN_IN_CENTIMETERS
          Possible range units for the SRF08
static int COMMAND_ANN_IN_INCHES
          Possible range units for the SRF08
static int COMMAND_ANN_IN_MICROSECONDS
          Possible range units for the SRF08
static int COMMAND_RANGE_IN_CENTIMETERS
          Possible range units for the SRF08
static int COMMAND_RANGE_IN_INCHES
          Possible range units for the SRF08
static int COMMAND_RANGE_IN_MICROSECONDS
          Possible range units for the SRF08
 
Constructor Summary
SRF08(int address)
          Constructor for the SRF08 object
 
Method Summary
 java.lang.String getDeviceDestription()
          Gets the destription attribute of the Device object
 java.lang.String getDeviceName()
          Gets the name attribute of the Device object
 I2CDevice getI2CDevice()
          This must be implemented by all I2C devices, and must return it's own instance.
 int getLightLevel()
          Gets the light level that the SRF08 detected.
 int[] getRange(int count)
          Gets the range of the last ping.
 int getSoftwareRevision()
          Gets the softwareRevision attribute of the SRF08 object
 void ping(int scale)
          Causes the SRF08 to ping.
 
Methods inherited from class cork.net.i2c.AbstractI2CDevice
capture, destroy, getBusMaster, getDeviceAddress, isCaptured, read, release, start, stop, tick, write
 
Methods inherited from class cork.device.AbstractDevice
addEventListener, removeEventListener, sendDeviceEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ADDRESS_GENERAL_BROADCAST

public static final int ADDRESS_GENERAL_BROADCAST
General broadcast address for all SRF08's on the bus.
Since:
0.1.1

ADDRESS_E0

public static final int ADDRESS_E0
This is the DEFAULT SHIPPING ADDRESS. Use this address unless you have changed the address for the device.
Since:
0.1.1

ADDRESS_E2

public static final int ADDRESS_E2
Possible address for the SRF08
Since:
0.1.1

ADDRESS_E4

public static final int ADDRESS_E4
Possible address for the SRF08
Since:
0.1.1

ADDRESS_E6

public static final int ADDRESS_E6
Possible address for the SRF08
Since:
0.1.1

ADDRESS_E8

public static final int ADDRESS_E8
Possible address for the SRF08
Since:
0.1.1

ADDRESS_EA

public static final int ADDRESS_EA
Possible address for the SRF08
Since:
0.1.1

ADDRESS_EC

public static final int ADDRESS_EC
Possible address for the SRF08
Since:
0.1.1

ADDRESS_EE

public static final int ADDRESS_EE
Possible address for the SRF08
Since:
0.1.1

ADDRESS_F0

public static final int ADDRESS_F0
Possible address for the SRF08
Since:
0.1.1

ADDRESS_F2

public static final int ADDRESS_F2
Possible address for the SRF08
Since:
0.1.1

ADDRESS_F4

public static final int ADDRESS_F4
Possible address for the SRF08
Since:
0.1.1

ADDRESS_F6

public static final int ADDRESS_F6
Possible address for the SRF08
Since:
0.1.1

ADDRESS_F8

public static final int ADDRESS_F8
Possible address for the SRF08
Since:
0.1.1

ADDRESS_FA

public static final int ADDRESS_FA
Possible address for the SRF08
Since:
0.1.1

ADDRESS_FC

public static final int ADDRESS_FC
Possible address for the SRF08
Since:
0.1.1

ADDRESS_FE

public static final int ADDRESS_FE
Possible address for the SRF08
Since:
0.1.1

COMMAND_RANGE_IN_INCHES

public static final int COMMAND_RANGE_IN_INCHES
Possible range units for the SRF08
Since:
0.1.1

COMMAND_RANGE_IN_CENTIMETERS

public static final int COMMAND_RANGE_IN_CENTIMETERS
Possible range units for the SRF08
Since:
0.1.1

COMMAND_RANGE_IN_MICROSECONDS

public static final int COMMAND_RANGE_IN_MICROSECONDS
Possible range units for the SRF08
Since:
0.1.1

COMMAND_ANN_IN_INCHES

public static final int COMMAND_ANN_IN_INCHES
Possible range units for the SRF08
Since:
0.1.1

COMMAND_ANN_IN_CENTIMETERS

public static final int COMMAND_ANN_IN_CENTIMETERS
Possible range units for the SRF08
Since:
0.1.1

COMMAND_ANN_IN_MICROSECONDS

public static final int COMMAND_ANN_IN_MICROSECONDS
Possible range units for the SRF08
Since:
0.1.1
Constructor Detail

SRF08

public SRF08(int address)
Constructor for the SRF08 object
Parameters:
address - int the address of this SRF08. use the default address if you have not change it.
Since:
0.1.1
Method Detail

ping

public void ping(int scale)
          throws I2CException
Causes the SRF08 to ping. The values can then be read from the various method in the class.
Parameters:
scale - one of the scale constants in this class.
Throws:
I2CException - Description of Exception
Since:
0.1.1

getSoftwareRevision

public int getSoftwareRevision()
                        throws I2CException
Gets the softwareRevision attribute of the SRF08 object
Returns:
The softwareRevision value
Throws:
I2CException - Description of Exception
Since:
0.1.1

getLightLevel

public int getLightLevel()
                  throws I2CException
Gets the light level that the SRF08 detected. This data is only valid after a ping command.
Returns:
int The light level detected
Throws:
I2CException - if there was an error getting the light level
Since:
0.1.1

getRange

public int[] getRange(int count)
               throws I2CException
Gets the range of the last ping. The SRF08 can see multiple ranges from multiple objects.
Parameters:
count - The number of objects in view, starting with the closest object as index 0.
Returns:
the range of objects, and the units specified during the call to the ping(int).
Throws:
I2CException - if there was a problem getting the range.
Since:
0.1.1

getDeviceName

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

getDeviceDestription

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

getI2CDevice

public I2CDevice getI2CDevice()
This must be implemented by all I2C devices, and must return it's own instance.
Overrides:
getI2CDevice in class AbstractI2CDevice
Returns:
This instance of an I2C device.
Since:
0.1.1