libpropeller
Making PropellerGCC Easier
|
Provides an interface to the LSM303DLHC accelerometer and magnetometer. More...
#include <lsm303dlhc.h>
Public Member Functions | |
LSM303DLHC () | |
Create a new LSM303DLHC instance. More... | |
bool | Init (I2C *i2c_bus) |
Tests to make sure that the LSM303DLHC is actually on the bus, and returns false if it is not. More... | |
bool | ReadAccl (int &x, int &y, int &z) |
Reads the accelerometer at the current settings, and updates the three reference values. More... | |
bool | ReadMagn (int &x, int &y, int &z) |
Reads the magnetometer at the current settings, and updates the three reference values. More... | |
Provides an interface to the LSM303DLHC accelerometer and magnetometer.
"Output Data Rate, in digital-output accelerometers, defines the rate at which data is sampled. Bandwidth is the highest frequency signal that can be sampled without aliasing by the specified Output Data Rate. Per the Nyquist sampling criterion, bandwidth is half the Output Data Rate." -Analog Devices
See this question for more information on ODR: http://electronics.stackexchange.com/questions/67610/lsm303dlhc-low-power-and-high-precision-modes
|
inline |
Create a new LSM303DLHC instance.
|
inline |
Tests to make sure that the LSM303DLHC is actually on the bus, and returns false if it is not.
Otherwise, sets the registers as follows and returns true.
Set the control registers of the accelerometer:
Set the control registers of the Magn :
i2cbus | The bus that the LSM303DLHC is on. |
|
inline |
Reads the accelerometer at the current settings, and updates the three reference values.
If there is an error then x, y, and z will be set to zero and false will be returned.
x | The acceleration x axis value. Will be overwritten. |
y | The acceleration y axis value. Will be overwritten. |
z | The acceleration z axis value. Will be overwritten. |
|
inline |
Reads the magnetometer at the current settings, and updates the three reference values.
If there is an error then x, y, and z will be set to zero and false will be returned.
x | The magnetometer x axis value. Will be overwritten. |
y | The magnetometer y axis value. Will be overwritten. |
z | The magnetometer z axis value. Will be overwritten. |