BLE nrf51822 MPU6050 i2c(P9 P10) UART(P0 P1)
Dependents: Hello_LinkSprite_ble_mpu6050
Fork of MPU6050 by
Revision 2:04a94bea4f74, committed 2015-09-22
- Comitter:
- DarkerL
- Date:
- Tue Sep 22 02:24:06 2015 +0000
- Parent:
- 1:1e0baaf91e96
- Commit message:
- mpu6050 ble i2c(p9 p10) uart(p0 p1) nrf51822
Changed in this revision
I2Cdev.h | Show annotated file Show diff for this revision Revisions of this file |
MPU6050.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 1e0baaf91e96 -r 04a94bea4f74 I2Cdev.h --- a/I2Cdev.h Wed May 08 00:34:55 2013 +0000 +++ b/I2Cdev.h Tue Sep 22 02:24:06 2015 +0000 @@ -9,8 +9,8 @@ #include "mbed.h" -#define I2C_SDA p28 -#define I2C_SCL p27 +#define I2C_SDA p9 +#define I2C_SCL p10 class I2Cdev { private:
diff -r 1e0baaf91e96 -r 04a94bea4f74 MPU6050.cpp --- a/MPU6050.cpp Wed May 08 00:34:55 2013 +0000 +++ b/MPU6050.cpp Tue Sep 22 02:24:06 2015 +0000 @@ -78,18 +78,18 @@ void MPU6050::initialize() { -#ifdef useDebugSerial - debugSerial.printf("MPU6050::initialize start\n"); -#endif + + printf("MPU6050::initialize start\n\r"); + setClockSource(MPU6050_CLOCK_PLL_XGYRO); setFullScaleGyroRange(MPU6050_GYRO_FS_250); setFullScaleAccelRange(MPU6050_ACCEL_FS_2); setSleepEnabled(false); // thanks to Jack Elston for pointing this one out! -#ifdef useDebugSerial - debugSerial.printf("MPU6050::initialize end\n"); -#endif + + printf("MPU6050::initialize end\n\r"); + } /** Verify the I2C connection. @@ -98,13 +98,13 @@ */ bool MPU6050::testConnection() { -#ifdef useDebugSerial - debugSerial.printf("MPU6050::testConnection start\n"); -#endif + + printf("MPU6050::testConnection start\n\r"); + uint8_t deviceId = getDeviceID(); -#ifdef useDebugSerial - debugSerial.printf("DeviceId = %d\n",deviceId); -#endif + + printf("DeviceId = %d\n",deviceId); + return deviceId == 0x34; }