Package lejos.hardware.sensor
Class MindsensorsAbsoluteIMU.ShortSensorMode
- java.lang.Object
-
- lejos.hardware.sensor.MindsensorsAbsoluteIMU.ShortSensorMode
-
- All Implemented Interfaces:
SensorMode,SampleProvider
- Enclosing class:
- MindsensorsAbsoluteIMU
protected class MindsensorsAbsoluteIMU.ShortSensorMode extends java.lang.Object implements SensorMode
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedShortSensorMode(java.lang.String name, int reg, int sampleSize, float[] convert, float scale)Internal class to provide the sensor data.protectedShortSensorMode(java.lang.String name, int reg, int sampleSize, float convert, float scale)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfetchSample(float[] sample, int offset)Fetches a sample from a sensor or filter.java.lang.StringgetName()return a string description of this sensor modeintsampleSize()Returns the number of elements in a sample.
The number of elements does not change during runtime.protected voidsetScale(float scale)Set the scale factor used when converting data to returned units.
-
-
-
Constructor Detail
-
ShortSensorMode
protected ShortSensorMode(java.lang.String name, int reg, int sampleSize, float[] convert, float scale)Internal class to provide the sensor data. Handles obtaining the base data and converting it to suitable SI units.- Parameters:
name- mode namereg- base register for the available samplessampleSize- number of samplesconvert- conversion factor to SI unitsscale- scale factor needed for range adjustment
-
ShortSensorMode
protected ShortSensorMode(java.lang.String name, int reg, int sampleSize, float convert, float scale)
-
-
Method Detail
-
setScale
protected void setScale(float scale)
Set the scale factor used when converting data to returned units.- Parameters:
scale- new scale factor
-
sampleSize
public int sampleSize()
Description copied from interface:SampleProviderReturns the number of elements in a sample.
The number of elements does not change during runtime.- Specified by:
sampleSizein interfaceSampleProvider- Returns:
- the number of elements in a sample
-
fetchSample
public void fetchSample(float[] sample, int offset)Description copied from interface:SampleProviderFetches a sample from a sensor or filter.- Specified by:
fetchSamplein interfaceSampleProvider- Parameters:
sample- The array to store the sample in.offset- The elements of the sample are stored in the array starting at the offset position.
-
getName
public java.lang.String getName()
Description copied from interface:SensorModereturn a string description of this sensor mode- Specified by:
getNamein interfaceSensorMode- Returns:
- The description/name of this mode
-
-