dsafeadf
Fork of MPU6050-DMP-Ian by
Diff: MPU/src/MPU6050.cpp
- Revision:
- 14:3f0bc381e1dd
- Parent:
- 13:b1b98e5c61df
--- a/MPU/src/MPU6050.cpp Thu May 08 09:37:25 2014 +0000 +++ b/MPU/src/MPU6050.cpp Tue May 27 09:21:09 2014 +0000 @@ -3,7 +3,7 @@ // //Changelog: //2013-01-08 - first beta release - + // I2Cdev library collection - MPU6050 I2C device class // Based on InvenSense MPU-6050 register map document rev. 2.0, 5/19/2011 (RM-MPU-6000A-00) // 8/24/2011 by Jeff Rowberg <jeff@rowberg.net> @@ -11,25 +11,25 @@ // // Changelog: // ... - ongoing debug release - + // NOTE: THIS IS ONLY A PARIAL RELEASE. THIS DEVICE CLASS IS CURRENTLY UNDERGOING ACTIVE // DEVELOPMENT AND IS STILL MISSING SOME IMPORTANT FEATURES. PLEASE KEEP THIS IN MIND IF // YOU DECIDE TO USE THIS PARTICULAR CODE FOR ANYTHING. - + /* ============================================ I2Cdev device library code is placed under the MIT license Copyright (c) 2012 Jeff Rowberg - + 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 @@ -57,11 +57,6 @@ devAddr = MPU6050_DEFAULT_ADDRESS; } -MPU6050::MPU6050(PinName i2cSDA, PinName i2cSCL) : i2Cdev(i2cSDA, i2cSCL), debugSerial(USBTX, USBRX) -{ - devAddr = MPU6050_DEFAULT_ADDRESS; -} - /** Specific address constructor. * @param address I2C address * @see MPU6050_DEFAULT_ADDRESS @@ -82,6 +77,7 @@ */ void MPU6050::initialize() { + #ifdef useDebugSerial debugSerial.printf("MPU6050::initialize start\n"); #endif @@ -1053,7 +1049,7 @@ } /** Set the enabled value for the specified slave (0-3). * @param num Slave number (0-3) - * @param enabled New enabled value for specified slave + * @param enabled New enabled value for specified slave * @see getSlaveEnabled() * @see MPU6050_RA_I2C_SLV0_CTRL */ @@ -1886,7 +1882,7 @@ void MPU6050::getMotion9(int16_t* ax, int16_t* ay, int16_t* az, int16_t* gx, int16_t* gy, int16_t* gz, int16_t* mx, int16_t* my, int16_t* mz) { getMotion6(ax, ay, az, gx, gy, gz); - + // magnetometer reading i2Cdev.writeByte(devAddr, MPU6050_RA_INT_PIN_CFG, 0x02); //set i2c bypass enable pin to true to access magnetometer wait_ms(10); // necessary wait >=6ms