hiroya taura / Mbed 2 deprecated LAURUS_program

Dependencies:   ConfigFile SDFileSystem mbed

Fork of LAURUS_program by LAURUS

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MPU6050.h Source File

MPU6050.h

00001 #pragma once
00002 
00003 const static int mpu_addr = 0xd0;
00004 
00005 typedef union {
00006     uint8_t reg[14]; 
00007     struct {
00008         uint8_t acc_x_L;
00009         uint8_t acc_x_H;
00010         uint8_t acc_y_L;
00011         uint8_t acc_y_H;
00012         uint8_t acc_z_L;
00013         uint8_t acc_z_H;
00014         
00015         uint8_t T_L;
00016         uint8_t T_H;
00017         
00018         uint8_t gyro_x_L;
00019         uint8_t gyro_x_H;
00020         uint8_t gyro_y_L;
00021         uint8_t gyro_y_H;
00022         uint8_t gyro_z_L;
00023         uint8_t gyro_z_H;
00024     } byte;
00025     
00026     struct {
00027         int16_t acc[3];
00028         
00029         int16_t T;
00030         
00031         int16_t gyro[3];
00032     } value;
00033 } MPU_DATA;
00034 
00035 class MPU6050 {
00036 public:
00037     MPU6050(I2C* p_i2c);
00038     ~MPU6050();
00039     
00040     int init();
00041     int read();
00042     
00043     MPU_DATA data;
00044     
00045 private:
00046     I2C* i2c;
00047 };