|
SunSPOT API V6.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.spot.resources.Resource
com.sun.spot.sensorboard.peripheral.Accelerometer3D
com.sun.spot.sensorboard.peripheral.MMA7455LAccelerometer
public class MMA7455LAccelerometer
Class to implement an accelerometer on the demo sensor board and provide access to it via the IAccelerometer3D interface. Provides methods specific to this particular accelerometer.
The MMA7455L accelerometer can measure accelerations using either a 2G, 4G or 8G scale.
Note: the sample rate is either 125 or 250 Hz.
The accelerometer directly reports the acceleration along each axis. No conversion is necessary.
| Field Summary | |
|---|---|
static String |
ACCELEROMETER_DRIFT_OFFSETS_PROPERTY
Name of the property holding the drift offsets for this accelerometer |
static String |
ACCELEROMETER_GAINS_PROPERTY
Name of the property holding the calibrated gains for this accelerometer |
static int |
SCALE_2G
Constant index for setting the accelerometer to use the 2G scale |
static int |
SCALE_4G
Constant index for setting the accelerometer to use the 4G scale |
static int |
SCALE_8G
Constant index for setting the accelerometer to use the 8G scale |
| Fields inherited from class com.sun.spot.sensorboard.peripheral.Accelerometer3D |
|---|
supportsThresholdEvents |
| Fields inherited from interface com.sun.spot.sensorboard.peripheral.IAccelerometer3D |
|---|
ABSOLUTE, ALL_AXES, RELATIVE, X_AXIS, Y_AXIS, Z_AXIS |
| Fields inherited from interface com.sun.spot.resources.transducers.IAccelerometer3D |
|---|
ALL_AXES, X_AXIS, Y_AXIS, Z_AXIS |
| Constructor Summary | |
|---|---|
MMA7455LAccelerometer()
Constructor for the accelerometer. |
|
| Method Summary | |
|---|---|
void |
addIMeasurementRangeListener(IMeasurementRangeListener who)
Add an IMeasurementRangeListener to be called back when the range is changed. |
double[] |
getAccelValues()
Return all the current values. |
double |
getAccelX()
Read the current acceleration along the X axis. |
double |
getAccelY()
Read the current acceleration along the Y axis. |
double |
getAccelZ()
Read the current acceleration along the Z axis. |
double |
getAccuracy()
Returns the accuracy of the sensor (in the current measurement range) as a percentage of reading (=data value). |
double |
getAccuracy(int index)
Returns the Nth accuracy of the specified measurement range. |
String |
getCalibration()
Returns the current calibration values for this sensor. |
int |
getCurrentRange()
Returns the index of the current measurement range of the given sensor. |
String |
getDescription()
This method returns a readable description of the sensor. |
double[] |
getDriftOffsets()
Get the accelerometer's drift offsets. |
double[][] |
getGains()
Return the current array of gains used to convert to G's. |
IMeasurementRangeListener[] |
getIMeasurementRangeListeners()
Return all of the IMeasurementRangeListener callbacks. |
double |
getMaxSamplingRate()
Return the maximum sampling rate per second for this sensor. |
double |
getMaxValue()
Returns the current maximum value of the sensor (in the current measurement range). |
double |
getMaxValue(int index)
Returns the Nth max value of the specified measurement range. |
double |
getMinValue()
Returns the current minimum value of the sensor (in the current measurement range). |
double |
getMinValue(int index)
Returns the Nth min value of the specified measurement range. |
int |
getNumberRanges()
Returns the number of possible measurement ranges for this given sensor. |
int[] |
getRawAccelValues()
Return all the current values without scaling them. |
double |
getRelativeAccelX()
Deprecated. |
double |
getRelativeAccelY()
Deprecated. |
double |
getRelativeAccelZ()
Deprecated. |
double |
getResolution()
Returns the resolution of the range (in the current measurement range). |
double |
getResolution(int index)
Returns the Nth resolution of the specified measurement range. |
boolean |
isInSelfTest()
Check if the accelerometer is in self-test mode. |
boolean |
isInStandbyMode()
Check if the accelerometer is in standby mode. |
void |
removeIMeasurementRangeListener(IMeasurementRangeListener who)
Remove an IMeasurementRangeListener from the list of callbacks. |
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 with a sampling filter set to 62.5Hz. |
void |
saveCalibration()
Save the drift offsets & gains as properties in the EDemoBoard flash. |
void |
selfTest(boolean setSelfTestMode)
Put the accelerometer into/out of self-test mode. |
void |
setCalibration(String calibration)
Sets the calibration values for this sensor. |
void |
setCurrentRange(int range)
Sets the measurement range of the sensor. |
void |
setDriftOffsets(double x,
double y,
double z)
Set the accelerometer's drift offsets. |
void |
setGains(double[][] gains)
Set the gains used to convert to G's. |
void |
setRestOffsets()
Deprecated. |
void |
setSampleFilter(boolean high)
Set the filter for sampling to either 62.5 or 125Hz. |
protected void |
setScaleAux(int newScaleIndex)
Set the scale for this accelerometer to use. |
void |
setStandbyMode(boolean sleep)
Put the accelerometer into standby mode to save power. |
| Methods inherited from class com.sun.spot.resources.Resource |
|---|
addTag, getTags, getTagValue, hasTag, removeTag |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.sun.spot.resources.IResource |
|---|
addTag, getTags, getTagValue, hasTag, removeTag |
| Methods inherited from interface com.sun.spot.resources.IResource |
|---|
addTag, getTags, getTagValue, hasTag, removeTag |
| Field Detail |
|---|
public static final String ACCELEROMETER_DRIFT_OFFSETS_PROPERTY
public static final String ACCELEROMETER_GAINS_PROPERTY
public static final int SCALE_2G
public static final int SCALE_4G
public static final int SCALE_8G
| Constructor Detail |
|---|
public MMA7455LAccelerometer()
EDemoBoard.getAccelerometer().
| Method Detail |
|---|
public void saveCalibration()
public void reset()
public void setStandbyMode(boolean sleep)
setStandbyMode in interface IStandbysleep - if true then put accelerometer into standby modepublic boolean isInStandbyMode()
isInStandbyMode in interface IStandby
public void setSampleFilter(boolean high)
throws IOException
high - if true use 125Hz filter setting
IOException
public double getAccelX()
throws IOException
getAccelX in interface IAccelerometer3DgetAccelX in class Accelerometer3DIOException
public double getAccelY()
throws IOException
getAccelY in interface IAccelerometer3DgetAccelY in class Accelerometer3DIOException
public double getAccelZ()
throws IOException
getAccelZ in interface IAccelerometer3DgetAccelZ in class Accelerometer3DIOException
public double[] getAccelValues()
throws IOException
getAccelValues in interface IAccelerometer3DgetAccelValues in class Accelerometer3DIOException
public int[] getRawAccelValues()
throws IOException
IOException
public void setRestOffsets()
throws IOException
setRestOffsets in class Accelerometer3DIOException
public double getRelativeAccelX()
throws IOException
getRelativeAccelX in class Accelerometer3DIOException
public double getRelativeAccelY()
throws IOException
getRelativeAccelY in class Accelerometer3DIOException
public double getRelativeAccelZ()
throws IOException
getRelativeAccelZ in class Accelerometer3DIOException
protected void setScaleAux(int newScaleIndex)
throws IOException
newScaleIndex - the scale to use specified as an offset into the array returned by getScales()
IOExceptionpublic void selfTest(boolean setSelfTestMode)
setSelfTestMode - if true the accelerometer is put into self-test mode;
if false, the accelerometer is taken out of self-test mode.public boolean isInSelfTest()
public double[][] getGains()
public void setGains(double[][] gains)
gains - the array[scale][axis] of gains: A = (V - Z) / Gpublic double[] getDriftOffsets()
public void setDriftOffsets(double x,
double y,
double z)
throws IOException
x - drift offset for X axisy - drift offset for Y axisz - drift offset for Z axis
IOExceptionpublic String getDescription()
ITransducer
getDescription in interface ITransducerpublic double getMaxSamplingRate()
ITransducer
getMaxSamplingRate in interface ITransducerpublic double getMinValue()
IMeasurementInfo
getMinValue in interface IMeasurementInfopublic double getMaxValue()
IMeasurementInfo
getMaxValue in interface IMeasurementInfopublic double getResolution()
IMeasurementInfo
getResolution in interface IMeasurementInfopublic double getAccuracy()
IMeasurementInfo
getAccuracy in interface IMeasurementInfopublic int getNumberRanges()
IMeasurementRange
getNumberRanges in interface IMeasurementRangepublic int getCurrentRange()
IMeasurementRange
getCurrentRange in interface IMeasurementRangepublic void setCurrentRange(int range)
IMeasurementRange
setCurrentRange in interface IMeasurementRangerange - the index of the measurement range to be set.public double getMinValue(int index)
IMeasurementRange
getMinValue in interface IMeasurementRangepublic double getMaxValue(int index)
IMeasurementRange
getMaxValue in interface IMeasurementRangepublic double getResolution(int index)
IMeasurementRange
getResolution in interface IMeasurementRangepublic double getAccuracy(int index)
IMeasurementRange
getAccuracy in interface IMeasurementRangepublic void addIMeasurementRangeListener(IMeasurementRangeListener who)
IMeasurementRange
addIMeasurementRangeListener in interface IMeasurementRangewho - the IMeasurementRangeListener to addpublic void removeIMeasurementRangeListener(IMeasurementRangeListener who)
removeIMeasurementRangeListener in interface IMeasurementRangewho - the IMeasurementRangeListener to removepublic IMeasurementRangeListener[] getIMeasurementRangeListeners()
getIMeasurementRangeListeners in interface IMeasurementRangepublic String getCalibration()
public void setCalibration(String calibration)
calibration - calibration values to be set.
IllegalArgumentException - - if the given string cannot be parsed
|
SunSPOT API V6.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||