libpropeller
Making PropellerGCC Easier
|
Provides an interface the L3GD20 gyroscope. More...
#include <l3gd20.h>
Public Types | |
enum | AddressLSB { LSB_0, LSB_1 } |
Specify the least significant bit of the L3GD20 I2C address. More... | |
Public Member Functions | |
L3GD20 () | |
Create a new L3GD20 instance. More... | |
bool | Init (I2C *i2c_bus, const AddressLSB address=LSB_0) |
Set the control registers of the device: More... | |
bool | ReadGyro (int &x, int &y, int &z) |
Get the current rotation rate readings from the gyroscope. More... | |
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
enum L3GD20::AddressLSB |
|
inline |
Create a new L3GD20 instance.
|
inline |
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. |
|
inline |
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. |