issues
Dependents: mpu6050_test_basic_1
Fork of MPU6050 by
Revision 2:d7915dab2d3c, committed 2014-07-01
- Comitter:
- chris1seto
- Date:
- Tue Jul 01 23:24:17 2014 +0000
- Parent:
- 1:1e0baaf91e96
- Commit message:
- STM issues
Changed in this revision
--- a/I2Cdev.cpp Wed May 08 00:34:55 2013 +0000 +++ b/I2Cdev.cpp Tue Jul 01 23:24:17 2014 +0000 @@ -4,15 +4,16 @@ // 2013-01-08 - first release #include "I2Cdev.h" +#include "shared.h" #define useDebugSerial -I2Cdev::I2Cdev(): debugSerial(USBTX, USBRX), i2c(I2C_SDA,I2C_SCL) +I2Cdev::I2Cdev(): i2c(I2C_SDA,I2C_SCL) { } -I2Cdev::I2Cdev(PinName i2cSda, PinName i2cScl): debugSerial(USBTX, USBRX), i2c(i2cSda,i2cScl) +I2Cdev::I2Cdev(PinName i2cSda, PinName i2cScl) : i2c(i2cSda, i2cScl) { } @@ -136,6 +137,7 @@ i2c.read(devAddr<<1, redData, length); for(int i =0; i < length; i++) { data[i] = redData[i]; + pc.printf("%d", redData[i]); } free (redData); return length;
--- a/I2Cdev.h Wed May 08 00:34:55 2013 +0000 +++ b/I2Cdev.h Tue Jul 01 23:24:17 2014 +0000 @@ -9,13 +9,9 @@ #include "mbed.h" -#define I2C_SDA p28 -#define I2C_SCL p27 - class I2Cdev { private: I2C i2c; - Serial debugSerial; public: I2Cdev(); I2Cdev(PinName i2cSda, PinName i2cScl);
--- a/MPU6050.cpp Wed May 08 00:34:55 2013 +0000 +++ b/MPU6050.cpp Tue Jul 01 23:24:17 2014 +0000 @@ -41,8 +41,9 @@ */ #include "MPU6050.h" +#include "shared.h" -#define useDebugSerial +//#define useDebugSerial //instead of using pgmspace.h typedef const unsigned char prog_uchar; @@ -52,7 +53,7 @@ /** Default constructor, uses default I2C address. * @see MPU6050_DEFAULT_ADDRESS */ -MPU6050::MPU6050() : debugSerial(USBTX, USBRX) +MPU6050::MPU6050() { devAddr = MPU6050_DEFAULT_ADDRESS; } @@ -63,7 +64,7 @@ * @see MPU6050_ADDRESS_AD0_LOW * @see MPU6050_ADDRESS_AD0_HIGH */ -MPU6050::MPU6050(uint8_t address) : debugSerial(USBTX, USBRX) +MPU6050::MPU6050(uint8_t address) { devAddr = address; } @@ -1899,6 +1900,12 @@ void MPU6050::getMotion6(int16_t* ax, int16_t* ay, int16_t* az, int16_t* gx, int16_t* gy, int16_t* gz) { i2Cdev.readBytes(devAddr, MPU6050_RA_ACCEL_XOUT_H, 14, buffer); + + for (int i = 0; i < 14; i++) + { + pc.printf("%d", buffer[i]); + } + *ax = (((int16_t)buffer[0]) << 8) | buffer[1]; *ay = (((int16_t)buffer[2]) << 8) | buffer[3]; *az = (((int16_t)buffer[4]) << 8) | buffer[5];
--- a/MPU6050.h Wed May 08 00:34:55 2013 +0000 +++ b/MPU6050.h Tue Jul 01 23:24:17 2014 +0000 @@ -405,7 +405,6 @@ class MPU6050 { private: I2Cdev i2Cdev; - Serial debugSerial; public: MPU6050(); MPU6050(uint8_t address);