Mindstorms 3rd Party ROBOTC Drivers RobotC
[Home] [Download] [Submit a bug/suggestion] [ROBOTC Forums] [Blog] [Support this project]

dexterind-imu.h

Go to the documentation of this file.
00001 /*!@addtogroup Dexter_Industries
00002  * @{
00003  * @defgroup DIMU IMU Sensor
00004  * Dexter Industries DIMU Sensor driver
00005  * @{
00006  */
00007 
00008 /*
00009  * $Id: dexterind-imu.h 133 2013-03-10 15:15:38Z xander $
00010  */
00011 
00012 #ifndef __DIMU_H__
00013 #define __DIMU_H__
00014 /** \file dexterind-imu.h
00015  * \brief Dexter Industries IMU Sensor driver
00016  *
00017  * dexterind-imu.h provides an API for the Dexter Industries IMU Sensor.\n
00018  *
00019  * Changelog:
00020  * - 0.1: Initial release
00021  *
00022  * Credits:
00023  * - Big thanks to Dexter Industries for providing me with the hardware necessary to write and test this.
00024  *
00025  * License: You may use this code as you wish, provided you give credit where its due.
00026  *
00027  * THIS CODE WILL ONLY WORK WITH ROBOTC VERSION 3.59 AND HIGHER. 
00028 
00029  
00030  * \author Xander Soldaat (xander_at_botbench.com)
00031  * \date 07 August 2011
00032  * \version 0.1
00033  * \example dexterind-imu-test1.c
00034  * \example dexterind-imu-test2.c
00035  */
00036 
00037 #pragma systemFile
00038 
00039 #ifndef __COMMON_H__
00040 #include "common.h"
00041 #endif
00042 
00043 //#define STRUCT_CODE_ENABLED 1
00044 
00045 #ifdef STRUCT_CODE_ENABLED
00046 #warn "You have enabled experimental code!"
00047 #endif
00048 
00049 #define DIMU_GYRO_I2C_ADDR      0xD2  /*!< Gyro I2C address */
00050 
00051 #define DIMU_GYRO_RANGE_250     0x00  /*!< 250 dps range */
00052 #define DIMU_GYRO_RANGE_500     0x10  /*!< 500 dps range */
00053 #define DIMU_GYRO_RANGE_2000    0x30  /*!< 2000 dps range */
00054 #define DIMU_CTRL4_BLOCKDATA    0x80
00055 
00056 #define DIMU_GYRO_CTRL_REG1     0x20  /*!< CTRL_REG1 for Gyro */
00057 #define DIMU_GYRO_CTRL_REG2     0x21  /*!< CTRL_REG2 for Gyro */
00058 #define DIMU_GYRO_CTRL_REG3     0x22  /*!< CTRL_REG3 for Gyro */
00059 #define DIMU_GYRO_CTRL_REG4     0x23  /*!< CTRL_REG4 for Gyro */
00060 #define DIMU_GYRO_CTRL_REG5     0x24  /*!< CTRL_REG5 for Gyro */
00061 
00062 #define DIMU_GYRO_ALL_AXES      0x28  /*!< All Axes for Gyro */
00063 #define DIMU_GYRO_X_AXIS        0x2A  /*!< X Axis for Gyro */
00064 #define DIMU_GYRO_Y_AXIS        0x28  /*!< Y Axis for Gyro */
00065 #define DIMU_GYRO_Z_AXIS        0x2C  /*!< Z Axis for Gyro */
00066 
00067 #define DIMU_ACC_I2C_ADDR       0x3A  /*!< Accelerometer I2C address */
00068 #define DIMU_ACC_RANGE_2G       0x04  /*!< Accelerometer 2G range */
00069 #define DIMU_ACC_RANGE_4G       0x08  /*!< Accelerometer 4G range */
00070 #define DIMU_ACC_RANGE_8G       0x00  /*!< Accelerometer 8G range */
00071 #define DIMU_ACC_MODE_STBY      0x00  /*!< Accelerometer standby mode */
00072 #define DIMU_ACC_MODE_MEAS      0x01  /*!< Accelerometer measurement mode */
00073 #define DIMU_ACC_MODE_LVLD      0x02  /*!< Accelerometer level detect mode */
00074 #define DIMU_ACC_MODE_PLSE      0x03  /*!< Accelerometer pulse detect mode */
00075 #define DIMU_ACC_X_AXIS         0x00  /*!< X Axis for Accel */
00076 #define DIMU_ACC_Y_AXIS         0x02  /*!< Y Axis for Accel */
00077 #define DIMU_ACC_Z_AXIS         0x04  /*!< Z Axis for Accel */
00078 
00079 #define DIMUreadGyroXAxis(X) DIMUreadGyroAxis(X, DIMU_GYRO_X_AXIS)
00080 #define DIMUreadGyroYAxis(X) DIMUreadGyroAxis(X, DIMU_GYRO_Y_AXIS)
00081 #define DIMUreadGyroZAxis(X) DIMUreadGyroAxis(X, DIMU_GYRO_Z_AXIS)
00082 
00083 #define DIMUreadAccelXAxis10Bit(X) DIMUreadAccelAxis10Bit(X, DIMU_ACC_X_AXIS)
00084 #define DIMUreadAccelYAxis10Bit(X) DIMUreadAccelAxis10Bit(X, DIMU_ACC_Y_AXIS)
00085 #define DIMUreadAccelZAxis10Bit(X) DIMUreadAccelAxis10Bit(X, DIMU_ACC_Z_AXIS)
00086 
00087 #define DIMUreadAccelXAxis8Bit(X) DIMUreadAccelAxis8Bit(X, DIMU_ACC_X_AXIS)
00088 #define DIMUreadAccelYAxis8Bit(X) DIMUreadAccelAxis8Bit(X, DIMU_ACC_Y_AXIS)
00089 #define DIMUreadAccelZAxis8Bit(X) DIMUreadAccelAxis8Bit(X, DIMU_ACC_Z_AXIS)
00090 
00091 // for future use
00092 #ifdef STRUCT_CODE_ENABLED
00093 typedef struct
00094 {
00095   ubyte I2CAddress;
00096   tSensors link;
00097   tByteArray I2CRequest;
00098   tByteArray I2CReply;
00099   float gyroDivisor;
00100   float accelDivisor;
00101   float axesAccel8Bit[3];
00102   float axesAccel10Bit[3];
00103   float axesGyro8Bit[3];
00104   float axesGyro10Bit[3];
00105 } tDIMUdata, *tDIMUdataPtr;
00106 #endif
00107 
00108 float DIMU_Gyro_divisor[4] = {0.0, 0.0, 0.0, 0.0}; /*!< Array to hold divisor data for 8 bit measurements */
00109 float DIMU_Accel_divisor[4] = {0.0, 0.0, 0.0, 0.0}; /*!< Array to hold divisor data for 8 bit measurements */
00110 
00111 tByteArray DIMU_I2CRequest;    /*!< Array to hold I2C command data */
00112 tByteArray DIMU_I2CReply;      /*!< Array to hold I2C reply data */
00113 
00114 
00115 bool DIMUconfigGyro(tSensors link, ubyte range, bool lpfenable=true);
00116 float DIMUreadGyroAxis(tSensors link, ubyte axis);
00117 void DIMUreadGyroAxes(tSensors link, float &_x, float &_y, float &_z);
00118 bool DIMUconfigAccel(tSensors link, ubyte range);
00119 float DIMUreadAccelAxis8Bit(tSensors link, ubyte axis);
00120 bool DIMUsetAccelAxisOffset(tSensors link, ubyte drift_reg, ubyte drift_LSB, ubyte drift_MSB);
00121 float DIMUreadAccelAxis10Bit(tSensors link, ubyte axis, bool calibrate = false);
00122 void DIMUreadAccelAxes8Bit(tSensors link, float &_x, float &_y, float &_z);
00123 void DIMUreadAccelAxes10Bit(tSensors link, float &_x, float &_y, float &_z);
00124 void DIMUcalAccel(tSensors link);
00125 bool DIMUconfigIMU(tSensors link, ubyte accelRange=DIMU_ACC_RANGE_8G, ubyte gyroRange=DIMU_GYRO_RANGE_250, bool lpfenable=true);
00126 
00127 #ifdef STRUCT_CODE_ENABLED
00128 bool DIMUconfigGyro(tDIMUdataPtr sensor, ubyte range, bool lpfenable=true);
00129 void DIMUreadGyroAxes(tDIMUdataPtr sensor);
00130 bool DIMUconfigAccel(tDIMUdataPtr sensor, ubyte range);
00131 void DIMUreadAccelAxes8Bit(tDIMUdataPtr sensor);
00132 void DIMUreadAccelAxes10Bit(tDIMUdataPtr sensor);
00133 void DIMUcalAccel(tDIMUdataPtr sensor);
00134 bool DIMUconfigIMU(tDIMUdataPtr sensor, ubyte accelRange=DIMU_ACC_RANGE_8G, ubyte gyroRange=DIMU_GYRO_RANGE_250, bool lpfenable=true);
00135 #endif
00136 
00137 /**
00138  * Configure the gyro
00139  * @param link the port number
00140  * @param range the operating range of the gyro
00141  * @param lpfenable Enable built-in Low Pass Filter to reduce spikes in data, optional, defaults to true.
00142  * @return true if no error occured, false if it did
00143  */
00144 bool DIMUconfigGyro(tSensors link, ubyte range, bool lpfenable){
00145         memset(DIMU_I2CRequest, 0, sizeof(DIMU_I2CRequest));
00146 
00147         // Setup the size and address, same for all requests.
00148         DIMU_I2CRequest[0] = 3;    // Sending address, register, value. Optional, defaults to true
00149         DIMU_I2CRequest[1] = 0xD2; // I2C Address of gyro.
00150 
00151         // Write CTRL_REG2
00152         // No High Pass Filter
00153         DIMU_I2CRequest[2] = DIMU_GYRO_CTRL_REG2;
00154         DIMU_I2CRequest[3] = 0x00;
00155         if (!writeI2C(link, DIMU_I2CRequest))
00156           return false;
00157 
00158         // Write CTRL_REG3
00159         // No interrupts.  Date ready.
00160         ////////////////////////////////////////////////////////////////////////////
00161         DIMU_I2CRequest[2] = DIMU_GYRO_CTRL_REG3;      // Register address of CTRL_REG3
00162         DIMU_I2CRequest[3] = 0x08;      // No interrupts.  Date ready.
00163         if(!writeI2C(link, DIMU_I2CRequest))
00164           return false;
00165 
00166         // Write CTRL_REG4
00167         // Full scale range.
00168         DIMU_I2CRequest[2] = DIMU_GYRO_CTRL_REG4;
00169         DIMU_I2CRequest[3] = range + DIMU_CTRL4_BLOCKDATA;
00170         writeI2C(link, DIMU_I2CRequest);
00171 
00172         //Write CTRL_REG5
00173         DIMU_I2CRequest[2] = DIMU_GYRO_CTRL_REG5;      // Register address of CTRL_REG5
00174         DIMU_I2CRequest[3] = (lpfenable) ? 0x02 : 0x00;      // filtering - low pass
00175         if (!writeI2C(link, DIMU_I2CRequest))
00176           return false;
00177 
00178         // Write CTRL_REG1
00179         // Enable all axes. Disable power down.
00180         DIMU_I2CRequest[2] = DIMU_GYRO_CTRL_REG1;
00181         DIMU_I2CRequest[3] = 0x0F;
00182         if (!writeI2C(link, DIMU_I2CRequest))
00183           return false;
00184 
00185         // Set DIMU_Gyro_divisor so that the output of our gyro axis readings can be turned
00186         // into scaled values.
00187         ///////////////////////////////////////////////////////////////////////////
00188         if(range == 0)
00189           DIMU_Gyro_divisor[link] = 114.28571;      // Full scale range is 250 dps.
00190   else if (range == 0x10)
00191     DIMU_Gyro_divisor[link] = 57.142857;       // Full scale range is 500 dps.
00192         else if (range == 0x30)
00193           DIMU_Gyro_divisor[link] = 14.285714;       // Full scale range is 2000 dps.
00194 
00195         return true;
00196 }
00197 
00198 
00199 /**
00200  * Retrieve the axis data
00201  * @param link the port number
00202  * @param axis the specified axis
00203  * @return the axis data in degrees per second
00204  */
00205 float DIMUreadGyroAxis(tSensors link, ubyte axis){
00206         // ubyte _msb = 0;
00207         // ubyte _lsb = 0;
00208 
00209         DIMU_I2CRequest[0] = 2;                   // Message size
00210   DIMU_I2CRequest[1] = DIMU_GYRO_I2C_ADDR;  // I2C Address
00211         DIMU_I2CRequest[2] = axis + 0x80;            // Register address
00212 
00213   if (!writeI2C(link, DIMU_I2CRequest, DIMU_I2CReply, 2)) {
00214     writeDebugStreamLine("error write");
00215     return 0;
00216   }
00217 
00218   return (DIMU_I2CReply[0]+((long)(DIMU_I2CReply[1]<<8)))/DIMU_Gyro_divisor[link];
00219 }
00220 
00221 
00222 /**
00223  * Read all three axes of the gyro
00224  * @param link the port number
00225  * @param _x data for x axis in degrees per second
00226  * @param _y data for y axis in degrees per second
00227  * @param _z data for z axis in degrees per second
00228  * @return true if no error occured, false if it did
00229  */
00230 void DIMUreadGyroAxes(tSensors link, float &_x, float &_y, float &_z){
00231         DIMU_I2CRequest[0] = 2;                   // Message size
00232   DIMU_I2CRequest[1] = DIMU_GYRO_I2C_ADDR;  // I2C Address
00233         DIMU_I2CRequest[2] = DIMU_GYRO_ALL_AXES + 0x80;            // Register address
00234 
00235   if (!writeI2C(link, DIMU_I2CRequest, DIMU_I2CReply, 6)) {
00236     writeDebugStreamLine("error write");
00237     return;
00238   }
00239 
00240   _y = (DIMU_I2CReply[0]+((long)(DIMU_I2CReply[1]<<8)))/DIMU_Gyro_divisor[link];
00241   _x = (DIMU_I2CReply[2]+((long)(DIMU_I2CReply[3]<<8)))/DIMU_Gyro_divisor[link];
00242   _z = (DIMU_I2CReply[4]+((long)(DIMU_I2CReply[5]<<8)))/DIMU_Gyro_divisor[link];
00243 }
00244 
00245 
00246 /**
00247  * Wait for the I2C bus to be ready for the next message
00248  * @param link the port number
00249  * @param range the range at which to operate the Accelerometer, can be 2, 4 and 8G
00250  * @return true if no error occured, false if it did
00251  */
00252 bool DIMUconfigAccel(tSensors link, ubyte range) {
00253   switch(range) {
00254     case DIMU_ACC_RANGE_2G: DIMU_Accel_divisor[link] = 64.0; break;
00255     case DIMU_ACC_RANGE_4G: DIMU_Accel_divisor[link] = 32.0; break;
00256     case DIMU_ACC_RANGE_8G: DIMU_Accel_divisor[link] = 16.0; break;
00257   }
00258 
00259         DIMU_I2CRequest[0] = 3;                 // Sending address, register, value.
00260         DIMU_I2CRequest[1] = DIMU_ACC_I2C_ADDR; // I2C Address of Accelerometer.
00261 
00262         //Set the Mode Control - P.25 of Documentation
00263         ////////////////////////////////////////////////////////////////////////////
00264         DIMU_I2CRequest[2] = 0x16;                   // Register address of Mode Control
00265         DIMU_I2CRequest[3] = range | DIMU_ACC_MODE_MEAS;
00266         if (!writeI2C(link, DIMU_I2CRequest))     // (Port 1, Message Array, Reply Size)
00267           return false;
00268 
00269         DIMUcalAccel(link);
00270         return true;
00271 }
00272 
00273 
00274 /**
00275  * Read the specified accelerometer axis, returns an 8 bit answer
00276  * @param link the port number
00277  * @param axis the specific axis
00278  * @return gravity in G with 8 bit accuracy
00279  */
00280 float DIMUreadAccelAxis8Bit(tSensors link, ubyte axis){
00281   int sensorReading = 0;
00282         DIMU_I2CRequest[0] = 2;      // Sending address, register.
00283         DIMU_I2CRequest[1] = DIMU_ACC_I2C_ADDR;   // I2C Address of accl.
00284 
00285         switch (axis) {
00286     case DIMU_ACC_X_AXIS: DIMU_I2CRequest[2] = 0x06; break;
00287     case DIMU_ACC_Y_AXIS: DIMU_I2CRequest[2] = 0x07; break;
00288     case DIMU_ACC_Z_AXIS: DIMU_I2CRequest[2] = 0x08; break;
00289   }
00290 
00291         if (!writeI2C(link, DIMU_I2CRequest, DIMU_I2CReply, 1))
00292           return 0;
00293 
00294         sensorReading = (int)DIMU_I2CReply[0];
00295         return ((sensorReading > 128) ? sensorReading - 256 : sensorReading) / DIMU_Accel_divisor[link];
00296 }
00297 
00298 
00299 /**
00300  * Confgures an offset register for the accelerometer.
00301  * @param link the port number
00302  * @param drift_reg the register to write to
00303  * @param drift_LSB drift value LSB
00304  * @param drift_MSB drift value MSB
00305  * @return true if no error occured, false if it did
00306  */
00307 bool DIMUsetAccelAxisOffset(tSensors link, ubyte drift_reg, ubyte drift_LSB, ubyte drift_MSB){
00308   DIMU_I2CRequest[0] = 3;                     // Sending address, register, value.
00309   DIMU_I2CRequest[1] = DIMU_ACC_I2C_ADDR;     // I2C Address of accl.
00310 
00311   DIMU_I2CRequest[2] = drift_reg;             // Register of the data we're writing to.
00312   DIMU_I2CRequest[3] = drift_LSB;             // The drift value to write for calibration.
00313   if (!writeI2C(link, DIMU_I2CRequest))
00314     return false;
00315 
00316   DIMU_I2CRequest[2] = drift_reg + 1;
00317   DIMU_I2CRequest[3] = drift_MSB;
00318   return writeI2C(link, DIMU_I2CRequest);
00319 }
00320 
00321 
00322 /**
00323  * Read the specified accelerometer axis, returns an 10 bit answer
00324  * @param link the port number
00325  * @param axis the specific axis
00326  * @param calibrate optional argument, if set to to true, the sensor will calibrate this axis first.
00327  * @return gravity in G with 10 bit accuracy
00328  */
00329 float DIMUreadAccelAxis10Bit(tSensors link, ubyte axis, bool calibrate){
00330   int ureading = 0;  // unsigned sensor data
00331   int sreading = 0;  // signed sensor data
00332   int drift_offset = 0;
00333 
00334   if (calibrate == true) {
00335     writeDebugStreamLine("axis: %d", axis);
00336     DIMUsetAccelAxisOffset(link, 0x10 + axis, 0x00, 0x00);
00337     wait1Msec(50);
00338   }
00339 
00340   DIMU_I2CRequest[0] = 2;          // Sending address, register.
00341   DIMU_I2CRequest[1] = DIMU_ACC_I2C_ADDR;  // I2C Address of accl.
00342   DIMU_I2CRequest[2] = axis;        // First Register of the data we're requesting.
00343 
00344   if (!writeI2C(link, DIMU_I2CRequest, DIMU_I2CReply, 2))
00345     return 0;
00346 
00347   ureading = DIMU_I2CReply[0] + (DIMU_I2CReply[1] << 8) & 0x3FF;
00348   sreading = (ureading > 511) ? ureading - 1024 : ureading;
00349   //sreading = (ureading & 0x200) ? -(((~ureading) & 0x3FF)+1) : ureading;
00350 
00351   if (calibrate == true) {
00352     wait1Msec(50);
00353     switch (axis) {
00354       case DIMU_ACC_X_AXIS: drift_offset = (  0 - sreading ) * 2; break;
00355       case DIMU_ACC_Y_AXIS: drift_offset = (  0 - sreading ) * 2; break;
00356       case DIMU_ACC_Z_AXIS: drift_offset = ( 64 - sreading ) * 2; break;
00357     }
00358     DIMUsetAccelAxisOffset(link, 0x10 + axis, drift_offset & 0x00ff, (drift_offset & 0xff00 ) >> 8);
00359   }
00360 
00361   return sreading / 64.0;
00362 }
00363 
00364 
00365 /**
00366  * Read the specified accelerometer axis, returns an 8 bit answer
00367  * @param link the port number
00368  * @param _x variable to hold X axis data
00369  * @param _y variable to hold Y axis data
00370  * @param _z variable to hold Z axis data
00371  */
00372 void DIMUreadAccelAxes8Bit(tSensors link, float &_x, float &_y, float &_z){
00373         _x = DIMUreadAccelAxis8Bit(link, DIMU_ACC_X_AXIS);
00374         _y = DIMUreadAccelAxis8Bit(link, DIMU_ACC_Y_AXIS);
00375         _z = DIMUreadAccelAxis8Bit(link, DIMU_ACC_Z_AXIS);
00376 }
00377 
00378 
00379 /**
00380  * Read the specified accelerometer axis, returns an 10 bit answer
00381  * @param link the port number
00382  * @param _x variable to hold X axis data
00383  * @param _y variable to hold Y axis data
00384  * @param _z variable to hold Z axis data
00385  */
00386 void DIMUreadAccelAxes10Bit(tSensors link, float &_x, float &_y, float &_z){
00387         _x = DIMUreadAccelAxis10Bit(link, DIMU_ACC_X_AXIS);
00388         _y = DIMUreadAccelAxis10Bit(link, DIMU_ACC_Y_AXIS);
00389         _z = DIMUreadAccelAxis10Bit(link, DIMU_ACC_Z_AXIS);
00390 }
00391 
00392 
00393 /**
00394  * Calibrate the Accelerometer.  The sensor must be stationary and assumes the Z axis is facing up.
00395  * @param link the port number
00396  */
00397 void DIMUcalAccel(tSensors link){
00398   DIMUreadAccelAxis10Bit(link, DIMU_ACC_X_AXIS, true);      // Get x axis data.
00399         DIMUreadAccelAxis10Bit(link, DIMU_ACC_Y_AXIS, true);      // Get y axis data.
00400         DIMUreadAccelAxis10Bit(link, DIMU_ACC_Z_AXIS, true);      // Get z axis data.
00401         wait1Msec(100);
00402 }
00403 
00404 
00405 bool DIMUconfigIMU(tSensors link, ubyte accelRange, ubyte gyroRange, bool lpfenable)
00406 {
00407   if (!DIMUconfigGyro(link, gyroRange, lpfenable))
00408     return false;
00409 
00410   return DIMUconfigAccel(link, accelRange);
00411 }
00412 
00413 
00414 #ifdef STRUCT_CODE_ENABLED
00415 bool DIMUconfigGyro(tDIMUdataPtr sensor, ubyte range, bool lpfenable)
00416 {
00417         memset(sensor->I2CRequest, 0, sizeof(tByteArray));
00418 
00419         // Setup the size and address, same for all requests.
00420         sensor->I2CRequest[0] = 3;    // Sending address, register, value. Optional, defaults to true
00421         sensor->I2CRequest[1] = 0xD2; // I2C Address of gyro.
00422 
00423         // Write CTRL_REG2
00424         // No High Pass Filter
00425         sensor->I2CRequest[2] = DIMU_GYRO_CTRL_REG2;
00426         sensor->I2CRequest[3] = 0x00;
00427         if (!writeI2C(link, sensor->I2CRequest))
00428           return false;
00429 
00430         // Write CTRL_REG3
00431         // No interrupts.  Date ready.
00432         ////////////////////////////////////////////////////////////////////////////
00433         sensor->I2CRequest[2] = DIMU_GYRO_CTRL_REG3;      // Register address of CTRL_REG3
00434         sensor->I2CRequest[3] = 0x08;      // No interrupts.  Date ready.
00435         if(!writeI2C(link, sensor->I2CRequest))
00436           return false;
00437 
00438         // Write CTRL_REG4
00439         // Full scale range.
00440         sensor->I2CRequest = DIMU_GYRO_CTRL_REG4;
00441         sensor->I2CRequest[3] = range + DIMU_CTRL4_BLOCKDATA;
00442         writeI2C(link, sensor->I2CRequest);
00443 
00444         //Write CTRL_REG5
00445         sensor->I2CRequest[2] = DIMU_GYRO_CTRL_REG5;      // Register address of CTRL_REG5
00446         sensor->I2CRequest[3] = (lpfenable) ? 0x02 : 0x00;      // filtering - low pass
00447         if (!writeI2C(link, sensor->I2CRequest))
00448           return false;
00449 
00450         // Write CTRL_REG1
00451         // Enable all axes. Disable power down.
00452         sensor->I2CRequest[2] = DIMU_GYRO_CTRL_REG1;
00453         sensor->I2CRequest[3] = 0x0F;
00454         if (!writeI2C(link, sensor->I2CRequest))
00455           return false;
00456 
00457         // Set DIMU_Gyro_divisor so that the output of our gyro axis readings can be turned
00458         // into scaled values.
00459         ///////////////////////////////////////////////////////////////////////////
00460         if(range == 0)
00461           DIMU_Gyro_divisor[link] = 114.28571;      // Full scale range is 250 dps.
00462   else if (range == 0x10)
00463     DIMU_Gyro_divisor[link] = 57.142857;       // Full scale range is 500 dps.
00464         else if (range == 0x30)
00465           DIMU_Gyro_divisor[link] = 14.285714;       // Full scale range is 2000 dps.
00466 
00467         return true;
00468 }
00469 
00470 void DIMUreadGyroAxes(tDIMUdataPtr sensor)
00471 {
00472 
00473 }
00474 bool DIMUconfigAccel(tDIMUdataPtr sensor, ubyte range)
00475 {
00476 
00477 }
00478 void DIMUreadAccelAxes8Bit(tDIMUdataPtr sensor)
00479 {
00480 
00481 }
00482 void DIMUreadAccelAxes10Bit(tDIMUdataPtr sensor)
00483 {
00484 
00485 }
00486 void DIMUcalAccel(tDIMUdataPtr sensor)
00487 {
00488 
00489 }
00490 bool DIMUconfigIMU(tDIMUdataPtr sensor, ubyte accelRange, ubyte gyroRange, bool lpfenable)
00491 {
00492 
00493 }
00494 #endif
00495 
00496 #endif // __DIMU_H__
00497 
00498 /*
00499  * $Id: dexterind-imu.h 133 2013-03-10 15:15:38Z xander $
00500  */
00501 /* @} */
00502 /* @} */