public class LSM303D
extends java.lang.Object
| Constructor and Description |
|---|
LSM303D() |
LSM303D(int bus) |
LSM303D(int bus,
int addr)
LSM303D constructor
This driver only supports I2C.
|
| Modifier and Type | Method and Description |
|---|---|
void |
delete() |
floatVector |
getAccelerometer()
Return acceleration data in gravities in the form of a
floating point vector.
|
floatVector |
getMagnetometer()
Return magnetometer data in micro-Teslas (uT) in the form
of a floating point vector.
|
float |
getTemperature()
Return temperature data in degrees Celsius.
|
void |
init(LSM303D_M_RES_T res)
Initialize the device and start operation.
|
void |
setAccelerometerFullScale(LSM303D_AFS_T fs)
Set the full scale (sensitivity) value for the
accelerometer.
|
void |
setAccelerometerODR(LSM303D_AODR_T odr)
Set the accelerometer output data rate (ODR)
|
void |
setMagnetometerFullScale(LSM303D_MFS_T fs)
Set the full scale (sensitivity) value for the
magnetometer.
|
void |
setMagnetometerODR(LSM303D_MODR_T odr)
Set the magnetometer output data rate (ODR)
|
void |
update()
Update the internal stored values from sensor data.
|
public LSM303D(int bus,
int addr)
bus - I2C bus to useaddr - The I2C address of the devicestd::runtime_error - on failure.public LSM303D(int bus)
public LSM303D()
public void delete()
public void update()
std::runtime_error - on failurepublic floatVector getMagnetometer()
public floatVector getAccelerometer()
public float getTemperature()
public void init(LSM303D_M_RES_T res)
res - One of the LSM303D_M_RES_T values. This value
sets the resolution of the magnetometer. At init time,
this value is set to LSM303D_M_RES_HIGH.std::runtime_error - on failurepublic void setAccelerometerFullScale(LSM303D_AFS_T fs)
fs - One of the LSM303D_AFS_T valuesstd::runtime_error - on failurepublic void setMagnetometerFullScale(LSM303D_MFS_T fs)
fs - One of the LSM303D_MFS_T valuesstd::runtime_error - on failurepublic void setAccelerometerODR(LSM303D_AODR_T odr)
odr - One of the LSM303D_AODR_T values. The default
set at initialization time is LSM303D_AODR_100HZ.std::runtime_error - on failurepublic void setMagnetometerODR(LSM303D_MODR_T odr)
odr - One of the LSM303D_MODR_T values.
The default set at initialization time is
LSM303D_MODR_12_5HZ.std::runtime_error - on failure