Slightly modified version (to work with processing GUI)

Dependencies:   ITG3200 mbed

Fork of 6DoF_IMU_readvalue by Ryo Nakabayashi

Revision:
5:e4a11d519322
Parent:
4:c7d5863b2576
--- a/ADXL345_I2C.cpp	Thu Oct 24 20:31:54 2013 +0000
+++ b/ADXL345_I2C.cpp	Wed Feb 05 22:12:32 2014 +0000
@@ -59,7 +59,7 @@
 // initialize the BW data rate
     char tx[2];
     tx[0] = ADXL345_BW_RATE_REG;
-    tx[1] = ADXL345_6HZ25; //value greater than or equal to 0x0A is written into the rate bits (Bit D3 through Bit D0) in the BW_RATE register 
+    tx[1] = ADXL345_1600HZ; //value greater than or equal to 0x0A is written into the rate bits (Bit D3 through Bit D0) in the BW_RATE register 
  i2c_.write( ADXL345_I2C_WRITE , tx, 2);  
 
 //Data format (for +-16g) - This is done by setting Bit D3 of the DATA_FORMAT register (Address 0x31) and writing a value of 0x03 to the range bits (Bit D1 and Bit D0) of the DATA_FORMAT register (Address 0x31).
@@ -129,13 +129,13 @@
 }
 
 
-void ADXL345_I2C::getOutput(int* readings){
+void ADXL345_I2C::getOutput(short int* readings){
     char buffer[6];    
     multiByteRead(ADXL345_DATAX0_REG, buffer, 6);
     
-    readings[0] = (int)buffer[1] << 8 | (int)buffer[0];
-    readings[1] = (int)buffer[3] << 8 | (int)buffer[2];
-    readings[2] = (int)buffer[5] << 8 | (int)buffer[4];
+    readings[0] = (short int)buffer[1] << 8 | (short int)buffer[0];
+    readings[1] = (short int)buffer[3] << 8 | (short int)buffer[2];
+    readings[2] = (short int)buffer[5] << 8 | (short int)buffer[4];
 
 }