IMU 10dof MEMS from DR Robot adapted from HK10DOF Changed gyro to ITG3200
Fork of HK10DOF by
WARNING: This project is not complete, but this library seems ok so far.
I have the module DFRobotics.com 10DOF MEMS IMU. I wanted a concise module for resolving direction and movement.
I found HK10DOF library (http://developer.mbed.org/users/pommzorz/code/HK10DOF/) with quaternions. But it used a different gyro. So I modified that code to use the same higher level calls but use the ITG3200 low level calls.
BMP085.h@4:c4db4e2ffdd7, 2014-11-18 (annotated)
- Committer:
- svkatielee
- Date:
- Tue Nov 18 06:28:56 2014 +0000
- Revision:
- 4:c4db4e2ffdd7
- Parent:
- 0:9a1682a09c50
Changed gyro sensor to ITG3200
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pommzorz | 0:9a1682a09c50 | 1 | /* |
pommzorz | 0:9a1682a09c50 | 2 | * BMP085.h |
pommzorz | 0:9a1682a09c50 | 3 | * |
pommzorz | 0:9a1682a09c50 | 4 | * Created on: 13 juil. 2013 |
pommzorz | 0:9a1682a09c50 | 5 | * Author: Vincent |
pommzorz | 0:9a1682a09c50 | 6 | */ |
pommzorz | 0:9a1682a09c50 | 7 | |
pommzorz | 0:9a1682a09c50 | 8 | #ifndef BMP085_H_ |
pommzorz | 0:9a1682a09c50 | 9 | #define BMP085_H_ |
pommzorz | 0:9a1682a09c50 | 10 | |
pommzorz | 0:9a1682a09c50 | 11 | #include "mbed.h" |
pommzorz | 0:9a1682a09c50 | 12 | |
pommzorz | 0:9a1682a09c50 | 13 | class BMP085{ |
pommzorz | 0:9a1682a09c50 | 14 | |
pommzorz | 0:9a1682a09c50 | 15 | public : |
pommzorz | 0:9a1682a09c50 | 16 | |
pommzorz | 0:9a1682a09c50 | 17 | static const int I2C_ADDRESS = 0xEE; // sensor address |
pommzorz | 0:9a1682a09c50 | 18 | |
pommzorz | 0:9a1682a09c50 | 19 | BMP085(PinName sda, PinName scl); |
pommzorz | 0:9a1682a09c50 | 20 | |
pommzorz | 0:9a1682a09c50 | 21 | |
pommzorz | 0:9a1682a09c50 | 22 | BMP085(I2C &i2c) : i2c_(i2c) { |
pommzorz | 0:9a1682a09c50 | 23 | //init(); |
pommzorz | 0:9a1682a09c50 | 24 | } |
pommzorz | 0:9a1682a09c50 | 25 | |
pommzorz | 0:9a1682a09c50 | 26 | ~BMP085(); |
pommzorz | 0:9a1682a09c50 | 27 | |
pommzorz | 0:9a1682a09c50 | 28 | void writeRegister(unsigned char r, unsigned char v); |
pommzorz | 0:9a1682a09c50 | 29 | |
pommzorz | 0:9a1682a09c50 | 30 | // read a 16 bit register |
pommzorz | 0:9a1682a09c50 | 31 | int readIntRegister(unsigned char r); |
pommzorz | 0:9a1682a09c50 | 32 | |
pommzorz | 0:9a1682a09c50 | 33 | // read uncompensated temperature value |
pommzorz | 0:9a1682a09c50 | 34 | unsigned int readUT(); |
pommzorz | 0:9a1682a09c50 | 35 | |
pommzorz | 0:9a1682a09c50 | 36 | |
pommzorz | 0:9a1682a09c50 | 37 | // read uncompensated pressure value |
pommzorz | 0:9a1682a09c50 | 38 | long readUP(); |
pommzorz | 0:9a1682a09c50 | 39 | |
pommzorz | 0:9a1682a09c50 | 40 | // Below there are the utility functions to get data from the sensor. |
pommzorz | 0:9a1682a09c50 | 41 | |
pommzorz | 0:9a1682a09c50 | 42 | // read temperature and pressure from sensor |
pommzorz | 0:9a1682a09c50 | 43 | void readSensor(); |
pommzorz | 0:9a1682a09c50 | 44 | |
pommzorz | 0:9a1682a09c50 | 45 | void getCalibrationData(); |
pommzorz | 0:9a1682a09c50 | 46 | |
pommzorz | 0:9a1682a09c50 | 47 | float press(void); |
pommzorz | 0:9a1682a09c50 | 48 | |
pommzorz | 0:9a1682a09c50 | 49 | float temp(void); |
pommzorz | 0:9a1682a09c50 | 50 | |
pommzorz | 0:9a1682a09c50 | 51 | float altitud(void); |
pommzorz | 0:9a1682a09c50 | 52 | |
pommzorz | 0:9a1682a09c50 | 53 | |
pommzorz | 0:9a1682a09c50 | 54 | private : |
pommzorz | 0:9a1682a09c50 | 55 | |
pommzorz | 0:9a1682a09c50 | 56 | I2C &i2c_; |
pommzorz | 0:9a1682a09c50 | 57 | // variables to keep the values |
pommzorz | 0:9a1682a09c50 | 58 | float temperature; |
pommzorz | 0:9a1682a09c50 | 59 | float pressure; |
pommzorz | 0:9a1682a09c50 | 60 | |
pommzorz | 0:9a1682a09c50 | 61 | |
pommzorz | 0:9a1682a09c50 | 62 | char i2cRaw[sizeof(I2C)]; |
pommzorz | 0:9a1682a09c50 | 63 | }; |
pommzorz | 0:9a1682a09c50 | 64 | |
pommzorz | 0:9a1682a09c50 | 65 | |
pommzorz | 0:9a1682a09c50 | 66 | #endif /* BMP085_H_ */ |
pommzorz | 0:9a1682a09c50 | 67 |