Now you can download a copy of these docs so you can use them offline! Download now
Classes |
Public Types |
Public Member Functions |
Protected Types |
Protected Attributes |
Static Protected Attributes
ADXL345_I2C Class Reference
#include <ADXL345_I2C.h>
Inheritance diagram for ADXL345_I2C:

Collaboration diagram for ADXL345_I2C:

Classes | |
| struct | AllAxes |
Public Types | |
| enum | DataFormat_Range { kRange_2G = 0x00, kRange_4G = 0x01, kRange_8G = 0x02, kRange_16G = 0x03 } |
| enum | Axes { kAxis_X = 0x00, kAxis_Y = 0x02, kAxis_Z = 0x04 } |
Public Member Functions | |
| ADXL345_I2C (UINT8 moduleNumber, DataFormat_Range range=kRange_2G) | |
| virtual | ~ADXL345_I2C () |
| virtual double | GetAcceleration (Axes axis) |
| virtual AllAxes | GetAccelerations () |
Protected Types | |
| enum | PowerCtlFields { kPowerCtl_Link = 0x20, kPowerCtl_AutoSleep = 0x10, kPowerCtl_Measure = 0x08, kPowerCtl_Sleep = 0x04 } |
| enum | DataFormatFields { kDataFormat_SelfTest = 0x80, kDataFormat_SPI = 0x40, kDataFormat_IntInvert = 0x20, kDataFormat_FullRes = 0x08, kDataFormat_Justify = 0x04 } |
Protected Attributes | |
| I2C * | m_i2c |
Static Protected Attributes | |
| static const UINT8 | kAddress = 0x3A |
| static const UINT8 | kPowerCtlRegister = 0x2D |
| static const UINT8 | kDataFormatRegister = 0x31 |
| static const UINT8 | kDataRegister = 0x32 |
| static const double | kGsPerLSB = 0.00390625 |
Detailed Description
ADXL345 Accelerometer on I2C.
This class alows access to a Analog Devices ADXL345 3-axis accelerometer on an I2C bus. This class assumes the default (not alternate) sensor address of 0x3A (8-bit address).
Definition at line 20 of file ADXL345_I2C.h.
Constructor & Destructor Documentation
| ADXL345_I2C::ADXL345_I2C | ( | UINT8 | moduleNumber, | |
| ADXL345_I2C::DataFormat_Range | range = kRange_2G | |||
| ) | [explicit] |
Constructor.
- Parameters:
-
moduleNumber The digital module that the sensor is plugged into (1 or 2). range The range (+ or -) that the accelerometer will measure.
Definition at line 23 of file ADXL345_I2C.cpp.
| ADXL345_I2C::~ADXL345_I2C | ( | ) | [virtual] |
Destructor.
Definition at line 41 of file ADXL345_I2C.cpp.
Member Function Documentation
| double ADXL345_I2C::GetAcceleration | ( | ADXL345_I2C::Axes | axis | ) | [virtual] |
Get the acceleration of one axis in Gs.
- Parameters:
-
axis The axis to read from.
- Returns:
- Acceleration of the ADXL345 in Gs.
Definition at line 53 of file ADXL345_I2C.cpp.
| ADXL345_I2C::AllAxes ADXL345_I2C::GetAccelerations | ( | ) | [virtual] |
Get the acceleration of all axes in Gs.
- Returns:
- Acceleration measured on all axes of the ADXL345 in Gs.
Definition at line 71 of file ADXL345_I2C.cpp.
The documentation for this class was generated from the following files:
Generated on Thu Jan 12 2012 22:35:26 for WPILibC++ by
1.7.1