for interfacing the sparkfun boards

Dependencies:   ADXL345_I2C HMC5883L IMUfilter ITG3200_HelloWorld mbed

Committer:
sandwich
Date:
Tue Apr 29 00:04:48 2014 +0000
Revision:
0:441caaf895d8
imufilter works. 6dof

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sandwich 0:441caaf895d8 1 #pragma once
sandwich 0:441caaf895d8 2 #include "ADXL345_I2C.h"
sandwich 0:441caaf895d8 3
sandwich 0:441caaf895d8 4
sandwich 0:441caaf895d8 5 //Gravity at Earth's surface in m/s/s
sandwich 0:441caaf895d8 6 #define g0 9.812865328
sandwich 0:441caaf895d8 7 //Number of samples to average.
sandwich 0:441caaf895d8 8 #define SAMPLES 4
sandwich 0:441caaf895d8 9 //Convert from radians to degrees.
sandwich 0:441caaf895d8 10 #define toDegrees(x) (x * 57.2957795)
sandwich 0:441caaf895d8 11 //Convert from degrees to radians.
sandwich 0:441caaf895d8 12 #define toRadians(x) (x * 0.01745329252)
sandwich 0:441caaf895d8 13 //Full scale resolution on the ADXL345 is 4mg/LSB.
sandwich 0:441caaf895d8 14 #define ACCELEROMETER_GAIN (0.004 * g0)
sandwich 0:441caaf895d8 15 //Sampling accelerometer at 200Hz.
sandwich 0:441caaf895d8 16 #define ACC_RATE 0.005
sandwich 0:441caaf895d8 17
sandwich 0:441caaf895d8 18 class ADXL345HL
sandwich 0:441caaf895d8 19 {
sandwich 0:441caaf895d8 20 private:
sandwich 0:441caaf895d8 21 ADXL345_I2C* accelerometer;
sandwich 0:441caaf895d8 22 int readings[3];
sandwich 0:441caaf895d8 23 double xBias;
sandwich 0:441caaf895d8 24 double yBias;
sandwich 0:441caaf895d8 25 double zBias;
sandwich 0:441caaf895d8 26 double* output; //x,y,z
sandwich 0:441caaf895d8 27 char address; //i^2c device address
sandwich 0:441caaf895d8 28 int calibrationsamples;
sandwich 0:441caaf895d8 29 int readsamples;
sandwich 0:441caaf895d8 30 float samplerate;
sandwich 0:441caaf895d8 31 public:
sandwich 0:441caaf895d8 32 void init(int calibsamples, int readsampls, float samplrate);
sandwich 0:441caaf895d8 33 void calibrateAccelerometer(void);
sandwich 0:441caaf895d8 34 double* sampleAccelerometer(void);
sandwich 0:441caaf895d8 35 ADXL345HL();
sandwich 0:441caaf895d8 36 ~ADXL345HL();
sandwich 0:441caaf895d8 37 };