83 lines
2.6 KiB
C
83 lines
2.6 KiB
C
#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 //陀螺仪自检å<E282AC>Šæµ‹é‡<C3A9>范围,典型值:0x18(ä¸<C3A4>自检ï¼?000deg/s)
|
||
#define ACCEL_CONFIG 0x1C //åŠ é€Ÿè®¡è‡ªæ£€ã€<C3A3>测é‡<C3A9>范围å<C2B4>Šé«˜é€šæ»¤æ³¢é¢‘率,典型值:0x01(ä¸<C3A4>自检ï¼?Gï¼?Hz)
|
||
#define ACCEL_CONFIG2 0X1D //åŠ é€Ÿåº¦è®¡ä½Žé€šæ»¤æ³¢å™¨ 0x06 5hz
|
||
|
||
#define PWR_MGMT_1 0X6B//电æº<C3A6>管ç<C2A1>†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地å<C2B0>€å¯„å˜å™?默认数å€?x68,å<C592>ªè¯?
|
||
#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原始数æ<C2B0>®
|
||
extern _st_AngE Angle;
|
||
extern _st_AngE Angle;
|
||
|
||
int8_t MpuInit(void); //åˆ<C3A5>始åŒ?
|
||
void MpuGetData(void); //读å<C2BB>–陀螺仪数æ<C2B0>®åŠ 滤æ³?
|
||
|
||
#endif |