Creating a project for TT_Mxx

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 "mbed.h"
00005 
00006 class MPU6050 : public I2C {
00007 
00008 
00009 public:
00010     MPU6050();
00011     MPU6050(PinName sda,PinName scl);
00012     /**
00013      * @brief Get MPU6050 device's ID for test the device wheter connect.
00014      * @return [0x68] [0xFF] fail.
00015      */
00016     uint8_t getDeviceID();
00017 
00018     uint16_t getX();
00019 
00020     uint16_t getY();
00021 
00022     uint16_t getZ();
00023 
00024     uint16_t getGX();
00025 
00026     uint16_t getGY();
00027 
00028     uint16_t getGZ();
00029 private:
00030     /**
00031      * @brief  Read value from MPU6050 register address
00032      * @param  register_address 
00033      * @return                  [description]
00034      */
00035     uint8_t readByte(uint8_t register_address);
00036 
00037     /**
00038      * @brief  Write value to MPU6050's register address.
00039      * @param  register_address [description]
00040      * @param  value            [description]
00041      * @return [0] success.
00042      */
00043     uint8_t writeByte(uint8_t register_address,uint8_t value);
00044 
00045   
00046     /**
00047      * @brief Init MPU6050 sensor.
00048      */
00049     void init_sensor();
00050 
00051     /**
00052      * @brief Set clock source.
00053      * @param value [description]
00054      */
00055     void setClockSource(uint8_t value);
00056 
00057     /**
00058      * @brief Set gyroscopes’ full scale range.
00059      * @param value 
00060      */
00061     void setFullScaleGyroRange(uint8_t value);
00062 
00063     /**
00064      * @brief Set configure the accelerometer full scale range.
00065      * @param value [description]
00066      */
00067     void setFullScaleAccelRange(uint8_t value);
00068 
00069 };
00070 
00071 
00072 #endif