albatross / Mbed 2 deprecated LAURUS_program_copy

Dependencies:   ConfigFile SDFileSystem mbed

Fork of LAURUS_program by hiroya taura

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 typedef union {
00005     uint8_t reg[14]; 
00006     struct {
00007         uint8_t acc_x_L;
00008         uint8_t acc_x_H;
00009         uint8_t acc_y_L;
00010         uint8_t acc_y_H;
00011         uint8_t acc_z_L;
00012         uint8_t acc_z_H;
00013         
00014         uint8_t T_L;
00015         uint8_t T_H;
00016         
00017         uint8_t gyro_x_L;
00018         uint8_t gyro_x_H;
00019         uint8_t gyro_y_L;
00020         uint8_t gyro_y_H;
00021         uint8_t gyro_z_L;
00022         uint8_t gyro_z_H;
00023     } byte;
00024     
00025     struct {
00026         int16_t acc[3];
00027         
00028         int16_t T;
00029         
00030         int16_t gyro[3];
00031     } value;
00032 } MPU_DATA;
00033 
00034 class MPU6050 {
00035 public:
00036     MPU6050(I2C* p_i2c);
00037     ~MPU6050();
00038     
00039     int init();
00040     int read();
00041     MPU_DATA data;
00042    void checker_set(int x){check = x;}
00043    int checker_get(){return check;}
00044 private:
00045     I2C* i2c;
00046       int check;
00047 };