Sun SPOT API
Green Release  


com.sun.spot.sensorboard.peripheral
Class LIS3L02AQAccelerometer

java.lang.Object
  extended by com.sun.spot.sensorboard.peripheral.LIS3L02AQAccelerometer
All Implemented Interfaces:
IDriver, IAccelerometer3D

public class LIS3L02AQAccelerometer
extends Object
implements IAccelerometer3D, IDriver

Class to implement an accelerometer on the demo sensor board and provide access to it via the Accelerometer3D interface.

Author:
Syntropy

Constructor Summary
LIS3L02AQAccelerometer(IScalarInput xInput, IScalarInput yInput, IScalarInput zInput, IOutputPin selfTest, IOutputPin fullScale)
          Constructor for the accelerometer
 
Method Summary
 int getCurrentRange()
           
 int[] getRanges()
           
 IScalarInput getXAxis()
          Returns a RangeInput giving access to the accelerometer's reading for the x axis
 IScalarInput getYAxis()
          Returns a RangeInput giving access to the accelerometer's reading for the y axis
 IScalarInput getZAxis()
          Returns a RangeInput giving access to the accelerometer's reading for the z axis
 boolean isInSelfTest()
           
 String name()
          An identifying name for the driver (e.g.
 void reset()
          Resets the accelerometer (ensures that it is not in self-test and is not powered down) and sets it to the 2G scale
 void selfTest(boolean setSelfTestMode)
           
 void setRange(int rangeIndex)
          Set the current range of this device to the range corresponding to getRanges()[rangeIndex]
 void setUp()
          Activate or reactivate the driver (after a deep sleep or when another driver refused to deep sleep).
 boolean tearDown()
          Deactivate the driver (usually in preparation for deep sleep).
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LIS3L02AQAccelerometer

public LIS3L02AQAccelerometer(IScalarInput xInput,
                              IScalarInput yInput,
                              IScalarInput zInput,
                              IOutputPin selfTest,
                              IOutputPin fullScale)
Constructor for the accelerometer

Parameters:
xInput - a RangeInput that will be used to access values for the x axis
yInput - a RangeInput that will be used to access values for the y axis
zInput - a RangeInput that will be used to access values for the z axis
selfTest - a SingleBitOutput to be used for self-testing
powerDown - a SingleBitOutput to be used to put the accelerometer into power-down mode
fullScale - a SingleBitOutput to be used in switching between the 2G and 6G scales
Method Detail

reset

public void reset()
Resets the accelerometer (ensures that it is not in self-test and is not powered down) and sets it to the 2G scale


name

public String name()
Description copied from interface: IDriver
An identifying name for the driver (e.g. "AIC" for the AIC driver).

Specified by:
name in interface IDriver
Returns:
The driver name

setUp

public void setUp()
Description copied from interface: IDriver
Activate or reactivate the driver (after a deep sleep or when another driver refused to deep sleep). The driver should claim all the resources it needs from other drivers and reinitialize its hardware. It should also restore any state saved before tearDown.

Specified by:
setUp in interface IDriver

tearDown

public boolean tearDown()
Description copied from interface: IDriver
Deactivate the driver (usually in preparation for deep sleep). The driver should store any important state and release all resources it has claimed from other drivers.

Specified by:
tearDown in interface IDriver
Returns:
True if the driver is able to deactivate, false if it cannot deactivate (e.g. due to being busy with a data transfer). If any driver returns false, no deep sleep occurs and all other drivers will be reactivated.

getXAxis

public IScalarInput getXAxis()
Returns a RangeInput giving access to the accelerometer's reading for the x axis

Specified by:
getXAxis in interface IAccelerometer3D
Returns:
a RangeInput for the x axis.
See Also:
IAccelerometer3D.getXAxis()

getYAxis

public IScalarInput getYAxis()
Returns a RangeInput giving access to the accelerometer's reading for the y axis

Specified by:
getYAxis in interface IAccelerometer3D
Returns:
a RangeInput for the y axis.
See Also:
IAccelerometer3D.getYAxis()

getZAxis

public IScalarInput getZAxis()
Returns a RangeInput giving access to the accelerometer's reading for the z axis

Specified by:
getZAxis in interface IAccelerometer3D
Returns:
a RangeInput for the z axis.
See Also:
IAccelerometer3D.getZAxis()

selfTest

public void selfTest(boolean setSelfTestMode)
Parameters:
setSelfTestMode - if true the accelerometer is put into self-test mode; if false, the accelerometer is taken out of self-test mode.

isInSelfTest

public boolean isInSelfTest()
Returns:
true if the accelerometer is in self-test mode

getRanges

public int[] getRanges()
Specified by:
getRanges in interface IAccelerometer3D
Returns:
an array containing the 'max range' values supported by this device

setRange

public void setRange(int rangeIndex)
Description copied from interface: IAccelerometer3D
Set the current range of this device to the range corresponding to getRanges()[rangeIndex]

Specified by:
setRange in interface IAccelerometer3D
Parameters:
rangeIndex - index into getRanges() of the required range

getCurrentRange

public int getCurrentRange()
Specified by:
getCurrentRange in interface IAccelerometer3D
Returns:
the index into getRanges() of the current range

Sun SPOT API
Green Release  


Copyright © 2006 Sun Microsystems, Inc. All Rights Reserved.