Republished Library, to be refined for use with the SparkFun 9DOF in HARP project.

Dependents:   vmConfort_v6

Fork of ADXL345 by Tyler Weaver

Revision:
5:122a504fcfa3
Parent:
4:8046894b947e
Child:
6:5fb29534a6cf
--- a/ADXL345.h	Mon Sep 17 10:39:19 2012 +0000
+++ b/ADXL345.h	Sat Sep 29 14:15:24 2012 +0000
@@ -134,6 +134,21 @@
      * @param sck mbed pin to use for SCL line of I2C interface.
      */
     ADXL345(PinName sda, PinName scl);
+    
+
+    /**
+     * Constructor that accepts external i2c interface object.
+     *
+     * @param i2c The I2C interface object to use.
+     */
+    ADXL345(I2C &i2c) : i2c_(i2c), myI2c(NULL){}
+    
+    /**
+     * Destructor that frees self-allocated I2C object.
+     */
+    ~ADXL345();
+    
+    void init();
 
     /**
      * Get the output of all three axes.
@@ -530,7 +545,9 @@
    
 private:
 
-    I2C i2c_;
+    I2C &i2c_;
+    
+    I2C *myI2c;
     
 
     /**