PropWare
2.1.2
C++ objects and CMake build system for Parallax Propeller
|
Click here for docs on the
develop
branch.
#include <l3gd20.h>
Public Types | |
enum | AddressLSB { LSB_0, LSB_1 } |
Public Member Functions | |
L3GD20 () | |
bool | Init (I2C *i2c_bus, const AddressLSB address=LSB_0) |
bool | ReadGyro (int &x, int &y, int &z) |
Provides an interface the L3GD20 gyroscope.
"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
libpropeller::L3GD20::L3GD20 | ( | ) |
bool libpropeller::L3GD20::Init | ( | I2C * | i2c_bus, |
const AddressLSB | address = LSB_0 |
||
) |
Set the control registers of the device:
CTRL_REG1 -ODR = 760 Hz -Cut-Off = 100 -Normal power -XYZ enabled
CTRL_REG4: -Continuous block data update (default) -Data LSb at lower address (default) -2000+- degrees per second -(no functionality) -00 (no functionality) -SPI interface mode off
i2cbus | the I2C bus that the gyro is connected to. |
Definition at line 55 of file l3gd20.h.
bool libpropeller::L3GD20::ReadGyro | ( | int & | x, |
int & | y, | ||
int & | z | ||
) |
Get the current rotation rate readings from the gyroscope.
If there is an error then x, y, and z will be set to zero and false will be returned.
x | The gyroscope x axis value. Will be overwritten. |
y | The gyroscope y axis value. Will be overwritten. |
z | The gyroscope z axis value. Will be overwritten. |
Definition at line 81 of file l3gd20.h.