BMA180 library with multiple configurable ranges. Based on the Sensor_test by Bo Carøe.
Dependents: Sensor_test_2_0 KalmanFilter
Fork of BMA180 by
Diff: BMA180.h
- Revision:
- 1:cd2316c8a187
- Parent:
- 0:6904212fb1d1
- Child:
- 2:c7eb9f15e026
--- a/BMA180.h Wed May 30 10:43:42 2012 +0000 +++ b/BMA180.h Wed Aug 15 01:33:49 2012 +0000 @@ -1,10 +1,13 @@ #pragma once -//I2C Adresse, entweder 0x40 oder 0x41, abhaengig von Pin VDDIO -#define BMA180_ADRESS 0x41 +//I2C address, either 0x40 or 0x41, depending on pin VDDIO +#define BMA180_ADRESS 0x40 -//Beschleunigung in Meter pro Quadratsekunde umrechnen -const float fConvMPSS= 3.4346447e-3; +//Convert acceleration to meters per second squared +//This value depends on the Range you are using, i.e. +-1g, +-3g, etc. +//fConvMPSS= (acc of gravitation) / Sensitivity + +const float fConvMPSS= 1.7919037e-3; class BMA180 { @@ -16,27 +19,29 @@ float Offset[3]; public: - //Beschleunigung auf allen drei Achsen - short RawAcc[3]; //Rohdaten - float Acc[3]; //kalibrierte Rohdaten in m/s^2 + //Acceleration on all three axes + short RawAcc[3]; //Raw Data + float Acc[3]; //Calibrated raw data in m/s^2 - //Initialisieren + //Initialization BMA180(I2C & I2CBus_, Timer & GlobalTime_); void Init(); -private: - //Rohdaten lesen +public: + //Read raw Data void ReadRawData(); public: - //Update-Methode - //- Holt aktuelle Daten vom Sensor ab - //- Rechnet das Offset hinzu - //- Rechnet in andere Einheiten um + //Update Method + //Get current information from the sensor + //Calculate the offset + //Converts other units void Update(); - //Kalibrieren - //- pRaw1g: Array short[3] ideale Rohdaten für 1g = ca. {0, 0, -2870} + //Calibration + //pRaw1g: short array [3] provides the best raw data for approximately 1g = {0, 0, -2870} void Calibrate(int ms, const short * pRaw1g); + + void userCalibration(short * Raw1g); };