#ifndef __MPU__ #define __MPU__ #include "data.h" // Read-only Reg #define AK8963_I2C_ADDR 0x18 // slave address for the AK8963 #define AK8963_DEVICE_ID 0x48 #define AK8963_WIA 0x00 #define AK8963_INFO 0x01 #define AK8963_ST1 0x02 // data ready status bit 0 #define AK8963_XOUT_L 0x03 // data #define AK8963_XOUT_H 0x04 #define AK8963_YOUT_L 0x05 #define AK8963_YOUT_H 0x06 #define AK8963_ZOUT_L 0x07 #define AK8963_ZOUT_H 0x08 #define AK8963_ST2 0x09 // Data overflow bit 3 and data read error status bit 2 #define AK8963_CNTL 0x0A // Power down (0000), single-measurement (0001), self-test (1000) and Fuse ROM (1111) modes on bits 3:0 #define AK8963_ASTC 0x0C // Self test control #define AK8963_I2CDIS 0x0F // I2C disable #define AK8963_ASAX 0x10 // Fuse ROM x-axis sensitivity adjustment value #define AK8963_ASAY 0x11 // Fuse ROM y-axis sensitivity adjustment value #define AK8963_ASAZ 0x12 // Fuse ROM z-axis sensitivity adjustment value // Write/Read Reg #define AK8963_CNTL1 0x0A #define AK8963_CNTL2 0x0B #define AK8963_ASTC 0x0C #define AK8963_TS1 0x0D #define AK8963_TS2 0x0E #define AK8963_I2CDIS 0x0F // Read-only Reg ( ROM ) #define AK8963_ASAX 0x10 #define AK8963_ASAY 0x11 #define AK8963_ASAZ 0x12 #define SMPLRT_DIV 0x19 //陀螺仪采样率,典型值:0x07(125Hz) #define CONFIGL 0x1A //低通滤波频率,典型值:0x06(5Hz) #define GYRO_CONFIG 0x1B //陀螺仪自检及测量范围,典型值:0x18(不自检?000deg/s) #define ACCEL_CONFIG 0x1C //加速计自检、测量范围及高通滤波频率,典型值:0x01(不自检?G?Hz) #define ACCEL_CONFIG2 0X1D //加速度计低通滤波器 0x06 5hz #define PWR_MGMT_1 0X6B//电源管理1 典型值为0x00 #define INT_PIN_CFG 0x37 #define ACCEL_ADDRESS 0x3B #define ACCEL_XOUT_H 0x3B #define ACCEL_XOUT_L 0x3C #define ACCEL_YOUT_H 0x3D #define ACCEL_YOUT_L 0x3E #define ACCEL_ZOUT_H 0x3F #define ACCEL_ZOUT_L 0x40 #define TEMP_OUT_H 0x41 #define TEMP_OUT_L 0x42 #define GYRO_XOUT_H 0x43 #define GYRO_ADDRESS 0x43 #define GYRO_XOUT_L 0x44 #define GYRO_YOUT_H 0x45 #define GYRO_YOUT_L 0x46 #define GYRO_ZOUT_H 0x47 #define GYRO_ZOUT_L 0x48 #define WHO_AM_I 0x75 //IIC地址寄存?默认数?x68,只? #define MPU6050_PRODUCT_ID 0x68 #define MPU6052C_PRODUCT_ID 0x72 #define MPU9250_PRODUCT_ID 0x71 // #define I2C_SLV0_ADDR 0x25 #define EXT_SENS_DATA_00 0x49 #define I2C_SLV0_CTRL 0x27 #define I2C_SLV0_DO 0x64 #define USER_CTRL 0x6A extern _st_Mpu MPU6050; //MPU6050原始数据 extern _st_AngE Angle; extern _st_AngE Angle; int8_t MpuInit(void); //初始? void MpuGetData(void); //读取陀螺仪数据加滤? #endif