An fully working IMU-Filter and Sensor drivers for the 10DOF-Board over I2C. All in one simple class. Include, calibrate sensors, call read, get angles. (3D Visualisation code for Python also included) Sensors: L3G4200D, ADXL345, HMC5883, BMP085
IMU/Sensors/I2C_Sensor.h
- Committer:
- maetugr
- Date:
- 2013-08-29
- Revision:
- 4:f62337b907e5
- Parent:
- 1:798db5deb8b9
File content as of revision 4:f62337b907e5:
// by MaEtUgR #ifndef I2C_Sensor_H #define I2C_Sensor_H #include "mbed.h" class I2C_Sensor { public: I2C_Sensor(PinName sda, PinName scl, char address); float data[3]; // where the measured data is saved virtual void read() = 0; // read all axis from register to array data //TODO: virtual void calibrate() = 0; // calibrate the sensor and if desired write calibration values to a file protected: // Calibration void saveCalibrationValues(float values[], int size, char * filename); void loadCalibrationValues(float values[], int size, char * filename); // I2C functions char readRegister(char reg); void writeRegister(char reg, char data); void readMultiRegister(char reg, char* output, int size); // raw data and function to measure it short raw[3]; virtual void readraw() = 0; private: I2C i2c; // original mbed I2C-library just to initialise the control registers char i2c_address; // address LocalFileSystem local; // file access to save calibration values }; #endif