Used to control two motors

Fork of MPU6050 by Baser Kandehir

Committer:
BaserK
Date:
Thu Jul 09 12:13:56 2015 +0000
Revision:
0:954f15bd95f1
Child:
1:a248e65a25cc
First commit for this library;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
BaserK 0:954f15bd95f1 1 // Most of the code is adapted from Kris Winer's MPU6050 library
BaserK 0:954f15bd95f1 2
BaserK 0:954f15bd95f1 3 #ifndef MPU6050_H
BaserK 0:954f15bd95f1 4 #define MPU6050_H
BaserK 0:954f15bd95f1 5
BaserK 0:954f15bd95f1 6 #include "mbed.h"
BaserK 0:954f15bd95f1 7 #include "math.h"
BaserK 0:954f15bd95f1 8 #include "MPU6050RegDef.h"
BaserK 0:954f15bd95f1 9
BaserK 0:954f15bd95f1 10 extern I2C i2c; // extern the i2c in order to able to use from other files
BaserK 0:954f15bd95f1 11 extern float aRes, gRes;
BaserK 0:954f15bd95f1 12
BaserK 0:954f15bd95f1 13 /* whoAmI func uses this func, variables etc */
BaserK 0:954f15bd95f1 14 extern Ticker toggler1;
BaserK 0:954f15bd95f1 15 extern Serial ftdi;
BaserK 0:954f15bd95f1 16 extern DigitalOut led2;
BaserK 0:954f15bd95f1 17 extern void toggle_led1();
BaserK 0:954f15bd95f1 18
BaserK 0:954f15bd95f1 19 /* Sensor datas to be used in main.cpp */
BaserK 0:954f15bd95f1 20 extern float ax,ay,az;
BaserK 0:954f15bd95f1 21 extern float gx,gy,gz;
BaserK 0:954f15bd95f1 22 extern int16_t accelData[3],gyroData[3],tempData;
BaserK 0:954f15bd95f1 23 extern float accelBias[3], gyroBias[3];
BaserK 0:954f15bd95f1 24
BaserK 0:954f15bd95f1 25 /* Function Prototypes */
BaserK 0:954f15bd95f1 26 class MPU6050
BaserK 0:954f15bd95f1 27 {
BaserK 0:954f15bd95f1 28 protected:
BaserK 0:954f15bd95f1 29 public:
BaserK 0:954f15bd95f1 30 void getAres();
BaserK 0:954f15bd95f1 31 void getGres();
BaserK 0:954f15bd95f1 32 void writeByte(uint8_t address, uint8_t subAddress, uint8_t data);
BaserK 0:954f15bd95f1 33 char readByte(uint8_t address, uint8_t subAddress);
BaserK 0:954f15bd95f1 34 void readBytes(uint8_t address, uint8_t subAddress, uint8_t byteNum, uint8_t* dest);
BaserK 0:954f15bd95f1 35 void whoAmI();
BaserK 0:954f15bd95f1 36 void init();
BaserK 0:954f15bd95f1 37 void reset();
BaserK 0:954f15bd95f1 38 void readAccelData(int16_t* dest);
BaserK 0:954f15bd95f1 39 void readGyroData(int16_t* dest);
BaserK 0:954f15bd95f1 40 int16_t readTempData();
BaserK 0:954f15bd95f1 41 void calibrate(float* dest1, float* dest2);
BaserK 0:954f15bd95f1 42 };
BaserK 0:954f15bd95f1 43
BaserK 0:954f15bd95f1 44 #endif