libpropeller
Making PropellerGCC Easier
 All Classes Files Functions Variables Enumerations Enumerator Macros Pages
Public Types | Public Member Functions | List of all members
L3GD20 Class Reference

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...
 

Detailed Description

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

Author
SRLM (srlm@.nosp@m.srlm.nosp@m.produ.nosp@m.ctio.nosp@m.ns.co.nosp@m.m)

Member Enumeration Documentation

Specify the least significant bit of the L3GD20 I2C address.

Enumerator
LSB_0 
LSB_1 

Constructor & Destructor Documentation

L3GD20::L3GD20 ( )
inline

Create a new L3GD20 instance.

Member Function Documentation

bool L3GD20::Init ( I2C i2c_bus,
const AddressLSB  address = LSB_0 
)
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

Parameters
i2cbusthe I2C bus that the gyro is connected to.
Returns
true when the gyro is successfully initialized.

Here is the call graph for this function:

bool L3GD20::ReadGyro ( int &  x,
int &  y,
int &  z 
)
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.

Parameters
xThe gyroscope x axis value. Will be overwritten.
yThe gyroscope y axis value. Will be overwritten.
zThe gyroscope z axis value. Will be overwritten.
Returns
true if all is successful, false otherwise. If false, try reinitilizing

Here is the call graph for this function:


The documentation for this class was generated from the following file: