Bradley Kohler / MPU6050
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MPU6050.h Source File

MPU6050.h

00001 #ifndef MPU6050_H
00002 #define MPU6050_H
00003 
00004 #include "mpu6050_reg.h"
00005 #include "mbed.h"
00006 
00007 enum Ascale {
00008   AFS_2G = 0,
00009   AFS_4G,
00010   AFS_8G,
00011   AFS_16G
00012 };
00013 
00014 enum Gscale {
00015   GFS_250DPS = 0,
00016   GFS_500DPS,
00017   GFS_1000DPS,
00018   GFS_2000DPS
00019 };
00020 
00021 class mpu6050 {
00022 protected:
00023 
00024 public:
00025     //wire.h functions
00026     void writeByte(uint8_t address, uint8_t subAddress, uint8_t data);
00027     char readByte(uint8_t address, uint8_t subAddress);
00028     void readBytes(uint8_t address, uint8_t subAddress, uint8_t count, uint8_t * dest);
00029     //mpu6050 functions
00030     void getGres();
00031     void getAres();
00032     void readAccelData(int16_t * destination);
00033     void readGyroData(int16_t * destination);
00034     int16_t readTempData();
00035     void lowPowerAccelOnly();
00036     void reset();
00037     void init();
00038     void calibrate(float * dest1, float * dest2);
00039     void selfTest(float * destination); // Should return percent deviation from factory trim values, +/- 14 or less deviation is a pass
00040     void MadgwickQuaternionUpdate(float ax, float ay, float az, float gx, float gy, float gz);
00041 };
00042 
00043 #endif