IMU 10dof MEMS from DR Robot adapted from HK10DOF Changed gyro to ITG3200

Fork of HK10DOF by Aloïs Wolff

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.

Revision:
4:c4db4e2ffdd7
Parent:
3:450acaa4f52d
--- a/L3G4200D.h	Tue Nov 18 06:25:57 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@
-/* Copyright (c) 2011 Pololu Corporation.  For more information, see
- * 
- * http://www.pololu.com/
- * http://forum.pololu.com/
- * 
- * 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.
- */
-
-#ifndef __L3G4200D_H
-#define __L3G4200D_H
-
-#include "mbed.h"
-
-// register addresses
-
-#define L3G4200D_WHO_AM_I      0x0F
-
-#define L3G4200D_CTRL_REG1     0x20
-#define L3G4200D_CTRL_REG2     0x21
-#define L3G4200D_CTRL_REG3     0x22
-#define L3G4200D_CTRL_REG4     0x23
-#define L3G4200D_CTRL_REG5     0x24
-#define L3G4200D_REFERENCE     0x25
-#define L3G4200D_OUT_TEMP      0x26
-#define L3G4200D_STATUS_REG    0x27
-
-#define L3G4200D_OUT_X_L       0x28
-#define L3G4200D_OUT_X_H       0x29
-#define L3G4200D_OUT_Y_L       0x2A
-#define L3G4200D_OUT_Y_H       0x2B
-#define L3G4200D_OUT_Z_L       0x2C
-#define L3G4200D_OUT_Z_H       0x2D
-
-#define L3G4200D_FIFO_CTRL_REG 0x2E
-#define L3G4200D_FIFO_SRC_REG  0x2F
-
-#define L3G4200D_INT1_CFG      0x30
-#define L3G4200D_INT1_SRC      0x31
-#define L3G4200D_INT1_THS_XH   0x32
-#define L3G4200D_INT1_THS_XL   0x33
-#define L3G4200D_INT1_THS_YH   0x34
-#define L3G4200D_INT1_THS_YL   0x35
-#define L3G4200D_INT1_THS_ZH   0x36
-#define L3G4200D_INT1_THS_ZL   0x37
-#define L3G4200D_INT1_DURATION 0x38
-
-typedef char byte;
-
-/** Interface library for the ST L3G4200D 3-axis gyro
- *
- * Ported from Pololu L3G4200D library for Arduino by
- * Michael Shimniok http://bot-thoughts.com
- *
- * @code
- * #include "mbed.h"
- * #include "L3G4200D.h"
- * L3G4200D gyro(p28, p27);
- * ...
- * int g[3];
- * gyro.read(g);
- * @endcode
- */
-class L3G4200D
-{
-    public:
-        /** Create a new L3G4200D I2C interface
-         * @param sda is the pin for the I2C SDA line
-         * @param scl is the pin for the I2C SCL line
-         */
-        L3G4200D(PinName sda, PinName scl);
-        
-        /** Read gyro values
-         * @param g Array containing x, y, and z gyro values
-         * @return g Array containing x, y, and z gyro values
-         */
-        void read(int *g);
-        void read3(int x, int y, int z);
-        void zeroCalibrate(unsigned int totSamples, unsigned int sampleDelayMS);
-        void readRawCal(int *_GyroXYZ);
-        void readFin(float *_GyroXYZ); // includes gain and offset
-        
-    private:
-        float gains[3]; 
-        int offsets[3];
-        float polarities[3];
-        
-        void setGains(float _Xgain, float _Ygain, float _Zgain);
-        void setOffsets(int _Xoffset, int _Yoffset, int _Zoffset);
-        void setRevPolarity(bool _Xpol, bool _Ypol, bool _Zpol);  // true = Reversed  false = default
-    
-    
-        byte data[6];
-        int _rates[3];
-        I2C _device;
-        void writeReg(byte reg, byte value);
-        byte readReg(byte reg);
-        void enableDefault(void);
-};
-
-#endif