Republished Library, to be refined for use with the SparkFun 9DOF in HARP project.
Fork of ADXL345 by
Diff: ADXL345.cpp
- 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.