My attempt to make a better lib (in development)

Dependents:   Nucleo_i2c_9dof

Fork of L3GD20 by brian claus

Revision:
3:17c3c3f59c4d
Parent:
2:b45dbca259f8
diff -r b45dbca259f8 -r 17c3c3f59c4d L3GD20.h
--- a/L3GD20.h	Mon May 22 15:18:15 2017 +0000
+++ b/L3GD20.h	Mon Aug 07 01:25:38 2017 +0000
@@ -29,7 +29,7 @@
 #define __L3GD20_H
 
 #include "mbed.h"
-
+ 
 // register addresses
 
 #define L3GD20_WHO_AM_I      0x0F
@@ -64,6 +64,9 @@
 #define L3GD20_INT1_DURATION 0x38
 #define L3GD20_LOW_ODR       0x39 // D20H
 
+
+#define DPS_TO_RPS  57.2957795130824
+
 /** Interface library for the ST L3GD20 3-axis gyro
  *
  * Ported from Pololu L3GD20 library for Arduino by
@@ -85,17 +88,24 @@
          * @param scl is the pin for the I2C SCL line
          */
         L3GD20(PinName sda, PinName scl);
+        L3GD20(I2C *pI2C);
+        
+        /** Destructor of the class
+         */
+         ~L3GD20();
         
         /** Read gyro values
          * @param g Array containing x, y, and z gyro values
          * @return g Array containing x, y, and z gyro values
          */
         bool read(float *gx, float *gy, float *gz);
+        bool Convert_to_RadPerSec(float *gx, float *gy, float *gz);
         
     private:
-            I2C _L3GD20;
+        I2C* m_ptr_I2C;//_L3GD20;
         float gx, gy, gz;
 
+        void init(void) ;
         bool write_reg(int addr_i2c,int addr_reg, char v);
         bool read_reg(int addr_i2c,int addr_reg, char *v);
         bool recv(char sad, char sub, char *buf, int length);