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

Dependents:   9Dof_unit_testing

Fork of ADXL345 by James Watanabe

Revision:
5:122a504fcfa3
Parent:
4:8046894b947e
Child:
6:5fb29534a6cf
--- a/ADXL345.cpp	Mon Sep 17 10:39:19 2012 +0000
+++ b/ADXL345.cpp	Sat Sep 29 14:15:24 2012 +0000
@@ -54,7 +54,16 @@
 
 //#include "mbed.h"
 
-ADXL345::ADXL345(PinName sda, PinName scl) : i2c_(sda, scl) {
+ADXL345::ADXL345(PinName sda, PinName scl) : i2c_(*(new I2C(sda, scl))) {
+    myI2c = &i2c_;
+}
+
+ADXL345::~ADXL345(){
+    delete myI2c;
+}
+
+
+void ADXL345::init(){
 
     //400kHz, allowing us to use the fastest data rates.
     //there are other chips on board, sorry