Unit testing and development for 9DOF sparkfun sensor stick
Dependencies: ADXL345 HMC5883L ITG3200 mbed
Diff: adxl345unit.h
- Revision:
- 3:5e21a352e236
- Parent:
- 2:d7e66940541d
- Child:
- 4:8a77e21d08f1
diff -r d7e66940541d -r 5e21a352e236 adxl345unit.h --- a/adxl345unit.h Thu Nov 01 18:46:58 2012 +0000 +++ b/adxl345unit.h Mon Nov 05 18:35:42 2012 +0000 @@ -40,7 +40,7 @@ * * @param i2c buss to use for adxl345 */ - ADXL345UNIT(I2C &i2c); + ADXL345UNIT(I2C &i2c, Timer &t); /** * Initalize the device @@ -48,16 +48,41 @@ void init(); /** - * Perform built in self test and print results to ADXL_BIT.csv + * Perform built in self test and print results to BIST.csv + * Raw data is printed to BIST_RAW.csv + * + * NOT YET TESTED + * + * @param store_raw true to store raw data + * @returns test result: true if passed, false if failed + */ + bool builtInSelfTest(bool); + + /** + * Performs the offset callibration test and prints to OFF_CAL.csv + * + * NOT YET TESTED * - * @returns true if passed, false if failed + * TODO: implement into ADXL345 class. + * + * @param store_raw true to store raw data */ - bool builtInSelfTest(); + void offsetCalibration(bool); + + /** + * Tests the method of ADXL345 library + * + * Results stored in method.txt + * + * @returns test result, true if passed, false if not + */ + bool methodTest(); + private: ADXL345 adxl345_; Serial pc_; - LocalFileSystem local_; DigitalOut open_file_; + Timer t_; /** * Averages an array of n length @@ -65,7 +90,17 @@ * @param the array * @param length */ - int arr_avg(int*,int); + int16_t arr_avg(int16_t*,int16_t); + + /** + * 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 (should already be started) + */ + void sample100avg(float, int16_t[][3], int16_t*, Timer*); }; #endif \ No newline at end of file