最终代码

Dependencies:   mbed

Fork of MPU6050_Driver_Balance by Chen Huan

Committer:
heroistired
Date:
Mon Apr 09 14:34:45 2018 +0000
Revision:
0:badebd32bd8b
????MPU6050?? ; C.H.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
heroistired 0:badebd32bd8b 1 #ifndef __MPU6050_H
heroistired 0:badebd32bd8b 2 #define __MPU6050_H
heroistired 0:badebd32bd8b 3 //#include "mpuiic.h"
heroistired 0:badebd32bd8b 4 #include "mbed.h"
heroistired 0:badebd32bd8b 5
heroistired 0:badebd32bd8b 6 //////////////////////////////////////////////////////////////////////////////////
heroistired 0:badebd32bd8b 7 //MPU6050驱动程序 C.H.
heroistired 0:badebd32bd8b 8 //////////////////////////////////////////////////////////////////////////////////
heroistired 0:badebd32bd8b 9
heroistired 0:badebd32bd8b 10 //用来选择驱动程序用于哪个项目的电路板
heroistired 0:badebd32bd8b 11 //define DRIVER_MODE_ROTOR //四旋翼
heroistired 0:badebd32bd8b 12 #define DRIVER_MODE_BALANCE //平衡车
heroistired 0:badebd32bd8b 13
heroistired 0:badebd32bd8b 14 //兼容宏定义
heroistired 0:badebd32bd8b 15 #define delay_us wait_us
heroistired 0:badebd32bd8b 16 #define delay_ms wait_ms
heroistired 0:badebd32bd8b 17
heroistired 0:badebd32bd8b 18
heroistired 0:badebd32bd8b 19 //IO口操作宏定义
heroistired 0:badebd32bd8b 20 #define BITBAND(addr, bitnum) ((addr & 0xF0000000)+0x2000000+((addr &0xFFFFF)<<5)+(bitnum<<2))
heroistired 0:badebd32bd8b 21 #define MEM_ADDR(addr) *((volatile unsigned long *)(addr))
heroistired 0:badebd32bd8b 22 #define BIT_ADDR(addr, bitnum) MEM_ADDR(BITBAND(addr, bitnum))
heroistired 0:badebd32bd8b 23 //IO口地址映射
heroistired 0:badebd32bd8b 24 #define GPIOA_ODR_Addr (GPIOA_BASE+12) //0x4001080C
heroistired 0:badebd32bd8b 25 #define GPIOB_ODR_Addr (GPIOB_BASE+12) //0x40010C0C
heroistired 0:badebd32bd8b 26 #define GPIOC_ODR_Addr (GPIOC_BASE+12) //0x4001100C
heroistired 0:badebd32bd8b 27 #define GPIOD_ODR_Addr (GPIOD_BASE+12) //0x4001140C
heroistired 0:badebd32bd8b 28 #define GPIOE_ODR_Addr (GPIOE_BASE+12) //0x4001180C
heroistired 0:badebd32bd8b 29 #define GPIOF_ODR_Addr (GPIOF_BASE+12) //0x40011A0C
heroistired 0:badebd32bd8b 30 #define GPIOG_ODR_Addr (GPIOG_BASE+12) //0x40011E0C
heroistired 0:badebd32bd8b 31
heroistired 0:badebd32bd8b 32 #define GPIOA_IDR_Addr (GPIOA_BASE+8) //0x40010808
heroistired 0:badebd32bd8b 33 #define GPIOB_IDR_Addr (GPIOB_BASE+8) //0x40010C08
heroistired 0:badebd32bd8b 34 #define GPIOC_IDR_Addr (GPIOC_BASE+8) //0x40011008
heroistired 0:badebd32bd8b 35 #define GPIOD_IDR_Addr (GPIOD_BASE+8) //0x40011408
heroistired 0:badebd32bd8b 36 #define GPIOE_IDR_Addr (GPIOE_BASE+8) //0x40011808
heroistired 0:badebd32bd8b 37 #define GPIOF_IDR_Addr (GPIOF_BASE+8) //0x40011A08
heroistired 0:badebd32bd8b 38 #define GPIOG_IDR_Addr (GPIOG_BASE+8) //0x40011E08
heroistired 0:badebd32bd8b 39
heroistired 0:badebd32bd8b 40 //IO口操作,只对单一的IO口!
heroistired 0:badebd32bd8b 41 //确保n的值小于16!
heroistired 0:badebd32bd8b 42 #define PAout(n) BIT_ADDR(GPIOA_ODR_Addr,n) //输出
heroistired 0:badebd32bd8b 43 #define PAin(n) BIT_ADDR(GPIOA_IDR_Addr,n) //输入
heroistired 0:badebd32bd8b 44
heroistired 0:badebd32bd8b 45 #define PBout(n) BIT_ADDR(GPIOB_ODR_Addr,n) //输出
heroistired 0:badebd32bd8b 46 #define PBin(n) BIT_ADDR(GPIOB_IDR_Addr,n) //输入
heroistired 0:badebd32bd8b 47
heroistired 0:badebd32bd8b 48 #define PCout(n) BIT_ADDR(GPIOC_ODR_Addr,n) //输出
heroistired 0:badebd32bd8b 49 #define PCin(n) BIT_ADDR(GPIOC_IDR_Addr,n) //输入
heroistired 0:badebd32bd8b 50
heroistired 0:badebd32bd8b 51 #define PDout(n) BIT_ADDR(GPIOD_ODR_Addr,n) //输出
heroistired 0:badebd32bd8b 52 #define PDin(n) BIT_ADDR(GPIOD_IDR_Addr,n) //输入
heroistired 0:badebd32bd8b 53
heroistired 0:badebd32bd8b 54 #define PEout(n) BIT_ADDR(GPIOE_ODR_Addr,n) //输出
heroistired 0:badebd32bd8b 55 #define PEin(n) BIT_ADDR(GPIOE_IDR_Addr,n) //输入
heroistired 0:badebd32bd8b 56
heroistired 0:badebd32bd8b 57 #define PFout(n) BIT_ADDR(GPIOF_ODR_Addr,n) //输出
heroistired 0:badebd32bd8b 58 #define PFin(n) BIT_ADDR(GPIOF_IDR_Addr,n) //输入
heroistired 0:badebd32bd8b 59
heroistired 0:badebd32bd8b 60 #define PGout(n) BIT_ADDR(GPIOG_ODR_Addr,n) //输出
heroistired 0:badebd32bd8b 61 #define PGin(n) BIT_ADDR(GPIOG_IDR_Addr,n) //输入
heroistired 0:badebd32bd8b 62 /////////////////////////////////////////////////////////////////
heroistired 0:badebd32bd8b 63
heroistired 0:badebd32bd8b 64
heroistired 0:badebd32bd8b 65
heroistired 0:badebd32bd8b 66
heroistired 0:badebd32bd8b 67 //#define MPU_ACCEL_OFFS_REG 0X06 //accel_offs寄存器,可读取版本号,寄存器手册未提到
heroistired 0:badebd32bd8b 68 //#define MPU_PROD_ID_REG 0X0C //prod id寄存器,在寄存器手册未提到
heroistired 0:badebd32bd8b 69 #define MPU_SELF_TESTX_REG 0X0D //自检寄存器X
heroistired 0:badebd32bd8b 70 #define MPU_SELF_TESTY_REG 0X0E //自检寄存器Y
heroistired 0:badebd32bd8b 71 #define MPU_SELF_TESTZ_REG 0X0F //自检寄存器Z
heroistired 0:badebd32bd8b 72 #define MPU_SELF_TESTA_REG 0X10 //自检寄存器A
heroistired 0:badebd32bd8b 73 #define MPU_SAMPLE_RATE_REG 0X19 //采样频率分频器
heroistired 0:badebd32bd8b 74 #define MPU_CFG_REG 0X1A //配置寄存器
heroistired 0:badebd32bd8b 75 #define MPU_GYRO_CFG_REG 0X1B //陀螺仪配置寄存器
heroistired 0:badebd32bd8b 76 #define MPU_ACCEL_CFG_REG 0X1C //加速度计配置寄存器
heroistired 0:badebd32bd8b 77 #define MPU_MOTION_DET_REG 0X1F //运动检测阀值设置寄存器
heroistired 0:badebd32bd8b 78 #define MPU_FIFO_EN_REG 0X23 //FIFO使能寄存器
heroistired 0:badebd32bd8b 79 #define MPU_I2CMST_CTRL_REG 0X24 //IIC主机控制寄存器
heroistired 0:badebd32bd8b 80 #define MPU_I2CSLV0_ADDR_REG 0X25 //IIC从机0器件地址寄存器
heroistired 0:badebd32bd8b 81 #define MPU_I2CSLV0_REG 0X26 //IIC从机0数据地址寄存器
heroistired 0:badebd32bd8b 82 #define MPU_I2CSLV0_CTRL_REG 0X27 //IIC从机0控制寄存器
heroistired 0:badebd32bd8b 83 #define MPU_I2CSLV1_ADDR_REG 0X28 //IIC从机1器件地址寄存器
heroistired 0:badebd32bd8b 84 #define MPU_I2CSLV1_REG 0X29 //IIC从机1数据地址寄存器
heroistired 0:badebd32bd8b 85 #define MPU_I2CSLV1_CTRL_REG 0X2A //IIC从机1控制寄存器
heroistired 0:badebd32bd8b 86 #define MPU_I2CSLV2_ADDR_REG 0X2B //IIC从机2器件地址寄存器
heroistired 0:badebd32bd8b 87 #define MPU_I2CSLV2_REG 0X2C //IIC从机2数据地址寄存器
heroistired 0:badebd32bd8b 88 #define MPU_I2CSLV2_CTRL_REG 0X2D //IIC从机2控制寄存器
heroistired 0:badebd32bd8b 89 #define MPU_I2CSLV3_ADDR_REG 0X2E //IIC从机3器件地址寄存器
heroistired 0:badebd32bd8b 90 #define MPU_I2CSLV3_REG 0X2F //IIC从机3数据地址寄存器
heroistired 0:badebd32bd8b 91 #define MPU_I2CSLV3_CTRL_REG 0X30 //IIC从机3控制寄存器
heroistired 0:badebd32bd8b 92 #define MPU_I2CSLV4_ADDR_REG 0X31 //IIC从机4器件地址寄存器
heroistired 0:badebd32bd8b 93 #define MPU_I2CSLV4_REG 0X32 //IIC从机4数据地址寄存器
heroistired 0:badebd32bd8b 94 #define MPU_I2CSLV4_DO_REG 0X33 //IIC从机4写数据寄存器
heroistired 0:badebd32bd8b 95 #define MPU_I2CSLV4_CTRL_REG 0X34 //IIC从机4控制寄存器
heroistired 0:badebd32bd8b 96 #define MPU_I2CSLV4_DI_REG 0X35 //IIC从机4读数据寄存器
heroistired 0:badebd32bd8b 97
heroistired 0:badebd32bd8b 98 #define MPU_I2CMST_STA_REG 0X36 //IIC主机状态寄存器
heroistired 0:badebd32bd8b 99 #define MPU_INTBP_CFG_REG 0X37 //中断/旁路设置寄存器
heroistired 0:badebd32bd8b 100 #define MPU_INT_EN_REG 0X38 //中断使能寄存器
heroistired 0:badebd32bd8b 101 #define MPU_INT_STA_REG 0X3A //中断状态寄存器
heroistired 0:badebd32bd8b 102
heroistired 0:badebd32bd8b 103 #define MPU_ACCEL_XOUTH_REG 0X3B //加速度值,X轴高8位寄存器
heroistired 0:badebd32bd8b 104 #define MPU_ACCEL_XOUTL_REG 0X3C //加速度值,X轴低8位寄存器
heroistired 0:badebd32bd8b 105 #define MPU_ACCEL_YOUTH_REG 0X3D //加速度值,Y轴高8位寄存器
heroistired 0:badebd32bd8b 106 #define MPU_ACCEL_YOUTL_REG 0X3E //加速度值,Y轴低8位寄存器
heroistired 0:badebd32bd8b 107 #define MPU_ACCEL_ZOUTH_REG 0X3F //加速度值,Z轴高8位寄存器
heroistired 0:badebd32bd8b 108 #define MPU_ACCEL_ZOUTL_REG 0X40 //加速度值,Z轴低8位寄存器
heroistired 0:badebd32bd8b 109
heroistired 0:badebd32bd8b 110 #define MPU_TEMP_OUTH_REG 0X41 //温度值高八位寄存器
heroistired 0:badebd32bd8b 111 #define MPU_TEMP_OUTL_REG 0X42 //温度值低8位寄存器
heroistired 0:badebd32bd8b 112
heroistired 0:badebd32bd8b 113 #define MPU_GYRO_XOUTH_REG 0X43 //陀螺仪值,X轴高8位寄存器
heroistired 0:badebd32bd8b 114 #define MPU_GYRO_XOUTL_REG 0X44 //陀螺仪值,X轴低8位寄存器
heroistired 0:badebd32bd8b 115 #define MPU_GYRO_YOUTH_REG 0X45 //陀螺仪值,Y轴高8位寄存器
heroistired 0:badebd32bd8b 116 #define MPU_GYRO_YOUTL_REG 0X46 //陀螺仪值,Y轴低8位寄存器
heroistired 0:badebd32bd8b 117 #define MPU_GYRO_ZOUTH_REG 0X47 //陀螺仪值,Z轴高8位寄存器
heroistired 0:badebd32bd8b 118 #define MPU_GYRO_ZOUTL_REG 0X48 //陀螺仪值,Z轴低8位寄存器
heroistired 0:badebd32bd8b 119
heroistired 0:badebd32bd8b 120 #define MPU_I2CSLV0_DO_REG 0X63 //IIC从机0数据寄存器
heroistired 0:badebd32bd8b 121 #define MPU_I2CSLV1_DO_REG 0X64 //IIC从机1数据寄存器
heroistired 0:badebd32bd8b 122 #define MPU_I2CSLV2_DO_REG 0X65 //IIC从机2数据寄存器
heroistired 0:badebd32bd8b 123 #define MPU_I2CSLV3_DO_REG 0X66 //IIC从机3数据寄存器
heroistired 0:badebd32bd8b 124
heroistired 0:badebd32bd8b 125 #define MPU_I2CMST_DELAY_REG 0X67 //IIC主机延时管理寄存器
heroistired 0:badebd32bd8b 126 #define MPU_SIGPATH_RST_REG 0X68 //信号通道复位寄存器
heroistired 0:badebd32bd8b 127 #define MPU_MDETECT_CTRL_REG 0X69 //运动检测控制寄存器
heroistired 0:badebd32bd8b 128 #define MPU_USER_CTRL_REG 0X6A //用户控制寄存器
heroistired 0:badebd32bd8b 129 #define MPU_PWR_MGMT1_REG 0X6B //电源管理寄存器1
heroistired 0:badebd32bd8b 130 #define MPU_PWR_MGMT2_REG 0X6C //电源管理寄存器2
heroistired 0:badebd32bd8b 131 #define MPU_FIFO_CNTH_REG 0X72 //FIFO计数寄存器高八位
heroistired 0:badebd32bd8b 132 #define MPU_FIFO_CNTL_REG 0X73 //FIFO计数寄存器低八位
heroistired 0:badebd32bd8b 133 #define MPU_FIFO_RW_REG 0X74 //FIFO读写寄存器
heroistired 0:badebd32bd8b 134 #define MPU_DEVICE_ID_REG 0X75 //器件ID寄存器
heroistired 0:badebd32bd8b 135
heroistired 0:badebd32bd8b 136 //如果AD0脚(9脚)接地,IIC地址为0X68(不包含最低位).
heroistired 0:badebd32bd8b 137 //如果接V3.3,则IIC地址为0X69(不包含最低位).
heroistired 0:badebd32bd8b 138 #define MPU_ADDR 0X68
heroistired 0:badebd32bd8b 139
heroistired 0:badebd32bd8b 140
heroistired 0:badebd32bd8b 141 ////因为模块AD0默认接GND,所以转为读写地址后,为0XD1和0XD0(如果接VCC,则为0XD3和0XD2)
heroistired 0:badebd32bd8b 142 //#define MPU_READ 0XD1
heroistired 0:badebd32bd8b 143 //#define MPU_WRITE 0XD0
heroistired 0:badebd32bd8b 144
heroistired 0:badebd32bd8b 145 unsigned char MPU_Init(void); //初始化MPU6050
heroistired 0:badebd32bd8b 146 unsigned char MPU_Write_Len(unsigned char addr,unsigned char reg,unsigned char len,unsigned char *buf);//IIC连续写
heroistired 0:badebd32bd8b 147 unsigned char MPU_Read_Len(unsigned char addr,unsigned char reg,unsigned char len,unsigned char *buf); //IIC连续读
heroistired 0:badebd32bd8b 148 unsigned char MPU_Write_Byte(unsigned char reg,unsigned char data); //IIC写一个字节
heroistired 0:badebd32bd8b 149 unsigned char MPU_Read_Byte(unsigned char reg); //IIC读一个字节
heroistired 0:badebd32bd8b 150
heroistired 0:badebd32bd8b 151 unsigned char MPU_Set_Gyro_Fsr(unsigned char fsr);
heroistired 0:badebd32bd8b 152 unsigned char MPU_Set_Accel_Fsr(unsigned char fsr);
heroistired 0:badebd32bd8b 153 unsigned char MPU_Set_LPF(unsigned short lpf);
heroistired 0:badebd32bd8b 154 unsigned char MPU_Set_Rate(unsigned short rate);
heroistired 0:badebd32bd8b 155 unsigned char MPU_Set_Fifo(unsigned char sens);
heroistired 0:badebd32bd8b 156
heroistired 0:badebd32bd8b 157
heroistired 0:badebd32bd8b 158 short MPU_Get_Temperature(void);
heroistired 0:badebd32bd8b 159 unsigned char MPU_Get_Gyroscope(short *gx,short *gy,short *gz);
heroistired 0:badebd32bd8b 160 unsigned char MPU_Get_Accelerometer(short *ax,short *ay,short *az);
heroistired 0:badebd32bd8b 161
heroistired 0:badebd32bd8b 162 #if defined DRIVER_MODE_BALANCE
heroistired 0:badebd32bd8b 163 //IO方向设置
heroistired 0:badebd32bd8b 164 #define MPU_SDA_IN() {GPIOB->CRL&=0X0FFFFFFF;GPIOB->CRL|=8<<28;}
heroistired 0:badebd32bd8b 165 #define MPU_SDA_OUT() {GPIOB->CRL&=0X0FFFFFFF;GPIOB->CRL|=3<<28;}
heroistired 0:badebd32bd8b 166
heroistired 0:badebd32bd8b 167 //IO操作函数
heroistired 0:badebd32bd8b 168 #define MPU_IIC_SCL PBout(6) //SCL
heroistired 0:badebd32bd8b 169 #define MPU_IIC_SDA PBout(7) //SDA
heroistired 0:badebd32bd8b 170 #define MPU_READ_SDA PBin(7) //输入SDA
heroistired 0:badebd32bd8b 171 #elif defined DRIVER_MODE_ROTOR
heroistired 0:badebd32bd8b 172
heroistired 0:badebd32bd8b 173 #define MPU_SDA_IN() {GPIOB->CRH&=0XFFFF0FFF;GPIOB->CRH|=8<<12;}
heroistired 0:badebd32bd8b 174 #define MPU_SDA_OUT() {GPIOB->CRH&=0XFFFF0FFF;GPIOB->CRH|=3<<12;}
heroistired 0:badebd32bd8b 175
heroistired 0:badebd32bd8b 176 #define MPU_IIC_SCL PBout(10) //SCL
heroistired 0:badebd32bd8b 177 #define MPU_IIC_SDA PBout(11) //SDA
heroistired 0:badebd32bd8b 178 #define MPU_READ_SDA PBin(11) //输入SDA
heroistired 0:badebd32bd8b 179 #else
heroistired 0:badebd32bd8b 180 #error Target Board is not specified.
heroistired 0:badebd32bd8b 181 #endif
heroistired 0:badebd32bd8b 182
heroistired 0:badebd32bd8b 183
heroistired 0:badebd32bd8b 184 //IIC所有操作函数
heroistired 0:badebd32bd8b 185 void MPU_IIC_Delay(void); //MPU IIC延时函数
heroistired 0:badebd32bd8b 186 void MPU_IIC_Init(void); //初始化IIC的IO口
heroistired 0:badebd32bd8b 187 void MPU_IIC_Start(void); //发送IIC开始信号
heroistired 0:badebd32bd8b 188 void MPU_IIC_Stop(void); //发送IIC停止信号
heroistired 0:badebd32bd8b 189 void MPU_IIC_Send_Byte(unsigned char txd); //IIC发送一个字节
heroistired 0:badebd32bd8b 190 unsigned char MPU_IIC_Read_Byte(unsigned char ack);//IIC读取一个字节
heroistired 0:badebd32bd8b 191 unsigned char MPU_IIC_Wait_Ack(void); //IIC等待ACK信号
heroistired 0:badebd32bd8b 192 void MPU_IIC_Ack(void); //IIC发送ACK信号
heroistired 0:badebd32bd8b 193 void MPU_IIC_NAck(void); //IIC不发送ACK信号
heroistired 0:badebd32bd8b 194
heroistired 0:badebd32bd8b 195 void IMPU_IC_Write_One_Byte(unsigned char daddr,unsigned char addr,unsigned char data);
heroistired 0:badebd32bd8b 196 unsigned char MPU_IIC_Read_One_Byte(unsigned char daddr,unsigned char addr);
heroistired 0:badebd32bd8b 197
heroistired 0:badebd32bd8b 198 #define KEY_CFG_25 (0)
heroistired 0:badebd32bd8b 199 #define KEY_CFG_24 (KEY_CFG_25 + 1)
heroistired 0:badebd32bd8b 200 #define KEY_CFG_26 (KEY_CFG_24 + 1)
heroistired 0:badebd32bd8b 201 #define KEY_CFG_27 (KEY_CFG_26 + 1)
heroistired 0:badebd32bd8b 202 #define KEY_CFG_21 (KEY_CFG_27 + 1)
heroistired 0:badebd32bd8b 203 #define KEY_CFG_20 (KEY_CFG_21 + 1)
heroistired 0:badebd32bd8b 204 #define KEY_CFG_TAP4 (KEY_CFG_20 + 1)
heroistired 0:badebd32bd8b 205 #define KEY_CFG_TAP5 (KEY_CFG_TAP4 + 1)
heroistired 0:badebd32bd8b 206 #define KEY_CFG_TAP6 (KEY_CFG_TAP5 + 1)
heroistired 0:badebd32bd8b 207 #define KEY_CFG_TAP7 (KEY_CFG_TAP6 + 1)
heroistired 0:badebd32bd8b 208 #define KEY_CFG_TAP0 (KEY_CFG_TAP7 + 1)
heroistired 0:badebd32bd8b 209 #define KEY_CFG_TAP1 (KEY_CFG_TAP0 + 1)
heroistired 0:badebd32bd8b 210 #define KEY_CFG_TAP2 (KEY_CFG_TAP1 + 1)
heroistired 0:badebd32bd8b 211 #define KEY_CFG_TAP3 (KEY_CFG_TAP2 + 1)
heroistired 0:badebd32bd8b 212 #define KEY_CFG_TAP_QUANTIZE (KEY_CFG_TAP3 + 1)
heroistired 0:badebd32bd8b 213 #define KEY_CFG_TAP_JERK (KEY_CFG_TAP_QUANTIZE + 1)
heroistired 0:badebd32bd8b 214 #define KEY_CFG_DR_INT (KEY_CFG_TAP_JERK + 1)
heroistired 0:badebd32bd8b 215 #define KEY_CFG_AUTH (KEY_CFG_DR_INT + 1)
heroistired 0:badebd32bd8b 216 #define KEY_CFG_TAP_SAVE_ACCB (KEY_CFG_AUTH + 1)
heroistired 0:badebd32bd8b 217 #define KEY_CFG_TAP_CLEAR_STICKY (KEY_CFG_TAP_SAVE_ACCB + 1)
heroistired 0:badebd32bd8b 218 #define KEY_CFG_FIFO_ON_EVENT (KEY_CFG_TAP_CLEAR_STICKY + 1)
heroistired 0:badebd32bd8b 219 #define KEY_FCFG_ACCEL_INPUT (KEY_CFG_FIFO_ON_EVENT + 1)
heroistired 0:badebd32bd8b 220 #define KEY_FCFG_ACCEL_INIT (KEY_FCFG_ACCEL_INPUT + 1)
heroistired 0:badebd32bd8b 221 #define KEY_CFG_23 (KEY_FCFG_ACCEL_INIT + 1)
heroistired 0:badebd32bd8b 222 #define KEY_FCFG_1 (KEY_CFG_23 + 1)
heroistired 0:badebd32bd8b 223 #define KEY_FCFG_3 (KEY_FCFG_1 + 1)
heroistired 0:badebd32bd8b 224 #define KEY_FCFG_2 (KEY_FCFG_3 + 1)
heroistired 0:badebd32bd8b 225 #define KEY_CFG_3D (KEY_FCFG_2 + 1)
heroistired 0:badebd32bd8b 226 #define KEY_CFG_3B (KEY_CFG_3D + 1)
heroistired 0:badebd32bd8b 227 #define KEY_CFG_3C (KEY_CFG_3B + 1)
heroistired 0:badebd32bd8b 228 #define KEY_FCFG_5 (KEY_CFG_3C + 1)
heroistired 0:badebd32bd8b 229 #define KEY_FCFG_4 (KEY_FCFG_5 + 1)
heroistired 0:badebd32bd8b 230 #define KEY_FCFG_7 (KEY_FCFG_4 + 1)
heroistired 0:badebd32bd8b 231 #define KEY_FCFG_FSCALE (KEY_FCFG_7 + 1)
heroistired 0:badebd32bd8b 232 #define KEY_FCFG_AZ (KEY_FCFG_FSCALE + 1)
heroistired 0:badebd32bd8b 233 #define KEY_FCFG_6 (KEY_FCFG_AZ + 1)
heroistired 0:badebd32bd8b 234 #define KEY_FCFG_LSB4 (KEY_FCFG_6 + 1)
heroistired 0:badebd32bd8b 235 #define KEY_CFG_12 (KEY_FCFG_LSB4 + 1)
heroistired 0:badebd32bd8b 236 #define KEY_CFG_14 (KEY_CFG_12 + 1)
heroistired 0:badebd32bd8b 237 #define KEY_CFG_15 (KEY_CFG_14 + 1)
heroistired 0:badebd32bd8b 238 #define KEY_CFG_16 (KEY_CFG_15 + 1)
heroistired 0:badebd32bd8b 239 #define KEY_CFG_18 (KEY_CFG_16 + 1)
heroistired 0:badebd32bd8b 240 #define KEY_CFG_6 (KEY_CFG_18 + 1)
heroistired 0:badebd32bd8b 241 #define KEY_CFG_7 (KEY_CFG_6 + 1)
heroistired 0:badebd32bd8b 242 #define KEY_CFG_4 (KEY_CFG_7 + 1)
heroistired 0:badebd32bd8b 243 #define KEY_CFG_5 (KEY_CFG_4 + 1)
heroistired 0:badebd32bd8b 244 #define KEY_CFG_2 (KEY_CFG_5 + 1)
heroistired 0:badebd32bd8b 245 #define KEY_CFG_3 (KEY_CFG_2 + 1)
heroistired 0:badebd32bd8b 246 #define KEY_CFG_1 (KEY_CFG_3 + 1)
heroistired 0:badebd32bd8b 247 #define KEY_CFG_EXTERNAL (KEY_CFG_1 + 1)
heroistired 0:badebd32bd8b 248 #define KEY_CFG_8 (KEY_CFG_EXTERNAL + 1)
heroistired 0:badebd32bd8b 249 #define KEY_CFG_9 (KEY_CFG_8 + 1)
heroistired 0:badebd32bd8b 250 #define KEY_CFG_ORIENT_3 (KEY_CFG_9 + 1)
heroistired 0:badebd32bd8b 251 #define KEY_CFG_ORIENT_2 (KEY_CFG_ORIENT_3 + 1)
heroistired 0:badebd32bd8b 252 #define KEY_CFG_ORIENT_1 (KEY_CFG_ORIENT_2 + 1)
heroistired 0:badebd32bd8b 253 #define KEY_CFG_GYRO_SOURCE (KEY_CFG_ORIENT_1 + 1)
heroistired 0:badebd32bd8b 254 #define KEY_CFG_ORIENT_IRQ_1 (KEY_CFG_GYRO_SOURCE + 1)
heroistired 0:badebd32bd8b 255 #define KEY_CFG_ORIENT_IRQ_2 (KEY_CFG_ORIENT_IRQ_1 + 1)
heroistired 0:badebd32bd8b 256 #define KEY_CFG_ORIENT_IRQ_3 (KEY_CFG_ORIENT_IRQ_2 + 1)
heroistired 0:badebd32bd8b 257 #define KEY_FCFG_MAG_VAL (KEY_CFG_ORIENT_IRQ_3 + 1)
heroistired 0:badebd32bd8b 258 #define KEY_FCFG_MAG_MOV (KEY_FCFG_MAG_VAL + 1)
heroistired 0:badebd32bd8b 259 #define KEY_CFG_LP_QUAT (KEY_FCFG_MAG_MOV + 1)
heroistired 0:badebd32bd8b 260
heroistired 0:badebd32bd8b 261 /* MPU6050 keys */
heroistired 0:badebd32bd8b 262 #define KEY_CFG_ACCEL_FILTER (KEY_CFG_LP_QUAT + 1)
heroistired 0:badebd32bd8b 263 #define KEY_CFG_MOTION_BIAS (KEY_CFG_ACCEL_FILTER + 1)
heroistired 0:badebd32bd8b 264 #define KEY_TEMPLABEL (KEY_CFG_MOTION_BIAS + 1)
heroistired 0:badebd32bd8b 265
heroistired 0:badebd32bd8b 266 #define KEY_D_0_22 (KEY_TEMPLABEL + 1)
heroistired 0:badebd32bd8b 267 #define KEY_D_0_24 (KEY_D_0_22 + 1)
heroistired 0:badebd32bd8b 268 #define KEY_D_0_36 (KEY_D_0_24 + 1)
heroistired 0:badebd32bd8b 269 #define KEY_D_0_52 (KEY_D_0_36 + 1)
heroistired 0:badebd32bd8b 270 #define KEY_D_0_96 (KEY_D_0_52 + 1)
heroistired 0:badebd32bd8b 271 #define KEY_D_0_104 (KEY_D_0_96 + 1)
heroistired 0:badebd32bd8b 272 #define KEY_D_0_108 (KEY_D_0_104 + 1)
heroistired 0:badebd32bd8b 273 #define KEY_D_0_163 (KEY_D_0_108 + 1)
heroistired 0:badebd32bd8b 274 #define KEY_D_0_188 (KEY_D_0_163 + 1)
heroistired 0:badebd32bd8b 275 #define KEY_D_0_192 (KEY_D_0_188 + 1)
heroistired 0:badebd32bd8b 276 #define KEY_D_0_224 (KEY_D_0_192 + 1)
heroistired 0:badebd32bd8b 277 #define KEY_D_0_228 (KEY_D_0_224 + 1)
heroistired 0:badebd32bd8b 278 #define KEY_D_0_232 (KEY_D_0_228 + 1)
heroistired 0:badebd32bd8b 279 #define KEY_D_0_236 (KEY_D_0_232 + 1)
heroistired 0:badebd32bd8b 280
heroistired 0:badebd32bd8b 281 #define KEY_DMP_PREVPTAT (KEY_D_0_236 + 1)
heroistired 0:badebd32bd8b 282 #define KEY_D_1_2 (KEY_DMP_PREVPTAT + 1)
heroistired 0:badebd32bd8b 283 #define KEY_D_1_4 (KEY_D_1_2 + 1)
heroistired 0:badebd32bd8b 284 #define KEY_D_1_8 (KEY_D_1_4 + 1)
heroistired 0:badebd32bd8b 285 #define KEY_D_1_10 (KEY_D_1_8 + 1)
heroistired 0:badebd32bd8b 286 #define KEY_D_1_24 (KEY_D_1_10 + 1)
heroistired 0:badebd32bd8b 287 #define KEY_D_1_28 (KEY_D_1_24 + 1)
heroistired 0:badebd32bd8b 288 #define KEY_D_1_36 (KEY_D_1_28 + 1)
heroistired 0:badebd32bd8b 289 #define KEY_D_1_40 (KEY_D_1_36 + 1)
heroistired 0:badebd32bd8b 290 #define KEY_D_1_44 (KEY_D_1_40 + 1)
heroistired 0:badebd32bd8b 291 #define KEY_D_1_72 (KEY_D_1_44 + 1)
heroistired 0:badebd32bd8b 292 #define KEY_D_1_74 (KEY_D_1_72 + 1)
heroistired 0:badebd32bd8b 293 #define KEY_D_1_79 (KEY_D_1_74 + 1)
heroistired 0:badebd32bd8b 294 #define KEY_D_1_88 (KEY_D_1_79 + 1)
heroistired 0:badebd32bd8b 295 #define KEY_D_1_90 (KEY_D_1_88 + 1)
heroistired 0:badebd32bd8b 296 #define KEY_D_1_92 (KEY_D_1_90 + 1)
heroistired 0:badebd32bd8b 297 #define KEY_D_1_96 (KEY_D_1_92 + 1)
heroistired 0:badebd32bd8b 298 #define KEY_D_1_98 (KEY_D_1_96 + 1)
heroistired 0:badebd32bd8b 299 #define KEY_D_1_100 (KEY_D_1_98 + 1)
heroistired 0:badebd32bd8b 300 #define KEY_D_1_106 (KEY_D_1_100 + 1)
heroistired 0:badebd32bd8b 301 #define KEY_D_1_108 (KEY_D_1_106 + 1)
heroistired 0:badebd32bd8b 302 #define KEY_D_1_112 (KEY_D_1_108 + 1)
heroistired 0:badebd32bd8b 303 #define KEY_D_1_128 (KEY_D_1_112 + 1)
heroistired 0:badebd32bd8b 304 #define KEY_D_1_152 (KEY_D_1_128 + 1)
heroistired 0:badebd32bd8b 305 #define KEY_D_1_160 (KEY_D_1_152 + 1)
heroistired 0:badebd32bd8b 306 #define KEY_D_1_168 (KEY_D_1_160 + 1)
heroistired 0:badebd32bd8b 307 #define KEY_D_1_175 (KEY_D_1_168 + 1)
heroistired 0:badebd32bd8b 308 #define KEY_D_1_176 (KEY_D_1_175 + 1)
heroistired 0:badebd32bd8b 309 #define KEY_D_1_178 (KEY_D_1_176 + 1)
heroistired 0:badebd32bd8b 310 #define KEY_D_1_179 (KEY_D_1_178 + 1)
heroistired 0:badebd32bd8b 311 #define KEY_D_1_218 (KEY_D_1_179 + 1)
heroistired 0:badebd32bd8b 312 #define KEY_D_1_232 (KEY_D_1_218 + 1)
heroistired 0:badebd32bd8b 313 #define KEY_D_1_236 (KEY_D_1_232 + 1)
heroistired 0:badebd32bd8b 314 #define KEY_D_1_240 (KEY_D_1_236 + 1)
heroistired 0:badebd32bd8b 315 #define KEY_D_1_244 (KEY_D_1_240 + 1)
heroistired 0:badebd32bd8b 316 #define KEY_D_1_250 (KEY_D_1_244 + 1)
heroistired 0:badebd32bd8b 317 #define KEY_D_1_252 (KEY_D_1_250 + 1)
heroistired 0:badebd32bd8b 318 #define KEY_D_2_12 (KEY_D_1_252 + 1)
heroistired 0:badebd32bd8b 319 #define KEY_D_2_96 (KEY_D_2_12 + 1)
heroistired 0:badebd32bd8b 320 #define KEY_D_2_108 (KEY_D_2_96 + 1)
heroistired 0:badebd32bd8b 321 #define KEY_D_2_208 (KEY_D_2_108 + 1)
heroistired 0:badebd32bd8b 322 #define KEY_FLICK_MSG (KEY_D_2_208 + 1)
heroistired 0:badebd32bd8b 323 #define KEY_FLICK_COUNTER (KEY_FLICK_MSG + 1)
heroistired 0:badebd32bd8b 324 #define KEY_FLICK_LOWER (KEY_FLICK_COUNTER + 1)
heroistired 0:badebd32bd8b 325 #define KEY_CFG_FLICK_IN (KEY_FLICK_LOWER + 1)
heroistired 0:badebd32bd8b 326 #define KEY_FLICK_UPPER (KEY_CFG_FLICK_IN + 1)
heroistired 0:badebd32bd8b 327 #define KEY_CGNOTICE_INTR (KEY_FLICK_UPPER + 1)
heroistired 0:badebd32bd8b 328 #define KEY_D_2_224 (KEY_CGNOTICE_INTR + 1)
heroistired 0:badebd32bd8b 329 #define KEY_D_2_244 (KEY_D_2_224 + 1)
heroistired 0:badebd32bd8b 330 #define KEY_D_2_248 (KEY_D_2_244 + 1)
heroistired 0:badebd32bd8b 331 #define KEY_D_2_252 (KEY_D_2_248 + 1)
heroistired 0:badebd32bd8b 332
heroistired 0:badebd32bd8b 333 #define KEY_D_GYRO_BIAS_X (KEY_D_2_252 + 1)
heroistired 0:badebd32bd8b 334 #define KEY_D_GYRO_BIAS_Y (KEY_D_GYRO_BIAS_X + 1)
heroistired 0:badebd32bd8b 335 #define KEY_D_GYRO_BIAS_Z (KEY_D_GYRO_BIAS_Y + 1)
heroistired 0:badebd32bd8b 336 #define KEY_D_ACC_BIAS_X (KEY_D_GYRO_BIAS_Z + 1)
heroistired 0:badebd32bd8b 337 #define KEY_D_ACC_BIAS_Y (KEY_D_ACC_BIAS_X + 1)
heroistired 0:badebd32bd8b 338 #define KEY_D_ACC_BIAS_Z (KEY_D_ACC_BIAS_Y + 1)
heroistired 0:badebd32bd8b 339 #define KEY_D_GYRO_ENABLE (KEY_D_ACC_BIAS_Z + 1)
heroistired 0:badebd32bd8b 340 #define KEY_D_ACCEL_ENABLE (KEY_D_GYRO_ENABLE + 1)
heroistired 0:badebd32bd8b 341 #define KEY_D_QUAT_ENABLE (KEY_D_ACCEL_ENABLE +1)
heroistired 0:badebd32bd8b 342 #define KEY_D_OUTPUT_ENABLE (KEY_D_QUAT_ENABLE + 1)
heroistired 0:badebd32bd8b 343 #define KEY_D_CR_TIME_G (KEY_D_OUTPUT_ENABLE + 1)
heroistired 0:badebd32bd8b 344 #define KEY_D_CR_TIME_A (KEY_D_CR_TIME_G + 1)
heroistired 0:badebd32bd8b 345 #define KEY_D_CR_TIME_Q (KEY_D_CR_TIME_A + 1)
heroistired 0:badebd32bd8b 346 #define KEY_D_CS_TAX (KEY_D_CR_TIME_Q + 1)
heroistired 0:badebd32bd8b 347 #define KEY_D_CS_TAY (KEY_D_CS_TAX + 1)
heroistired 0:badebd32bd8b 348 #define KEY_D_CS_TAZ (KEY_D_CS_TAY + 1)
heroistired 0:badebd32bd8b 349 #define KEY_D_CS_TGX (KEY_D_CS_TAZ + 1)
heroistired 0:badebd32bd8b 350 #define KEY_D_CS_TGY (KEY_D_CS_TGX + 1)
heroistired 0:badebd32bd8b 351 #define KEY_D_CS_TGZ (KEY_D_CS_TGY + 1)
heroistired 0:badebd32bd8b 352 #define KEY_D_CS_TQ0 (KEY_D_CS_TGZ + 1)
heroistired 0:badebd32bd8b 353 #define KEY_D_CS_TQ1 (KEY_D_CS_TQ0 + 1)
heroistired 0:badebd32bd8b 354 #define KEY_D_CS_TQ2 (KEY_D_CS_TQ1 + 1)
heroistired 0:badebd32bd8b 355 #define KEY_D_CS_TQ3 (KEY_D_CS_TQ2 + 1)
heroistired 0:badebd32bd8b 356
heroistired 0:badebd32bd8b 357 /* Compass keys */
heroistired 0:badebd32bd8b 358 #define KEY_CPASS_BIAS_X (KEY_D_CS_TQ3 + 1)
heroistired 0:badebd32bd8b 359 #define KEY_CPASS_BIAS_Y (KEY_CPASS_BIAS_X + 1)
heroistired 0:badebd32bd8b 360 #define KEY_CPASS_BIAS_Z (KEY_CPASS_BIAS_Y + 1)
heroistired 0:badebd32bd8b 361 #define KEY_CPASS_MTX_00 (KEY_CPASS_BIAS_Z + 1)
heroistired 0:badebd32bd8b 362 #define KEY_CPASS_MTX_01 (KEY_CPASS_MTX_00 + 1)
heroistired 0:badebd32bd8b 363 #define KEY_CPASS_MTX_02 (KEY_CPASS_MTX_01 + 1)
heroistired 0:badebd32bd8b 364 #define KEY_CPASS_MTX_10 (KEY_CPASS_MTX_02 + 1)
heroistired 0:badebd32bd8b 365 #define KEY_CPASS_MTX_11 (KEY_CPASS_MTX_10 + 1)
heroistired 0:badebd32bd8b 366 #define KEY_CPASS_MTX_12 (KEY_CPASS_MTX_11 + 1)
heroistired 0:badebd32bd8b 367 #define KEY_CPASS_MTX_20 (KEY_CPASS_MTX_12 + 1)
heroistired 0:badebd32bd8b 368 #define KEY_CPASS_MTX_21 (KEY_CPASS_MTX_20 + 1)
heroistired 0:badebd32bd8b 369 #define KEY_CPASS_MTX_22 (KEY_CPASS_MTX_21 + 1)
heroistired 0:badebd32bd8b 370
heroistired 0:badebd32bd8b 371 /* Gesture Keys */
heroistired 0:badebd32bd8b 372 #define KEY_DMP_TAPW_MIN (KEY_CPASS_MTX_22 + 1)
heroistired 0:badebd32bd8b 373 #define KEY_DMP_TAP_THR_X (KEY_DMP_TAPW_MIN + 1)
heroistired 0:badebd32bd8b 374 #define KEY_DMP_TAP_THR_Y (KEY_DMP_TAP_THR_X + 1)
heroistired 0:badebd32bd8b 375 #define KEY_DMP_TAP_THR_Z (KEY_DMP_TAP_THR_Y + 1)
heroistired 0:badebd32bd8b 376 #define KEY_DMP_SH_TH_Y (KEY_DMP_TAP_THR_Z + 1)
heroistired 0:badebd32bd8b 377 #define KEY_DMP_SH_TH_X (KEY_DMP_SH_TH_Y + 1)
heroistired 0:badebd32bd8b 378 #define KEY_DMP_SH_TH_Z (KEY_DMP_SH_TH_X + 1)
heroistired 0:badebd32bd8b 379 #define KEY_DMP_ORIENT (KEY_DMP_SH_TH_Z + 1)
heroistired 0:badebd32bd8b 380 #define KEY_D_ACT0 (KEY_DMP_ORIENT + 1)
heroistired 0:badebd32bd8b 381 #define KEY_D_ACSX (KEY_D_ACT0 + 1)
heroistired 0:badebd32bd8b 382 #define KEY_D_ACSY (KEY_D_ACSX + 1)
heroistired 0:badebd32bd8b 383 #define KEY_D_ACSZ (KEY_D_ACSY + 1)
heroistired 0:badebd32bd8b 384
heroistired 0:badebd32bd8b 385 #define KEY_X_GRT_Y_TMP (KEY_D_ACSZ + 1)
heroistired 0:badebd32bd8b 386 #define KEY_SKIP_X_GRT_Y_TMP (KEY_X_GRT_Y_TMP + 1)
heroistired 0:badebd32bd8b 387 #define KEY_SKIP_END_COMPARE (KEY_SKIP_X_GRT_Y_TMP + 1)
heroistired 0:badebd32bd8b 388 #define KEY_END_COMPARE_Y_X_TMP2 (KEY_SKIP_END_COMPARE + 1)
heroistired 0:badebd32bd8b 389 #define KEY_CFG_ANDROID_ORIENT_INT (KEY_END_COMPARE_Y_X_TMP2 + 1)
heroistired 0:badebd32bd8b 390 #define KEY_NO_ORIENT_INTERRUPT (KEY_CFG_ANDROID_ORIENT_INT + 1)
heroistired 0:badebd32bd8b 391 #define KEY_END_COMPARE_Y_X_TMP (KEY_NO_ORIENT_INTERRUPT + 1)
heroistired 0:badebd32bd8b 392 #define KEY_END_ORIENT_1 (KEY_END_COMPARE_Y_X_TMP + 1)
heroistired 0:badebd32bd8b 393 #define KEY_END_COMPARE_Y_X (KEY_END_ORIENT_1 + 1)
heroistired 0:badebd32bd8b 394 #define KEY_END_ORIENT (KEY_END_COMPARE_Y_X + 1)
heroistired 0:badebd32bd8b 395 #define KEY_X_GRT_Y (KEY_END_ORIENT + 1)
heroistired 0:badebd32bd8b 396 #define KEY_NOT_TIME_MINUS_1 (KEY_X_GRT_Y + 1)
heroistired 0:badebd32bd8b 397 #define KEY_END_COMPARE_Y_X_TMP3 (KEY_NOT_TIME_MINUS_1 + 1)
heroistired 0:badebd32bd8b 398 #define KEY_X_GRT_Y_TMP2 (KEY_END_COMPARE_Y_X_TMP3 + 1)
heroistired 0:badebd32bd8b 399
heroistired 0:badebd32bd8b 400 /* Authenticate Keys */
heroistired 0:badebd32bd8b 401 #define KEY_D_AUTH_OUT (KEY_X_GRT_Y_TMP2 + 1)
heroistired 0:badebd32bd8b 402 #define KEY_D_AUTH_IN (KEY_D_AUTH_OUT + 1)
heroistired 0:badebd32bd8b 403 #define KEY_D_AUTH_A (KEY_D_AUTH_IN + 1)
heroistired 0:badebd32bd8b 404 #define KEY_D_AUTH_B (KEY_D_AUTH_A + 1)
heroistired 0:badebd32bd8b 405
heroistired 0:badebd32bd8b 406 /* Pedometer standalone only keys */
heroistired 0:badebd32bd8b 407 #define KEY_D_PEDSTD_BP_B (KEY_D_AUTH_B + 1)
heroistired 0:badebd32bd8b 408 #define KEY_D_PEDSTD_HP_A (KEY_D_PEDSTD_BP_B + 1)
heroistired 0:badebd32bd8b 409 #define KEY_D_PEDSTD_HP_B (KEY_D_PEDSTD_HP_A + 1)
heroistired 0:badebd32bd8b 410 #define KEY_D_PEDSTD_BP_A4 (KEY_D_PEDSTD_HP_B + 1)
heroistired 0:badebd32bd8b 411 #define KEY_D_PEDSTD_BP_A3 (KEY_D_PEDSTD_BP_A4 + 1)
heroistired 0:badebd32bd8b 412 #define KEY_D_PEDSTD_BP_A2 (KEY_D_PEDSTD_BP_A3 + 1)
heroistired 0:badebd32bd8b 413 #define KEY_D_PEDSTD_BP_A1 (KEY_D_PEDSTD_BP_A2 + 1)
heroistired 0:badebd32bd8b 414 #define KEY_D_PEDSTD_INT_THRSH (KEY_D_PEDSTD_BP_A1 + 1)
heroistired 0:badebd32bd8b 415 #define KEY_D_PEDSTD_CLIP (KEY_D_PEDSTD_INT_THRSH + 1)
heroistired 0:badebd32bd8b 416 #define KEY_D_PEDSTD_SB (KEY_D_PEDSTD_CLIP + 1)
heroistired 0:badebd32bd8b 417 #define KEY_D_PEDSTD_SB_TIME (KEY_D_PEDSTD_SB + 1)
heroistired 0:badebd32bd8b 418 #define KEY_D_PEDSTD_PEAKTHRSH (KEY_D_PEDSTD_SB_TIME + 1)
heroistired 0:badebd32bd8b 419 #define KEY_D_PEDSTD_TIML (KEY_D_PEDSTD_PEAKTHRSH + 1)
heroistired 0:badebd32bd8b 420 #define KEY_D_PEDSTD_TIMH (KEY_D_PEDSTD_TIML + 1)
heroistired 0:badebd32bd8b 421 #define KEY_D_PEDSTD_PEAK (KEY_D_PEDSTD_TIMH + 1)
heroistired 0:badebd32bd8b 422 #define KEY_D_PEDSTD_TIMECTR (KEY_D_PEDSTD_PEAK + 1)
heroistired 0:badebd32bd8b 423 #define KEY_D_PEDSTD_STEPCTR (KEY_D_PEDSTD_TIMECTR + 1)
heroistired 0:badebd32bd8b 424 #define KEY_D_PEDSTD_WALKTIME (KEY_D_PEDSTD_STEPCTR + 1)
heroistired 0:badebd32bd8b 425 #define KEY_D_PEDSTD_DECI (KEY_D_PEDSTD_WALKTIME + 1)
heroistired 0:badebd32bd8b 426
heroistired 0:badebd32bd8b 427 /*Host Based No Motion*/
heroistired 0:badebd32bd8b 428 #define KEY_D_HOST_NO_MOT (KEY_D_PEDSTD_DECI + 1)
heroistired 0:badebd32bd8b 429
heroistired 0:badebd32bd8b 430 /* EIS keys */
heroistired 0:badebd32bd8b 431 #define KEY_P_EIS_FIFO_FOOTER (KEY_D_HOST_NO_MOT + 1)
heroistired 0:badebd32bd8b 432 #define KEY_P_EIS_FIFO_YSHIFT (KEY_P_EIS_FIFO_FOOTER + 1)
heroistired 0:badebd32bd8b 433 #define KEY_P_EIS_DATA_RATE (KEY_P_EIS_FIFO_YSHIFT + 1)
heroistired 0:badebd32bd8b 434 #define KEY_P_EIS_FIFO_XSHIFT (KEY_P_EIS_DATA_RATE + 1)
heroistired 0:badebd32bd8b 435 #define KEY_P_EIS_FIFO_SYNC (KEY_P_EIS_FIFO_XSHIFT + 1)
heroistired 0:badebd32bd8b 436 #define KEY_P_EIS_FIFO_ZSHIFT (KEY_P_EIS_FIFO_SYNC + 1)
heroistired 0:badebd32bd8b 437 #define KEY_P_EIS_FIFO_READY (KEY_P_EIS_FIFO_ZSHIFT + 1)
heroistired 0:badebd32bd8b 438 #define KEY_DMP_FOOTER (KEY_P_EIS_FIFO_READY + 1)
heroistired 0:badebd32bd8b 439 #define KEY_DMP_INTX_HC (KEY_DMP_FOOTER + 1)
heroistired 0:badebd32bd8b 440 #define KEY_DMP_INTX_PH (KEY_DMP_INTX_HC + 1)
heroistired 0:badebd32bd8b 441 #define KEY_DMP_INTX_SH (KEY_DMP_INTX_PH + 1)
heroistired 0:badebd32bd8b 442 #define KEY_DMP_AINV_SH (KEY_DMP_INTX_SH + 1)
heroistired 0:badebd32bd8b 443 #define KEY_DMP_A_INV_XH (KEY_DMP_AINV_SH + 1)
heroistired 0:badebd32bd8b 444 #define KEY_DMP_AINV_PH (KEY_DMP_A_INV_XH + 1)
heroistired 0:badebd32bd8b 445 #define KEY_DMP_CTHX_H (KEY_DMP_AINV_PH + 1)
heroistired 0:badebd32bd8b 446 #define KEY_DMP_CTHY_H (KEY_DMP_CTHX_H + 1)
heroistired 0:badebd32bd8b 447 #define KEY_DMP_CTHZ_H (KEY_DMP_CTHY_H + 1)
heroistired 0:badebd32bd8b 448 #define KEY_DMP_NCTHX_H (KEY_DMP_CTHZ_H + 1)
heroistired 0:badebd32bd8b 449 #define KEY_DMP_NCTHY_H (KEY_DMP_NCTHX_H + 1)
heroistired 0:badebd32bd8b 450 #define KEY_DMP_NCTHZ_H (KEY_DMP_NCTHY_H + 1)
heroistired 0:badebd32bd8b 451 #define KEY_DMP_CTSQ_XH (KEY_DMP_NCTHZ_H + 1)
heroistired 0:badebd32bd8b 452 #define KEY_DMP_CTSQ_YH (KEY_DMP_CTSQ_XH + 1)
heroistired 0:badebd32bd8b 453 #define KEY_DMP_CTSQ_ZH (KEY_DMP_CTSQ_YH + 1)
heroistired 0:badebd32bd8b 454 #define KEY_DMP_INTX_H (KEY_DMP_CTSQ_ZH + 1)
heroistired 0:badebd32bd8b 455 #define KEY_DMP_INTY_H (KEY_DMP_INTX_H + 1)
heroistired 0:badebd32bd8b 456 #define KEY_DMP_INTZ_H (KEY_DMP_INTY_H + 1)
heroistired 0:badebd32bd8b 457 //#define KEY_DMP_HPX_H (KEY_DMP_INTZ_H + 1)
heroistired 0:badebd32bd8b 458 //#define KEY_DMP_HPY_H (KEY_DMP_HPX_H + 1)
heroistired 0:badebd32bd8b 459 //#define KEY_DMP_HPZ_H (KEY_DMP_HPY_H + 1)
heroistired 0:badebd32bd8b 460
heroistired 0:badebd32bd8b 461 /* Stream keys */
heroistired 0:badebd32bd8b 462 #define KEY_STREAM_P_GYRO_Z (KEY_DMP_INTZ_H + 1)
heroistired 0:badebd32bd8b 463 #define KEY_STREAM_P_GYRO_Y (KEY_STREAM_P_GYRO_Z + 1)
heroistired 0:badebd32bd8b 464 #define KEY_STREAM_P_GYRO_X (KEY_STREAM_P_GYRO_Y + 1)
heroistired 0:badebd32bd8b 465 #define KEY_STREAM_P_TEMP (KEY_STREAM_P_GYRO_X + 1)
heroistired 0:badebd32bd8b 466 #define KEY_STREAM_P_AUX_Y (KEY_STREAM_P_TEMP + 1)
heroistired 0:badebd32bd8b 467 #define KEY_STREAM_P_AUX_X (KEY_STREAM_P_AUX_Y + 1)
heroistired 0:badebd32bd8b 468 #define KEY_STREAM_P_AUX_Z (KEY_STREAM_P_AUX_X + 1)
heroistired 0:badebd32bd8b 469 #define KEY_STREAM_P_ACCEL_Y (KEY_STREAM_P_AUX_Z + 1)
heroistired 0:badebd32bd8b 470 #define KEY_STREAM_P_ACCEL_X (KEY_STREAM_P_ACCEL_Y + 1)
heroistired 0:badebd32bd8b 471 #define KEY_STREAM_P_FOOTER (KEY_STREAM_P_ACCEL_X + 1)
heroistired 0:badebd32bd8b 472 #define KEY_STREAM_P_ACCEL_Z (KEY_STREAM_P_FOOTER + 1)
heroistired 0:badebd32bd8b 473
heroistired 0:badebd32bd8b 474 #define NUM_KEYS (KEY_STREAM_P_ACCEL_Z + 1)
heroistired 0:badebd32bd8b 475
heroistired 0:badebd32bd8b 476 typedef struct {
heroistired 0:badebd32bd8b 477 unsigned short key;
heroistired 0:badebd32bd8b 478 unsigned short addr;
heroistired 0:badebd32bd8b 479 } tKeyLabel;
heroistired 0:badebd32bd8b 480
heroistired 0:badebd32bd8b 481 #define DINA0A 0x0a
heroistired 0:badebd32bd8b 482 #define DINA22 0x22
heroistired 0:badebd32bd8b 483 #define DINA42 0x42
heroistired 0:badebd32bd8b 484 #define DINA5A 0x5a
heroistired 0:badebd32bd8b 485
heroistired 0:badebd32bd8b 486 #define DINA06 0x06
heroistired 0:badebd32bd8b 487 #define DINA0E 0x0e
heroistired 0:badebd32bd8b 488 #define DINA16 0x16
heroistired 0:badebd32bd8b 489 #define DINA1E 0x1e
heroistired 0:badebd32bd8b 490 #define DINA26 0x26
heroistired 0:badebd32bd8b 491 #define DINA2E 0x2e
heroistired 0:badebd32bd8b 492 #define DINA36 0x36
heroistired 0:badebd32bd8b 493 #define DINA3E 0x3e
heroistired 0:badebd32bd8b 494 #define DINA46 0x46
heroistired 0:badebd32bd8b 495 #define DINA4E 0x4e
heroistired 0:badebd32bd8b 496 #define DINA56 0x56
heroistired 0:badebd32bd8b 497 #define DINA5E 0x5e
heroistired 0:badebd32bd8b 498 #define DINA66 0x66
heroistired 0:badebd32bd8b 499 #define DINA6E 0x6e
heroistired 0:badebd32bd8b 500 #define DINA76 0x76
heroistired 0:badebd32bd8b 501 #define DINA7E 0x7e
heroistired 0:badebd32bd8b 502
heroistired 0:badebd32bd8b 503 #define DINA00 0x00
heroistired 0:badebd32bd8b 504 #define DINA08 0x08
heroistired 0:badebd32bd8b 505 #define DINA10 0x10
heroistired 0:badebd32bd8b 506 #define DINA18 0x18
heroistired 0:badebd32bd8b 507 #define DINA20 0x20
heroistired 0:badebd32bd8b 508 #define DINA28 0x28
heroistired 0:badebd32bd8b 509 #define DINA30 0x30
heroistired 0:badebd32bd8b 510 #define DINA38 0x38
heroistired 0:badebd32bd8b 511 #define DINA40 0x40
heroistired 0:badebd32bd8b 512 #define DINA48 0x48
heroistired 0:badebd32bd8b 513 #define DINA50 0x50
heroistired 0:badebd32bd8b 514 #define DINA58 0x58
heroistired 0:badebd32bd8b 515 #define DINA60 0x60
heroistired 0:badebd32bd8b 516 #define DINA68 0x68
heroistired 0:badebd32bd8b 517 #define DINA70 0x70
heroistired 0:badebd32bd8b 518 #define DINA78 0x78
heroistired 0:badebd32bd8b 519
heroistired 0:badebd32bd8b 520 #define DINA04 0x04
heroistired 0:badebd32bd8b 521 #define DINA0C 0x0c
heroistired 0:badebd32bd8b 522 #define DINA14 0x14
heroistired 0:badebd32bd8b 523 #define DINA1C 0x1C
heroistired 0:badebd32bd8b 524 #define DINA24 0x24
heroistired 0:badebd32bd8b 525 #define DINA2C 0x2c
heroistired 0:badebd32bd8b 526 #define DINA34 0x34
heroistired 0:badebd32bd8b 527 #define DINA3C 0x3c
heroistired 0:badebd32bd8b 528 #define DINA44 0x44
heroistired 0:badebd32bd8b 529 #define DINA4C 0x4c
heroistired 0:badebd32bd8b 530 #define DINA54 0x54
heroistired 0:badebd32bd8b 531 #define DINA5C 0x5c
heroistired 0:badebd32bd8b 532 #define DINA64 0x64
heroistired 0:badebd32bd8b 533 #define DINA6C 0x6c
heroistired 0:badebd32bd8b 534 #define DINA74 0x74
heroistired 0:badebd32bd8b 535 #define DINA7C 0x7c
heroistired 0:badebd32bd8b 536
heroistired 0:badebd32bd8b 537 #define DINA01 0x01
heroistired 0:badebd32bd8b 538 #define DINA09 0x09
heroistired 0:badebd32bd8b 539 #define DINA11 0x11
heroistired 0:badebd32bd8b 540 #define DINA19 0x19
heroistired 0:badebd32bd8b 541 #define DINA21 0x21
heroistired 0:badebd32bd8b 542 #define DINA29 0x29
heroistired 0:badebd32bd8b 543 #define DINA31 0x31
heroistired 0:badebd32bd8b 544 #define DINA39 0x39
heroistired 0:badebd32bd8b 545 #define DINA41 0x41
heroistired 0:badebd32bd8b 546 #define DINA49 0x49
heroistired 0:badebd32bd8b 547 #define DINA51 0x51
heroistired 0:badebd32bd8b 548 #define DINA59 0x59
heroistired 0:badebd32bd8b 549 #define DINA61 0x61
heroistired 0:badebd32bd8b 550 #define DINA69 0x69
heroistired 0:badebd32bd8b 551 #define DINA71 0x71
heroistired 0:badebd32bd8b 552 #define DINA79 0x79
heroistired 0:badebd32bd8b 553
heroistired 0:badebd32bd8b 554 #define DINA25 0x25
heroistired 0:badebd32bd8b 555 #define DINA2D 0x2d
heroistired 0:badebd32bd8b 556 #define DINA35 0x35
heroistired 0:badebd32bd8b 557 #define DINA3D 0x3d
heroistired 0:badebd32bd8b 558 #define DINA4D 0x4d
heroistired 0:badebd32bd8b 559 #define DINA55 0x55
heroistired 0:badebd32bd8b 560 #define DINA5D 0x5D
heroistired 0:badebd32bd8b 561 #define DINA6D 0x6d
heroistired 0:badebd32bd8b 562 #define DINA75 0x75
heroistired 0:badebd32bd8b 563 #define DINA7D 0x7d
heroistired 0:badebd32bd8b 564
heroistired 0:badebd32bd8b 565 #define DINADC 0xdc
heroistired 0:badebd32bd8b 566 #define DINAF2 0xf2
heroistired 0:badebd32bd8b 567 #define DINAAB 0xab
heroistired 0:badebd32bd8b 568 #define DINAAA 0xaa
heroistired 0:badebd32bd8b 569 #define DINAF1 0xf1
heroistired 0:badebd32bd8b 570 #define DINADF 0xdf
heroistired 0:badebd32bd8b 571 #define DINADA 0xda
heroistired 0:badebd32bd8b 572 #define DINAB1 0xb1
heroistired 0:badebd32bd8b 573 #define DINAB9 0xb9
heroistired 0:badebd32bd8b 574 #define DINAF3 0xf3
heroistired 0:badebd32bd8b 575 #define DINA8B 0x8b
heroistired 0:badebd32bd8b 576 #define DINAA3 0xa3
heroistired 0:badebd32bd8b 577 #define DINA91 0x91
heroistired 0:badebd32bd8b 578 #define DINAB6 0xb6
heroistired 0:badebd32bd8b 579 #define DINAB4 0xb4
heroistired 0:badebd32bd8b 580
heroistired 0:badebd32bd8b 581
heroistired 0:badebd32bd8b 582 #define DINC00 0x00
heroistired 0:badebd32bd8b 583 #define DINC01 0x01
heroistired 0:badebd32bd8b 584 #define DINC02 0x02
heroistired 0:badebd32bd8b 585 #define DINC03 0x03
heroistired 0:badebd32bd8b 586 #define DINC08 0x08
heroistired 0:badebd32bd8b 587 #define DINC09 0x09
heroistired 0:badebd32bd8b 588 #define DINC0A 0x0a
heroistired 0:badebd32bd8b 589 #define DINC0B 0x0b
heroistired 0:badebd32bd8b 590 #define DINC10 0x10
heroistired 0:badebd32bd8b 591 #define DINC11 0x11
heroistired 0:badebd32bd8b 592 #define DINC12 0x12
heroistired 0:badebd32bd8b 593 #define DINC13 0x13
heroistired 0:badebd32bd8b 594 #define DINC18 0x18
heroistired 0:badebd32bd8b 595 #define DINC19 0x19
heroistired 0:badebd32bd8b 596 #define DINC1A 0x1a
heroistired 0:badebd32bd8b 597 #define DINC1B 0x1b
heroistired 0:badebd32bd8b 598
heroistired 0:badebd32bd8b 599 #define DINC20 0x20
heroistired 0:badebd32bd8b 600 #define DINC21 0x21
heroistired 0:badebd32bd8b 601 #define DINC22 0x22
heroistired 0:badebd32bd8b 602 #define DINC23 0x23
heroistired 0:badebd32bd8b 603 #define DINC28 0x28
heroistired 0:badebd32bd8b 604 #define DINC29 0x29
heroistired 0:badebd32bd8b 605 #define DINC2A 0x2a
heroistired 0:badebd32bd8b 606 #define DINC2B 0x2b
heroistired 0:badebd32bd8b 607 #define DINC30 0x30
heroistired 0:badebd32bd8b 608 #define DINC31 0x31
heroistired 0:badebd32bd8b 609 #define DINC32 0x32
heroistired 0:badebd32bd8b 610 #define DINC33 0x33
heroistired 0:badebd32bd8b 611 #define DINC38 0x38
heroistired 0:badebd32bd8b 612 #define DINC39 0x39
heroistired 0:badebd32bd8b 613 #define DINC3A 0x3a
heroistired 0:badebd32bd8b 614 #define DINC3B 0x3b
heroistired 0:badebd32bd8b 615
heroistired 0:badebd32bd8b 616 #define DINC40 0x40
heroistired 0:badebd32bd8b 617 #define DINC41 0x41
heroistired 0:badebd32bd8b 618 #define DINC42 0x42
heroistired 0:badebd32bd8b 619 #define DINC43 0x43
heroistired 0:badebd32bd8b 620 #define DINC48 0x48
heroistired 0:badebd32bd8b 621 #define DINC49 0x49
heroistired 0:badebd32bd8b 622 #define DINC4A 0x4a
heroistired 0:badebd32bd8b 623 #define DINC4B 0x4b
heroistired 0:badebd32bd8b 624 #define DINC50 0x50
heroistired 0:badebd32bd8b 625 #define DINC51 0x51
heroistired 0:badebd32bd8b 626 #define DINC52 0x52
heroistired 0:badebd32bd8b 627 #define DINC53 0x53
heroistired 0:badebd32bd8b 628 #define DINC58 0x58
heroistired 0:badebd32bd8b 629 #define DINC59 0x59
heroistired 0:badebd32bd8b 630 #define DINC5A 0x5a
heroistired 0:badebd32bd8b 631 #define DINC5B 0x5b
heroistired 0:badebd32bd8b 632
heroistired 0:badebd32bd8b 633 #define DINC60 0x60
heroistired 0:badebd32bd8b 634 #define DINC61 0x61
heroistired 0:badebd32bd8b 635 #define DINC62 0x62
heroistired 0:badebd32bd8b 636 #define DINC63 0x63
heroistired 0:badebd32bd8b 637 #define DINC68 0x68
heroistired 0:badebd32bd8b 638 #define DINC69 0x69
heroistired 0:badebd32bd8b 639 #define DINC6A 0x6a
heroistired 0:badebd32bd8b 640 #define DINC6B 0x6b
heroistired 0:badebd32bd8b 641 #define DINC70 0x70
heroistired 0:badebd32bd8b 642 #define DINC71 0x71
heroistired 0:badebd32bd8b 643 #define DINC72 0x72
heroistired 0:badebd32bd8b 644 #define DINC73 0x73
heroistired 0:badebd32bd8b 645 #define DINC78 0x78
heroistired 0:badebd32bd8b 646 #define DINC79 0x79
heroistired 0:badebd32bd8b 647 #define DINC7A 0x7a
heroistired 0:badebd32bd8b 648 #define DINC7B 0x7b
heroistired 0:badebd32bd8b 649
heroistired 0:badebd32bd8b 650 #define DIND40 0x40
heroistired 0:badebd32bd8b 651
heroistired 0:badebd32bd8b 652
heroistired 0:badebd32bd8b 653 #define DINA80 0x80
heroistired 0:badebd32bd8b 654 #define DINA90 0x90
heroistired 0:badebd32bd8b 655 #define DINAA0 0xa0
heroistired 0:badebd32bd8b 656 #define DINAC9 0xc9
heroistired 0:badebd32bd8b 657 #define DINACB 0xcb
heroistired 0:badebd32bd8b 658 #define DINACD 0xcd
heroistired 0:badebd32bd8b 659 #define DINACF 0xcf
heroistired 0:badebd32bd8b 660 #define DINAC8 0xc8
heroistired 0:badebd32bd8b 661 #define DINACA 0xca
heroistired 0:badebd32bd8b 662 #define DINACC 0xcc
heroistired 0:badebd32bd8b 663 #define DINACE 0xce
heroistired 0:badebd32bd8b 664 #define DINAD8 0xd8
heroistired 0:badebd32bd8b 665 #define DINADD 0xdd
heroistired 0:badebd32bd8b 666 #define DINAF8 0xf0
heroistired 0:badebd32bd8b 667 #define DINAFE 0xfe
heroistired 0:badebd32bd8b 668
heroistired 0:badebd32bd8b 669 #define DINBF8 0xf8
heroistired 0:badebd32bd8b 670 #define DINAC0 0xb0
heroistired 0:badebd32bd8b 671 #define DINAC1 0xb1
heroistired 0:badebd32bd8b 672 #define DINAC2 0xb4
heroistired 0:badebd32bd8b 673 #define DINAC3 0xb5
heroistired 0:badebd32bd8b 674 #define DINAC4 0xb8
heroistired 0:badebd32bd8b 675 #define DINAC5 0xb9
heroistired 0:badebd32bd8b 676 #define DINBC0 0xc0
heroistired 0:badebd32bd8b 677 #define DINBC2 0xc2
heroistired 0:badebd32bd8b 678 #define DINBC4 0xc4
heroistired 0:badebd32bd8b 679 #define DINBC6 0xc6
heroistired 0:badebd32bd8b 680
heroistired 0:badebd32bd8b 681 #ifdef __cplusplus
heroistired 0:badebd32bd8b 682 extern "C"
heroistired 0:badebd32bd8b 683 {
heroistired 0:badebd32bd8b 684 #endif
heroistired 0:badebd32bd8b 685
heroistired 0:badebd32bd8b 686 #define DMP_PTAT 0
heroistired 0:badebd32bd8b 687 #define DMP_XGYR 2
heroistired 0:badebd32bd8b 688 #define DMP_YGYR 4
heroistired 0:badebd32bd8b 689 #define DMP_ZGYR 6
heroistired 0:badebd32bd8b 690 #define DMP_XACC 8
heroistired 0:badebd32bd8b 691 #define DMP_YACC 10
heroistired 0:badebd32bd8b 692 #define DMP_ZACC 12
heroistired 0:badebd32bd8b 693 #define DMP_ADC1 14
heroistired 0:badebd32bd8b 694 #define DMP_ADC2 16
heroistired 0:badebd32bd8b 695 #define DMP_ADC3 18
heroistired 0:badebd32bd8b 696 #define DMP_BIASUNC 20
heroistired 0:badebd32bd8b 697 #define DMP_FIFORT 22
heroistired 0:badebd32bd8b 698 #define DMP_INVGSFH 24
heroistired 0:badebd32bd8b 699 #define DMP_INVGSFL 26
heroistired 0:badebd32bd8b 700 #define DMP_1H 28
heroistired 0:badebd32bd8b 701 #define DMP_1L 30
heroistired 0:badebd32bd8b 702 #define DMP_BLPFSTCH 32
heroistired 0:badebd32bd8b 703 #define DMP_BLPFSTCL 34
heroistired 0:badebd32bd8b 704 #define DMP_BLPFSXH 36
heroistired 0:badebd32bd8b 705 #define DMP_BLPFSXL 38
heroistired 0:badebd32bd8b 706 #define DMP_BLPFSYH 40
heroistired 0:badebd32bd8b 707 #define DMP_BLPFSYL 42
heroistired 0:badebd32bd8b 708 #define DMP_BLPFSZH 44
heroistired 0:badebd32bd8b 709 #define DMP_BLPFSZL 46
heroistired 0:badebd32bd8b 710 #define DMP_BLPFMTC 48
heroistired 0:badebd32bd8b 711 #define DMP_SMC 50
heroistired 0:badebd32bd8b 712 #define DMP_BLPFMXH 52
heroistired 0:badebd32bd8b 713 #define DMP_BLPFMXL 54
heroistired 0:badebd32bd8b 714 #define DMP_BLPFMYH 56
heroistired 0:badebd32bd8b 715 #define DMP_BLPFMYL 58
heroistired 0:badebd32bd8b 716 #define DMP_BLPFMZH 60
heroistired 0:badebd32bd8b 717 #define DMP_BLPFMZL 62
heroistired 0:badebd32bd8b 718 #define DMP_BLPFC 64
heroistired 0:badebd32bd8b 719 #define DMP_SMCTH 66
heroistired 0:badebd32bd8b 720 #define DMP_0H2 68
heroistired 0:badebd32bd8b 721 #define DMP_0L2 70
heroistired 0:badebd32bd8b 722 #define DMP_BERR2H 72
heroistired 0:badebd32bd8b 723 #define DMP_BERR2L 74
heroistired 0:badebd32bd8b 724 #define DMP_BERR2NH 76
heroistired 0:badebd32bd8b 725 #define DMP_SMCINC 78
heroistired 0:badebd32bd8b 726 #define DMP_ANGVBXH 80
heroistired 0:badebd32bd8b 727 #define DMP_ANGVBXL 82
heroistired 0:badebd32bd8b 728 #define DMP_ANGVBYH 84
heroistired 0:badebd32bd8b 729 #define DMP_ANGVBYL 86
heroistired 0:badebd32bd8b 730 #define DMP_ANGVBZH 88
heroistired 0:badebd32bd8b 731 #define DMP_ANGVBZL 90
heroistired 0:badebd32bd8b 732 #define DMP_BERR1H 92
heroistired 0:badebd32bd8b 733 #define DMP_BERR1L 94
heroistired 0:badebd32bd8b 734 #define DMP_ATCH 96
heroistired 0:badebd32bd8b 735 #define DMP_BIASUNCSF 98
heroistired 0:badebd32bd8b 736 #define DMP_ACT2H 100
heroistired 0:badebd32bd8b 737 #define DMP_ACT2L 102
heroistired 0:badebd32bd8b 738 #define DMP_GSFH 104
heroistired 0:badebd32bd8b 739 #define DMP_GSFL 106
heroistired 0:badebd32bd8b 740 #define DMP_GH 108
heroistired 0:badebd32bd8b 741 #define DMP_GL 110
heroistired 0:badebd32bd8b 742 #define DMP_0_5H 112
heroistired 0:badebd32bd8b 743 #define DMP_0_5L 114
heroistired 0:badebd32bd8b 744 #define DMP_0_0H 116
heroistired 0:badebd32bd8b 745 #define DMP_0_0L 118
heroistired 0:badebd32bd8b 746 #define DMP_1_0H 120
heroistired 0:badebd32bd8b 747 #define DMP_1_0L 122
heroistired 0:badebd32bd8b 748 #define DMP_1_5H 124
heroistired 0:badebd32bd8b 749 #define DMP_1_5L 126
heroistired 0:badebd32bd8b 750 #define DMP_TMP1AH 128
heroistired 0:badebd32bd8b 751 #define DMP_TMP1AL 130
heroistired 0:badebd32bd8b 752 #define DMP_TMP2AH 132
heroistired 0:badebd32bd8b 753 #define DMP_TMP2AL 134
heroistired 0:badebd32bd8b 754 #define DMP_TMP3AH 136
heroistired 0:badebd32bd8b 755 #define DMP_TMP3AL 138
heroistired 0:badebd32bd8b 756 #define DMP_TMP4AH 140
heroistired 0:badebd32bd8b 757 #define DMP_TMP4AL 142
heroistired 0:badebd32bd8b 758 #define DMP_XACCW 144
heroistired 0:badebd32bd8b 759 #define DMP_TMP5 146
heroistired 0:badebd32bd8b 760 #define DMP_XACCB 148
heroistired 0:badebd32bd8b 761 #define DMP_TMP8 150
heroistired 0:badebd32bd8b 762 #define DMP_YACCB 152
heroistired 0:badebd32bd8b 763 #define DMP_TMP9 154
heroistired 0:badebd32bd8b 764 #define DMP_ZACCB 156
heroistired 0:badebd32bd8b 765 #define DMP_TMP10 158
heroistired 0:badebd32bd8b 766 #define DMP_DZH 160
heroistired 0:badebd32bd8b 767 #define DMP_DZL 162
heroistired 0:badebd32bd8b 768 #define DMP_XGCH 164
heroistired 0:badebd32bd8b 769 #define DMP_XGCL 166
heroistired 0:badebd32bd8b 770 #define DMP_YGCH 168
heroistired 0:badebd32bd8b 771 #define DMP_YGCL 170
heroistired 0:badebd32bd8b 772 #define DMP_ZGCH 172
heroistired 0:badebd32bd8b 773 #define DMP_ZGCL 174
heroistired 0:badebd32bd8b 774 #define DMP_YACCW 176
heroistired 0:badebd32bd8b 775 #define DMP_TMP7 178
heroistired 0:badebd32bd8b 776 #define DMP_AFB1H 180
heroistired 0:badebd32bd8b 777 #define DMP_AFB1L 182
heroistired 0:badebd32bd8b 778 #define DMP_AFB2H 184
heroistired 0:badebd32bd8b 779 #define DMP_AFB2L 186
heroistired 0:badebd32bd8b 780 #define DMP_MAGFBH 188
heroistired 0:badebd32bd8b 781 #define DMP_MAGFBL 190
heroistired 0:badebd32bd8b 782 #define DMP_QT1H 192
heroistired 0:badebd32bd8b 783 #define DMP_QT1L 194
heroistired 0:badebd32bd8b 784 #define DMP_QT2H 196
heroistired 0:badebd32bd8b 785 #define DMP_QT2L 198
heroistired 0:badebd32bd8b 786 #define DMP_QT3H 200
heroistired 0:badebd32bd8b 787 #define DMP_QT3L 202
heroistired 0:badebd32bd8b 788 #define DMP_QT4H 204
heroistired 0:badebd32bd8b 789 #define DMP_QT4L 206
heroistired 0:badebd32bd8b 790 #define DMP_CTRL1H 208
heroistired 0:badebd32bd8b 791 #define DMP_CTRL1L 210
heroistired 0:badebd32bd8b 792 #define DMP_CTRL2H 212
heroistired 0:badebd32bd8b 793 #define DMP_CTRL2L 214
heroistired 0:badebd32bd8b 794 #define DMP_CTRL3H 216
heroistired 0:badebd32bd8b 795 #define DMP_CTRL3L 218
heroistired 0:badebd32bd8b 796 #define DMP_CTRL4H 220
heroistired 0:badebd32bd8b 797 #define DMP_CTRL4L 222
heroistired 0:badebd32bd8b 798 #define DMP_CTRLS1 224
heroistired 0:badebd32bd8b 799 #define DMP_CTRLSF1 226
heroistired 0:badebd32bd8b 800 #define DMP_CTRLS2 228
heroistired 0:badebd32bd8b 801 #define DMP_CTRLSF2 230
heroistired 0:badebd32bd8b 802 #define DMP_CTRLS3 232
heroistired 0:badebd32bd8b 803 #define DMP_CTRLSFNLL 234
heroistired 0:badebd32bd8b 804 #define DMP_CTRLS4 236
heroistired 0:badebd32bd8b 805 #define DMP_CTRLSFNL2 238
heroistired 0:badebd32bd8b 806 #define DMP_CTRLSFNL 240
heroistired 0:badebd32bd8b 807 #define DMP_TMP30 242
heroistired 0:badebd32bd8b 808 #define DMP_CTRLSFJT 244
heroistired 0:badebd32bd8b 809 #define DMP_TMP31 246
heroistired 0:badebd32bd8b 810 #define DMP_TMP11 248
heroistired 0:badebd32bd8b 811 #define DMP_CTRLSF2_2 250
heroistired 0:badebd32bd8b 812 #define DMP_TMP12 252
heroistired 0:badebd32bd8b 813 #define DMP_CTRLSF1_2 254
heroistired 0:badebd32bd8b 814 #define DMP_PREVPTAT 256
heroistired 0:badebd32bd8b 815 #define DMP_ACCZB 258
heroistired 0:badebd32bd8b 816 #define DMP_ACCXB 264
heroistired 0:badebd32bd8b 817 #define DMP_ACCYB 266
heroistired 0:badebd32bd8b 818 #define DMP_1HB 272
heroistired 0:badebd32bd8b 819 #define DMP_1LB 274
heroistired 0:badebd32bd8b 820 #define DMP_0H 276
heroistired 0:badebd32bd8b 821 #define DMP_0L 278
heroistired 0:badebd32bd8b 822 #define DMP_ASR22H 280
heroistired 0:badebd32bd8b 823 #define DMP_ASR22L 282
heroistired 0:badebd32bd8b 824 #define DMP_ASR6H 284
heroistired 0:badebd32bd8b 825 #define DMP_ASR6L 286
heroistired 0:badebd32bd8b 826 #define DMP_TMP13 288
heroistired 0:badebd32bd8b 827 #define DMP_TMP14 290
heroistired 0:badebd32bd8b 828 #define DMP_FINTXH 292
heroistired 0:badebd32bd8b 829 #define DMP_FINTXL 294
heroistired 0:badebd32bd8b 830 #define DMP_FINTYH 296
heroistired 0:badebd32bd8b 831 #define DMP_FINTYL 298
heroistired 0:badebd32bd8b 832 #define DMP_FINTZH 300
heroistired 0:badebd32bd8b 833 #define DMP_FINTZL 302
heroistired 0:badebd32bd8b 834 #define DMP_TMP1BH 304
heroistired 0:badebd32bd8b 835 #define DMP_TMP1BL 306
heroistired 0:badebd32bd8b 836 #define DMP_TMP2BH 308
heroistired 0:badebd32bd8b 837 #define DMP_TMP2BL 310
heroistired 0:badebd32bd8b 838 #define DMP_TMP3BH 312
heroistired 0:badebd32bd8b 839 #define DMP_TMP3BL 314
heroistired 0:badebd32bd8b 840 #define DMP_TMP4BH 316
heroistired 0:badebd32bd8b 841 #define DMP_TMP4BL 318
heroistired 0:badebd32bd8b 842 #define DMP_STXG 320
heroistired 0:badebd32bd8b 843 #define DMP_ZCTXG 322
heroistired 0:badebd32bd8b 844 #define DMP_STYG 324
heroistired 0:badebd32bd8b 845 #define DMP_ZCTYG 326
heroistired 0:badebd32bd8b 846 #define DMP_STZG 328
heroistired 0:badebd32bd8b 847 #define DMP_ZCTZG 330
heroistired 0:badebd32bd8b 848 #define DMP_CTRLSFJT2 332
heroistired 0:badebd32bd8b 849 #define DMP_CTRLSFJTCNT 334
heroistired 0:badebd32bd8b 850 #define DMP_PVXG 336
heroistired 0:badebd32bd8b 851 #define DMP_TMP15 338
heroistired 0:badebd32bd8b 852 #define DMP_PVYG 340
heroistired 0:badebd32bd8b 853 #define DMP_TMP16 342
heroistired 0:badebd32bd8b 854 #define DMP_PVZG 344
heroistired 0:badebd32bd8b 855 #define DMP_TMP17 346
heroistired 0:badebd32bd8b 856 #define DMP_MNMFLAGH 352
heroistired 0:badebd32bd8b 857 #define DMP_MNMFLAGL 354
heroistired 0:badebd32bd8b 858 #define DMP_MNMTMH 356
heroistired 0:badebd32bd8b 859 #define DMP_MNMTML 358
heroistired 0:badebd32bd8b 860 #define DMP_MNMTMTHRH 360
heroistired 0:badebd32bd8b 861 #define DMP_MNMTMTHRL 362
heroistired 0:badebd32bd8b 862 #define DMP_MNMTHRH 364
heroistired 0:badebd32bd8b 863 #define DMP_MNMTHRL 366
heroistired 0:badebd32bd8b 864 #define DMP_ACCQD4H 368
heroistired 0:badebd32bd8b 865 #define DMP_ACCQD4L 370
heroistired 0:badebd32bd8b 866 #define DMP_ACCQD5H 372
heroistired 0:badebd32bd8b 867 #define DMP_ACCQD5L 374
heroistired 0:badebd32bd8b 868 #define DMP_ACCQD6H 376
heroistired 0:badebd32bd8b 869 #define DMP_ACCQD6L 378
heroistired 0:badebd32bd8b 870 #define DMP_ACCQD7H 380
heroistired 0:badebd32bd8b 871 #define DMP_ACCQD7L 382
heroistired 0:badebd32bd8b 872 #define DMP_ACCQD0H 384
heroistired 0:badebd32bd8b 873 #define DMP_ACCQD0L 386
heroistired 0:badebd32bd8b 874 #define DMP_ACCQD1H 388
heroistired 0:badebd32bd8b 875 #define DMP_ACCQD1L 390
heroistired 0:badebd32bd8b 876 #define DMP_ACCQD2H 392
heroistired 0:badebd32bd8b 877 #define DMP_ACCQD2L 394
heroistired 0:badebd32bd8b 878 #define DMP_ACCQD3H 396
heroistired 0:badebd32bd8b 879 #define DMP_ACCQD3L 398
heroistired 0:badebd32bd8b 880 #define DMP_XN2H 400
heroistired 0:badebd32bd8b 881 #define DMP_XN2L 402
heroistired 0:badebd32bd8b 882 #define DMP_XN1H 404
heroistired 0:badebd32bd8b 883 #define DMP_XN1L 406
heroistired 0:badebd32bd8b 884 #define DMP_YN2H 408
heroistired 0:badebd32bd8b 885 #define DMP_YN2L 410
heroistired 0:badebd32bd8b 886 #define DMP_YN1H 412
heroistired 0:badebd32bd8b 887 #define DMP_YN1L 414
heroistired 0:badebd32bd8b 888 #define DMP_YH 416
heroistired 0:badebd32bd8b 889 #define DMP_YL 418
heroistired 0:badebd32bd8b 890 #define DMP_B0H 420
heroistired 0:badebd32bd8b 891 #define DMP_B0L 422
heroistired 0:badebd32bd8b 892 #define DMP_A1H 424
heroistired 0:badebd32bd8b 893 #define DMP_A1L 426
heroistired 0:badebd32bd8b 894 #define DMP_A2H 428
heroistired 0:badebd32bd8b 895 #define DMP_A2L 430
heroistired 0:badebd32bd8b 896 #define DMP_SEM1 432
heroistired 0:badebd32bd8b 897 #define DMP_FIFOCNT 434
heroistired 0:badebd32bd8b 898 #define DMP_SH_TH_X 436
heroistired 0:badebd32bd8b 899 #define DMP_PACKET 438
heroistired 0:badebd32bd8b 900 #define DMP_SH_TH_Y 440
heroistired 0:badebd32bd8b 901 #define DMP_FOOTER 442
heroistired 0:badebd32bd8b 902 #define DMP_SH_TH_Z 444
heroistired 0:badebd32bd8b 903 #define DMP_TEMP29 448
heroistired 0:badebd32bd8b 904 #define DMP_TEMP30 450
heroistired 0:badebd32bd8b 905 #define DMP_XACCB_PRE 452
heroistired 0:badebd32bd8b 906 #define DMP_XACCB_PREL 454
heroistired 0:badebd32bd8b 907 #define DMP_YACCB_PRE 456
heroistired 0:badebd32bd8b 908 #define DMP_YACCB_PREL 458
heroistired 0:badebd32bd8b 909 #define DMP_ZACCB_PRE 460
heroistired 0:badebd32bd8b 910 #define DMP_ZACCB_PREL 462
heroistired 0:badebd32bd8b 911 #define DMP_TMP22 464
heroistired 0:badebd32bd8b 912 #define DMP_TAP_TIMER 466
heroistired 0:badebd32bd8b 913 #define DMP_TAP_THX 468
heroistired 0:badebd32bd8b 914 #define DMP_TAP_THY 472
heroistired 0:badebd32bd8b 915 #define DMP_TAP_THZ 476
heroistired 0:badebd32bd8b 916 #define DMP_TAPW_MIN 478
heroistired 0:badebd32bd8b 917 #define DMP_TMP25 480
heroistired 0:badebd32bd8b 918 #define DMP_TMP26 482
heroistired 0:badebd32bd8b 919 #define DMP_TMP27 484
heroistired 0:badebd32bd8b 920 #define DMP_TMP28 486
heroistired 0:badebd32bd8b 921 #define DMP_ORIENT 488
heroistired 0:badebd32bd8b 922 #define DMP_THRSH 490
heroistired 0:badebd32bd8b 923 #define DMP_ENDIANH 492
heroistired 0:badebd32bd8b 924 #define DMP_ENDIANL 494
heroistired 0:badebd32bd8b 925 #define DMP_BLPFNMTCH 496
heroistired 0:badebd32bd8b 926 #define DMP_BLPFNMTCL 498
heroistired 0:badebd32bd8b 927 #define DMP_BLPFNMXH 500
heroistired 0:badebd32bd8b 928 #define DMP_BLPFNMXL 502
heroistired 0:badebd32bd8b 929 #define DMP_BLPFNMYH 504
heroistired 0:badebd32bd8b 930 #define DMP_BLPFNMYL 506
heroistired 0:badebd32bd8b 931 #define DMP_BLPFNMZH 508
heroistired 0:badebd32bd8b 932 #define DMP_BLPFNMZL 510
heroistired 0:badebd32bd8b 933 #ifdef __cplusplus
heroistired 0:badebd32bd8b 934 }
heroistired 0:badebd32bd8b 935 #endif
heroistired 0:badebd32bd8b 936
heroistired 0:badebd32bd8b 937 //定义输出速度
heroistired 0:badebd32bd8b 938 #define DEFAULT_MPU_HZ (100) //100Hz
heroistired 0:badebd32bd8b 939
heroistired 0:badebd32bd8b 940 #define INV_X_GYRO (0x40)
heroistired 0:badebd32bd8b 941 #define INV_Y_GYRO (0x20)
heroistired 0:badebd32bd8b 942 #define INV_Z_GYRO (0x10)
heroistired 0:badebd32bd8b 943 #define INV_XYZ_GYRO (INV_X_GYRO | INV_Y_GYRO | INV_Z_GYRO)
heroistired 0:badebd32bd8b 944 #define INV_XYZ_ACCEL (0x08)
heroistired 0:badebd32bd8b 945 #define INV_XYZ_COMPASS (0x01)
heroistired 0:badebd32bd8b 946
heroistired 0:badebd32bd8b 947 //移植官方MSP430 DMP驱动过来
heroistired 0:badebd32bd8b 948 struct int_param_s {
heroistired 0:badebd32bd8b 949 //#if defined EMPL_TARGET_MSP430 || defined MOTION_DRIVER_TARGET_MSP430
heroistired 0:badebd32bd8b 950 void (*cb)(void);
heroistired 0:badebd32bd8b 951 unsigned short pin;
heroistired 0:badebd32bd8b 952 unsigned char lp_exit;
heroistired 0:badebd32bd8b 953 unsigned char active_low;
heroistired 0:badebd32bd8b 954 //#elif defined EMPL_TARGET_UC3L0
heroistired 0:badebd32bd8b 955 // unsigned long pin;
heroistired 0:badebd32bd8b 956 // void (*cb)(volatile void*);
heroistired 0:badebd32bd8b 957 // void *arg;
heroistired 0:badebd32bd8b 958 //#endif
heroistired 0:badebd32bd8b 959 };
heroistired 0:badebd32bd8b 960
heroistired 0:badebd32bd8b 961 #define MPU_INT_STATUS_DATA_READY (0x0001)
heroistired 0:badebd32bd8b 962 #define MPU_INT_STATUS_DMP (0x0002)
heroistired 0:badebd32bd8b 963 #define MPU_INT_STATUS_PLL_READY (0x0004)
heroistired 0:badebd32bd8b 964 #define MPU_INT_STATUS_I2C_MST (0x0008)
heroistired 0:badebd32bd8b 965 #define MPU_INT_STATUS_FIFO_OVERFLOW (0x0010)
heroistired 0:badebd32bd8b 966 #define MPU_INT_STATUS_ZMOT (0x0020)
heroistired 0:badebd32bd8b 967 #define MPU_INT_STATUS_MOT (0x0040)
heroistired 0:badebd32bd8b 968 #define MPU_INT_STATUS_FREE_FALL (0x0080)
heroistired 0:badebd32bd8b 969 #define MPU_INT_STATUS_DMP_0 (0x0100)
heroistired 0:badebd32bd8b 970 #define MPU_INT_STATUS_DMP_1 (0x0200)
heroistired 0:badebd32bd8b 971 #define MPU_INT_STATUS_DMP_2 (0x0400)
heroistired 0:badebd32bd8b 972 #define MPU_INT_STATUS_DMP_3 (0x0800)
heroistired 0:badebd32bd8b 973 #define MPU_INT_STATUS_DMP_4 (0x1000)
heroistired 0:badebd32bd8b 974 #define MPU_INT_STATUS_DMP_5 (0x2000)
heroistired 0:badebd32bd8b 975
heroistired 0:badebd32bd8b 976 /* Set up APIs */
heroistired 0:badebd32bd8b 977 int mpu_init(void);
heroistired 0:badebd32bd8b 978 int mpu_init_slave(void);
heroistired 0:badebd32bd8b 979 int mpu_set_bypass(unsigned char bypass_on);
heroistired 0:badebd32bd8b 980
heroistired 0:badebd32bd8b 981 /* Configuration APIs */
heroistired 0:badebd32bd8b 982 int mpu_lp_accel_mode(unsigned char rate);
heroistired 0:badebd32bd8b 983 int mpu_lp_motion_interrupt(unsigned short thresh, unsigned char time,
heroistired 0:badebd32bd8b 984 unsigned char lpa_freq);
heroistired 0:badebd32bd8b 985 int mpu_set_int_level(unsigned char active_low);
heroistired 0:badebd32bd8b 986 int mpu_set_int_latched(unsigned char enable);
heroistired 0:badebd32bd8b 987
heroistired 0:badebd32bd8b 988 int mpu_set_dmp_state(unsigned char enable);
heroistired 0:badebd32bd8b 989 int mpu_get_dmp_state(unsigned char *enabled);
heroistired 0:badebd32bd8b 990
heroistired 0:badebd32bd8b 991 int mpu_get_lpf(unsigned short *lpf);
heroistired 0:badebd32bd8b 992 int mpu_set_lpf(unsigned short lpf);
heroistired 0:badebd32bd8b 993
heroistired 0:badebd32bd8b 994 int mpu_get_gyro_fsr(unsigned short *fsr);
heroistired 0:badebd32bd8b 995 int mpu_set_gyro_fsr(unsigned short fsr);
heroistired 0:badebd32bd8b 996
heroistired 0:badebd32bd8b 997 int mpu_get_accel_fsr(unsigned char *fsr);
heroistired 0:badebd32bd8b 998 int mpu_set_accel_fsr(unsigned char fsr);
heroistired 0:badebd32bd8b 999
heroistired 0:badebd32bd8b 1000 int mpu_get_compass_fsr(unsigned short *fsr);
heroistired 0:badebd32bd8b 1001
heroistired 0:badebd32bd8b 1002 int mpu_get_gyro_sens(float *sens);
heroistired 0:badebd32bd8b 1003 int mpu_get_accel_sens(unsigned short *sens);
heroistired 0:badebd32bd8b 1004
heroistired 0:badebd32bd8b 1005 int mpu_get_sample_rate(unsigned short *rate);
heroistired 0:badebd32bd8b 1006 int mpu_set_sample_rate(unsigned short rate);
heroistired 0:badebd32bd8b 1007 int mpu_get_compass_sample_rate(unsigned short *rate);
heroistired 0:badebd32bd8b 1008 int mpu_set_compass_sample_rate(unsigned short rate);
heroistired 0:badebd32bd8b 1009
heroistired 0:badebd32bd8b 1010 int mpu_get_fifo_config(unsigned char *sensors);
heroistired 0:badebd32bd8b 1011 int mpu_configure_fifo(unsigned char sensors);
heroistired 0:badebd32bd8b 1012
heroistired 0:badebd32bd8b 1013 int mpu_get_power_state(unsigned char *power_on);
heroistired 0:badebd32bd8b 1014 int mpu_set_sensors(unsigned char sensors);
heroistired 0:badebd32bd8b 1015
heroistired 0:badebd32bd8b 1016 int mpu_set_accel_bias(const long *accel_bias);
heroistired 0:badebd32bd8b 1017
heroistired 0:badebd32bd8b 1018 /* Data getter/setter APIs */
heroistired 0:badebd32bd8b 1019 int mpu_get_gyro_reg(short *data, unsigned long *timestamp);
heroistired 0:badebd32bd8b 1020 int mpu_get_accel_reg(short *data, unsigned long *timestamp);
heroistired 0:badebd32bd8b 1021 int mpu_get_compass_reg(short *data, unsigned long *timestamp);
heroistired 0:badebd32bd8b 1022 int mpu_get_temperature(long *data, unsigned long *timestamp);
heroistired 0:badebd32bd8b 1023
heroistired 0:badebd32bd8b 1024 int mpu_get_int_status(short *status);
heroistired 0:badebd32bd8b 1025 int mpu_read_fifo(short *gyro, short *accel, unsigned long *timestamp,
heroistired 0:badebd32bd8b 1026 unsigned char *sensors, unsigned char *more);
heroistired 0:badebd32bd8b 1027 int mpu_read_fifo_stream(unsigned short length, unsigned char *data,
heroistired 0:badebd32bd8b 1028 unsigned char *more);
heroistired 0:badebd32bd8b 1029 int mpu_reset_fifo(void);
heroistired 0:badebd32bd8b 1030
heroistired 0:badebd32bd8b 1031 int mpu_write_mem(unsigned short mem_addr, unsigned short length,
heroistired 0:badebd32bd8b 1032 unsigned char *data);
heroistired 0:badebd32bd8b 1033 int mpu_read_mem(unsigned short mem_addr, unsigned short length,
heroistired 0:badebd32bd8b 1034 unsigned char *data);
heroistired 0:badebd32bd8b 1035 int mpu_load_firmware(unsigned short length, const unsigned char *firmware,
heroistired 0:badebd32bd8b 1036 unsigned short start_addr, unsigned short sample_rate);
heroistired 0:badebd32bd8b 1037
heroistired 0:badebd32bd8b 1038 int mpu_reg_dump(void);
heroistired 0:badebd32bd8b 1039 int mpu_read_reg(unsigned char reg, unsigned char *data);
heroistired 0:badebd32bd8b 1040 int mpu_run_self_test(long *gyro, long *accel);
heroistired 0:badebd32bd8b 1041 int mpu_register_tap_cb(void (*func)(unsigned char, unsigned char));
heroistired 0:badebd32bd8b 1042 //自行添加的一些函数
heroistired 0:badebd32bd8b 1043 void mget_ms(unsigned long *time);
heroistired 0:badebd32bd8b 1044 unsigned short inv_row_2_scale(const signed char *row);
heroistired 0:badebd32bd8b 1045 unsigned short inv_orientation_matrix_to_scalar(const signed char *mtx);
heroistired 0:badebd32bd8b 1046 unsigned char run_self_test(void);
heroistired 0:badebd32bd8b 1047 unsigned char mpu_dmp_init(void);
heroistired 0:badebd32bd8b 1048 unsigned char mpu_dmp_get_data(float *pitch,float *roll,float *yaw);
heroistired 0:badebd32bd8b 1049
heroistired 0:badebd32bd8b 1050 #define TAP_X (0x01)
heroistired 0:badebd32bd8b 1051 #define TAP_Y (0x02)
heroistired 0:badebd32bd8b 1052 #define TAP_Z (0x04)
heroistired 0:badebd32bd8b 1053 #define TAP_XYZ (0x07)
heroistired 0:badebd32bd8b 1054
heroistired 0:badebd32bd8b 1055 #define TAP_X_UP (0x01)
heroistired 0:badebd32bd8b 1056 #define TAP_X_DOWN (0x02)
heroistired 0:badebd32bd8b 1057 #define TAP_Y_UP (0x03)
heroistired 0:badebd32bd8b 1058 #define TAP_Y_DOWN (0x04)
heroistired 0:badebd32bd8b 1059 #define TAP_Z_UP (0x05)
heroistired 0:badebd32bd8b 1060 #define TAP_Z_DOWN (0x06)
heroistired 0:badebd32bd8b 1061
heroistired 0:badebd32bd8b 1062 #define ANDROID_ORIENT_PORTRAIT (0x00)
heroistired 0:badebd32bd8b 1063 #define ANDROID_ORIENT_LANDSCAPE (0x01)
heroistired 0:badebd32bd8b 1064 #define ANDROID_ORIENT_REVERSE_PORTRAIT (0x02)
heroistired 0:badebd32bd8b 1065 #define ANDROID_ORIENT_REVERSE_LANDSCAPE (0x03)
heroistired 0:badebd32bd8b 1066
heroistired 0:badebd32bd8b 1067 #define DMP_INT_GESTURE (0x01)
heroistired 0:badebd32bd8b 1068 #define DMP_INT_CONTINUOUS (0x02)
heroistired 0:badebd32bd8b 1069
heroistired 0:badebd32bd8b 1070 #define DMP_FEATURE_TAP (0x001)
heroistired 0:badebd32bd8b 1071 #define DMP_FEATURE_ANDROID_ORIENT (0x002)
heroistired 0:badebd32bd8b 1072 #define DMP_FEATURE_LP_QUAT (0x004)
heroistired 0:badebd32bd8b 1073 #define DMP_FEATURE_PEDOMETER (0x008)
heroistired 0:badebd32bd8b 1074 #define DMP_FEATURE_6X_LP_QUAT (0x010)
heroistired 0:badebd32bd8b 1075 #define DMP_FEATURE_GYRO_CAL (0x020)
heroistired 0:badebd32bd8b 1076 #define DMP_FEATURE_SEND_RAW_ACCEL (0x040)
heroistired 0:badebd32bd8b 1077 #define DMP_FEATURE_SEND_RAW_GYRO (0x080)
heroistired 0:badebd32bd8b 1078 #define DMP_FEATURE_SEND_CAL_GYRO (0x100)
heroistired 0:badebd32bd8b 1079
heroistired 0:badebd32bd8b 1080 #define INV_WXYZ_QUAT (0x100)
heroistired 0:badebd32bd8b 1081
heroistired 0:badebd32bd8b 1082 /* Set up functions. */
heroistired 0:badebd32bd8b 1083 int dmp_load_motion_driver_firmware(void);
heroistired 0:badebd32bd8b 1084 int dmp_set_fifo_rate(unsigned short rate);
heroistired 0:badebd32bd8b 1085 int dmp_get_fifo_rate(unsigned short *rate);
heroistired 0:badebd32bd8b 1086 int dmp_enable_feature(unsigned short mask);
heroistired 0:badebd32bd8b 1087 int dmp_get_enabled_features(unsigned short *mask);
heroistired 0:badebd32bd8b 1088 int dmp_set_interrupt_mode(unsigned char mode);
heroistired 0:badebd32bd8b 1089 int dmp_set_orientation(unsigned short orient);
heroistired 0:badebd32bd8b 1090 int dmp_set_gyro_bias(long *bias);
heroistired 0:badebd32bd8b 1091 int dmp_set_accel_bias(long *bias);
heroistired 0:badebd32bd8b 1092
heroistired 0:badebd32bd8b 1093 /* Tap functions. */
heroistired 0:badebd32bd8b 1094 int dmp_register_tap_cb(void (*func)(unsigned char, unsigned char));
heroistired 0:badebd32bd8b 1095 int dmp_set_tap_thresh(unsigned char axis, unsigned short thresh);
heroistired 0:badebd32bd8b 1096 int dmp_set_tap_axes(unsigned char axis);
heroistired 0:badebd32bd8b 1097 int dmp_set_tap_count(unsigned char min_taps);
heroistired 0:badebd32bd8b 1098 int dmp_set_tap_time(unsigned short time);
heroistired 0:badebd32bd8b 1099 int dmp_set_tap_time_multi(unsigned short time);
heroistired 0:badebd32bd8b 1100 int dmp_set_shake_reject_thresh(long sf, unsigned short thresh);
heroistired 0:badebd32bd8b 1101 int dmp_set_shake_reject_time(unsigned short time);
heroistired 0:badebd32bd8b 1102 int dmp_set_shake_reject_timeout(unsigned short time);
heroistired 0:badebd32bd8b 1103
heroistired 0:badebd32bd8b 1104 /* Android orientation functions. */
heroistired 0:badebd32bd8b 1105 int dmp_register_android_orient_cb(void (*func)(unsigned char));
heroistired 0:badebd32bd8b 1106
heroistired 0:badebd32bd8b 1107 /* LP quaternion functions. */
heroistired 0:badebd32bd8b 1108 int dmp_enable_lp_quat(unsigned char enable);
heroistired 0:badebd32bd8b 1109 int dmp_enable_6x_lp_quat(unsigned char enable);
heroistired 0:badebd32bd8b 1110
heroistired 0:badebd32bd8b 1111 /* Pedometer functions. */
heroistired 0:badebd32bd8b 1112 int dmp_get_pedometer_step_count(unsigned long *count);
heroistired 0:badebd32bd8b 1113 int dmp_set_pedometer_step_count(unsigned long count);
heroistired 0:badebd32bd8b 1114 int dmp_get_pedometer_walk_time(unsigned long *time);
heroistired 0:badebd32bd8b 1115 int dmp_set_pedometer_walk_time(unsigned long time);
heroistired 0:badebd32bd8b 1116
heroistired 0:badebd32bd8b 1117 /* DMP gyro calibration functions. */
heroistired 0:badebd32bd8b 1118 int dmp_enable_gyro_cal(unsigned char enable);
heroistired 0:badebd32bd8b 1119
heroistired 0:badebd32bd8b 1120 /* Read function. This function should be called whenever the MPU interrupt is
heroistired 0:badebd32bd8b 1121 * detected.
heroistired 0:badebd32bd8b 1122 */
heroistired 0:badebd32bd8b 1123 int dmp_read_fifo(short *gyro, short *accel, long *quat,
heroistired 0:badebd32bd8b 1124 unsigned long *timestamp, short *sensors, unsigned char *more);
heroistired 0:badebd32bd8b 1125
heroistired 0:badebd32bd8b 1126 #endif
heroistired 0:badebd32bd8b 1127
heroistired 0:badebd32bd8b 1128
heroistired 0:badebd32bd8b 1129
heroistired 0:badebd32bd8b 1130
heroistired 0:badebd32bd8b 1131
heroistired 0:badebd32bd8b 1132
heroistired 0:badebd32bd8b 1133
heroistired 0:badebd32bd8b 1134
heroistired 0:badebd32bd8b 1135
heroistired 0:badebd32bd8b 1136
heroistired 0:badebd32bd8b 1137
heroistired 0:badebd32bd8b 1138
heroistired 0:badebd32bd8b 1139
heroistired 0:badebd32bd8b 1140
heroistired 0:badebd32bd8b 1141
heroistired 0:badebd32bd8b 1142
heroistired 0:badebd32bd8b 1143
heroistired 0:badebd32bd8b 1144
heroistired 0:badebd32bd8b 1145
heroistired 0:badebd32bd8b 1146
heroistired 0:badebd32bd8b 1147
heroistired 0:badebd32bd8b 1148
heroistired 0:badebd32bd8b 1149
heroistired 0:badebd32bd8b 1150
heroistired 0:badebd32bd8b 1151
heroistired 0:badebd32bd8b 1152
heroistired 0:badebd32bd8b 1153
heroistired 0:badebd32bd8b 1154
heroistired 0:badebd32bd8b 1155
heroistired 0:badebd32bd8b 1156
heroistired 0:badebd32bd8b 1157
heroistired 0:badebd32bd8b 1158
heroistired 0:badebd32bd8b 1159
heroistired 0:badebd32bd8b 1160
heroistired 0:badebd32bd8b 1161
heroistired 0:badebd32bd8b 1162