Forked from Uwe Gartmann's ADXL345 library, customized as part of the 9DOF stick from Sparkfun.com

Fork of ADXL345 by Uwe Gartmann

ADXL345 is triple axis, digital interface, accelerometer.

This library is forked from Uwe Gartmann and Peter Swanson's work.

This library is for specific application using 9DoF-Stick.

Datasheet:

http://www.analog.com/static/imported-files/data_sheets/ADXL345.pdf

ADXL345は3軸のデジタルインターフェースを備えた加速度センサです。

このライブラリは 9DoF-Stick を使用した特定の企画のために保守しています。

mbed IDEが日本語をサポートするまでは英語でコメントを書いていきますが、サポートした後もきっと英語で書いていくでしょう。

Revision:
4:8046894b947e
Parent:
3:7b83694c7292
Child:
5:122a504fcfa3
--- a/ADXL345.cpp	Thu Sep 13 11:43:11 2012 +0000
+++ b/ADXL345.cpp	Mon Sep 17 10:39:19 2012 +0000
@@ -117,7 +117,6 @@
 }
 
 
-
 void ADXL345::multiByteRead(char address, char* output, int size) {
     i2c_.write( ADXL345_WRITE, &address, 1);  //tell it where to read from
     i2c_.read( ADXL345_READ , output, size);      //tell it where to store the data read
@@ -180,6 +179,13 @@
     
 }
 
+int ADXL345::setDataFormatControl(char settings, char mask, char *prev){
+    char old = SingleByteRead(ADXL345_DATA_FORMAT_REG);
+    if(prev)
+        *prev = old;
+    return SingleByteWrite(ADXL345_DATA_FORMAT_REG, (old | (settings & mask)) & (settings | ~mask));
+}
+
 int ADXL345::setDataRate(char rate) {
 
     //Get the current register contents, so we don't clobber the power bit.