MPU9250

Dependents:   FreeIMU

Fork of MPU6050 by Yifei Teng

Revision:
9:d879deb55ae1
Parent:
7:95e74f827c08
Child:
10:11cc1b413f49
--- a/I2Cdev.h	Tue Nov 05 11:28:54 2013 +0000
+++ b/I2Cdev.h	Sat Nov 09 08:51:07 2013 +0000
@@ -8,19 +8,22 @@
 #ifndef I2Cdev_h
 #define I2Cdev_h
 
-#include "mbed.h"
+#ifndef I2C_SDA
+    #define I2C_SDA p28
+    #define I2C_SCL p27
+#endif
 
-#define I2C_SDA p28
-#define I2C_SCL p27
+#include "mbed.h"
+#include "MODI2C.h"
 
 class I2Cdev {
     private:
-        I2C i2c;
+        
         Serial debugSerial;
     public:
         I2Cdev();
         I2Cdev(PinName i2cSda, PinName i2cScl);        
-        I2Cdev(I2C i2c_);
+        I2Cdev(MODI2C i2c_);
         
         int8_t readBit(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint8_t *data, uint16_t timeout=I2Cdev::readTimeout());
         int8_t readBitW(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint16_t *data, uint16_t timeout=I2Cdev::readTimeout());
@@ -39,8 +42,18 @@
         bool writeWord(uint8_t devAddr, uint8_t regAddr, uint16_t data);
         bool writeBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_t *data);
         bool writeWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint16_t *data);
+        
+        void readBytes_nb(uint8_t devAddr, char *command, uint8_t length, uint8_t *data, uint32_t (*function)(uint32_t), void* param);
 
         static uint16_t readTimeout(void);
+
+        MODI2C i2c;
+        
+        char* allocbuffer();
+        void freebuffer();
+        
+        MemoryPool<char[20], 20> pool;
+        Queue<char, 20> queue;
 };
 
 #endif
\ No newline at end of file