Unit testing and development for 9DOF sparkfun sensor stick
Dependencies: ADXL345 HMC5883L ITG3200 mbed
Diff: adxl345unit.h
- Revision:
- 2:d7e66940541d
- Child:
- 3:5e21a352e236
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/adxl345unit.h Thu Nov 01 18:46:58 2012 +0000 @@ -0,0 +1,71 @@ +/* + * @file adxl345unit.h + * @author Tyler Weaver + * + * @section LICENSE + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software + * and associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, + * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or + * substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * @section DESCRIPTION + * + * Unit test for the ADXL345 library. + * + * Reference: + */ + +#ifndef ADXL345UNIT_H +#define ADXL345UNIT_H + +#include "mbed.h" +#include "ADXL345.h" + +class ADXL345UNIT { + public: + /** + * Constructor + * runs init() + * + * @param i2c buss to use for adxl345 + */ + ADXL345UNIT(I2C &i2c); + + /** + * Initalize the device + */ + void init(); + + /** + * Perform built in self test and print results to ADXL_BIT.csv + * + * @returns true if passed, false if failed + */ + bool builtInSelfTest(); + private: + ADXL345 adxl345_; + Serial pc_; + LocalFileSystem local_; + DigitalOut open_file_; + + /** + * Averages an array of n length + * + * @param the array + * @param length + */ + int arr_avg(int*,int); +}; + +#endif \ No newline at end of file