Now you can download a copy of these docs so you can use them offline! Download now

#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_t moduleNumber, DataFormat_Range range=kRange_2G)
 
virtual ~ADXL345_I2C ()
 
virtual double GetAcceleration (Axes axis)
 
virtual AllAxes GetAccelerations ()
 
- Public Member Functions inherited from SensorBase
 SensorBase ()
 
virtual ~SensorBase ()
 
- Public Member Functions inherited from ErrorBase
virtual ErrorGetError ()
 Retrieve the current error. Get the current error information associated with this sensor.
 
virtual const ErrorGetError () const
 
virtual void SetErrnoError (const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber) const
 Set error information associated with a C library call that set an error to the "errno" global variable. More...
 
virtual void SetImaqError (int success, const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber) const
 Set the current error information associated from the nivision Imaq API. More...
 
virtual void SetError (Error::Code code, const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber) const
 Set the current error information associated with this sensor. More...
 
virtual void SetWPIError (const char *errorMessage, const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber) const
 Set the current error information associated with this sensor. More...
 
virtual void CloneError (ErrorBase *rhs) const
 
virtual void ClearError () const
 Clear the current error information associated with this sensor.
 
virtual bool StatusIsFatal () const
 Check if the current error code represents a fatal error. More...
 

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

I2Cm_i2c
 
- Protected Attributes inherited from ErrorBase
Error m_error
 

Static Protected Attributes

static const uint8_t kAddress = 0x3A
 
static const uint8_t kPowerCtlRegister = 0x2D
 
static const uint8_t kDataFormatRegister = 0x31
 
static const uint8_t kDataRegister = 0x32
 
static constexpr double kGsPerLSB = 0.00390625
 
- Static Protected Attributes inherited from ErrorBase
static SEM_ID _globalErrorMutex = semMCreate(SEM_Q_PRIORITY | SEM_DELETE_SAFE | SEM_INVERSION_SAFE)
 
static Error _globalError
 

Additional Inherited Members

- Static Public Member Functions inherited from SensorBase
static void DeleteSingletons ()
 
static uint32_t GetDefaultAnalogModule ()
 
static uint32_t GetDefaultDigitalModule ()
 
static uint32_t GetDefaultSolenoidModule ()
 
static bool CheckAnalogModule (uint8_t moduleNumber)
 
static bool CheckDigitalModule (uint8_t moduleNumber)
 
static bool CheckPWMModule (uint8_t moduleNumber)
 
static bool CheckRelayModule (uint8_t moduleNumber)
 
static bool CheckSolenoidModule (uint8_t moduleNumber)
 
static bool CheckDigitalChannel (uint32_t channel)
 
static bool CheckRelayChannel (uint32_t channel)
 
static bool CheckPWMChannel (uint32_t channel)
 
static bool CheckAnalogChannel (uint32_t channel)
 
static bool CheckSolenoidChannel (uint32_t channel)
 
- Static Public Member Functions inherited from ErrorBase
static void SetGlobalError (Error::Code code, const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber)
 
static void SetGlobalWPIError (const char *errorMessage, const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber)
 
static ErrorGetGlobalError ()
 
- Static Public Attributes inherited from SensorBase
static const uint32_t kSystemClockTicksPerMicrosecond = 40
 
static const uint32_t kDigitalChannels = 14
 
static const uint32_t kAnalogChannels = 8
 
static const uint32_t kAnalogModules = 2
 
static const uint32_t kDigitalModules = 2
 
static const uint32_t kSolenoidChannels = 8
 
static const uint32_t kSolenoidModules = 2
 
static const uint32_t kPwmChannels = 10
 
static const uint32_t kRelayChannels = 8
 
static const uint32_t kChassisSlots = 8
 
- Protected Member Functions inherited from SensorBase
void AddToSingletonList ()
 
- Protected Member Functions inherited from ErrorBase
 ErrorBase ()
 Initialize the instance status to 0 for now.
 

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_t  moduleNumber,
ADXL345_I2C::DataFormat_Range  range = kRange_2G 
)
explicit

Constructor.

Parameters
moduleNumberThe digital module that the sensor is plugged into (1 or 2).
rangeThe range (+ or -) that the accelerometer will measure.

Definition at line 24 of file ADXL345_I2C.cpp.

ADXL345_I2C::~ADXL345_I2C ( )
virtual

Destructor.

Definition at line 44 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
axisThe axis to read from.
Returns
Acceleration of the ADXL345 in Gs.

Definition at line 56 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 74 of file ADXL345_I2C.cpp.


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

Generated on Sat Apr 26 2014 12:26:45 for WPILibC++ by doxygen 1.8.6