cork.module.devantech
Class CMPS03

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

public class CMPS03
extends AbstractI2CDevice

Driver for controlling a Devantech CMPS03 compass module. be sure to calibrate the module properly!

Version:
0.1.1
Author:
Brill Pappin

Constructor Summary
CMPS03()
          Constructor for the CMPS03 object
 
Method Summary
 int getBearingByte()
          Gets the bearing of the compass as a value between 0-255.
 int getBearingDegrees()
          Gets the bearing of the compass in degrees.
 java.lang.String getDeviceDestription()
          Gets the deviceDestription attribute of the CMPS03 object
 java.lang.String getDeviceName()
          Gets the deviceName attribute of the CMPS03 object
 I2CDevice getI2CDevice()
          Gets the i2CDevice attribute of the CMPS03 object
 int getOppositBearingDegrees()
          Gets the opposit bearing from the bearing in degrees.
 int getSoftwareRevision()
          Gets the softwareRevisionNumber attribute of the CMPS03 object
 void markCardinalPoint()
          Used to calibrate the CMPS03 module.
 
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
 

Constructor Detail

CMPS03

public CMPS03()
Constructor for the CMPS03 object
Since:
 
Method Detail

markCardinalPoint

public final void markCardinalPoint()
                             throws I2CException
Used to calibrate the CMPS03 module. Place the device at each of the 4 cardinal points (north, east, south, west) calling this method once for each point.

I have no idea what readings you will get if you fail to properly calibrate the compass module. Use a hand compass to line up the CMPS03 exactly . The more accurate you get, the better the reading from the compass (within the limits of its resolution).

Throws:
I2CException - Throws ans I2CException if the calibration call fails for any reason.
Since:
0.1.0

getSoftwareRevision

public final int getSoftwareRevision()
Gets the softwareRevisionNumber attribute of the CMPS03 object
Returns:
The softwareRevisionNumber value
Since:
 

getBearingByte

public int getBearingByte()
                   throws I2CException
Gets the bearing of the compass as a value between 0-255. The CMPS03 must be calibrated first!.
Returns:
The bearing value
Throws:
I2CException - Description of Exception
Since:
0.1.0

getBearingDegrees

public int getBearingDegrees()
                      throws I2CException
Gets the bearing of the compass in degrees. The CMPS03 must be calibrated first!.
Returns:
The bearing in degrees
Throws:
I2CException - Description of Exception
Since:
0.1.0

getOppositBearingDegrees

public int getOppositBearingDegrees()
                             throws I2CException
Gets the opposit bearing from the bearing in degrees. This is done by subtracting 180.0 from the bearing if it's greater than 180.0 degrees, or adding 180.0 degrees from the bearing if it's less than 180.0 degrees.
Returns:
The brearing opposit the current brearing of the compass module.
Throws:
I2CException - should the compass not be able to get the bearing.
Since:
0.1.1

getDeviceName

public java.lang.String getDeviceName()
Gets the deviceName attribute of the CMPS03 object
Returns:
The deviceName value
Since:
 

getDeviceDestription

public java.lang.String getDeviceDestription()
Gets the deviceDestription attribute of the CMPS03 object
Returns:
The deviceDestription value
Since:
 

getI2CDevice

public I2CDevice getI2CDevice()
Gets the i2CDevice attribute of the CMPS03 object
Overrides:
getI2CDevice in class AbstractI2CDevice
Returns:
The i2CDevice value
Since: