Republished Library, to be refined for use with the SparkFun 9DOF in HARP project.
Fork of ADXL345 by
Diff: ADXL345.h
- Revision:
- 9:cc0260a2404b
- Parent:
- 8:4cdd4315189f
- Child:
- 10:d81793e01ec4
--- a/ADXL345.h Mon Nov 05 18:34:49 2012 +0000 +++ b/ADXL345.h Tue Nov 06 16:40:36 2012 +0000 @@ -148,7 +148,7 @@ * * @param i2c The I2C interface object to use. */ - ADXL345(I2C &i2c) : i2c_(i2c), myI2c(NULL) {} + ADXL345(I2C &i2c) : i2c_(i2c), myI2c(NULL) {init();} /** * Destructor that frees self-allocated I2C object. @@ -626,19 +626,7 @@ * @param size: The number of bytes to write. */ int multiByteWrite(char startAddress, char* ptr_data, int size); - - /** - * Sample 100 times and average - * - * @param period of sample rate - * @param array to hold raw data, should be int16_t[100][3] (sample,axis) - * @param array to hold averages, should be 3 in length - * @param pointer to timer object - */ - void sample100avg(float, int16_t[][3], int16_t*, Timer*); - -private: - + /** * Converts little-endian 2's complement byte pair to native byte order of * the CPU and then sign extend it to the CPU's register size. @@ -655,6 +643,16 @@ // compilers if we want to keep it portable. return int16_t(((unsigned char)rx[1] << 8) | (unsigned char)rx[0]); } + + /** + * Sample 100 times and average + * + * @param period of sample rate + * @param array to hold raw data, should be int16_t[100][3] (sample,axis) + * @param array to hold averages, should be 3 in length + * @param pointer to timer object + */ + void sample100avg(float, int16_t[][3], int16_t*, Timer*); }; #endif /* ADXL345_H */