MPU6050 issues

Dependencies:   mbed

Fork of MPU6050 by Shundo Kishi

Revision:
6:6300d9561dfd
Parent:
5:7d1bf3ce0053
--- a/MPU6050_6Axis_MotionApps20.h	Sat Nov 23 16:47:00 2013 +0000
+++ b/MPU6050_6Axis_MotionApps20.h	Tue Jul 01 16:56:00 2014 +0000
@@ -33,7 +33,7 @@
 #ifndef _MPU6050_6AXIS_MOTIONAPPS20_H_
 #define _MPU6050_6AXIS_MOTIONAPPS20_H_
 
-#include <iostream>
+#include "shared.h"
 
 #include "I2Cdev.h"
 #include "helper_3dmath.h"
@@ -102,18 +102,18 @@
 // after moving string constants to flash memory storage using the F()
 // compiler macro (Arduino IDE 1.0+ required).
 
-//#define DEBUG
+#define DEBUG
 #ifdef DEBUG
-    #define DEBUG_PRINT(x) std::cout << x   //Serial.print(x)
-    #define DEBUG_PRINTF(x, y) std::cout << x   //Serial.print(x, y)
-    #define DEBUG_PRINTLN(x) std::cout << x << std::endl   //Serial.println(x)
-    #define DEBUG_PRINTLNF(x, y) std::cout << x << std::endl  //Serial.println(x, y)
+    #define DEBUG_PRINT(x) pc.printf(" %s \r\n", x);
+    #define DEBUG_PRINTF(x, y) pc.printf(" %s \r\n", x);
+    #define DEBUG_PRINTLN(x) pc.printf(" %s \r\n", x);
+    #define DEBUG_PRINTLNF(x, y) pc.printf(" %s \r\n", x);
     #define F(x) x
 #else
-    #define DEBUG_PRINT(x)
-    #define DEBUG_PRINTF(x, y)
-    #define DEBUG_PRINTLN(x)
-    #define DEBUG_PRINTLNF(x, y)
+    #define DEBUG_PRINT(x)         
+    #define DEBUG_PRINTF(x, y)      
+    #define DEBUG_PRINTLN(x)         
+    #define DEBUG_PRINTLNF(x, y) 
 #endif
 
 #define MPU6050_DMP_CODE_SIZE       1929    // dmpMemory[]
@@ -349,8 +349,7 @@
     setMemoryStartAddress(0x06);
     DEBUG_PRINTLN(F("Checking hardware revision..."));
     uint8_t hwRevision = readMemoryByte();
-    DEBUG_PRINT(F("Revision @ user[16][6] = "));
-    DEBUG_PRINTLNF(hwRevision, HEX);
+    pc.printf("Revision @ user[16][6] = %d\r\n", hwRevision);
     DEBUG_PRINTLN(F("Resetting memory bank selection to 0..."));
     setMemoryBank(0, false, false);
 
@@ -386,9 +385,10 @@
 
     // load DMP code into memory banks
     DEBUG_PRINT(F("Writing DMP code to MPU memory banks ("));
-    DEBUG_PRINT(MPU6050_DMP_CODE_SIZE);
-    DEBUG_PRINTLN(F(" bytes)"));
-    if (writeProgMemoryBlock(dmpMemory, MPU6050_DMP_CODE_SIZE)) {
+    pc.printf("%d bytes)\r\n", MPU6050_DMP_CODE_SIZE);
+    
+    if (writeProgMemoryBlock(dmpMemory, MPU6050_DMP_CODE_SIZE))
+    {
         DEBUG_PRINTLN(F("Success! DMP code written and verified."));
 
         // write DMP configuration