ttttttttc 6 mēneši atpakaļ
vecāks
revīzija
726d0fe638
100 mainītis faili ar 6870 papildinājumiem un 39621 dzēšanām
  1. 0 0
      Core - 副本/Inc/adc.h
  2. 0 0
      Core - 副本/Inc/gpio.h
  3. 0 0
      Core - 副本/Inc/i2c.h
  4. 5 0
      Core - 副本/Inc/main.h
  5. 0 0
      Core - 副本/Inc/quadspi.h
  6. 0 0
      Core - 副本/Inc/stm32h7xx_hal_conf.h
  7. 0 0
      Core - 副本/Inc/stm32h7xx_it.h
  8. 0 0
      Core - 副本/Inc/tim.h
  9. 0 0
      Core - 副本/Inc/usart.h
  10. 0 0
      Core - 副本/Src/adc.c
  11. 0 0
      Core - 副本/Src/gpio.c
  12. 15 3
      Core - 副本/Src/i2c.c
  13. 178 38
      Core - 副本/Src/main.c
  14. 0 0
      Core - 副本/Src/quadspi.c
  15. 0 0
      Core - 副本/Src/stm32h7xx_hal_msp.c
  16. 0 0
      Core - 副本/Src/stm32h7xx_it.c
  17. 0 0
      Core - 副本/Src/system_stm32h7xx.c
  18. 0 0
      Core - 副本/Src/tim.c
  19. 0 0
      Core - 副本/Src/usart.c
  20. 710 0
      Core - 副本/imu/MPU6050.c
  21. 124 0
      Core - 副本/imu/MPU6050.h
  22. 0 0
      Core - 副本/imu/dmpKey.h
  23. 0 0
      Core - 副本/imu/dmpmap.h
  24. 336 296
      Core - 副本/imu/inv_mpu.c
  25. 36 32
      Core - 副本/imu/inv_mpu.h
  26. 21 21
      Core - 副本/imu/inv_mpu_dmp_motion_driver.c
  27. 0 0
      Core - 副本/imu/inv_mpu_dmp_motion_driver.h
  28. 15 3
      Core/Src/i2c.c
  29. 189 112
      Core/Src/main.c
  30. 1 1
      Core/Src/usart.c
  31. 19 33
      Core/imu/MPU6050.c
  32. 4 12
      Core/imu/MPU6050.h
  33. 99 101
      Core/imu/inv_mpu.c
  34. 0 69
      Core备份3/Inc/main.h
  35. 0 342
      Core备份3/Src/i2c.c
  36. 0 542
      Core备份3/imu1/MPU60501.c
  37. 0 117
      Core备份3/imu1/MPU60501.h
  38. 0 494
      Core备份3/imu1/dmpKey1.h
  39. 0 264
      Core备份3/imu1/dmpmap1.h
  40. 0 2774
      Core备份3/imu1/inv_mpu1.c
  41. 0 132
      Core备份3/imu1/inv_mpu1.h
  42. 0 1380
      Core备份3/imu1/inv_mpu_dmp_motion_driver1.c
  43. 0 97
      Core备份3/imu1/inv_mpu_dmp_motion_driver1.h
  44. 0 542
      Core备份3/imu2/MPU60502.c
  45. 0 117
      Core备份3/imu2/MPU60502.h
  46. 0 494
      Core备份3/imu2/dmpKey2.h
  47. 0 264
      Core备份3/imu2/dmpmap2.h
  48. 0 2774
      Core备份3/imu2/inv_mpu2.c
  49. 0 132
      Core备份3/imu2/inv_mpu2.h
  50. 0 1380
      Core备份3/imu2/inv_mpu_dmp_motion_driver2.c
  51. 0 97
      Core备份3/imu2/inv_mpu_dmp_motion_driver2.h
  52. 0 542
      Core备份3/imu3/MPU60503.c
  53. 0 117
      Core备份3/imu3/MPU60503.h
  54. 0 494
      Core备份3/imu3/dmpKey3.h
  55. 0 264
      Core备份3/imu3/dmpmap3.h
  56. 0 2774
      Core备份3/imu3/inv_mpu3.c
  57. 0 132
      Core备份3/imu3/inv_mpu3.h
  58. 0 1380
      Core备份3/imu3/inv_mpu_dmp_motion_driver3.c
  59. 0 97
      Core备份3/imu3/inv_mpu_dmp_motion_driver3.h
  60. 0 542
      Core备份3/imu4/MPU60504.c
  61. 0 117
      Core备份3/imu4/MPU60504.h
  62. 0 494
      Core备份3/imu4/dmpKey4.h
  63. 0 264
      Core备份3/imu4/dmpmap4.h
  64. 0 2774
      Core备份3/imu4/inv_mpu4.c
  65. 0 132
      Core备份3/imu4/inv_mpu4.h
  66. 0 1380
      Core备份3/imu4/inv_mpu_dmp_motion_driver4.c
  67. 0 97
      Core备份3/imu4/inv_mpu_dmp_motion_driver4.h
  68. 0 542
      Core备份3/imu5/MPU60505.c
  69. 0 117
      Core备份3/imu5/MPU60505.h
  70. 0 494
      Core备份3/imu5/dmpKey5.h
  71. 0 264
      Core备份3/imu5/dmpmap5.h
  72. 0 2774
      Core备份3/imu5/inv_mpu5.c
  73. 0 132
      Core备份3/imu5/inv_mpu5.h
  74. 0 1380
      Core备份3/imu5/inv_mpu_dmp_motion_driver5.c
  75. 0 97
      Core备份3/imu5/inv_mpu_dmp_motion_driver5.h
  76. 0 542
      Core备份3/imu6/MPU60506.c
  77. 0 117
      Core备份3/imu6/MPU60506.h
  78. 0 494
      Core备份3/imu6/dmpKey6.h
  79. 0 264
      Core备份3/imu6/dmpmap6.h
  80. 0 2774
      Core备份3/imu6/inv_mpu6.c
  81. 0 132
      Core备份3/imu6/inv_mpu6.h
  82. 0 1380
      Core备份3/imu6/inv_mpu_dmp_motion_driver6.c
  83. 0 97
      Core备份3/imu6/inv_mpu_dmp_motion_driver6.h
  84. 2 0
      MDK-ARM/.vscode/keil-assistant.log
  85. 9 0
      MDK-ARM/EventRecorderStub.scvd
  86. 1327 16
      MDK-ARM/SmartGlove.uvguix.94772
  87. 65 45
      MDK-ARM/SmartGlove.uvoptx
  88. 41 41
      MDK-ARM/SmartGlove.uvprojx
  89. 2 0
      MDK-ARM/SmartGlove/ExtDll.iex
  90. BIN
      MDK-ARM/SmartGlove/SmartGlove.axf
  91. 42 8
      MDK-ARM/SmartGlove/SmartGlove.build_log.htm
  92. 2695 2734
      MDK-ARM/SmartGlove/SmartGlove.hex
  93. 259 240
      MDK-ARM/SmartGlove/SmartGlove.htm
  94. 3 3
      MDK-ARM/SmartGlove/SmartGlove.lnp
  95. 589 587
      MDK-ARM/SmartGlove/SmartGlove.map
  96. 84 84
      MDK-ARM/SmartGlove/SmartGlove_SmartGlove.dep
  97. BIN
      MDK-ARM/SmartGlove/adc.o
  98. BIN
      MDK-ARM/SmartGlove/gpio.o
  99. BIN
      MDK-ARM/SmartGlove/i2c.crf
  100. BIN
      MDK-ARM/SmartGlove/i2c.o

+ 0 - 0
Core备份3/Inc/adc.h → Core - 副本/Inc/adc.h


+ 0 - 0
Core备份3/Inc/gpio.h → Core - 副本/Inc/gpio.h


+ 0 - 0
Core备份3/Inc/i2c.h → Core - 副本/Inc/i2c.h


+ 5 - 0
core备份2/Inc/main.h → Core - 副本/Inc/main.h

@@ -16,6 +16,11 @@
   *
   ******************************************************************************
   */
+	
+extern int a;
+extern int b;
+extern int c;
+extern int t;
 /* USER CODE END Header */
 
 /* Define to prevent recursive inclusion -------------------------------------*/

+ 0 - 0
Core备份3/Inc/quadspi.h → Core - 副本/Inc/quadspi.h


+ 0 - 0
Core备份3/Inc/stm32h7xx_hal_conf.h → Core - 副本/Inc/stm32h7xx_hal_conf.h


+ 0 - 0
Core备份3/Inc/stm32h7xx_it.h → Core - 副本/Inc/stm32h7xx_it.h


+ 0 - 0
Core备份3/Inc/tim.h → Core - 副本/Inc/tim.h


+ 0 - 0
Core备份3/Inc/usart.h → Core - 副本/Inc/usart.h


+ 0 - 0
Core备份3/Src/adc.c → Core - 副本/Src/adc.c


+ 0 - 0
Core备份3/Src/gpio.c → Core - 副本/Src/gpio.c


+ 15 - 3
core备份/Src/i2c.c → Core - 副本/Src/i2c.c

@@ -40,7 +40,7 @@ void MX_I2C1_Init(void)
 
   /* USER CODE END I2C1_Init 1 */
   hi2c1.Instance = I2C1;
-  hi2c1.Init.Timing = 0x00909FCE;
+  hi2c1.Init.Timing = 0x00401242;
   hi2c1.Init.OwnAddress1 = 0;
   hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
   hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
@@ -66,6 +66,10 @@ void MX_I2C1_Init(void)
   {
     Error_Handler();
   }
+
+  /** I2C Enable Fast Mode Plus
+  */
+  HAL_I2CEx_EnableFastModePlus(I2C_FASTMODEPLUS_I2C1);
   /* USER CODE BEGIN I2C1_Init 2 */
 
   /* USER CODE END I2C1_Init 2 */
@@ -83,7 +87,7 @@ void MX_I2C2_Init(void)
 
   /* USER CODE END I2C2_Init 1 */
   hi2c2.Instance = I2C2;
-  hi2c2.Init.Timing = 0x00909FCE;
+  hi2c2.Init.Timing = 0x00401242;
   hi2c2.Init.OwnAddress1 = 0;
   hi2c2.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
   hi2c2.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
@@ -109,6 +113,10 @@ void MX_I2C2_Init(void)
   {
     Error_Handler();
   }
+
+  /** I2C Enable Fast Mode Plus
+  */
+  HAL_I2CEx_EnableFastModePlus(I2C_FASTMODEPLUS_I2C2);
   /* USER CODE BEGIN I2C2_Init 2 */
 
   /* USER CODE END I2C2_Init 2 */
@@ -126,7 +134,7 @@ void MX_I2C3_Init(void)
 
   /* USER CODE END I2C3_Init 1 */
   hi2c3.Instance = I2C3;
-  hi2c3.Init.Timing = 0x00909FCE;
+  hi2c3.Init.Timing = 0x00401242;
   hi2c3.Init.OwnAddress1 = 0;
   hi2c3.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
   hi2c3.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
@@ -152,6 +160,10 @@ void MX_I2C3_Init(void)
   {
     Error_Handler();
   }
+
+  /** I2C Enable Fast Mode Plus
+  */
+  HAL_I2CEx_EnableFastModePlus(I2C_FASTMODEPLUS_I2C3);
   /* USER CODE BEGIN I2C3_Init 2 */
 
   /* USER CODE END I2C3_Init 2 */

+ 178 - 38
Core备份3/Src/main.c → Core - 副本/Src/main.c

@@ -1,20 +1,20 @@
 /* USER CODE BEGIN Header */
 /**
-  ******************************************************************************
-  * @file           : main.c
-  * @brief          : Main program body
-  ******************************************************************************
-  * @attention
-  *
-  * Copyright (c) 2024 STMicroelectronics.
-  * All rights reserved.
-  *
-  * This software is licensed under terms that can be found in the LICENSE file
-  * in the root directory of this software component.
-  * If no LICENSE file comes with this software, it is provided AS-IS.
-  *
-  ******************************************************************************
-  */
+ ******************************************************************************
+ * @file           : main.c
+ * @brief          : Main program body
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2024 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software is licensed under terms that can be found in the LICENSE file
+ * in the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ ******************************************************************************
+ */
 /* USER CODE END Header */
 /* Includes ------------------------------------------------------------------*/
 #include "main.h"
@@ -27,12 +27,8 @@
 
 /* Private includes ----------------------------------------------------------*/
 /* USER CODE BEGIN Includes */
-#include "MPU60501.h"
-#include "MPU60502.h"
-#include "MPU60503.h"
-#include "MPU60504.h"
-#include "MPU60505.h"
-#include "MPU60506.h"
+#include "MPU6050.h"
+
 #include <stdio.h>
 /* USER CODE END Includes */
 
@@ -55,6 +51,14 @@
 
 /* USER CODE BEGIN PV */
 
+
+ int a=0x68;
+ int b=0xD1;
+ int c=0xD0;
+int t = 1;
+//int a = 0x69;
+//int b = 0xD3;
+//int c = 0xD2;
 /* USER CODE END PV */
 
 /* Private function prototypes -----------------------------------------------*/
@@ -66,17 +70,16 @@ void SystemClock_Config(void);
 /* Private user code ---------------------------------------------------------*/
 /* USER CODE BEGIN 0 */
 
-
 int fputc(int ch, FILE *f)
 {
-  HAL_UART_Transmit(&huart2, (uint8_t *)&ch, 1, 0xffff);//�����ض���
+  HAL_UART_Transmit(&huart2, (uint8_t *)&ch, 1, 0xffff); // �����ض���
   return ch;
 }
 
 int fgetc(FILE *f)
 {
   uint8_t ch = 0;
-  HAL_UART_Receive(&huart2, &ch, 1, 0xffff);//�����ض���
+  HAL_UART_Receive(&huart2, &ch, 1, 0xffff); // �����ض���
   return ch;
 }
 
@@ -120,11 +123,45 @@ int main(void)
   MX_I2C2_Init();
   MX_I2C3_Init();
   /* USER CODE BEGIN 2 */
-
-DMP_Init();
-
-HAL_QSPI_Init(&hqspi);
-
+				a=0x69;
+    		b=0xD3;
+    		c=0XD2;
+    		t=1;
+				DMP_Init();
+				a=0x68;
+    		b=0xD1;
+    		c=0XD0;
+    		t=1;
+				DMP_Init();
+				a=0x68;
+    		b=0xD1;
+    		c=0XD0;
+    		t=2;
+				DMP_Init();
+				a=0x69;
+    		b=0xD3;
+    		c=0XD2;
+    		t=2;
+				DMP_Init();
+				a=0x69;
+    		b=0xD3;
+    		c=0XD2;
+    		t=3;
+				DMP_Init();
+				a=0x68;
+    		b=0xD1;
+    		c=0XD0;
+    		t=3;
+				DMP_Init();
+
+  HAL_QSPI_Init(&hqspi);
+  int g = 1;
+  float Pitch1, Roll1, Yaw1;
+  float Pitch2, Roll2, Yaw2;
+	float Pitch3, Roll3, Yaw3;
+	float Pitch4, Roll4, Yaw4;
+  float Pitch5, Roll5, Yaw5;
+	float Pitch6, Roll6, Yaw6;
   /* USER CODE END 2 */
 
   /* Infinite loop */
@@ -132,17 +169,120 @@ HAL_QSPI_Init(&hqspi);
   while (1)
   {
 
-		float Pitch, Roll, Yaw;
-
-  	  uint8_t ret = Read_DMP(&Pitch, &Roll, &Yaw);
 		
-  	  printf("%f,%f,%f\r\n", Pitch, Roll, Yaw);
-//		HAL_GPIO_WritePin(GPIOC,GPIO_PIN_13,0);
-//		HAL_Delay(10);
-		HAL_GPIO_WritePin(GPIOC,GPIO_PIN_13,1);
-//		HAL_Delay(10);
-//		
+		//测试
+//			a=0x68;
+//			b=0xD1;
+//			c=0XD0;
+				a=0x69;
+    		b=0xD3;
+    		c=0XD2;
+    		t=3;
+    
+    
+    uint8_t ret = Read_DMP(&Pitch1, &Roll1, &Yaw1);
+		a=0x68;
+    		b=0xD1;
+    		c=0XD0;
+    		t=1;
+    
+    
+    uint8_t ret1 = Read_DMP(&Pitch2, &Roll2, &Yaw2);
+    printf("%f,%f,%f,%f,%f,%f\r\n",Pitch1,Roll1,Yaw1,Pitch2,Roll2,Yaw2);
 		
+		
+//		
+//		
+//  	if(g==1){ //15
+//    		
+//			
+//			a=0x69;
+//    		b=0xD3;
+//    		c=0XD2;
+//    		t=1;
+//    
+//    // char buff[100]={0};
+//       	  uint8_t ret = Read_DMP(&Pitch1, &Roll1, &Yaw1);
+//    ////printf("%d,%f,%f,%f\r\n", g,Pitch1, Roll1, Yaw1);
+//    ////printf("com:imu:%d:ang:%f:%f:%f\r\n", g,Pitch1, Roll1, Yaw1);
+//    ////		sprintf(buff,"16:%f,%f,%f\r\n", Pitch, Roll, Yaw);
+//    ////		HAL_QSPI_Transmit(&hqspi, buff, 100);
+//    		g=2;
+//    	}
+//     else if(g==2){  //18
+//    			 a=0x68;
+//			b=0xD1;
+//			c=0XD0;
+//			t=1;
+//	
+
+//    // float Pitch2, Roll2, Yaw2;
+
+//      	  uint8_t ret = Read_DMP(&Pitch2, &Roll2, &Yaw2);
+//			
+//    // printf("com:imu:%d:ang:%f:%f:%f\r\n", g,Pitch2, Roll2, Yaw2);
+//    	g=3;
+//    }
+//     else if(g==3){ //16
+//    		
+//		
+//		    a=0x68;
+//    		b=0xD1;
+//    		c=0XD0;
+//    		t=2;
+//    // float Pitch, Roll, Yaw;
+
+//      	  uint8_t ret = Read_DMP(&Pitch3, &Roll3, &Yaw3);
+//			 //printf("%f,%f,%f,%f,%f,%f,%f,%f,%f\r\n",Pitch1, Roll1, Yaw1,Pitch2, Roll2, Yaw2,Pitch3, Roll3, Yaw3);
+//    // printf("com:imu:%d:ang:%f:%f:%f\r\n", g,Pitch3, Roll3, Yaw3);
+//    		g=4;
+//    	}
+
+//     else if(g==4){ //13
+//    a = 0x69;
+//    b = 0xD3;
+//    c = 0XD2;
+//    t = 2;
+
+
+//   uint8_t ret = Read_DMP(&Pitch4, &Roll4, &Yaw4);
+//			//printf("%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f\r\n",Pitch1, Roll1, Yaw1,Pitch2, Roll2, Yaw2,Pitch3, Roll3, Yaw3,Pitch4, Roll4, Yaw4,Pitch5, Roll5, Yaw5,Pitch6, Roll6, Yaw6);
+//		 //printf("%d,%f,%f,%f\r\n", g, Pitch4, Roll4, Yaw4);
+//    ////printf("com:imu:%d:ang:%f:%f:%f\r\n", g,Pitch4, Roll4, Yaw4);
+//    		g=5;
+//    	}
+//    	else if(g==5){ //17
+//    		a=0x68;
+//    		b=0xD1;
+//    		c=0XD0;
+//    		t=3;
+//    ////float Pitch5, Roll5, Yaw5;
+
+//      	  uint8_t ret = Read_DMP(&Pitch5, &Roll5, &Yaw5);
+//    ////		printf("%d,%f,%f,%f\r\n", g,Pitch5, Roll5, Yaw5);
+//    //printf("com:imu:%d:ang:%f:%f:%f\r\n", g,Pitch5, Roll5, Yaw5);
+//    		g=6;
+//    	}
+//    	else if(g==6){ //14
+//    		a=0x69;
+//    		b=0xD3;
+//    		c=0XD2;
+//    	t=3;
+//     
+//      uint8_t ret = Read_DMP(&Pitch6, &Roll6, &Yaw6);
+//    		//printf("%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f\r\n",Pitch1, Roll1, Yaw1,Pitch2, Roll2, Yaw2,Pitch3, Roll3, Yaw3,Pitch4, Roll4, Yaw4,Pitch5, Roll5, Yaw5,Pitch6, Roll6, Yaw6);
+//      	 
+//     //printf("com:imu:%d:ang:%f:%f:%f\r\n", g,Pitch, Roll, Yaw);
+//    		g=1;
+//    	}
+    //
+	//printf("%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f\r\n",Pitch1, Roll1, Yaw1,Pitch2, Roll2, Yaw2,Pitch3, Roll3, Yaw3,Pitch4, Roll4, Yaw4,Pitch5, Roll5, Yaw5,Pitch6, Roll6, Yaw6);
+    //		HAL_GPIO_WritePin(GPIOC,GPIO_PIN_13,0);
+    //		HAL_Delay(10);
+    HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, 1);
+    //		HAL_Delay(10);
+    //
+
     /* USER CODE END WHILE */
 
     /* USER CODE BEGIN 3 */

+ 0 - 0
Core备份3/Src/quadspi.c → Core - 副本/Src/quadspi.c


+ 0 - 0
Core备份3/Src/stm32h7xx_hal_msp.c → Core - 副本/Src/stm32h7xx_hal_msp.c


+ 0 - 0
Core备份3/Src/stm32h7xx_it.c → Core - 副本/Src/stm32h7xx_it.c


+ 0 - 0
Core备份3/Src/system_stm32h7xx.c → Core - 副本/Src/system_stm32h7xx.c


+ 0 - 0
Core备份3/Src/tim.c → Core - 副本/Src/tim.c


+ 0 - 0
Core备份3/Src/usart.c → Core - 副本/Src/usart.c


+ 710 - 0
Core - 副本/imu/MPU6050.c

@@ -0,0 +1,710 @@
+/*
+ * MPU6050.c
+ *
+ *  Created on: Oct 26, 2021
+ *      Author: Administrator
+ */
+
+#include "MPU6050.h"
+#include "main.h"
+#include <stdio.h>
+
+extern int t;
+extern int a;
+extern int b;
+extern int c;
+
+//void addr_check_point(u8 addr){
+//    if (addr != 0x69)
+//    {
+//        printf("checkpoint error addr");
+//    }
+//}
+
+//void common_check_point(u8 value){
+//printf("<checkpoint> value => %x\n", value);
+//}
+
+
+u8 IIC_Write_Byte(u8 reg, u8 value)
+{
+
+	
+
+    return IIC_Write_Len(a, reg, 1, &value);
+}
+
+
+u8 IIC_Read_Byte(u8 reg)
+{
+    u8 value = 0;
+
+
+  	IIC_Read_Len(a, reg, 1, &value);
+
+    return value;
+}
+
+
+
+
+u8 IIC_Write_Len1(u8 addr, u8 reg, u8 len, u8 *buf)
+{
+	
+	addr=a;
+	addr = (addr << 1) | 0;
+
+        u8 data[10] = {0};
+        data[0] = reg;
+        for (int i = 0; i < len; i++)
+        {
+            data[1 + i] = buf[i];
+        }
+
+        if (HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)addr, (uint8_t *)data, len + 1, 10000) != HAL_OK
+        ||HAL_I2C_Master_Transmit(&hi2c2, (uint16_t)addr, (uint8_t *)data, len + 1, 10000) != HAL_OK
+        ||HAL_I2C_Master_Transmit(&hi2c3, (uint16_t)addr, (uint8_t *)data, len + 1, 10000) != HAL_OK)
+        {
+            printf("++write len byte fail\r\n");
+            return 1;
+					
+        }
+	return 0;
+}
+// IIC连续写
+u8 IIC_Write_Len(u8 addr, u8 reg, u8 len, u8 *buf)
+{
+	
+	addr=a;
+  		
+
+    if (t == 1)
+    {
+        addr = (addr << 1) | 0;
+
+        u8 data[10] = {0};
+        data[0] = reg;
+        for (int i = 0; i < len; i++)
+        {
+            data[1 + i] = buf[i];
+        }
+
+        if (HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)addr, (uint8_t *)data, len + 1, 10000) != HAL_OK)
+        {
+            printf("++write len byte fail\r\n");
+            return 1;
+        }
+    }
+    else if (t == 2)
+    {
+        addr = (addr << 1) | 0;
+
+        u8 data[10] = {0};
+        data[0] = reg;
+        for (int i = 0; i < len; i++)
+        {
+            data[1 + i] = buf[i];
+        }
+
+        if (HAL_I2C_Master_Transmit(&hi2c2, (uint16_t)addr, (uint8_t *)data, len + 1, 10000) != HAL_OK)
+        {
+            printf("++write len byte fail\r\n");
+            return 1;
+        }
+    }
+    else if (t == 3)
+    {
+        addr = (addr << 1) | 0;
+
+        u8 data[10] = {0};
+        data[0] = reg;
+        for (int i = 0; i < len; i++)
+        {
+            data[1 + i] = buf[i];
+        }
+
+        if (HAL_I2C_Master_Transmit(&hi2c3, (uint16_t)addr, (uint8_t *)data, len + 1, 10000) != HAL_OK)
+        {
+            printf("++write len byte fail\r\n");
+            return 1;
+        }
+    }
+    return 0;
+}
+
+u8 IIC_Read_Len1(u8 addr, u8 reg, u8 len, u8 *buf)
+{addr=a;
+	u8 tmp = (addr << 1) | 0;
+        if (HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)tmp, (uint8_t *)&reg, 1, 10000) != HAL_OK
+        ||HAL_I2C_Master_Transmit(&hi2c2, (uint16_t)tmp, (uint8_t *)&reg, 1, 10000) != HAL_OK
+        ||HAL_I2C_Master_Transmit(&hi2c3, (uint16_t)tmp, (uint8_t *)&reg, 1, 10000) != HAL_OK)
+        {
+            printf("++write byte fail\r\n");
+            return 1;
+				
+			  
+				//	return addr_test;
+        }
+
+        tmp = (addr << 1) | 1;
+        if (HAL_I2C_Master_Receive(&hi2c1, (uint16_t)tmp, (uint8_t *)buf, len, 10000) != HAL_OK
+        ||HAL_I2C_Master_Receive(&hi2c2, (uint16_t)tmp, (uint8_t *)buf, len, 10000) != HAL_OK
+        ||HAL_I2C_Master_Receive(&hi2c3, (uint16_t)tmp, (uint8_t *)buf, len, 10000) != HAL_OK)
+        {
+					
+            printf("--read byte fail\r\n");
+				
+			  
+        }
+	
+}
+
+// IIC连续读
+u8 IIC_Read_Len(u8 addr, u8 reg, u8 len, u8 *buf)
+{
+	
+	addr=a;
+
+
+    if (t == 1)
+    {
+        u8 tmp = (addr << 1) | 0;
+        if (HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)tmp, (uint8_t *)&reg, 1, 10000) != HAL_OK)
+        {
+            printf("++write byte fail\r\n");
+            return 1;
+				//	return addr_test;
+        }
+
+        tmp = (addr << 1) | 1;
+        if (HAL_I2C_Master_Receive(&hi2c1, (uint16_t)tmp, (uint8_t *)buf, len, 10000) != HAL_OK)
+        {
+            printf("--read byte fail\r\n");
+        }
+    }
+    else if (t == 2)
+    {
+        u8 tmp = (addr << 1) | 0;
+        if (HAL_I2C_Master_Transmit(&hi2c2, (uint16_t)tmp, (uint8_t *)&reg, 1, 10000) != HAL_OK)
+        {
+            printf("++write byte fail\r\n");
+            return 1;
+				//	return addr_test;
+        }
+
+        tmp = (addr << 1) | 1;
+        if (HAL_I2C_Master_Receive(&hi2c2, (uint16_t)tmp, (uint8_t *)buf, len, 10000) != HAL_OK)
+        {
+            printf("--read byte fail\r\n");
+        }
+    }
+    else if (t == 3)
+    {
+        u8 tmp = (addr << 1) | 0;
+        if (HAL_I2C_Master_Transmit(&hi2c3, (uint16_t)tmp, (uint8_t *)&reg, 1, 10000) != HAL_OK)
+        {
+            printf("++write byte fail\r\n");
+             return 1;
+				//	return addr_test;
+        }
+
+        tmp = (addr << 1) | 1;
+        if (HAL_I2C_Master_Receive(&hi2c3, (uint16_t)tmp, (uint8_t *)buf, len, 10000) != HAL_OK)
+        {
+            printf("--read byte fail\r\n");
+        }
+    }
+		
+	//	return -1;
+}
+
+// 初始化MPU6050
+// 返回值: 0,成功
+//         其他,错误代码
+u8 MPU_Init(void)
+{
+    u8 res = 0;
+
+    IIC_Write_Byte(MPU_PWR_MGMT1_REG, 0X80); // 复位MPU6050
+
+    HAL_Delay(100);
+
+    IIC_Write_Byte(MPU_PWR_MGMT1_REG, 0X00); // 唤醒MPU6050
+
+    MPU_Set_Gyro_Fsr(3);                     // 陀螺仪传感器,±2000dps
+    MPU_Set_Accel_Fsr(0);                    // 加速度传感器 ±2g
+    MPU_Set_Rate(50);                        // 设置采样率50HZ
+    IIC_Write_Byte(MPU_INT_EN_REG, 0X00);    // 关闭所有中断
+    IIC_Write_Byte(MPU_USER_CTRL_REG, 0X00); // I2C主模式关闭
+    IIC_Write_Byte(MPU_FIFO_EN_REG, 0X00);   // 关闭FIFO
+    IIC_Write_Byte(MPU_INTBP_CFG_REG, 0X80); // INT引脚低电平有效
+
+    res = IIC_Read_Byte(MPU_DEVICE_ID_REG);
+
+    printf("the addr is:%d\r\n", res);
+
+    //    if(res==a)//器件ID正确
+    //    {
+    IIC_Write_Byte(MPU_PWR_MGMT1_REG, 0X01); // 设置CLKSEL,PLL X 轴为参考
+    IIC_Write_Byte(MPU_PWR_MGMT2_REG, 0X00); // 加速度陀螺仪都工作
+    MPU_Set_Rate(50);                        // 设置采样率为50HZ
+    //    }
+    //    else
+    //    {
+    //    	return 1;
+    //    }
+
+    return 0;
+}
+
+// 设置MPU6050陀螺仪传感器满量程范围
+// fsr:0,±250dps;1,±500dps;2,±1000dps;3,±2000dps
+// 返回值:0,设置成功
+//     其他,设置失败
+u8 MPU_Set_Gyro_Fsr(u8 fsr)
+{
+    return IIC_Write_Byte(MPU_GYRO_CFG_REG, fsr << 3); // 设置陀螺仪满量程范围
+}
+
+// 设置MPU6050加速度传感器满量程范围
+// fsr:0,±2g;1,±4g;2,±8g;3,±16g
+// 返回值:0,设置成功
+//     其他,设置失败
+u8 MPU_Set_Accel_Fsr(u8 fsr)
+{
+    return IIC_Write_Byte(MPU_ACCEL_CFG_REG, fsr << 3); // 设置加速度传感器满量程范围
+}
+
+// 设置MPU6050的数字低通滤波器
+// lpf:数字低通滤波频率(Hz)
+// 返回值:0,设置成功
+//     其他,设置失败
+u8 MPU_Set_LPF(u16 lpf)
+{
+    u8 data = 0;
+    if (lpf >= 188)
+        data = 1;
+    else if (lpf >= 98)
+        data = 2;
+    else if (lpf >= 42)
+        data = 2;
+    else if (lpf >= 42)
+        data = 3;
+    else if (lpf >= 20)
+        data = 4;
+    else if (lpf >= 10)
+        data = 5;
+    else
+        data = 6;
+    return IIC_Write_Byte(MPU_CFG_REG, data); // 设置数字低通滤波器
+}
+
+// 设置MPU6050的采样率(假定Fs=1KHz)
+// rate:4~1000(Hz)
+// 返回值:0,设置成功
+//     其他,设置失败
+u8 MPU_Set_Rate(u16 rate)
+{
+    u8 data;
+    if (rate > 1000)
+        rate = 1000;
+    if (rate < 4)
+        rate = 4;
+    data = 1000 / rate - 1;
+    data = IIC_Write_Byte(MPU_SAMPLE_RATE_REG, data); // 设置数字低通滤波器
+    return MPU_Set_LPF(rate / 2);                     // 自动设置LPF为采样率的一半
+}
+
+// 得到温度值
+// 返回值:温度值(扩大了100倍)
+short MPU_Get_Temperature(void)
+{
+    u8 buf[2];
+    short raw;
+    float temp;
+    IIC_Read_Len(a, MPU_TEMP_OUTH_REG, 2, buf);
+    raw = ((u16)buf[0] << 8) | buf[1];
+    temp = 36.53 + ((double)raw) / 340;
+
+    return temp * 100;
+    ;
+}
+
+// 得到陀螺仪值(原始值)
+// gx,gy,gz:陀螺仪x,y,z轴的原始读数(带符号)
+// 返回值:0,成功
+//  其他,错误代码
+u8 MPU_Get_Gyroscope(short *gx, short *gy, short *gz)
+{
+    u8 buf[6], res;
+    res = IIC_Read_Len(a, MPU_GYRO_XOUTH_REG, 6, buf);
+    if (res == 0)
+    {
+        *gx = ((u16)buf[0] << 8) | buf[1];
+        *gy = ((u16)buf[2] << 8) | buf[3];
+        *gz = ((u16)buf[4] << 8) | buf[5];
+    }
+    return res;
+}
+
+// 得到加速度值(原始值)
+// ax,ay,az:陀螺仪x,y,z轴的原始读数(带符号)
+// 返回值:0,成功
+//     其他,错误代码
+u8 MPU_Get_Accelerometer(short *ax, short *ay, short *az)
+{
+    u8 buf[6], res;
+    res = IIC_Read_Len(a, MPU_ACCEL_XOUTH_REG, 6, buf);
+    if (res == 0)
+    {
+        *ax = ((u16)buf[0] << 8) | buf[1];
+        *ay = ((u16)buf[2] << 8) | buf[3];
+        *az = ((u16)buf[4] << 8) | buf[5];
+    }
+    return res;
+    ;
+}
+
+/*--------------------以下为使用板载固件DMP的相关代码,这个融合得到的姿态角效果很好*/
+
+/**
+ * @brief  获取当前毫秒值
+ * @param  存储最新毫秒值的变量
+ * @retval 无
+ */
+int get_tick_count(unsigned long *count)
+{
+    count[0] = HAL_GetTick();
+    return 0;
+}
+
+#include "inv_mpu.h"
+#include "inv_mpu_dmp_motion_driver.h"
+
+/* Data requested by client. */
+#define PRINT_ACCEL (0x01)
+#define PRINT_GYRO (0x02)
+#define PRINT_QUAT (0x04)
+
+#define ACCEL_ON (0x01)
+#define GYRO_ON (0x02)
+
+#define MOTION (0)
+#define NO_MOTION (1)
+
+/* Starting sampling rate. */ // 100
+#define DEFAULT_MPU_HZ (50)
+
+struct rx_s
+{
+    unsigned char header[3];
+    unsigned char cmd;
+};
+struct hal_s
+{
+    unsigned char sensors;
+    unsigned char dmp_on;
+    unsigned char wait_for_tap;
+    volatile unsigned char new_gyro;
+    unsigned short report;
+    unsigned short dmp_features;
+    unsigned char motion_int_mode;
+    struct rx_s rx;
+};
+static struct hal_s hal = {0};
+
+/* USB RX binary semaphore. Actually, it's just a flag. Not included in struct
+ * because it's declared extern elsewhere.
+ */
+volatile unsigned char rx_new;
+
+/* The sensors can be mounted onto the board in any orientation. The mounting
+ * matrix seen below tells the MPL how to rotate the raw data from thei
+ * driver(s).
+ * TODO: The following matrices refer to the configuration on an internal test
+ * board at Invensense. If needed, please modify the matrices to match the
+ * chip-to-body matrix for your particular set up.
+ */
+static signed char gyro_orientation[9] = {-1, 0, 0,
+                                          0, -1, 0,
+                                          0, 0, 1};
+
+/* Every time new gyro data is available, this function is called in an
+ * ISR context. In this example, it sets a flag protecting the FIFO read
+ * function.
+ */
+static void gyro_data_ready_cb(void)
+{
+    hal.new_gyro = 1;
+}
+
+enum packet_type_e
+{
+    PACKET_TYPE_ACCEL,
+    PACKET_TYPE_GYRO,
+    PACKET_TYPE_QUAT,
+    PACKET_TYPE_TAP,
+    PACKET_TYPE_ANDROID_ORIENT,
+    PACKET_TYPE_PEDO,
+    PACKET_TYPE_MISC
+};
+
+#define BYTE u_char
+/* Send data to the Python client application.
+ * Data is formatted as follows:
+ * packet[0]    = $
+ * packet[1]    = packet type (see packet_type_e)
+ * packet[2+]   = data
+ */
+void send_packet(char packet_type, void *data)
+{
+
+#define MAX_BUF_LENGTH (18)
+    char buf[MAX_BUF_LENGTH], length;
+
+    memset(buf, 0, MAX_BUF_LENGTH);
+    buf[0] = '$';
+    buf[1] = packet_type;
+
+    if (packet_type == PACKET_TYPE_ACCEL || packet_type == PACKET_TYPE_GYRO)
+    {
+        short *sdata = (short *)data;
+        buf[2] = (char)(sdata[0] >> 8);
+        buf[3] = (char)sdata[0];
+        buf[4] = (char)(sdata[1] >> 8);
+        buf[5] = (char)sdata[1];
+        buf[6] = (char)(sdata[2] >> 8);
+        buf[7] = (char)sdata[2];
+        length = 8;
+    }
+    else if (packet_type == PACKET_TYPE_QUAT)
+    {
+        long *ldata = (long *)data;
+        buf[2] = (char)(ldata[0] >> 24);
+        buf[3] = (char)(ldata[0] >> 16);
+        buf[4] = (char)(ldata[0] >> 8);
+        buf[5] = (char)ldata[0];
+        buf[6] = (char)(ldata[1] >> 24);
+        buf[7] = (char)(ldata[1] >> 16);
+        buf[8] = (char)(ldata[1] >> 8);
+        buf[9] = (char)ldata[1];
+        buf[10] = (char)(ldata[2] >> 24);
+        buf[11] = (char)(ldata[2] >> 16);
+        buf[12] = (char)(ldata[2] >> 8);
+        buf[13] = (char)ldata[2];
+        buf[14] = (char)(ldata[3] >> 24);
+        buf[15] = (char)(ldata[3] >> 16);
+        buf[16] = (char)(ldata[3] >> 8);
+        buf[17] = (char)ldata[3];
+        length = 18;
+    }
+    else if (packet_type == PACKET_TYPE_TAP)
+    {
+        buf[2] = ((char *)data)[0];
+        buf[3] = ((char *)data)[1];
+        length = 4;
+    }
+    else if (packet_type == PACKET_TYPE_ANDROID_ORIENT)
+    {
+        buf[2] = ((char *)data)[0];
+        length = 3;
+    }
+    else if (packet_type == PACKET_TYPE_PEDO)
+    {
+        long *ldata = (long *)data;
+        buf[2] = (char)(ldata[0] >> 24);
+        buf[3] = (char)(ldata[0] >> 16);
+        buf[4] = (char)(ldata[0] >> 8);
+        buf[5] = (char)ldata[0];
+        buf[6] = (char)(ldata[1] >> 24);
+        buf[7] = (char)(ldata[1] >> 16);
+        buf[8] = (char)(ldata[1] >> 8);
+        buf[9] = (char)ldata[1];
+        length = 10;
+    }
+    else if (packet_type == PACKET_TYPE_MISC)
+    {
+        buf[2] = ((char *)data)[0];
+        buf[3] = ((char *)data)[1];
+        buf[4] = ((char *)data)[2];
+        buf[5] = ((char *)data)[3];
+        length = 6;
+    }
+
+    //    cdcSendDataWaitTilDone((BYTE*)buf, length, CDC0_INTFNUM, 100);
+}
+
+/* These next two functions converts the orientation matrix (see
+ * gyro_orientation) to a scalar representation for use by the DMP.
+ * NOTE: These functions are borrowed from Invensense's MPL.
+ */
+static inline unsigned short inv_row_2_scale(const signed char *row)
+{
+    unsigned short b;
+
+    if (row[0] > 0)
+        b = 0;
+    else if (row[0] < 0)
+        b = 4;
+    else if (row[1] > 0)
+        b = 1;
+    else if (row[1] < 0)
+        b = 5;
+    else if (row[2] > 0)
+        b = 2;
+    else if (row[2] < 0)
+        b = 6;
+    else
+        b = 7; // error
+    return b;
+}
+static inline unsigned short inv_orientation_matrix_to_scalar(
+    const signed char *mtx)
+{
+    unsigned short scalar;
+
+    /*
+       XYZ  010_001_000 Identity Matrix
+       XZY  001_010_000
+       YXZ  010_000_001
+       YZX  000_010_001
+       ZXY  001_000_010
+       ZYX  000_001_010
+     */
+
+    scalar = inv_row_2_scale(mtx);
+    scalar |= inv_row_2_scale(mtx + 3) << 3;
+    scalar |= inv_row_2_scale(mtx + 6) << 6;
+
+    return scalar;
+}
+
+static inline void run_self_test(void)
+{
+    int result;
+    char test_packet[4] = {0};
+    long gyro[3], accel[3];
+
+    result = mpu_run_self_test(gyro, accel);
+    if (result == 0x7)
+    {
+        /* Test passed. We can trust the gyro data here, so let's push it down
+         * to the DMP.
+         */
+        float sens;
+        unsigned short accel_sens;
+        mpu_get_gyro_sens(&sens);
+        gyro[0] = (long)(gyro[0] * sens);
+        gyro[1] = (long)(gyro[1] * sens);
+        gyro[2] = (long)(gyro[2] * sens);
+        dmp_set_gyro_bias(gyro);
+        mpu_get_accel_sens(&accel_sens);
+        accel[0] *= accel_sens;
+        accel[1] *= accel_sens;
+        accel[2] *= accel_sens;
+        dmp_set_accel_bias(accel);
+    }
+
+    /* Report results. */
+    test_packet[0] = 't';
+    test_packet[1] = result;
+    send_packet(PACKET_TYPE_MISC, test_packet);
+}
+
+#define INT_EXIT_LPM0 12
+
+void DMP_Init(void)
+{
+      	        printf("checkpoint Func DMP_Init\n");
+struct int_param_s int_param;
+
+    /* Set up gyro.
+     * Every function preceded by mpu_ is a driver function and can be found
+     * in inv_mpu.h.
+     */
+    int_param.cb = gyro_data_ready_cb;
+    int_param.pin = 16;
+    int_param.lp_exit = INT_EXIT_LPM0;
+    int_param.active_low = 1;
+
+    int result = mpu_init(&int_param);
+
+    printf("mpu_init, %d\r\n", result);
+
+    if (result == 0) // mpu初始化
+    {
+  if (!mpu_set_sensors(INV_XYZ_GYRO | INV_XYZ_ACCEL)) // 设置需要的传感器
+            printf("mpu_set_sensor complete ......\r\n");
+
+        if (!mpu_configure_fifo(INV_XYZ_GYRO | INV_XYZ_ACCEL)) // 设置fifo
+            printf("mpu_configure_fifo complete ......\r\n");
+
+        if (!mpu_set_sample_rate(DEFAULT_MPU_HZ)) // 设置采集样率
+            printf("mpu_set_sample_rate complete ......\r\n");
+
+        unsigned short gyro_rate = 0, gyro_fsr = 0;
+        unsigned char accel_fsr = 0;
+
+        mpu_get_sample_rate(&gyro_rate);
+        mpu_get_gyro_fsr(&gyro_fsr);
+        mpu_get_accel_fsr(&accel_fsr);
+
+        printf("gyro_rate %d, gyro_fsr %d, accel_fsr %d\r\n", gyro_rate, gyro_fsr, accel_fsr);
+
+        if (!dmp_load_motion_driver_firmware()) // 加载dmp固件
+            printf("dmp_load_motion_driver_firmware complete ......\r\n");
+
+        if (!dmp_set_orientation(inv_orientation_matrix_to_scalar(gyro_orientation)))
+            printf("dmp_set_orientation complete ......\r\n"); // 设置陀螺仪方向
+
+        if (!dmp_enable_feature(DMP_FEATURE_6X_LP_QUAT | DMP_FEATURE_TAP |
+                                DMP_FEATURE_ANDROID_ORIENT | DMP_FEATURE_SEND_RAW_ACCEL | DMP_FEATURE_SEND_CAL_GYRO |
+                                DMP_FEATURE_GYRO_CAL))
+            printf("dmp_enable_feature complete ......\r\n");
+
+        if (!dmp_set_fifo_rate(DEFAULT_MPU_HZ)) // 设置速率
+            printf("dmp_set_fifo_rate complete ......\r\n");
+
+        run_self_test(); // 自检(非必要)
+
+        if (!mpu_set_dmp_state(1)) // 使能
+            printf("mpu_set_dmp_state complete ......\r\n");
+    }
+}
+
+#define q30 1073741824.0
+
+uint8_t Read_DMP(float *Pitch, float *Roll, float *Yaw)
+{
+
+    short gyro[3], accel[3], sensors;
+    float q0 = 1.0f, q1 = 0.0f, q2 = 0.0f, q3 = 0.0f;
+    unsigned long sensor_timestamp;
+    unsigned char more;
+    long quat[4];
+
+    int ret = dmp_read_fifo(gyro, accel, quat, &sensor_timestamp, &sensors, &more);
+
+    //	printf("dmp_read_fifo, %d\r\n", ret);
+
+    if (ret)
+    {
+        return 1;
+    }
+
+    if (sensors & INV_WXYZ_QUAT)
+    {
+        q0 = quat[0] / q30;
+        q1 = quat[1] / q30;
+        q2 = quat[2] / q30;
+        q3 = quat[3] / q30;
+        *Pitch = (float)asin(-2 * q1 * q3 + 2 * q0 * q2) * 57.3;
+        *Roll = (float)atan2(2 * q2 * q3 + 2 * q0 * q1, -2 * q1 * q1 - 2 * q2 * q2 + 1) * 57.3; // roll
+        *Yaw = (float)atan2(2 * (q1 * q2 + q0 * q3), q0 * q0 + q1 * q1 - q2 * q2 - q3 * q3) * 57.3;
+        return 0;
+    }
+    else
+    {
+        return 2;
+    }
+}

+ 124 - 0
Core - 副本/imu/MPU6050.h

@@ -0,0 +1,124 @@
+/*
+ * MPU6050.h
+ *
+ *  Created on: Oct 26, 2021
+ *      Author: Administrator
+ */
+
+#ifndef INC_MPU6050_H_
+#define INC_MPU6050_H_
+
+#include "i2c.h"
+#include "inv_mpu.h"
+#include "main.h"
+
+extern int a;
+extern int b;
+extern int c;
+
+// #define MPU_ACCEL_OFFS_REG		0X06	//accel_offs寄存器,可读取版本号,寄存器手册未提到
+// #define MPU_PROD_ID_REG			0X0C	//prod id寄存器,在寄存器手册未提到
+#define MPU_SELF_TESTX_REG 0X0D   // 自检寄存器X
+#define MPU_SELF_TESTY_REG 0X0E   // 自检寄存器Y
+#define MPU_SELF_TESTZ_REG 0X0F   // 自检寄存器Z
+#define MPU_SELF_TESTA_REG 0X10   // 自检寄存器A
+#define MPU_SAMPLE_RATE_REG 0X19  // 采样频率分频器
+#define MPU_CFG_REG 0X1A          // 配置寄存器
+#define MPU_GYRO_CFG_REG 0X1B     // 陀螺仪配置寄存器
+#define MPU_ACCEL_CFG_REG 0X1C    // 加速度计配置寄存器
+#define MPU_MOTION_DET_REG 0X1F   // 运动检测阀值设置寄存器
+#define MPU_FIFO_EN_REG 0X23      // FIFO使能寄存器
+#define MPU_I2CMST_CTRL_REG 0X24  // IIC主机控制寄存器
+#define MPU_I2CSLV0_ADDR_REG 0X25 // IIC从机0器件地址寄存器
+#define MPU_I2CSLV0_REG 0X26      // IIC从机0数据地址寄存器
+#define MPU_I2CSLV0_CTRL_REG 0X27 // IIC从机0控制寄存器
+#define MPU_I2CSLV1_ADDR_REG 0X28 // IIC从机1器件地址寄存器
+#define MPU_I2CSLV1_REG 0X29      // IIC从机1数据地址寄存器
+#define MPU_I2CSLV1_CTRL_REG 0X2A // IIC从机1控制寄存器
+#define MPU_I2CSLV2_ADDR_REG 0X2B // IIC从机2器件地址寄存器
+#define MPU_I2CSLV2_REG 0X2C      // IIC从机2数据地址寄存器
+#define MPU_I2CSLV2_CTRL_REG 0X2D // IIC从机2控制寄存器
+#define MPU_I2CSLV3_ADDR_REG 0X2E // IIC从机3器件地址寄存器
+#define MPU_I2CSLV3_REG 0X2F      // IIC从机3数据地址寄存器
+#define MPU_I2CSLV3_CTRL_REG 0X30 // IIC从机3控制寄存器
+#define MPU_I2CSLV4_ADDR_REG 0X31 // IIC从机4器件地址寄存器
+#define MPU_I2CSLV4_REG 0X32      // IIC从机4数据地址寄存器
+#define MPU_I2CSLV4_DO_REG 0X33   // IIC从机4写数据寄存器
+#define MPU_I2CSLV4_CTRL_REG 0X34 // IIC从机4控制寄存器
+#define MPU_I2CSLV4_DI_REG 0X35   // IIC从机4读数据寄存器
+
+#define MPU_I2CMST_STA_REG 0X36 // IIC主机状态寄存器
+#define MPU_INTBP_CFG_REG 0X37  // 中断/旁路设置寄存器
+#define MPU_INT_EN_REG 0X38     // 中断使能寄存器
+#define MPU_INT_STA_REG 0X3A    // 中断状态寄存器
+
+#define MPU_ACCEL_XOUTH_REG 0X3B // 加速度值,X轴高8位寄存器
+#define MPU_ACCEL_XOUTL_REG 0X3C // 加速度值,X轴低8位寄存器
+#define MPU_ACCEL_YOUTH_REG 0X3D // 加速度值,Y轴高8位寄存器
+#define MPU_ACCEL_YOUTL_REG 0X3E // 加速度值,Y轴低8位寄存器
+#define MPU_ACCEL_ZOUTH_REG 0X3F // 加速度值,Z轴高8位寄存器
+#define MPU_ACCEL_ZOUTL_REG 0X40 // 加速度值,Z轴低8位寄存器
+
+#define MPU_TEMP_OUTH_REG 0X41 // 温度值高八位寄存器
+#define MPU_TEMP_OUTL_REG 0X42 // 温度值低8位寄存器
+
+#define MPU_GYRO_XOUTH_REG 0X43 // 陀螺仪值,X轴高8位寄存器
+#define MPU_GYRO_XOUTL_REG 0X44 // 陀螺仪值,X轴低8位寄存器
+#define MPU_GYRO_YOUTH_REG 0X45 // 陀螺仪值,Y轴高8位寄存器
+#define MPU_GYRO_YOUTL_REG 0X46 // 陀螺仪值,Y轴低8位寄存器
+#define MPU_GYRO_ZOUTH_REG 0X47 // 陀螺仪值,Z轴高8位寄存器
+#define MPU_GYRO_ZOUTL_REG 0X48 // 陀螺仪值,Z轴低8位寄存器
+
+#define MPU_I2CSLV0_DO_REG 0X63 // IIC从机0数据寄存器
+#define MPU_I2CSLV1_DO_REG 0X64 // IIC从机1数据寄存器
+#define MPU_I2CSLV2_DO_REG 0X65 // IIC从机2数据寄存器
+#define MPU_I2CSLV3_DO_REG 0X66 // IIC从机3数据寄存器
+
+#define MPU_I2CMST_DELAY_REG 0X67 // IIC主机延时管理寄存器
+#define MPU_SIGPATH_RST_REG 0X68  // 信号通道复位寄存器
+#define MPU_MDETECT_CTRL_REG 0X69 // 运动检测控制寄存器
+#define MPU_USER_CTRL_REG 0X6A    // 用户控制寄存器
+#define MPU_PWR_MGMT1_REG 0X6B    // 电源管理寄存器1
+#define MPU_PWR_MGMT2_REG 0X6C    // 电源管理寄存器2
+#define MPU_FIFO_CNTH_REG 0X72    // FIFO计数寄存器高八位
+#define MPU_FIFO_CNTL_REG 0X73    // FIFO计数寄存器低八位
+#define MPU_FIFO_RW_REG 0X74      // FIFO读写寄存器
+#define MPU_DEVICE_ID_REG 0X75    // 器件ID寄存器
+
+// 如果AD0脚接地,IIC地址为0X68(不包含最低位).
+// 如果接V3.3,则IIC地址为0X69(不包含最低位).
+
+// 因为模块AD0默认接GND,所以转为读写地址后,为0XD1和0XD0(如果接VCC,则为0XD3和0XD2)
+// #define MPU_ADDR		a
+// #define MPU_READ    b
+// #define MPU_WRITE   c
+
+#define u8 uint8_t
+#define u16 uint16_t
+
+u8 MPU_Init(void);                                  // 初始化MPU6050
+u8 IIC_Write_Len(u8 addr, u8 reg, u8 len, u8 *buf); // IIC连续写
+u8 IIC_Read_Len(u8 addr, u8 reg, u8 len, u8 *buf);  // IIC连续读
+u8 IIC_Write_Byte(u8 reg, u8 data);                 // IIC写一个字节
+u8 IIC_Read_Byte(u8 reg);                           // IIC读一个字节
+
+u8 IIC_Write_Len1(u8 addr, u8 reg, u8 len, u8 *buf);
+u8 IIC_Read_Len1(u8 addr, u8 reg, u8 len, u8 *buf);
+
+
+u8 MPU_Set_Gyro_Fsr(u8 fsr);
+u8 MPU_Set_Accel_Fsr(u8 fsr);
+u8 MPU_Set_LPF(u16 lpf);
+u8 MPU_Set_Rate(u16 rate);
+u8 MPU_Set_Fifo(u8 sens);
+
+short MPU_Get_Temperature(void);
+u8 MPU_Get_Gyroscope(short *gx, short *gy, short *gz);
+u8 MPU_Get_Accelerometer(short *ax, short *ay, short *az);
+
+//----------------------DMP-------------------------------
+void DMP_Init(void);
+uint8_t Read_DMP(float *Pitch, float *Roll, float *Yaw);
+int get_tick_count(unsigned long *count);
+
+#endif /* INC_MPU6050_H_ */

+ 0 - 0
core备份2/mpu6050/dmpKey.h → Core - 副本/imu/dmpKey.h


+ 0 - 0
core备份2/mpu6050/dmpmap.h → Core - 副本/imu/dmpmap.h


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 336 - 296
Core - 副本/imu/inv_mpu.c


+ 36 - 32
core备份2/mpu6050/inv_mpu.h → Core - 副本/imu/inv_mpu.h

@@ -23,17 +23,18 @@
 
 #define MOTION_DRIVER_TARGET_STM32
 #define MPU6050
-//#define EMPL
-//#define USE_DMP
-
-#define INV_X_GYRO      (0x40)
-#define INV_Y_GYRO      (0x20)
-#define INV_Z_GYRO      (0x10)
-#define INV_XYZ_GYRO    (INV_X_GYRO | INV_Y_GYRO | INV_Z_GYRO)
-#define INV_XYZ_ACCEL   (0x08)
+// #define EMPL
+// #define USE_DMP
+
+#define INV_X_GYRO (0x40)
+#define INV_Y_GYRO (0x20)
+#define INV_Z_GYRO (0x10)
+#define INV_XYZ_GYRO (INV_X_GYRO | INV_Y_GYRO | INV_Z_GYRO)
+#define INV_XYZ_ACCEL (0x08)
 #define INV_XYZ_COMPASS (0x01)
 
-struct int_param_s {
+struct int_param_s
+{
 #if defined EMPL_TARGET_MSP430 || defined MOTION_DRIVER_TARGET_MSP430 || defined MOTION_DRIVER_TARGET_STM32
     void (*cb)(void);
     unsigned short pin;
@@ -41,25 +42,25 @@ struct int_param_s {
     unsigned char active_low;
 #elif defined EMPL_TARGET_UC3L0
     unsigned long pin;
-    void (*cb)(volatile void*);
+    void (*cb)(volatile void *);
     void *arg;
 #endif
 };
 
-#define MPU_INT_STATUS_DATA_READY       (0x0001)
-#define MPU_INT_STATUS_DMP              (0x0002)
-#define MPU_INT_STATUS_PLL_READY        (0x0004)
-#define MPU_INT_STATUS_I2C_MST          (0x0008)
-#define MPU_INT_STATUS_FIFO_OVERFLOW    (0x0010)
-#define MPU_INT_STATUS_ZMOT             (0x0020)
-#define MPU_INT_STATUS_MOT              (0x0040)
-#define MPU_INT_STATUS_FREE_FALL        (0x0080)
-#define MPU_INT_STATUS_DMP_0            (0x0100)
-#define MPU_INT_STATUS_DMP_1            (0x0200)
-#define MPU_INT_STATUS_DMP_2            (0x0400)
-#define MPU_INT_STATUS_DMP_3            (0x0800)
-#define MPU_INT_STATUS_DMP_4            (0x1000)
-#define MPU_INT_STATUS_DMP_5            (0x2000)
+#define MPU_INT_STATUS_DATA_READY (0x0001)
+#define MPU_INT_STATUS_DMP (0x0002)
+#define MPU_INT_STATUS_PLL_READY (0x0004)
+#define MPU_INT_STATUS_I2C_MST (0x0008)
+#define MPU_INT_STATUS_FIFO_OVERFLOW (0x0010)
+#define MPU_INT_STATUS_ZMOT (0x0020)
+#define MPU_INT_STATUS_MOT (0x0040)
+#define MPU_INT_STATUS_FREE_FALL (0x0080)
+#define MPU_INT_STATUS_DMP_0 (0x0100)
+#define MPU_INT_STATUS_DMP_1 (0x0200)
+#define MPU_INT_STATUS_DMP_2 (0x0400)
+#define MPU_INT_STATUS_DMP_3 (0x0800)
+#define MPU_INT_STATUS_DMP_4 (0x1000)
+#define MPU_INT_STATUS_DMP_5 (0x2000)
 
 /* Set up APIs */
 int mpu_init(struct int_param_s *int_param);
@@ -69,7 +70,7 @@ int mpu_set_bypass(unsigned char bypass_on);
 /* Configuration APIs */
 int mpu_lp_accel_mode(unsigned char rate);
 int mpu_lp_motion_interrupt(unsigned short thresh, unsigned char time,
-    unsigned char lpa_freq);
+                            unsigned char lpa_freq);
 int mpu_set_int_level(unsigned char active_low);
 int mpu_set_int_latched(unsigned char enable);
 
@@ -111,22 +112,25 @@ int mpu_get_temperature(long *data, unsigned long *timestamp);
 
 int mpu_get_int_status(short *status);
 int mpu_read_fifo(short *gyro, short *accel, unsigned long *timestamp,
-    unsigned char *sensors, unsigned char *more);
+                  unsigned char *sensors, unsigned char *more);
 int mpu_read_fifo_stream(unsigned short length, unsigned char *data,
-    unsigned char *more);
+                         unsigned char *more);
 int mpu_reset_fifo(void);
 
 int mpu_write_mem(unsigned short mem_addr, unsigned short length,
-    unsigned char *data);
+                  unsigned char *data);
+int mpu_write_mem1(unsigned short mem_addr, unsigned short length,
+                  unsigned char *data);
 int mpu_read_mem(unsigned short mem_addr, unsigned short length,
-    unsigned char *data);
+                 unsigned char *data);
+int mpu_read_mem1(unsigned short mem_addr, unsigned short length,
+                 unsigned char *data);
 int mpu_load_firmware(unsigned short length, const unsigned char *firmware,
-    unsigned short start_addr, unsigned short sample_rate);
+                      unsigned short start_addr, unsigned short sample_rate);
 
 int mpu_reg_dump(void);
 int mpu_read_reg(unsigned char reg, unsigned char *data);
 int mpu_run_self_test(long *gyro, long *accel);
 int mpu_register_tap_cb(void (*func)(unsigned char, unsigned char));
 
-#endif  /* #ifndef _INV_MPU_H_ */
-
+#endif /* #ifndef _INV_MPU_H_ */

+ 21 - 21
core备份2/mpu6050/inv_mpu_dmp_motion_driver.c → Core - 副本/imu/inv_mpu_dmp_motion_driver.c

@@ -536,9 +536,9 @@ int dmp_set_orientation(unsigned short orient)
     accel_regs[2] = accel_axes[(orient >> 6) & 3];
 
     /* Chip-to-body, axes only. */
-    if (mpu_write_mem(FCFG_1, 3, gyro_regs))
+    if (mpu_write_mem1(FCFG_1, 3, gyro_regs))
         return -1;
-    if (mpu_write_mem(FCFG_2, 3, accel_regs))
+    if (mpu_write_mem1(FCFG_2, 3, accel_regs))
         return -1;
 
     memcpy(gyro_regs, gyro_sign, 3);
@@ -557,9 +557,9 @@ int dmp_set_orientation(unsigned short orient)
     }
 
     /* Chip-to-body, sign only. */
-    if (mpu_write_mem(FCFG_3, 3, gyro_regs))
+    if (mpu_write_mem1(FCFG_3, 3, gyro_regs))
         return -1;
-    if (mpu_write_mem(FCFG_7, 3, accel_regs))
+    if (mpu_write_mem1(FCFG_7, 3, accel_regs))
         return -1;
     dmp.orient = orient;
     return 0;
@@ -604,21 +604,21 @@ int dmp_set_gyro_bias(long *bias)
     regs[1] = (unsigned char)((gyro_bias_body[0] >> 16) & 0xFF);
     regs[2] = (unsigned char)((gyro_bias_body[0] >> 8) & 0xFF);
     regs[3] = (unsigned char)(gyro_bias_body[0] & 0xFF);
-    if (mpu_write_mem(D_EXT_GYRO_BIAS_X, 4, regs))
+    if (mpu_write_mem1(D_EXT_GYRO_BIAS_X, 4, regs))
         return -1;
 
     regs[0] = (unsigned char)((gyro_bias_body[1] >> 24) & 0xFF);
     regs[1] = (unsigned char)((gyro_bias_body[1] >> 16) & 0xFF);
     regs[2] = (unsigned char)((gyro_bias_body[1] >> 8) & 0xFF);
     regs[3] = (unsigned char)(gyro_bias_body[1] & 0xFF);
-    if (mpu_write_mem(D_EXT_GYRO_BIAS_Y, 4, regs))
+    if (mpu_write_mem1(D_EXT_GYRO_BIAS_Y, 4, regs))
         return -1;
 
     regs[0] = (unsigned char)((gyro_bias_body[2] >> 24) & 0xFF);
     regs[1] = (unsigned char)((gyro_bias_body[2] >> 16) & 0xFF);
     regs[2] = (unsigned char)((gyro_bias_body[2] >> 8) & 0xFF);
     regs[3] = (unsigned char)(gyro_bias_body[2] & 0xFF);
-    return mpu_write_mem(D_EXT_GYRO_BIAS_Z, 4, regs);
+    return mpu_write_mem1(D_EXT_GYRO_BIAS_Z, 4, regs);
 }
 
 /**
@@ -692,9 +692,9 @@ int dmp_set_fifo_rate(unsigned short rate)
     div = DMP_SAMPLE_RATE / rate - 1;
     tmp[0] = (unsigned char)((div >> 8) & 0xFF);
     tmp[1] = (unsigned char)(div & 0xFF);
-    if (mpu_write_mem(D_0_22, 2, tmp))
+    if (mpu_write_mem1(D_0_22, 2, tmp))
         return -1;
-    if (mpu_write_mem(CFG_6, 12, (unsigned char*)regs_end))
+    if (mpu_write_mem1(CFG_6, 12, (unsigned char*)regs_end))
         return -1;
 
     dmp.fifo_rate = rate;
@@ -706,7 +706,7 @@ int dmp_set_fifo_rate(unsigned short rate)
  *  @param[out] rate    Current fifo rate (Hz).
  *  @return     0 if successful.
  */
-int dmp_get_fifo_rate(unsigned short *rate)
+int dmp_get_fifo_rate1(unsigned short *rate)
 {
     rate[0] = dmp.fifo_rate;
     return 0;
@@ -759,21 +759,21 @@ int dmp_set_tap_thresh(unsigned char axis, unsigned short thresh)
     tmp[3] = (unsigned char)(dmp_thresh_2 & 0xFF);
 
     if (axis & TAP_X) {
-        if (mpu_write_mem(DMP_TAP_THX, 2, tmp))
+        if (mpu_write_mem1(DMP_TAP_THX, 2, tmp))
             return -1;
-        if (mpu_write_mem(D_1_36, 2, tmp+2))
+        if (mpu_write_mem1(D_1_36, 2, tmp+2))
             return -1;
     }
     if (axis & TAP_Y) {
-        if (mpu_write_mem(DMP_TAP_THY, 2, tmp))
+        if (mpu_write_mem1(DMP_TAP_THY, 2, tmp))
             return -1;
-        if (mpu_write_mem(D_1_40, 2, tmp+2))
+        if (mpu_write_mem1(D_1_40, 2, tmp+2))
             return -1;
     }
     if (axis & TAP_Z) {
-        if (mpu_write_mem(DMP_TAP_THZ, 2, tmp))
+        if (mpu_write_mem1(DMP_TAP_THZ, 2, tmp))
             return -1;
-        if (mpu_write_mem(D_1_44, 2, tmp+2))
+        if (mpu_write_mem1(D_1_44, 2, tmp+2))
             return -1;
     }
     return 0;
@@ -1037,7 +1037,7 @@ int dmp_enable_feature(unsigned short mask)
         tmp[0] = DINA20;
     else
         tmp[0] = 0xD8;
-    mpu_write_mem(CFG_27,1,tmp);
+    mpu_write_mem1(CFG_27,1,tmp);
 
     if (mask & DMP_FEATURE_GYRO_CAL)
         dmp_enable_gyro_cal(1);
@@ -1056,13 +1056,13 @@ int dmp_enable_feature(unsigned short mask)
             tmp[2] = DINAC2;
             tmp[3] = DINA90;
         }
-        mpu_write_mem(CFG_GYRO_RAW_DATA, 4, tmp);
+        mpu_write_mem1(CFG_GYRO_RAW_DATA, 4, tmp);
     }
 
     if (mask & DMP_FEATURE_TAP) {
         /* Enable tap. */
         tmp[0] = 0xF8;
-        mpu_write_mem(CFG_20, 1, tmp);
+        mpu_write_mem1(CFG_20, 1, tmp);
         dmp_set_tap_thresh(TAP_XYZ, 250);
         dmp_set_tap_axes(TAP_XYZ);
         dmp_set_tap_count(1);
@@ -1074,14 +1074,14 @@ int dmp_enable_feature(unsigned short mask)
         dmp_set_shake_reject_timeout(10);
     } else {
         tmp[0] = 0xD8;
-        mpu_write_mem(CFG_20, 1, tmp);
+        mpu_write_mem1(CFG_20, 1, tmp);
     }
 
     if (mask & DMP_FEATURE_ANDROID_ORIENT) {
         tmp[0] = 0xD9;
     } else
         tmp[0] = 0xD8;
-    mpu_write_mem(CFG_ANDROID_ORIENT_INT, 1, tmp);
+    mpu_write_mem1(CFG_ANDROID_ORIENT_INT, 1, tmp);
 
     if (mask & DMP_FEATURE_LP_QUAT)
         dmp_enable_lp_quat(1);

+ 0 - 0
core备份2/mpu6050/inv_mpu_dmp_motion_driver.h → Core - 副本/imu/inv_mpu_dmp_motion_driver.h


+ 15 - 3
Core/Src/i2c.c

@@ -40,7 +40,7 @@ void MX_I2C1_Init(void)
 
   /* USER CODE END I2C1_Init 1 */
   hi2c1.Instance = I2C1;
-  hi2c1.Init.Timing = 0x10C0ECFF;
+  hi2c1.Init.Timing = 0x00401242;
   hi2c1.Init.OwnAddress1 = 0;
   hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
   hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
@@ -66,6 +66,10 @@ void MX_I2C1_Init(void)
   {
     Error_Handler();
   }
+
+  /** I2C Enable Fast Mode Plus
+  */
+  HAL_I2CEx_EnableFastModePlus(I2C_FASTMODEPLUS_I2C1);
   /* USER CODE BEGIN I2C1_Init 2 */
 
   /* USER CODE END I2C1_Init 2 */
@@ -83,7 +87,7 @@ void MX_I2C2_Init(void)
 
   /* USER CODE END I2C2_Init 1 */
   hi2c2.Instance = I2C2;
-  hi2c2.Init.Timing = 0x10C0ECFF;
+  hi2c2.Init.Timing = 0x00401242;
   hi2c2.Init.OwnAddress1 = 0;
   hi2c2.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
   hi2c2.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
@@ -109,6 +113,10 @@ void MX_I2C2_Init(void)
   {
     Error_Handler();
   }
+
+  /** I2C Enable Fast Mode Plus
+  */
+  HAL_I2CEx_EnableFastModePlus(I2C_FASTMODEPLUS_I2C2);
   /* USER CODE BEGIN I2C2_Init 2 */
 
   /* USER CODE END I2C2_Init 2 */
@@ -126,7 +134,7 @@ void MX_I2C3_Init(void)
 
   /* USER CODE END I2C3_Init 1 */
   hi2c3.Instance = I2C3;
-  hi2c3.Init.Timing = 0x10C0ECFF;
+  hi2c3.Init.Timing = 0x00401242;
   hi2c3.Init.OwnAddress1 = 0;
   hi2c3.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
   hi2c3.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
@@ -152,6 +160,10 @@ void MX_I2C3_Init(void)
   {
     Error_Handler();
   }
+
+  /** I2C Enable Fast Mode Plus
+  */
+  HAL_I2CEx_EnableFastModePlus(I2C_FASTMODEPLUS_I2C3);
   /* USER CODE BEGIN I2C3_Init 2 */
 
   /* USER CODE END I2C3_Init 2 */

+ 189 - 112
Core/Src/main.c

@@ -1,20 +1,20 @@
 /* USER CODE BEGIN Header */
 /**
-  ******************************************************************************
-  * @file           : main.c
-  * @brief          : Main program body
-  ******************************************************************************
-  * @attention
-  *
-  * Copyright (c) 2024 STMicroelectronics.
-  * All rights reserved.
-  *
-  * This software is licensed under terms that can be found in the LICENSE file
-  * in the root directory of this software component.
-  * If no LICENSE file comes with this software, it is provided AS-IS.
-  *
-  ******************************************************************************
-  */
+ ******************************************************************************
+ * @file           : main.c
+ * @brief          : Main program body
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2024 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software is licensed under terms that can be found in the LICENSE file
+ * in the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ ******************************************************************************
+ */
 /* USER CODE END Header */
 /* Includes ------------------------------------------------------------------*/
 #include "main.h"
@@ -51,36 +51,35 @@
 
 /* USER CODE BEGIN PV */
 
-int t=2;
-int a=0x68;
-int b=0xD1;
-int c=0xD0;
-//int t=2;
-//int a=0x69;
-//int b=0xD3;
-//int c=0xD2;
+
+ int a=0x68;
+ int b=0xD1;
+ int c=0xD0;
+int t = 1;
+//int a = 0x69;
+//int b = 0xD3;
+//int c = 0xD2;
 /* USER CODE END PV */
 
 /* Private function prototypes -----------------------------------------------*/
 void SystemClock_Config(void);
-/* USER CODE BEGIN PFP 	*/
+/* USER CODE BEGIN PFP */
 
 /* USER CODE END PFP */
 
 /* Private user code ---------------------------------------------------------*/
 /* USER CODE BEGIN 0 */
 
-
 int fputc(int ch, FILE *f)
 {
-  HAL_UART_Transmit(&huart2, (uint8_t *)&ch, 1, 0xffff);//�����ض���
+  HAL_UART_Transmit(&huart2, (uint8_t *)&ch, 1, 0xffff); // �����ض���
   return ch;
 }
 
 int fgetc(FILE *f)
 {
   uint8_t ch = 0;
-  HAL_UART_Receive(&huart2, &ch, 1, 0xffff);//�����ض���
+  HAL_UART_Receive(&huart2, &ch, 1, 0xffff); // �����ض���
   return ch;
 }
 
@@ -124,14 +123,52 @@ int main(void)
   MX_I2C2_Init();
   MX_I2C3_Init();
   /* USER CODE BEGIN 2 */
-
-DMP_Init();
-
-HAL_QSPI_Init(&hqspi);
-int g=1;
-float Pitch1, Roll1, Yaw1;	
-float Pitch2, Roll2, Yaw2;	
-float Pitch5, Roll5, Yaw5;	
+				a=0x69;
+    		b=0xD3;
+    		c=0XD2;
+    		t=1;
+				DMP_Init();
+				a=0x68;
+    		b=0xD1;
+    		c=0XD0;
+    		t=1;
+				DMP_Init();
+				a=0x68;
+    		b=0xD1;
+    		c=0XD0;
+    		t=2;
+				DMP_Init();
+				a=0x69;
+    		b=0xD3;
+    		c=0XD2;
+    		t=2;
+				DMP_Init();
+				a=0x69;
+    		b=0xD3;
+    		c=0XD2;
+    		t=3;
+				DMP_Init();
+				a=0x68;
+    		b=0xD1;
+    		c=0XD0;
+    		t=3;
+				DMP_Init();
+
+  HAL_QSPI_Init(&hqspi);
+  int g = 1;
+  float Pitch1, Roll1, Yaw1;
+  float Pitch2, Roll2, Yaw2;
+	float Pitch3, Roll3, Yaw3;
+	float Pitch4, Roll4, Yaw4;
+  float Pitch5, Roll5, Yaw5;
+	float Pitch6, Roll6, Yaw6;
+	
+	int gx1,gy1,gz1;
+	short gx2,gy2,gz2;
+	short gx3,gy3,gz3;
+	short gx4,gy4,gz4;
+	short gx5,gy5,gz5;
+	short gx6,gy6,gz6;
   /* USER CODE END 2 */
 
   /* Infinite loop */
@@ -139,86 +176,126 @@ float Pitch5, Roll5, Yaw5;
   while (1)
   {
 
-	if(g==1){ //16
-		a=0x68;
-		b=0xD1;
-		c=0XD0;
-		t=2;
-//float Pitch1, Roll1, Yaw1;		
-char buff[100]={0};
-  	  uint8_t ret = Read_DMP(&Pitch1, &Roll1, &Yaw1);
-//printf("%d,%f,%f,%f\r\n", g,Pitch1, Roll1, Yaw1);
-//printf("com:imu:%d:ang:%f:%f:%f\r\n", g,Pitch1, Roll1, Yaw1);
-//		sprintf(buff,"16:%f,%f,%f\r\n", Pitch, Roll, Yaw);
-//		HAL_QSPI_Transmit(&hqspi, buff, 100);
-		g=5;
-	}
-//else if(g==2){  //13
-//		a=0x69;
-//		b=0xD3;
-//		c=0XD2;
-//		t=2;
-////float Pitch2, Roll2, Yaw2;		
-
-//  	  uint8_t ret = Read_DMP(&Pitch2, &Roll2, &Yaw2);
-////printf("com:imu:%d:ang:%f:%f:%f\r\n", g,Pitch2, Roll2, Yaw2);
-//	g=5;
-//}
-//else if(g==3){ //14
-//		a=0x69;
-//		b=0xD3;
-//		c=0XD2;
-//		t=3;
-//float Pitch, Roll, Yaw;		
-
-//  	  uint8_t ret = Read_DMP(&Pitch, &Roll, &Yaw);
-//printf("com:imu:%d:ang:%f:%f:%f\r\n", g,Pitch, Roll, Yaw);
-//		g=4;
-//	}
-
-//else if(g==4){ //15
-//		a=0x69;
-//		b=0xD3;
-//		c=0XD2;
-//		t=1;
-//float Pitch4, Roll4, Yaw4;		
-
-//  	  uint8_t ret = Read_DMP(&Pitch4, &Roll4, &Yaw4);
-//	printf("%d,%f,%f,%f\r\n", g,Pitch4, Roll4, Yaw4);
-////printf("com:imu:%d:ang:%f:%f:%f\r\n", g,Pitch4, Roll4, Yaw4);
-//		g=5;
-//	}
-	else if(g==5){ //18
-		a=0x68;
-		b=0xD1;
-		c=0XD0;
-		t=1;
-//float Pitch5, Roll5, Yaw5;		
-
-  	  uint8_t ret = Read_DMP(&Pitch5, &Roll5, &Yaw5);
-//		printf("%d,%f,%f,%f\r\n", g,Pitch5, Roll5, Yaw5);
-//printf("com:imu:%d:ang:%f:%f:%f\r\n", g,Pitch5, Roll5, Yaw5);
-		printf("%f,%f,%f,%f,%f,%f,%f,%f,%f\r\n",Pitch1, Roll1, Yaw1,Pitch2, Roll2, Yaw2,Pitch5, Roll5, Yaw5);
-		g=1;
-	}
-//	else if(g==6){ //17
+		
+		//测试
+//			a=0x68;
+//			b=0xD1;
+//			c=0XD0;
+//				a=0x69;
+//    		b=0xD3;
+//    		c=0XD2;
+//    		t=3;
+//    
+//    
+//    uint8_t ret = Read_DMP(&Pitch1, &Roll1, &Yaw1);
 //		a=0x68;
-//		b=0xD1;
-//		c=0XD0;
-//		t=3;
-//float Pitch, Roll, Yaw;		
-
-//  	  uint8_t ret = Read_DMP(&Pitch, &Roll, &Yaw);
-//printf("com:imu:%d:ang:%f:%f:%f\r\n", g,Pitch, Roll, Yaw);
-//		g=1;
-//	}
-//	
-//		HAL_GPIO_WritePin(GPIOC,GPIO_PIN_13,0);
-//		HAL_Delay(10);
-		HAL_GPIO_WritePin(GPIOC,GPIO_PIN_13,1);
-//		HAL_Delay(10);
+//    		b=0xD1;
+//    		c=0XD0;
+//    		t=1;
+//    
+//    
+//    uint8_t ret1 = Read_DMP(&Pitch2, &Roll2, &Yaw2);
+//    printf("%f,%f,%f,%f,%f,%f\r\n",Pitch1,Roll1,Yaw1,Pitch2,Roll2,Yaw2);
 //		
 		
+//		
+//		
+  	if(g==1){ //15
+    		
+			
+			a=0x69;
+    		b=0xD3;
+    		c=0XD2;
+    		t=1;
+    
+    // char buff[100]={0};
+       	  uint8_t ret = Read_DMP(&Pitch1, &Roll1, &Yaw1);
+			    MPU_Get_Gyroscope(&gx1,&gy1,&gz1);
+			printf("%d,%d,%d",gx1,gy1,gz1);
+			printf("%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f\r\n",Pitch1, Roll1, Yaw1,Pitch2, Roll2, Yaw2,Pitch3, Roll3, Yaw3,Pitch4, Roll4, Yaw4,Pitch5, Roll5, Yaw5,Pitch6, Roll6, Yaw6);
+    ////printf("%d,%f,%f,%f\r\n", g,Pitch1, Roll1, Yaw1);
+    ////printf("com:imu:%d:ang:%f:%f:%f\r\n", g,Pitch1, Roll1, Yaw1);
+    ////		sprintf(buff,"16:%f,%f,%f\r\n", Pitch, Roll, Yaw);
+    ////		HAL_QSPI_Transmit(&hqspi, buff, 100);
+    		g=2;
+    	}
+     else if(g==2){  //18
+    			 a=0x68;
+			b=0xD1;
+			c=0XD0;
+			t=1;
+	
+
+    // float Pitch2, Roll2, Yaw2;
+
+      	  uint8_t ret = Read_DMP(&Pitch2, &Roll2, &Yaw2);
+			//printf("%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f\r\n",Pitch1, Roll1, Yaw1,Pitch2, Roll2, Yaw2,Pitch3, Roll3, Yaw3,Pitch4, Roll4, Yaw4,Pitch5, Roll5, Yaw5,Pitch6, Roll6, Yaw6);
+    // printf("com:imu:%d:ang:%f:%f:%f\r\n", g,Pitch2, Roll2, Yaw2);
+    	g=3;
+    }
+     else if(g==3){ //16
+    		
+		
+		    a=0x68;
+    		b=0xD1;
+    		c=0XD0;
+    		t=2;
+    // float Pitch, Roll, Yaw;
+
+      	  uint8_t ret = Read_DMP(&Pitch3, &Roll3, &Yaw3);
+			 //printf("%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f\r\n",Pitch1, Roll1, Yaw1,Pitch2, Roll2, Yaw2,Pitch3, Roll3, Yaw3,Pitch4, Roll4, Yaw4,Pitch5, Roll5, Yaw5,Pitch6, Roll6, Yaw6);
+			 //printf("%f,%f,%f,%f,%f,%f,%f,%f,%f\r\n",Pitch1, Roll1, Yaw1,Pitch2, Roll2, Yaw2,Pitch3, Roll3, Yaw3);
+    // printf("com:imu:%d:ang:%f:%f:%f\r\n", g,Pitch3, Roll3, Yaw3);
+    		g=4;
+    	}
+
+     else if(g==4){ //13
+    a = 0x69;
+    b = 0xD3;
+    c = 0XD2;
+    t = 2;
+
+
+   uint8_t ret = Read_DMP(&Pitch4, &Roll4, &Yaw4);
+//printf("%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f\r\n",Pitch1, Roll1, Yaw1,Pitch2, Roll2, Yaw2,Pitch3, Roll3, Yaw3,Pitch4, Roll4, Yaw4,Pitch5, Roll5, Yaw5,Pitch6, Roll6, Yaw6);
+			//printf("%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f\r\n",Pitch1, Roll1, Yaw1,Pitch2, Roll2, Yaw2,Pitch3, Roll3, Yaw3,Pitch4, Roll4, Yaw4,Pitch5, Roll5, Yaw5,Pitch6, Roll6, Yaw6);
+		 //printf("%d,%f,%f,%f\r\n", g, Pitch4, Roll4, Yaw4);
+    ////printf("com:imu:%d:ang:%f:%f:%f\r\n", g,Pitch4, Roll4, Yaw4);
+    		g=5;
+    	}
+    	else if(g==5){ //17
+    		a=0x68;
+    		b=0xD1;
+    		c=0XD0;
+    		t=3;
+    ////float Pitch5, Roll5, Yaw5;
+
+      	  uint8_t ret = Read_DMP(&Pitch5, &Roll5, &Yaw5);
+				//printf("%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f\r\n",Pitch1, Roll1, Yaw1,Pitch2, Roll2, Yaw2,Pitch3, Roll3, Yaw3,Pitch4, Roll4, Yaw4,Pitch5, Roll5, Yaw5,Pitch6, Roll6, Yaw6);
+    ////		printf("%d,%f,%f,%f\r\n", g,Pitch5, Roll5, Yaw5);
+    //printf("com:imu:%d:ang:%f:%f:%f\r\n", g,Pitch5, Roll5, Yaw5);
+    		g=6;
+    	}
+    	else if(g==6){ //14
+    		a=0x69;
+    		b=0xD3;
+    		c=0XD2;
+    	t=3;
+     
+      uint8_t ret = Read_DMP(&Pitch6, &Roll6, &Yaw6);
+    		//printf("%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f\r\n",Pitch1, Roll1, Yaw1,Pitch2, Roll2, Yaw2,Pitch3, Roll3, Yaw3,Pitch4, Roll4, Yaw4,Pitch5, Roll5, Yaw5,Pitch6, Roll6, Yaw6);
+      	 //printf("%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f\r\n",Pitch1, Roll1, Yaw1,Pitch2, Roll2, Yaw2,Pitch3, Roll3, Yaw3,Pitch4, Roll4, Yaw4,Pitch5, Roll5, Yaw5,Pitch6, Roll6, Yaw6);
+     //printf("com:imu:%d:ang:%f:%f:%f\r\n", g,Pitch, Roll, Yaw);
+    		g=1;
+    	}
+    //
+	//printf("%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f\r\n",Pitch1, Roll1, Yaw1,Pitch2, Roll2, Yaw2,Pitch3, Roll3, Yaw3,Pitch4, Roll4, Yaw4,Pitch5, Roll5, Yaw5,Pitch6, Roll6, Yaw6);
+    //		HAL_GPIO_WritePin(GPIOC,GPIO_PIN_13,0);
+    //		HAL_Delay(10);
+    HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, 1);
+    //		HAL_Delay(10);
+    //
+
     /* USER CODE END WHILE */
 
     /* USER CODE BEGIN 3 */

+ 1 - 1
Core/Src/usart.c

@@ -39,7 +39,7 @@ void MX_USART2_UART_Init(void)
 
   /* USER CODE END USART2_Init 1 */
   huart2.Instance = USART2;
-  huart2.Init.BaudRate = 115200;
+  huart2.Init.BaudRate = 921600;
   huart2.Init.WordLength = UART_WORDLENGTH_8B;
   huart2.Init.StopBits = UART_STOPBITS_1;
   huart2.Init.Parity = UART_PARITY_NONE;

+ 19 - 33
Core/imu/MPU6050.c

@@ -6,13 +6,12 @@
  */
 
 #include "MPU6050.h"
-#include "main.h"
+
 #include <stdio.h>
 
-extern int t;
 extern int a;
-extern int b;
-extern int c;
+
+extern int t;
 
  u8 IIC_Write_Byte(u8 reg, u8 value)
  {
@@ -30,7 +29,10 @@ extern int c;
 
  //IIC连续写
  u8 IIC_Write_Len(u8 addr,u8 reg, u8 len, u8 *buf)
- {if(t==1){
+ {
+	 
+	 addr = a;
+	 
 	 addr = (addr << 1) | 0;
 
 	 u8 data[10] = {0};
@@ -39,39 +41,21 @@ extern int c;
 	 {
 		 data[1 + i] = buf[i];
 	 }
-
+if(t==1){
 	 if(HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)addr, (uint8_t*)data, len + 1, 10000)!= HAL_OK)
 	 {
 		 printf("++write len byte fail\r\n");
 		 return 1;
 	 }
  }
- else if(t==2){
-	 addr = (addr << 1) | 0;
-
-	 u8 data[10] = {0};
-	 data[0] = reg;
-	 for(int i = 0; i < len; i++)
-	 {
-		 data[1 + i] = buf[i];
-	 }
-
+else if(t==2){
 	 if(HAL_I2C_Master_Transmit(&hi2c2, (uint16_t)addr, (uint8_t*)data, len + 1, 10000)!= HAL_OK)
 	 {
 		 printf("++write len byte fail\r\n");
 		 return 1;
 	 }
  }
- else if(t==3){
-	 addr = (addr << 1) | 0;
-
-	 u8 data[10] = {0};
-	 data[0] = reg;
-	 for(int i = 0; i < len; i++)
-	 {
-		 data[1 + i] = buf[i];
-	 }
-
+else if(t==3){
 	 if(HAL_I2C_Master_Transmit(&hi2c3, (uint16_t)addr, (uint8_t*)data, len + 1, 10000)!= HAL_OK)
 	 {
 		 printf("++write len byte fail\r\n");
@@ -84,6 +68,8 @@ extern int c;
  //IIC连续读
  u8 IIC_Read_Len(u8 addr,u8 reg,u8 len,u8 *buf)
  {
+	 
+	 	 addr = a;
 	 if(t==1){
 	 u8 tmp  = (addr << 1) | 0;
 	 if(HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)tmp, (uint8_t*)&reg, 1, 10000)!= HAL_OK)
@@ -154,16 +140,16 @@ u8 MPU_Init(void)
 
     printf("the addr is:%d\r\n", res);
 
-//    if(res==a)//器件ID正确
-//    {
+    if(res==a)//器件ID正确
+    {
         IIC_Write_Byte(MPU_PWR_MGMT1_REG,0X01);//设置CLKSEL,PLL X 轴为参考
         IIC_Write_Byte(MPU_PWR_MGMT2_REG,0X00);//加速度陀螺仪都工作
         MPU_Set_Rate(50); //设置采样率为50HZ
-//    }
-//    else
-//    {
-//    	return 1;
-//    }
+    }
+    else
+    {
+    	return 1;
+    }
 
     return 0;
 }

+ 4 - 12
Core/imu/MPU6050.h

@@ -10,11 +10,6 @@
 
 #include "i2c.h"
 #include "inv_mpu.h"
-#include "main.h"
-
-extern int a;
-extern int b;
-extern int c;
 
 //#define MPU_ACCEL_OFFS_REG		0X06	//accel_offs寄存器,可读取版本号,寄存器手册未提到
 //#define MPU_PROD_ID_REG			0X0C	//prod id寄存器,在寄存器手册未提到
@@ -87,15 +82,12 @@ extern int c;
 
 //如果AD0脚接地,IIC地址为0X68(不包含最低位).
 //如果接V3.3,则IIC地址为0X69(不包含最低位).
-
-//因为模块AD0默认接GND,所以转为读写地址后,为0XD1和0XD0(如果接VCC,则为0XD3和0XD2)
-//#define MPU_ADDR		a
-//#define MPU_READ    b
-//#define MPU_WRITE   c
-
-
+#define MPU_ADDR				0X68
 
 
+//因为模块AD0默认接GND,所以转为读写地址后,为0XD1和0XD0(如果接VCC,则为0XD3和0XD2)
+#define MPU_READ    0XD1
+#define MPU_WRITE   0XD0
 
 #define u8 uint8_t
 #define u16 uint16_t

+ 99 - 101
Core/imu/inv_mpu.c

@@ -25,7 +25,7 @@
 #include "inv_mpu.h"
 
 #include "MPU6050.h"
-int a1=0x68,b1=0x69;
+
 
 /* The following functions must be defined for this platform:
  * i2c_write(unsigned char slave_addr, unsigned char reg_addr,
@@ -659,7 +659,7 @@ static int set_int_enable(unsigned char enable)
             tmp = BIT_DMP_INT_EN;
         else
             tmp = 0x00;
-        if (i2c_write(a1, st.reg->int_enable, 1, &tmp)&&i2c_write(b1, st.reg->int_enable, 1, &tmp))
+        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &tmp))
             return -1;
         st.chip_cfg.int_enable = tmp;
     } else {
@@ -671,7 +671,7 @@ static int set_int_enable(unsigned char enable)
             tmp = BIT_DATA_RDY_EN;
         else
             tmp = 0x00;
-        if (i2c_write(a1, st.reg->int_enable, 1, &tmp)&&i2c_write(b1, st.reg->int_enable, 1, &tmp))
+        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &tmp))
             return -1;
         st.chip_cfg.int_enable = tmp;
     }
@@ -690,7 +690,7 @@ int mpu_reg_dump(void)
     for (ii = 0; ii < st.hw->num_reg; ii++) {
         if (ii == st.reg->fifo_r_w || ii == st.reg->mem_r_w)
             continue;
-        if (i2c_read(a1, ii, 1, &data)&&i2c_write(b1, ii, 1, &data))
+        if (i2c_read(st.hw->addr, ii, 1, &data))
             return -1;
         log_i("%#5x: %#5x\r\n", ii, data);
     }
@@ -710,7 +710,7 @@ int mpu_read_reg(unsigned char reg, unsigned char *data)
         return -1;
     if (reg >= st.hw->num_reg)
         return -1;
-    return i2c_read(a, reg, 1, data);
+    return i2c_read(st.hw->addr, reg, 1, data);
 }
 
 /**
@@ -732,18 +732,18 @@ int mpu_init(struct int_param_s *int_param)
 
     /* Reset device. */
     data[0] = BIT_RESET;
-    if (i2c_write(a1, st.reg->pwr_mgmt_1, 1, data)&&i2c_write(b1, st.reg->pwr_mgmt_1, 1, data))
+    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, data))
         return -1;
     delay_ms(100);
 
     /* Wake up chip. */
     data[0] = 0x00;
-    if (i2c_write(a1, st.reg->pwr_mgmt_1, 1, data)&&i2c_write(b1, st.reg->pwr_mgmt_1, 1, data))
+    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, data))
         return -1;
 
 #if defined MPU6050
     /* Check product revision. */
-    if (i2c_read(a1, st.reg->pwr_mgmt_1, 1, data)&&i2c_write(b1, st.reg->pwr_mgmt_1, 1, data))
+    if (i2c_read(st.hw->addr, st.reg->accel_offs, 6, data))
         return -1;
     rev = ((data[5] & 0x01) << 2) | ((data[3] & 0x01) << 1) |
         (data[1] & 0x01);
@@ -759,7 +759,7 @@ int mpu_init(struct int_param_s *int_param)
             return -1;
         }
     } else {
-        if (i2c_read(a1, st.reg->prod_id, 1, data)&&i2c_read(b1, st.reg->prod_id, 1, data))
+        if (i2c_read(st.hw->addr, st.reg->prod_id, 1, data))
             return -1;
         rev = data[0] & 0x0F;
         if (!rev) {
@@ -787,7 +787,7 @@ int mpu_init(struct int_param_s *int_param)
      * first 3kB are needed by the DMP, we'll use the last 1kB for the FIFO.
      */
     data[0] = BIT_FIFO_SIZE_1024 | 0x8;
-    if (i2c_write(a, st.reg->accel_cfg2, 1, data))
+    if (i2c_write(st.hw->addr, st.reg->accel_cfg2, 1, data))
         return -1;
 #endif
 
@@ -870,7 +870,7 @@ int mpu_lp_accel_mode(unsigned char rate)
         mpu_set_int_latched(0);
         tmp[0] = 0;
         tmp[1] = BIT_STBY_XYZG;
-        if (i2c_write(a1, st.reg->pwr_mgmt_1, 2, tmp)&&i2c_write(b1, st.reg->pwr_mgmt_1, 2, tmp))
+        if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 2, tmp))
             return -1;
         st.chip_cfg.lp_accel_mode = 0;
         return 0;
@@ -899,7 +899,7 @@ int mpu_lp_accel_mode(unsigned char rate)
         mpu_set_lpf(20);
     }
     tmp[1] = (tmp[1] << 6) | BIT_STBY_XYZG;
-    if (i2c_write(a1, st.reg->pwr_mgmt_1, 2, tmp)&&i2c_write(b1, st.reg->pwr_mgmt_1, 2, tmp))
+    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 2, tmp))
         return -1;
 #elif defined MPU6500
     /* Set wake frequency. */
@@ -923,10 +923,10 @@ int mpu_lp_accel_mode(unsigned char rate)
         tmp[0] = INV_LPA_320HZ;
     else
         tmp[0] = INV_LPA_640HZ;
-    if (i2c_write(a, st.reg->lp_accel_odr, 1, tmp))
+    if (i2c_write(st.hw->addr, st.reg->lp_accel_odr, 1, tmp))
         return -1;
     tmp[0] = BIT_LPA_CYCLE;
-    if (i2c_write(a, st.reg->pwr_mgmt_1, 1, tmp))
+    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, tmp))
         return -1;
 #endif
     st.chip_cfg.sensors = INV_XYZ_ACCEL;
@@ -950,7 +950,7 @@ int mpu_get_gyro_reg(short *data, unsigned long *timestamp)
     if (!(st.chip_cfg.sensors & INV_XYZ_GYRO))
         return -1;
 
-    if (i2c_read(a1, st.reg->raw_gyro, 6, tmp)&&i2c_read(b1, st.reg->raw_gyro, 6, tmp))
+    if (i2c_read(st.hw->addr, st.reg->raw_gyro, 6, tmp))
         return -1;
     data[0] = (tmp[0] << 8) | tmp[1];
     data[1] = (tmp[2] << 8) | tmp[3];
@@ -973,7 +973,7 @@ int mpu_get_accel_reg(short *data, unsigned long *timestamp)
     if (!(st.chip_cfg.sensors & INV_XYZ_ACCEL))
         return -1;
 
-    if (i2c_read(a1, st.reg->raw_accel, 6, tmp)&&i2c_read(b1, st.reg->raw_accel, 6, tmp))
+    if (i2c_read(st.hw->addr, st.reg->raw_accel, 6, tmp))
         return -1;
     data[0] = (tmp[0] << 8) | tmp[1];
     data[1] = (tmp[2] << 8) | tmp[3];
@@ -997,7 +997,7 @@ int mpu_get_temperature(long *data, unsigned long *timestamp)
     if (!(st.chip_cfg.sensors))
         return -1;
 
-    if (i2c_read(a1, st.reg->temp, 2, tmp)&&i2c_read(b1, st.reg->temp, 2, tmp))
+    if (i2c_read(st.hw->addr, st.reg->temp, 2, tmp))
         return -1;
     raw = (tmp[0] << 8) | tmp[1];
     if (timestamp)
@@ -1026,7 +1026,7 @@ int mpu_set_accel_bias(const long *accel_bias)
     if (!accel_bias[0] && !accel_bias[1] && !accel_bias[2])
         return 0;
 
-    if (i2c_read(a1, 3, 3, data)&&i2c_read(b1, 3, 3, data))
+    if (i2c_read(st.hw->addr, 3, 3, data))
         return -1;
     fg[0] = ((data[0] >> 4) + 8) & 0xf;
     fg[1] = ((data[1] >> 4) + 8) & 0xf;
@@ -1036,7 +1036,7 @@ int mpu_set_accel_bias(const long *accel_bias)
     accel_hw[1] = (short)(accel_bias[1] * 2 / (64 + fg[1]));
     accel_hw[2] = (short)(accel_bias[2] * 2 / (64 + fg[2]));
 
-    if (i2c_read(a1, 0x06, 6, data)&&i2c_read(b1, 0x06, 6, data))
+    if (i2c_read(st.hw->addr, 0x06, 6, data))
         return -1;
 
     got_accel[0] = ((short)data[0] << 8) | data[1];
@@ -1054,7 +1054,7 @@ int mpu_set_accel_bias(const long *accel_bias)
     data[4] = (accel_hw[2] >> 8) & 0xff;
     data[5] = (accel_hw[2]) & 0xff;
 
-    if (i2c_write(a1, 0x06, 6, data)&&i2c_write(b1, 0x06, 6, data))
+    if (i2c_write(st.hw->addr, 0x06, 6, data))
         return -1;
     return 0;
 }
@@ -1071,50 +1071,50 @@ int mpu_reset_fifo(void)
         return -1;
 
     data = 0;
-    if (i2c_write(a1, st.reg->int_enable, 1, &data)&&i2c_write(b1, st.reg->int_enable, 1, &data))
+    if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &data))
         return -1;
-    if (i2c_write(a1, st.reg->fifo_en, 1, &data)&&i2c_write(b1, st.reg->fifo_en, 1, &data))
+    if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, &data))
         return -1;
-    if (i2c_write(a1, st.reg->user_ctrl, 1, &data)&&i2c_write(b1, st.reg->user_ctrl, 1, &data))
+    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
         return -1;
 
     if (st.chip_cfg.dmp_on) {
         data = BIT_FIFO_RST | BIT_DMP_RST;
-        if (i2c_write(a1, st.reg->user_ctrl, 1, &data)&&i2c_write(b1, st.reg->user_ctrl, 1, &data))
+        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
             return -1;
         delay_ms(50);
         data = BIT_DMP_EN | BIT_FIFO_EN;
         if (st.chip_cfg.sensors & INV_XYZ_COMPASS)
             data |= BIT_AUX_IF_EN;
-        if (i2c_write(a1, st.reg->user_ctrl, 1, &data)&&i2c_write(b1, st.reg->user_ctrl, 1, &data))
+        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
             return -1;
         if (st.chip_cfg.int_enable)
             data = BIT_DMP_INT_EN;
         else
             data = 0;
-        if (i2c_write(a1, st.reg->int_enable, 1, &data)&&i2c_write(b1, st.reg->int_enable, 1, &data))
+        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &data))
             return -1;
         data = 0;
-        if (i2c_write(a1, st.reg->fifo_en, 1, &data)&&i2c_write(b1, st.reg->fifo_en, 1, &data))
+        if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, &data))
             return -1;
     } else {
         data = BIT_FIFO_RST;
-        if (i2c_write(a1, st.reg->user_ctrl, 1, &data)&&i2c_write(b1, st.reg->user_ctrl, 1, &data))
+        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
             return -1;
         if (st.chip_cfg.bypass_mode || !(st.chip_cfg.sensors & INV_XYZ_COMPASS))
             data = BIT_FIFO_EN;
         else
             data = BIT_FIFO_EN | BIT_AUX_IF_EN;
-        if (i2c_write(a1, st.reg->user_ctrl, 1, &data)&&i2c_write(b1, st.reg->user_ctrl, 1, &data))
+        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
             return -1;
         delay_ms(50);
         if (st.chip_cfg.int_enable)
             data = BIT_DATA_RDY_EN;
         else
             data = 0;
-        if (i2c_write(a1, st.reg->int_enable, 1, &data)&&i2c_write(b1, st.reg->int_enable, 1, &data))
+        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &data))
             return -1;
-        if (i2c_write(a1, st.reg->fifo_en, 1, &st.chip_cfg.fifo_enable)&&i2c_write(b1, st.reg->fifo_en, 1, &st.chip_cfg.fifo_enable))
+        if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, &st.chip_cfg.fifo_enable))
             return -1;
     }
     return 0;
@@ -1178,7 +1178,7 @@ int mpu_set_gyro_fsr(unsigned short fsr)
 
     if (st.chip_cfg.gyro_fsr == (data >> 3))
         return 0;
-    if (i2c_write(a1, st.reg->gyro_cfg, 1, &data)&&i2c_write(b1, st.reg->gyro_cfg, 1, &data))
+    if (i2c_write(st.hw->addr, st.reg->gyro_cfg, 1, &data))
         return -1;
     st.chip_cfg.gyro_fsr = data >> 3;
     return 0;
@@ -1243,7 +1243,7 @@ int mpu_set_accel_fsr(unsigned char fsr)
 
     if (st.chip_cfg.accel_fsr == (data >> 3))
         return 0;
-    if (i2c_write(a1, st.reg->accel_cfg, 1, &data)&&i2c_write(b1, st.reg->accel_cfg, 1, &data))
+    if (i2c_write(st.hw->addr, st.reg->accel_cfg, 1, &data))
         return -1;
     st.chip_cfg.accel_fsr = data >> 3;
     return 0;
@@ -1312,7 +1312,7 @@ int mpu_set_lpf(unsigned short lpf)
 
     if (st.chip_cfg.lpf == data)
         return 0;
-    if (i2c_write(a1, st.reg->lpf, 1, &data)&&i2c_write(b1, st.reg->lpf, 1, &data))
+    if (i2c_write(st.hw->addr, st.reg->lpf, 1, &data))
         return -1;
     st.chip_cfg.lpf = data;
     return 0;
@@ -1366,7 +1366,7 @@ int mpu_set_sample_rate(unsigned short rate)
             rate = 1000;
 
         data = 1000 / rate - 1;
-        if (i2c_write(a1, st.reg->rate_div, 1, &data)&&i2c_write(b1, st.reg->rate_div, 1, &data))
+        if (i2c_write(st.hw->addr, st.reg->rate_div, 1, &data))
             return -1;
 
         st.chip_cfg.sample_rate = 1000 / (1 + data);
@@ -1416,7 +1416,7 @@ int mpu_set_compass_sample_rate(unsigned short rate)
         return -1;
 
     div = st.chip_cfg.sample_rate / rate - 1;
-    if (i2c_write(a, st.reg->s4_ctrl, 1, &div))
+    if (i2c_write(st.hw->addr, st.reg->s4_ctrl, 1, &div))
         return -1;
     st.chip_cfg.compass_sample_rate = st.chip_cfg.sample_rate / (div + 1);
     return 0;
@@ -1577,7 +1577,7 @@ int mpu_set_sensors(unsigned char sensors)
         data = 0;
     else
         data = BIT_SLEEP;
-    if (i2c_write(a1, st.reg->pwr_mgmt_1, 1, &data)&&i2c_write(b1, st.reg->pwr_mgmt_1, 1, &data)) {
+    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, &data)) {
         st.chip_cfg.sensors = 0;
         return -1;
     }
@@ -1592,7 +1592,7 @@ int mpu_set_sensors(unsigned char sensors)
         data |= BIT_STBY_ZG;
     if (!(sensors & INV_XYZ_ACCEL))
         data |= BIT_STBY_XYZA;
-    if (i2c_write(a1, st.reg->pwr_mgmt_2, 1, &data)&&i2c_write(b1, st.reg->pwr_mgmt_2, 1, &data)) {
+    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_2, 1, &data)) {
         st.chip_cfg.sensors = 0;
         return -1;
     }
@@ -1608,7 +1608,7 @@ int mpu_set_sensors(unsigned char sensors)
     else
         mpu_set_bypass(0);
 #else
-    if (i2c_read(a, st.reg->user_ctrl, 1, &user_ctrl))
+    if (i2c_read(st.hw->addr, st.reg->user_ctrl, 1, &user_ctrl))
         return -1;
     /* Handle AKM power management. */
     if (sensors & INV_XYZ_COMPASS) {
@@ -1622,10 +1622,10 @@ int mpu_set_sensors(unsigned char sensors)
         user_ctrl |= BIT_DMP_EN;
     else
         user_ctrl &= ~BIT_DMP_EN;
-    if (i2c_write(a, st.reg->s1_do, 1, &data))
+    if (i2c_write(st.hw->addr, st.reg->s1_do, 1, &data))
         return -1;
     /* Enable/disable I2C master mode. */
-    if (i2c_write(a, st.reg->user_ctrl, 1, &user_ctrl))
+    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &user_ctrl))
         return -1;
 #endif
 #endif
@@ -1646,7 +1646,7 @@ int mpu_get_int_status(short *status)
     unsigned char tmp[2];
     if (!st.chip_cfg.sensors)
         return -1;
-    if (i2c_read(a1, st.reg->dmp_int_status, 2, tmp)&&i2c_read(b1, st.reg->dmp_int_status, 2, tmp))
+    if (i2c_read(st.hw->addr, st.reg->dmp_int_status, 2, tmp))
         return -1;
     status[0] = (tmp[0] << 8) | tmp[1];
     return 0;
@@ -1696,7 +1696,7 @@ int mpu_read_fifo(short *gyro, short *accel, unsigned long *timestamp,
     if (st.chip_cfg.fifo_enable & INV_XYZ_ACCEL)
         packet_size += 6;
 
-    if (i2c_read(a1, st.reg->fifo_count_h, 2, data)&&i2c_read(b1, st.reg->fifo_count_h, 2, data))
+    if (i2c_read(st.hw->addr, st.reg->fifo_count_h, 2, data))
         return -1;
     fifo_count = (data[0] << 8) | data[1];
     if (fifo_count < packet_size)
@@ -1704,7 +1704,7 @@ int mpu_read_fifo(short *gyro, short *accel, unsigned long *timestamp,
 //    log_i("FIFO count: %hd\n", fifo_count);
     if (fifo_count > (st.hw->max_fifo >> 1)) {
         /* FIFO is 50% full, better check overflow bit. */
-        if (i2c_read(a1, st.reg->int_status, 1, data)&&i2c_read(b1, st.reg->int_status, 1, data))
+        if (i2c_read(st.hw->addr, st.reg->int_status, 1, data))
             return -1;
         if (data[0] & BIT_FIFO_OVERFLOW) {
             mpu_reset_fifo();
@@ -1713,7 +1713,7 @@ int mpu_read_fifo(short *gyro, short *accel, unsigned long *timestamp,
     }
     get_ms((unsigned long*)timestamp);
 
-    if (i2c_read(a1, st.reg->fifo_r_w, packet_size, data)&&i2c_read(b1, st.reg->fifo_r_w, packet_size, data))
+    if (i2c_read(st.hw->addr, st.reg->fifo_r_w, packet_size, data))
         return -1;
     more[0] = fifo_count / packet_size - 1;
     sensors[0] = 0;
@@ -1757,7 +1757,7 @@ int mpu_read_fifo_stream(unsigned short length, unsigned char *data,
     unsigned char tmp[2];
     unsigned short fifo_count;
 
-//    printf("addr %d, dmp_on %d, sensors %d\r\n", a, st.chip_cfg.dmp_on, st.chip_cfg.sensors);
+//    printf("addr %d, dmp_on %d, sensors %d\r\n", st.hw->addr, st.chip_cfg.dmp_on, st.chip_cfg.sensors);
 
     if (!st.chip_cfg.dmp_on)
         return -1;
@@ -1766,7 +1766,7 @@ int mpu_read_fifo_stream(unsigned short length, unsigned char *data,
 
 //    printf("----1\r\n");
 
-    if (i2c_read(a1, st.reg->fifo_count_h, 2, tmp)&&i2c_read(b1, st.reg->fifo_count_h, 2, tmp))
+    if (i2c_read(st.hw->addr, st.reg->fifo_count_h, 2, tmp))
         return -1;
 
 //    printf("----2\r\n");
@@ -1782,7 +1782,7 @@ int mpu_read_fifo_stream(unsigned short length, unsigned char *data,
 
 //        printf("----3.1\r\n");
         /* FIFO is 50% full, better check overflow bit. */
-        if (i2c_read(a1, st.reg->int_status, 1, tmp)&&i2c_read(b1, st.reg->int_status, 1, tmp))
+        if (i2c_read(st.hw->addr, st.reg->int_status, 1, tmp))
             return -1;
 
 //        printf("----3.2\r\n");
@@ -1793,7 +1793,7 @@ int mpu_read_fifo_stream(unsigned short length, unsigned char *data,
     }
 
 //    printf("----4\r\n");
-    if (i2c_read(a1, st.reg->fifo_r_w, length, data)&&i2c_read(b1, st.reg->fifo_r_w, length, data))
+    if (i2c_read(st.hw->addr, st.reg->fifo_r_w, length, data))
         return -1;
 
     more[0] = fifo_count / length - 1;
@@ -1813,10 +1813,10 @@ int mpu_set_bypass(unsigned char bypass_on)
         return 0;
 
     if (bypass_on) {
-        if (i2c_read(a1, st.reg->user_ctrl, 1, &tmp)&&i2c_read(b1, st.reg->user_ctrl, 1, &tmp))
+        if (i2c_read(st.hw->addr, st.reg->user_ctrl, 1, &tmp))
             return -1;
         tmp &= ~BIT_AUX_IF_EN;
-        if (i2c_write(a1, st.reg->user_ctrl, 1, &tmp)&&i2c_write(b1, st.reg->user_ctrl, 1, &tmp))
+        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &tmp))
             return -1;
         delay_ms(3);
         tmp = BIT_BYPASS_EN;
@@ -1824,17 +1824,17 @@ int mpu_set_bypass(unsigned char bypass_on)
             tmp |= BIT_ACTL;
         if (st.chip_cfg.latched_int)
             tmp |= BIT_LATCH_EN | BIT_ANY_RD_CLR;
-        if (i2c_write(a1, st.reg->int_pin_cfg, 1, &tmp)&&i2c_write(b1, st.reg->int_pin_cfg, 1, &tmp))
+        if (i2c_write(st.hw->addr, st.reg->int_pin_cfg, 1, &tmp))
             return -1;
     } else {
         /* Enable I2C master mode if compass is being used. */
-        if (i2c_read(a1, st.reg->user_ctrl, 1, &tmp)&&i2c_read(b1, st.reg->user_ctrl, 1, &tmp))
+        if (i2c_read(st.hw->addr, st.reg->user_ctrl, 1, &tmp))
             return -1;
         if (st.chip_cfg.sensors & INV_XYZ_COMPASS)
             tmp |= BIT_AUX_IF_EN;
         else
             tmp &= ~BIT_AUX_IF_EN;
-        if (i2c_write(a1, st.reg->user_ctrl, 1, &tmp)&&i2c_write(b1, st.reg->user_ctrl, 1, &tmp))
+        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &tmp))
             return -1;
         delay_ms(3);
         if (st.chip_cfg.active_low_int)
@@ -1843,7 +1843,7 @@ int mpu_set_bypass(unsigned char bypass_on)
             tmp = 0;
         if (st.chip_cfg.latched_int)
             tmp |= BIT_LATCH_EN | BIT_ANY_RD_CLR;
-        if (i2c_write(a1, st.reg->int_pin_cfg, 1, &tmp)&&i2c_write(b1, st.reg->int_pin_cfg, 1, &tmp))
+        if (i2c_write(st.hw->addr, st.reg->int_pin_cfg, 1, &tmp))
             return -1;
     }
     st.chip_cfg.bypass_mode = bypass_on;
@@ -1881,7 +1881,7 @@ int mpu_set_int_latched(unsigned char enable)
         tmp |= BIT_BYPASS_EN;
     if (st.chip_cfg.active_low_int)
         tmp |= BIT_ACTL;
-    if (i2c_write(a1, st.reg->int_pin_cfg, 1, &tmp)&&i2c_write(b1, st.reg->int_pin_cfg, 1, &tmp))
+    if (i2c_write(st.hw->addr, st.reg->int_pin_cfg, 1, &tmp))
         return -1;
     st.chip_cfg.latched_int = enable;
     return 0;
@@ -1892,7 +1892,7 @@ static int get_accel_prod_shift(float *st_shift)
 {
     unsigned char tmp[4], shift_code[3], ii;
 
-    if (i2c_read(a1, 0x0D, 4, tmp)&&i2c_read(b1, 0x0D, 4, tmp))
+    if (i2c_read(st.hw->addr, 0x0D, 4, tmp))
         return 0x07;
 
     shift_code[0] = ((tmp[0] & 0xE0) >> 3) | ((tmp[3] & 0x30) >> 4);
@@ -1939,7 +1939,7 @@ static int gyro_self_test(long *bias_regular, long *bias_st)
     unsigned char tmp[3];
     float st_shift, st_shift_cust, st_shift_var;
 
-    if (i2c_read(a1, 0x0D, 3, tmp)&&i2c_read(b1, 0x0D, 3, tmp))
+    if (i2c_read(st.hw->addr, 0x0D, 3, tmp))
         return 0x07;
 
     tmp[0] &= 0x1F;
@@ -2025,60 +2025,60 @@ static int get_st_biases(long *gyro, long *accel, unsigned char hw_test)
 
     data[0] = 0x01;
     data[1] = 0;
-    if (i2c_write(a1, st.reg->pwr_mgmt_1, 2, data)&&i2c_write(b1, st.reg->pwr_mgmt_1, 2, data))
+    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 2, data))
         return -1;
     delay_ms(200);
     data[0] = 0;
-    if (i2c_write(a1, st.reg->int_enable, 1, data)&&i2c_write(b1, st.reg->int_enable, 1, data))
+    if (i2c_write(st.hw->addr, st.reg->int_enable, 1, data))
         return -1;
-    if (i2c_write(a1, st.reg->fifo_en, 1, data)&&i2c_write(b1, st.reg->fifo_en, 1, data))
+    if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, data))
         return -1;
-    if (i2c_write(a1, st.reg->pwr_mgmt_1, 1, data)&&i2c_write(b1, st.reg->pwr_mgmt_1, 1, data))
+    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, data))
         return -1;
-    if (i2c_write(a1, st.reg->i2c_mst, 1, data)&&i2c_write(b1, st.reg->i2c_mst, 1, data))
+    if (i2c_write(st.hw->addr, st.reg->i2c_mst, 1, data))
         return -1;
-    if (i2c_write(a1, st.reg->user_ctrl, 1, data)&&i2c_write(b1, st.reg->user_ctrl, 1, data))
+    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, data))
         return -1;
     data[0] = BIT_FIFO_RST | BIT_DMP_RST;
-    if (i2c_write(a1, st.reg->user_ctrl, 1, data)&&i2c_write(b1, st.reg->user_ctrl, 1, data))
+    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, data))
         return -1;
     delay_ms(15);
     data[0] = st.test->reg_lpf;
-    if (i2c_write(a1, st.reg->lpf, 1, data)&&i2c_write(b1, st.reg->lpf, 1, data))
+    if (i2c_write(st.hw->addr, st.reg->lpf, 1, data))
         return -1;
     data[0] = st.test->reg_rate_div;
-    if (i2c_write(a1, st.reg->rate_div, 1, data)&&i2c_write(b1, st.reg->rate_div, 1, data))
+    if (i2c_write(st.hw->addr, st.reg->rate_div, 1, data))
         return -1;
     if (hw_test)
         data[0] = st.test->reg_gyro_fsr | 0xE0;
     else
         data[0] = st.test->reg_gyro_fsr;
-    if (i2c_write(a1, st.reg->gyro_cfg, 1, data)&&i2c_write(b1, st.reg->gyro_cfg, 1, data))
+    if (i2c_write(st.hw->addr, st.reg->gyro_cfg, 1, data))
         return -1;
 
     if (hw_test)
         data[0] = st.test->reg_accel_fsr | 0xE0;
     else
         data[0] = test.reg_accel_fsr;
-    if (i2c_write(a1, st.reg->accel_cfg, 1, data)&&i2c_write(b1, st.reg->accel_cfg, 1, data))
+    if (i2c_write(st.hw->addr, st.reg->accel_cfg, 1, data))
         return -1;
     if (hw_test)
         delay_ms(200);
 
     /* Fill FIFO for test.wait_ms milliseconds. */
     data[0] = BIT_FIFO_EN;
-    if (i2c_write(a1, st.reg->user_ctrl, 1, data)&&i2c_write(b1, st.reg->user_ctrl, 1, data))
+    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, data))
         return -1;
 
     data[0] = INV_XYZ_GYRO | INV_XYZ_ACCEL;
-    if (i2c_write(a1, st.reg->fifo_en, 1, data)&&i2c_write(b1, st.reg->fifo_en, 1, data))
+    if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, data))
         return -1;
     delay_ms(test.wait_ms);
     data[0] = 0;
-    if (i2c_write(a1, st.reg->fifo_en, 1, data)&&i2c_write(b1, st.reg->fifo_en, 1, data))
+    if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, data))
         return -1;
 
-    if (i2c_read(a1, st.reg->fifo_count_h, 2, data)&&i2c_write(b1, st.reg->fifo_count_h, 2, data))
+    if (i2c_read(st.hw->addr, st.reg->fifo_count_h, 2, data))
         return -1;
 
     fifo_count = (data[0] << 8) | data[1];
@@ -2088,7 +2088,7 @@ static int get_st_biases(long *gyro, long *accel, unsigned char hw_test)
 
     for (ii = 0; ii < packet_count; ii++) {
         short accel_cur[3], gyro_cur[3];
-        if (i2c_read(a1, st.reg->fifo_r_w, MAX_PACKET_LENGTH, data)&&i2c_read(b1, st.reg->fifo_r_w, MAX_PACKET_LENGTH, data))
+        if (i2c_read(st.hw->addr, st.reg->fifo_r_w, MAX_PACKET_LENGTH, data))
             return -1;
         accel_cur[0] = ((short)data[0] << 8) | data[1];
         accel_cur[1] = ((short)data[2] << 8) | data[3];
@@ -2276,9 +2276,9 @@ int mpu_write_mem(unsigned short mem_addr, unsigned short length,
     if (tmp[1] + length > st.hw->bank_size)
         return -1;
 
-    if (i2c_write(a1, st.reg->bank_sel, 2, tmp)&&i2c_write(b1, st.reg->bank_sel, 2, tmp))
+    if (i2c_write(st.hw->addr, st.reg->bank_sel, 2, tmp))
         return -1;
-    if (i2c_write(a1, st.reg->mem_r_w, length, data)&&i2c_write(b1, st.reg->bank_sel, 2, tmp))
+    if (i2c_write(st.hw->addr, st.reg->mem_r_w, length, data))
         return -1;
     return 0;
 }
@@ -2309,9 +2309,9 @@ int mpu_read_mem(unsigned short mem_addr, unsigned short length,
     if (tmp[1] + length > st.hw->bank_size)
         return -1;
 
-    if (i2c_write(a1, st.reg->bank_sel, 2, tmp)&&i2c_write(a1, st.reg->bank_sel, 2, tmp))
+    if (i2c_write(st.hw->addr, st.reg->bank_sel, 2, tmp))
         return -1;
-    if (i2c_read(a1, st.reg->mem_r_w, length, data)&&i2c_write(a1, st.reg->mem_r_w, length, tmp))
+    if (i2c_read(st.hw->addr, st.reg->mem_r_w, length, data))
         return -1;
     return 0;
 }
@@ -2352,7 +2352,7 @@ int mpu_load_firmware(unsigned short length, const unsigned char *firmware,
     /* Set program start address. */
     tmp[0] = start_addr >> 8;
     tmp[1] = start_addr & 0xFF;
-    if (i2c_write(a1, st.reg->prgm_start_h, 2, tmp)&&i2c_write(b1, st.reg->prgm_start_h, 2, tmp))
+    if (i2c_write(st.hw->addr, st.reg->prgm_start_h, 2, tmp))
         return -1;
 
     st.chip_cfg.dmp_loaded = 1;
@@ -2382,8 +2382,7 @@ int mpu_set_dmp_state(unsigned char enable)
         mpu_set_sample_rate(st.chip_cfg.dmp_sample_rate);
         /* Remove FIFO elements. */
         tmp = 0;
-        i2c_write(a1, 0x23, 1, &tmp);
-        i2c_write(b1, 0x23, 1, &tmp);
+        i2c_write(st.hw->addr, 0x23, 1, &tmp);
         st.chip_cfg.dmp_on = 1;
         /* Enable DMP interrupt. */
         set_int_enable(1);
@@ -2393,8 +2392,7 @@ int mpu_set_dmp_state(unsigned char enable)
         set_int_enable(0);
         /* Restore FIFO settings. */
         tmp = st.chip_cfg.fifo_enable;
-        i2c_write(a1, 0x23, 1, &tmp);
-        i2c_write(b1, 0x23, 1, &tmp);
+        i2c_write(st.hw->addr, 0x23, 1, &tmp);
         st.chip_cfg.dmp_on = 0;
         mpu_reset_fifo();
     }
@@ -2463,53 +2461,53 @@ static int setup_compass(void)
 
     /* Set up master mode, master clock, and ES bit. */
     data[0] = 0x40;
-    if (i2c_write(a, st.reg->i2c_mst, 1, data))
+    if (i2c_write(st.hw->addr, st.reg->i2c_mst, 1, data))
         return -1;
 
     /* Slave 0 reads from AKM data registers. */
     data[0] = BIT_I2C_READ | st.chip_cfg.compass_addr;
-    if (i2c_write(a, st.reg->s0_addr, 1, data))
+    if (i2c_write(st.hw->addr, st.reg->s0_addr, 1, data))
         return -1;
 
     /* Compass reads start at this register. */
     data[0] = AKM_REG_ST1;
-    if (i2c_write(a, st.reg->s0_reg, 1, data))
+    if (i2c_write(st.hw->addr, st.reg->s0_reg, 1, data))
         return -1;
 
     /* Enable slave 0, 8-byte reads. */
     data[0] = BIT_SLAVE_EN | 8;
-    if (i2c_write(a, st.reg->s0_ctrl, 1, data))
+    if (i2c_write(st.hw->addr, st.reg->s0_ctrl, 1, data))
         return -1;
 
     /* Slave 1 changes AKM measurement mode. */
     data[0] = st.chip_cfg.compass_addr;
-    if (i2c_write(a, st.reg->s1_addr, 1, data))
+    if (i2c_write(st.hw->addr, st.reg->s1_addr, 1, data))
         return -1;
 
     /* AKM measurement mode register. */
     data[0] = AKM_REG_CNTL;
-    if (i2c_write(a, st.reg->s1_reg, 1, data))
+    if (i2c_write(st.hw->addr, st.reg->s1_reg, 1, data))
         return -1;
 
     /* Enable slave 1, 1-byte writes. */
     data[0] = BIT_SLAVE_EN | 1;
-    if (i2c_write(a, st.reg->s1_ctrl, 1, data))
+    if (i2c_write(st.hw->addr, st.reg->s1_ctrl, 1, data))
         return -1;
 
     /* Set slave 1 data. */
     data[0] = AKM_SINGLE_MEASUREMENT;
-    if (i2c_write(a, st.reg->s1_do, 1, data))
+    if (i2c_write(st.hw->addr, st.reg->s1_do, 1, data))
         return -1;
 
     /* Trigger slave 0 and slave 1 actions at each sample. */
     data[0] = 0x03;
-    if (i2c_write(a, st.reg->i2c_delay_ctrl, 1, data))
+    if (i2c_write(st.hw->addr, st.reg->i2c_delay_ctrl, 1, data))
         return -1;
 
 #ifdef MPU9150
     /* For the MPU9150, the auxiliary I2C bus needs to be set to VDD. */
     data[0] = BIT_I2C_MST_VDDIO;
-    if (i2c_write(a, st.reg->yg_offs_tc, 1, data))
+    if (i2c_write(st.hw->addr, st.reg->yg_offs_tc, 1, data))
         return -1;
 #endif
 
@@ -2540,7 +2538,7 @@ int mpu_get_compass_reg(short *data, unsigned long *timestamp)
     if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, tmp+8))
         return -1;
 #else
-    if (i2c_read(a, st.reg->raw_compass, 8, tmp))
+    if (i2c_read(st.hw->addr, st.reg->raw_compass, 8, tmp))
         return -1;
 #endif
 
@@ -2679,12 +2677,12 @@ int mpu_lp_motion_interrupt(unsigned short thresh, unsigned char time,
         data[0] = 0;
         data[1] = 0;
         data[2] = BIT_STBY_XYZG;
-        if (i2c_write(a, st.reg->user_ctrl, 3, data))
+        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 3, data))
             goto lp_int_restore;
 
         /* Set motion threshold. */
         data[0] = thresh_hw;
-        if (i2c_write(a, st.reg->motion_thr, 1, data))
+        if (i2c_write(st.hw->addr, st.reg->motion_thr, 1, data))
             goto lp_int_restore;
 
         /* Set wake frequency. */
@@ -2708,22 +2706,22 @@ int mpu_lp_motion_interrupt(unsigned short thresh, unsigned char time,
             data[0] = INV_LPA_320HZ;
         else
             data[0] = INV_LPA_640HZ;
-        if (i2c_write(a, st.reg->lp_accel_odr, 1, data))
+        if (i2c_write(st.hw->addr, st.reg->lp_accel_odr, 1, data))
             goto lp_int_restore;
 
         /* Enable motion interrupt (MPU6500 version). */
         data[0] = BITS_WOM_EN;
-        if (i2c_write(a, st.reg->accel_intel, 1, data))
+        if (i2c_write(st.hw->addr, st.reg->accel_intel, 1, data))
             goto lp_int_restore;
 
         /* Enable cycle mode. */
         data[0] = BIT_LPA_CYCLE;
-        if (i2c_write(a, st.reg->pwr_mgmt_1, 1, data))
+        if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, data))
             goto lp_int_restore;
 
         /* Enable interrupt. */
         data[0] = BIT_MOT_INT_EN;
-        if (i2c_write(a, st.reg->int_enable, 1, data))
+        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, data))
             goto lp_int_restore;
 
         st.chip_cfg.int_motion_only = 1;
@@ -2762,7 +2760,7 @@ lp_int_restore:
 #ifdef MPU6500
     /* Disable motion interrupt (MPU6500 version). */
     data[0] = 0;
-    if (i2c_write(a, st.reg->accel_intel, 1, data))
+    if (i2c_write(st.hw->addr, st.reg->accel_intel, 1, data))
         goto lp_int_restore;
 #endif
 

+ 0 - 69
Core备份3/Inc/main.h

@@ -1,69 +0,0 @@
-/* USER CODE BEGIN Header */
-/**
-  ******************************************************************************
-  * @file           : main.h
-  * @brief          : Header for main.c file.
-  *                   This file contains the common defines of the application.
-  ******************************************************************************
-  * @attention
-  *
-  * Copyright (c) 2024 STMicroelectronics.
-  * All rights reserved.
-  *
-  * This software is licensed under terms that can be found in the LICENSE file
-  * in the root directory of this software component.
-  * If no LICENSE file comes with this software, it is provided AS-IS.
-  *
-  ******************************************************************************
-  */
-/* USER CODE END Header */
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __MAIN_H
-#define __MAIN_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Includes ------------------------------------------------------------------*/
-#include "stm32h7xx_hal.h"
-
-/* Private includes ----------------------------------------------------------*/
-/* USER CODE BEGIN Includes */
-
-/* USER CODE END Includes */
-
-/* Exported types ------------------------------------------------------------*/
-/* USER CODE BEGIN ET */
-
-/* USER CODE END ET */
-
-/* Exported constants --------------------------------------------------------*/
-/* USER CODE BEGIN EC */
-
-/* USER CODE END EC */
-
-/* Exported macro ------------------------------------------------------------*/
-/* USER CODE BEGIN EM */
-
-/* USER CODE END EM */
-
-/* Exported functions prototypes ---------------------------------------------*/
-void Error_Handler(void);
-
-/* USER CODE BEGIN EFP */
-
-/* USER CODE END EFP */
-
-/* Private defines -----------------------------------------------------------*/
-
-/* USER CODE BEGIN Private defines */
-
-/* USER CODE END Private defines */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __MAIN_H */

+ 0 - 342
Core备份3/Src/i2c.c

@@ -1,342 +0,0 @@
-/* USER CODE BEGIN Header */
-/**
-  ******************************************************************************
-  * @file    i2c.c
-  * @brief   This file provides code for the configuration
-  *          of the I2C instances.
-  ******************************************************************************
-  * @attention
-  *
-  * Copyright (c) 2024 STMicroelectronics.
-  * All rights reserved.
-  *
-  * This software is licensed under terms that can be found in the LICENSE file
-  * in the root directory of this software component.
-  * If no LICENSE file comes with this software, it is provided AS-IS.
-  *
-  ******************************************************************************
-  */
-/* USER CODE END Header */
-/* Includes ------------------------------------------------------------------*/
-#include "i2c.h"
-
-/* USER CODE BEGIN 0 */
-
-/* USER CODE END 0 */
-
-I2C_HandleTypeDef hi2c1;
-I2C_HandleTypeDef hi2c2;
-I2C_HandleTypeDef hi2c3;
-
-/* I2C1 init function */
-void MX_I2C1_Init(void)
-{
-
-  /* USER CODE BEGIN I2C1_Init 0 */
-
-  /* USER CODE END I2C1_Init 0 */
-
-  /* USER CODE BEGIN I2C1_Init 1 */
-
-  /* USER CODE END I2C1_Init 1 */
-  hi2c1.Instance = I2C1;
-  hi2c1.Init.Timing = 0x10C0ECFF;
-  hi2c1.Init.OwnAddress1 = 0;
-  hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
-  hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
-  hi2c1.Init.OwnAddress2 = 0;
-  hi2c1.Init.OwnAddress2Masks = I2C_OA2_NOMASK;
-  hi2c1.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
-  hi2c1.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
-  if (HAL_I2C_Init(&hi2c1) != HAL_OK)
-  {
-    Error_Handler();
-  }
-
-  /** Configure Analogue filter
-  */
-  if (HAL_I2CEx_ConfigAnalogFilter(&hi2c1, I2C_ANALOGFILTER_ENABLE) != HAL_OK)
-  {
-    Error_Handler();
-  }
-
-  /** Configure Digital filter
-  */
-  if (HAL_I2CEx_ConfigDigitalFilter(&hi2c1, 0) != HAL_OK)
-  {
-    Error_Handler();
-  }
-  /* USER CODE BEGIN I2C1_Init 2 */
-
-  /* USER CODE END I2C1_Init 2 */
-
-}
-/* I2C2 init function */
-void MX_I2C2_Init(void)
-{
-
-  /* USER CODE BEGIN I2C2_Init 0 */
-
-  /* USER CODE END I2C2_Init 0 */
-
-  /* USER CODE BEGIN I2C2_Init 1 */
-
-  /* USER CODE END I2C2_Init 1 */
-  hi2c2.Instance = I2C2;
-  hi2c2.Init.Timing = 0x10C0ECFF;
-  hi2c2.Init.OwnAddress1 = 0;
-  hi2c2.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
-  hi2c2.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
-  hi2c2.Init.OwnAddress2 = 0;
-  hi2c2.Init.OwnAddress2Masks = I2C_OA2_NOMASK;
-  hi2c2.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
-  hi2c2.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
-  if (HAL_I2C_Init(&hi2c2) != HAL_OK)
-  {
-    Error_Handler();
-  }
-
-  /** Configure Analogue filter
-  */
-  if (HAL_I2CEx_ConfigAnalogFilter(&hi2c2, I2C_ANALOGFILTER_ENABLE) != HAL_OK)
-  {
-    Error_Handler();
-  }
-
-  /** Configure Digital filter
-  */
-  if (HAL_I2CEx_ConfigDigitalFilter(&hi2c2, 0) != HAL_OK)
-  {
-    Error_Handler();
-  }
-  /* USER CODE BEGIN I2C2_Init 2 */
-
-  /* USER CODE END I2C2_Init 2 */
-
-}
-/* I2C3 init function */
-void MX_I2C3_Init(void)
-{
-
-  /* USER CODE BEGIN I2C3_Init 0 */
-
-  /* USER CODE END I2C3_Init 0 */
-
-  /* USER CODE BEGIN I2C3_Init 1 */
-
-  /* USER CODE END I2C3_Init 1 */
-  hi2c3.Instance = I2C3;
-  hi2c3.Init.Timing = 0x10C0ECFF;
-  hi2c3.Init.OwnAddress1 = 0;
-  hi2c3.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
-  hi2c3.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
-  hi2c3.Init.OwnAddress2 = 0;
-  hi2c3.Init.OwnAddress2Masks = I2C_OA2_NOMASK;
-  hi2c3.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
-  hi2c3.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
-  if (HAL_I2C_Init(&hi2c3) != HAL_OK)
-  {
-    Error_Handler();
-  }
-
-  /** Configure Analogue filter
-  */
-  if (HAL_I2CEx_ConfigAnalogFilter(&hi2c3, I2C_ANALOGFILTER_ENABLE) != HAL_OK)
-  {
-    Error_Handler();
-  }
-
-  /** Configure Digital filter
-  */
-  if (HAL_I2CEx_ConfigDigitalFilter(&hi2c3, 0) != HAL_OK)
-  {
-    Error_Handler();
-  }
-  /* USER CODE BEGIN I2C3_Init 2 */
-
-  /* USER CODE END I2C3_Init 2 */
-
-}
-
-void HAL_I2C_MspInit(I2C_HandleTypeDef* i2cHandle)
-{
-
-  GPIO_InitTypeDef GPIO_InitStruct = {0};
-  RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
-  if(i2cHandle->Instance==I2C1)
-  {
-  /* USER CODE BEGIN I2C1_MspInit 0 */
-
-  /* USER CODE END I2C1_MspInit 0 */
-
-  /** Initializes the peripherals clock
-  */
-    PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_I2C1;
-    PeriphClkInitStruct.I2c123ClockSelection = RCC_I2C123CLKSOURCE_D2PCLK1;
-    if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
-    {
-      Error_Handler();
-    }
-
-    __HAL_RCC_GPIOB_CLK_ENABLE();
-    /**I2C1 GPIO Configuration
-    PB7     ------> I2C1_SDA
-    PB8     ------> I2C1_SCL
-    */
-    GPIO_InitStruct.Pin = GPIO_PIN_7|GPIO_PIN_8;
-    GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
-    GPIO_InitStruct.Pull = GPIO_NOPULL;
-    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
-    GPIO_InitStruct.Alternate = GPIO_AF4_I2C1;
-    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
-
-    /* I2C1 clock enable */
-    __HAL_RCC_I2C1_CLK_ENABLE();
-  /* USER CODE BEGIN I2C1_MspInit 1 */
-
-  /* USER CODE END I2C1_MspInit 1 */
-  }
-  else if(i2cHandle->Instance==I2C2)
-  {
-  /* USER CODE BEGIN I2C2_MspInit 0 */
-
-  /* USER CODE END I2C2_MspInit 0 */
-
-  /** Initializes the peripherals clock
-  */
-    PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_I2C2;
-    PeriphClkInitStruct.I2c123ClockSelection = RCC_I2C123CLKSOURCE_D2PCLK1;
-    if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
-    {
-      Error_Handler();
-    }
-
-    __HAL_RCC_GPIOB_CLK_ENABLE();
-    /**I2C2 GPIO Configuration
-    PB10     ------> I2C2_SCL
-    PB11     ------> I2C2_SDA
-    */
-    GPIO_InitStruct.Pin = GPIO_PIN_10|GPIO_PIN_11;
-    GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
-    GPIO_InitStruct.Pull = GPIO_NOPULL;
-    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
-    GPIO_InitStruct.Alternate = GPIO_AF4_I2C2;
-    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
-
-    /* I2C2 clock enable */
-    __HAL_RCC_I2C2_CLK_ENABLE();
-  /* USER CODE BEGIN I2C2_MspInit 1 */
-
-  /* USER CODE END I2C2_MspInit 1 */
-  }
-  else if(i2cHandle->Instance==I2C3)
-  {
-  /* USER CODE BEGIN I2C3_MspInit 0 */
-
-  /* USER CODE END I2C3_MspInit 0 */
-
-  /** Initializes the peripherals clock
-  */
-    PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_I2C3;
-    PeriphClkInitStruct.I2c123ClockSelection = RCC_I2C123CLKSOURCE_D2PCLK1;
-    if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
-    {
-      Error_Handler();
-    }
-
-    __HAL_RCC_GPIOC_CLK_ENABLE();
-    __HAL_RCC_GPIOA_CLK_ENABLE();
-    /**I2C3 GPIO Configuration
-    PC9     ------> I2C3_SDA
-    PA8     ------> I2C3_SCL
-    */
-    GPIO_InitStruct.Pin = GPIO_PIN_9;
-    GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
-    GPIO_InitStruct.Pull = GPIO_NOPULL;
-    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
-    GPIO_InitStruct.Alternate = GPIO_AF4_I2C3;
-    HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
-
-    GPIO_InitStruct.Pin = GPIO_PIN_8;
-    GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
-    GPIO_InitStruct.Pull = GPIO_NOPULL;
-    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
-    GPIO_InitStruct.Alternate = GPIO_AF4_I2C3;
-    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
-
-    /* I2C3 clock enable */
-    __HAL_RCC_I2C3_CLK_ENABLE();
-  /* USER CODE BEGIN I2C3_MspInit 1 */
-
-  /* USER CODE END I2C3_MspInit 1 */
-  }
-}
-
-void HAL_I2C_MspDeInit(I2C_HandleTypeDef* i2cHandle)
-{
-
-  if(i2cHandle->Instance==I2C1)
-  {
-  /* USER CODE BEGIN I2C1_MspDeInit 0 */
-
-  /* USER CODE END I2C1_MspDeInit 0 */
-    /* Peripheral clock disable */
-    __HAL_RCC_I2C1_CLK_DISABLE();
-
-    /**I2C1 GPIO Configuration
-    PB7     ------> I2C1_SDA
-    PB8     ------> I2C1_SCL
-    */
-    HAL_GPIO_DeInit(GPIOB, GPIO_PIN_7);
-
-    HAL_GPIO_DeInit(GPIOB, GPIO_PIN_8);
-
-  /* USER CODE BEGIN I2C1_MspDeInit 1 */
-
-  /* USER CODE END I2C1_MspDeInit 1 */
-  }
-  else if(i2cHandle->Instance==I2C2)
-  {
-  /* USER CODE BEGIN I2C2_MspDeInit 0 */
-
-  /* USER CODE END I2C2_MspDeInit 0 */
-    /* Peripheral clock disable */
-    __HAL_RCC_I2C2_CLK_DISABLE();
-
-    /**I2C2 GPIO Configuration
-    PB10     ------> I2C2_SCL
-    PB11     ------> I2C2_SDA
-    */
-    HAL_GPIO_DeInit(GPIOB, GPIO_PIN_10);
-
-    HAL_GPIO_DeInit(GPIOB, GPIO_PIN_11);
-
-  /* USER CODE BEGIN I2C2_MspDeInit 1 */
-
-  /* USER CODE END I2C2_MspDeInit 1 */
-  }
-  else if(i2cHandle->Instance==I2C3)
-  {
-  /* USER CODE BEGIN I2C3_MspDeInit 0 */
-
-  /* USER CODE END I2C3_MspDeInit 0 */
-    /* Peripheral clock disable */
-    __HAL_RCC_I2C3_CLK_DISABLE();
-
-    /**I2C3 GPIO Configuration
-    PC9     ------> I2C3_SDA
-    PA8     ------> I2C3_SCL
-    */
-    HAL_GPIO_DeInit(GPIOC, GPIO_PIN_9);
-
-    HAL_GPIO_DeInit(GPIOA, GPIO_PIN_8);
-
-  /* USER CODE BEGIN I2C3_MspDeInit 1 */
-
-  /* USER CODE END I2C3_MspDeInit 1 */
-  }
-}
-
-/* USER CODE BEGIN 1 */
-
-/* USER CODE END 1 */

+ 0 - 542
Core备份3/imu1/MPU60501.c

@@ -1,542 +0,0 @@
-/*
- * MPU6050.c
- *
- *  Created on: Oct 26, 2021
- *      Author: Administrator
- */
-
-#include "MPU60501.h"
-
-#include <stdio.h>
-
- u8 IIC_Write_Byte1(u8 reg, u8 value)
- {
-	 return IIC_Write_Len1(MPU_ADDR, reg, 1, &value);
- }
-
- u8 IIC_Read_Byte1(u8 reg)
- {
-	 u8 value = 0;
-
-	 IIC_Read_Len1(MPU_ADDR, reg, 1, &value);
-
-	 return value;
- }
-
- //IIC连续写
- u8 IIC_Write_Len1(u8 addr,u8 reg, u8 len, u8 *buf)
- {
-	 addr = (addr << 1) | 0;
-
-	 u8 data[10] = {0};
-	 data[0] = reg;
-	 for(int i = 0; i < len; i++)
-	 {
-		 data[1 + i] = buf[i];
-	 }
-
-	 if(HAL_I2C_Master_Transmit(&hi2c2, (uint16_t)addr, (uint8_t*)data, len + 1, 10000)!= HAL_OK)
-	 {
-		 printf("++write len byte fail\r\n");
-		 return 1;
-	 }
-
-	 return 0;
- }
-
- //IIC连续读
- u8 IIC_Read_Len1(u8 addr,u8 reg,u8 len,u8 *buf)
- {
-	 u8 tmp  = (addr << 1) | 0;
-	 if(HAL_I2C_Master_Transmit(&hi2c2, (uint16_t)tmp, (uint8_t*)&reg, 1, 10000)!= HAL_OK)
-	 {
-		 printf("++write byte fail\r\n");
-		 return 1;
-	 }
-
-	 tmp  = (addr << 1) | 1;
-	 if(HAL_I2C_Master_Receive(&hi2c2, (uint16_t)tmp, (uint8_t *)buf, len, 10000) != HAL_OK)
-	 {
-		 printf("--read byte fail\r\n");
-	 }
-
- }
-
-
-//初始化MPU6050
-//返回值: 0,成功
-//        其他,错误代码
-u8 MPU_Init1(void)
-{
-    u8 res = 0;
-
-    IIC_Write_Byte1(MPU_PWR_MGMT1_REG,0X80);//复位MPU6050
-
-    HAL_Delay(100);
-
-    IIC_Write_Byte1(MPU_PWR_MGMT1_REG,0X00);//唤醒MPU6050
-
-    MPU_Set_Gyro_Fsr1(3); //陀螺仪传感器,±2000dps
-    MPU_Set_Accel_Fsr1(0); //加速度传感器 ±2g
-    MPU_Set_Rate1(50); //设置采样率50HZ
-    IIC_Write_Byte1(MPU_INT_EN_REG,0X00); //关闭所有中断
-    IIC_Write_Byte1(MPU_USER_CTRL_REG,0X00);//I2C主模式关闭
-    IIC_Write_Byte1(MPU_FIFO_EN_REG,0X00);//关闭FIFO
-    IIC_Write_Byte1(MPU_INTBP_CFG_REG,0X80);//INT引脚低电平有效
-
-    res=IIC_Read_Byte1(MPU_DEVICE_ID_REG);
-
-    printf("the addr is:%d\r\n", res);
-
-    if(res==MPU_ADDR)//器件ID正确
-    {
-        IIC_Write_Byte1(MPU_PWR_MGMT1_REG,0X01);//设置CLKSEL,PLL X 轴为参考
-        IIC_Write_Byte1(MPU_PWR_MGMT2_REG,0X00);//加速度陀螺仪都工作
-        MPU_Set_Rate1(50); //设置采样率为50HZ
-    }
-    else
-    {
-    	return 1;
-    }
-
-    return 0;
-}
-
-//设置MPU6050陀螺仪传感器满量程范围
-//fsr:0,±250dps;1,±500dps;2,±1000dps;3,±2000dps
-//返回值:0,设置成功
-//    其他,设置失败
-u8 MPU_Set_Gyro_Fsr1(u8 fsr)
-{
-    return IIC_Write_Byte1(MPU_GYRO_CFG_REG, fsr<<3);//设置陀螺仪满量程范围
-}
-
-//设置MPU6050加速度传感器满量程范围
-//fsr:0,±2g;1,±4g;2,±8g;3,±16g
-//返回值:0,设置成功
-//    其他,设置失败
-u8 MPU_Set_Accel_Fsr1(u8 fsr)
-{
-    return IIC_Write_Byte1(MPU_ACCEL_CFG_REG, fsr<<3);//设置加速度传感器满量程范围
-}
-
-//设置MPU6050的数字低通滤波器
-//lpf:数字低通滤波频率(Hz)
-//返回值:0,设置成功
-//    其他,设置失败
-u8 MPU_Set_LPF1(u16 lpf)
-{
-    u8 data=0;
-    if(lpf>=188) data=1;
-    else if(lpf>=98) data=2;
-    else if(lpf>=42) data=2;
-    else if(lpf>=42) data=3;
-    else if(lpf>=20) data=4;
-    else if(lpf>=10) data=5;
-    else data=6;
-    return IIC_Write_Byte1(MPU_CFG_REG,data);//设置数字低通滤波器
-}
-
-//设置MPU6050的采样率(假定Fs=1KHz)
-//rate:4~1000(Hz)
-//返回值:0,设置成功
-//    其他,设置失败
-u8 MPU_Set_Rate1(u16 rate)
-{
-    u8 data;
-    if(rate>1000)rate=1000;
-    if(rate<4)rate=4;
-    data=1000/rate-1;
-    data=IIC_Write_Byte1(MPU_SAMPLE_RATE_REG, data);  //设置数字低通滤波器
-    return MPU_Set_LPF1(rate/2); //自动设置LPF为采样率的一半
-}
-
-//得到温度值
-//返回值:温度值(扩大了100倍)
-short MPU_Get_Temperature1(void)
-{
-    u8 buf[2];
-    short raw;
-    float temp;
-    IIC_Read_Len1(MPU_ADDR, MPU_TEMP_OUTH_REG, 2, buf);
-    raw=((u16)buf[0]<<8)|buf[1];
-    temp=36.53+((double)raw)/340;
-
-    return temp*100;;
-}
-
-//得到陀螺仪值(原始值)
-//gx,gy,gz:陀螺仪x,y,z轴的原始读数(带符号)
-//返回值:0,成功
-// 其他,错误代码
-u8 MPU_Get_Gyroscope1(short *gx,short *gy,short *gz)
-{
-    u8 buf[6],res;
-    res=IIC_Read_Len1(MPU_ADDR,MPU_GYRO_XOUTH_REG,6,buf);
-    if(res==0)
-    {
-        *gx=((u16)buf[0]<<8)|buf[1];
-        *gy=((u16)buf[2]<<8)|buf[3];
-        *gz=((u16)buf[4]<<8)|buf[5];
-    }
-    return res;
-}
-
-//得到加速度值(原始值)
-//ax,ay,az:陀螺仪x,y,z轴的原始读数(带符号)
-//返回值:0,成功
-//    其他,错误代码
-u8 MPU_Get_Accelerometer1(short *ax,short *ay,short *az)
-{
-    u8 buf[6],res;
-    res=IIC_Read_Len1(MPU_ADDR,MPU_ACCEL_XOUTH_REG,6,buf);
-    if(res==0)
-    {
-        *ax=((u16)buf[0]<<8)|buf[1];
-        *ay=((u16)buf[2]<<8)|buf[3];
-        *az=((u16)buf[4]<<8)|buf[5];
-    }
-    return res;;
-}
-
-/*--------------------以下为使用板载固件DMP的相关代码,这个融合得到的姿态角效果很好*/
-
-
-/**
-  * @brief  获取当前毫秒值
-  * @param  存储最新毫秒值的变量
-  * @retval 无
-  */
-int get_tick_count1(unsigned long *count)
-{
-   count[0] = HAL_GetTick();
-	return 0;
-}
-
-
-#include "inv_mpu1.h"
-#include "inv_mpu_dmp_motion_driver1.h"
-
-/* Data requested by client. */
-#define PRINT_ACCEL     (0x01)
-#define PRINT_GYRO      (0x02)
-#define PRINT_QUAT      (0x04)
-
-#define ACCEL_ON        (0x01)
-#define GYRO_ON         (0x02)
-
-#define MOTION          (0)
-#define NO_MOTION       (1)
-
-/* Starting sampling rate. */ //100
-#define DEFAULT_MPU_HZ  (50)
-
-struct rx_s {
-    unsigned char header[3];
-    unsigned char cmd;
-};
-struct hal_s {
-    unsigned char sensors;
-    unsigned char dmp_on;
-    unsigned char wait_for_tap;
-    volatile unsigned char new_gyro;
-    unsigned short report;
-    unsigned short dmp_features;
-    unsigned char motion_int_mode;
-    struct rx_s rx;
-};
-static struct hal_s hal = {0};
-
-/* USB RX binary semaphore. Actually, it's just a flag. Not included in struct
- * because it's declared extern elsewhere.
- */
-volatile unsigned char rx_new;
-
-/* The sensors can be mounted onto the board in any orientation. The mounting
- * matrix seen below tells the MPL how to rotate the raw data from thei
- * driver(s).
- * TODO: The following matrices refer to the configuration on an internal test
- * board at Invensense. If needed, please modify the matrices to match the
- * chip-to-body matrix for your particular set up.
- */
-static signed char gyro_orientation[9] = {-1, 0, 0,
-                                           0,-1, 0,
-                                           0, 0, 1};
-
-/* Every time new gyro data is available, this function is called in an
- * ISR context. In this example, it sets a flag protecting the FIFO read
- * function.
- */
-static void gyro_data_ready_cb(void)
-{
-    hal.new_gyro = 1;
-}
-
-enum packet_type_e {
-    PACKET_TYPE_ACCEL,
-    PACKET_TYPE_GYRO,
-    PACKET_TYPE_QUAT,
-    PACKET_TYPE_TAP,
-    PACKET_TYPE_ANDROID_ORIENT,
-    PACKET_TYPE_PEDO,
-    PACKET_TYPE_MISC
-};
-
-#define BYTE u_char
-/* Send data to the Python client application.
- * Data is formatted as follows:
- * packet[0]    = $
- * packet[1]    = packet type (see packet_type_e)
- * packet[2+]   = data
- */
-void send_packet(char packet_type, void *data)
-{
-
-	#define MAX_BUF_LENGTH  (18)
-    char buf[MAX_BUF_LENGTH], length;
-
-    memset(buf, 0, MAX_BUF_LENGTH);
-    buf[0] = '$';
-    buf[1] = packet_type;
-
-    if (packet_type == PACKET_TYPE_ACCEL || packet_type == PACKET_TYPE_GYRO) {
-        short *sdata = (short*)data;
-        buf[2] = (char)(sdata[0] >> 8);
-        buf[3] = (char)sdata[0];
-        buf[4] = (char)(sdata[1] >> 8);
-        buf[5] = (char)sdata[1];
-        buf[6] = (char)(sdata[2] >> 8);
-        buf[7] = (char)sdata[2];
-        length = 8;
-    } else if (packet_type == PACKET_TYPE_QUAT) {
-        long *ldata = (long*)data;
-        buf[2] = (char)(ldata[0] >> 24);
-        buf[3] = (char)(ldata[0] >> 16);
-        buf[4] = (char)(ldata[0] >> 8);
-        buf[5] = (char)ldata[0];
-        buf[6] = (char)(ldata[1] >> 24);
-        buf[7] = (char)(ldata[1] >> 16);
-        buf[8] = (char)(ldata[1] >> 8);
-        buf[9] = (char)ldata[1];
-        buf[10] = (char)(ldata[2] >> 24);
-        buf[11] = (char)(ldata[2] >> 16);
-        buf[12] = (char)(ldata[2] >> 8);
-        buf[13] = (char)ldata[2];
-        buf[14] = (char)(ldata[3] >> 24);
-        buf[15] = (char)(ldata[3] >> 16);
-        buf[16] = (char)(ldata[3] >> 8);
-        buf[17] = (char)ldata[3];
-        length = 18;
-    } else if (packet_type == PACKET_TYPE_TAP) {
-        buf[2] = ((char*)data)[0];
-        buf[3] = ((char*)data)[1];
-        length = 4;
-    } else if (packet_type == PACKET_TYPE_ANDROID_ORIENT) {
-        buf[2] = ((char*)data)[0];
-        length = 3;
-    } else if (packet_type == PACKET_TYPE_PEDO) {
-        long *ldata = (long*)data;
-        buf[2] = (char)(ldata[0] >> 24);
-        buf[3] = (char)(ldata[0] >> 16);
-        buf[4] = (char)(ldata[0] >> 8);
-        buf[5] = (char)ldata[0];
-        buf[6] = (char)(ldata[1] >> 24);
-        buf[7] = (char)(ldata[1] >> 16);
-        buf[8] = (char)(ldata[1] >> 8);
-        buf[9] = (char)ldata[1];
-        length = 10;
-    } else if (packet_type == PACKET_TYPE_MISC) {
-        buf[2] = ((char*)data)[0];
-        buf[3] = ((char*)data)[1];
-        buf[4] = ((char*)data)[2];
-        buf[5] = ((char*)data)[3];
-        length = 6;
-    }
-
-//    cdcSendDataWaitTilDone((BYTE*)buf, length, CDC0_INTFNUM, 100);
-}
-
-/* These next two functions converts the orientation matrix (see
- * gyro_orientation) to a scalar representation for use by the DMP.
- * NOTE: These functions are borrowed from Invensense's MPL.
- */
-static inline unsigned short inv_row_2_scale(const signed char *row)
-{
-    unsigned short b;
-
-    if (row[0] > 0)
-        b = 0;
-    else if (row[0] < 0)
-        b = 4;
-    else if (row[1] > 0)
-        b = 1;
-    else if (row[1] < 0)
-        b = 5;
-    else if (row[2] > 0)
-        b = 2;
-    else if (row[2] < 0)
-        b = 6;
-    else
-        b = 7;      // error
-    return b;
-}
-static inline unsigned short inv_orientation_matrix_to_scalar(
-    const signed char *mtx)
-{
-    unsigned short scalar;
-
-    /*
-       XYZ  010_001_000 Identity Matrix
-       XZY  001_010_000
-       YXZ  010_000_001
-       YZX  000_010_001
-       ZXY  001_000_010
-       ZYX  000_001_010
-     */
-
-    scalar = inv_row_2_scale(mtx);
-    scalar |= inv_row_2_scale(mtx + 3) << 3;
-    scalar |= inv_row_2_scale(mtx + 6) << 6;
-
-
-    return scalar;
-}
-
-static inline void run_self_test(void)
-{
-    int result;
-    char test_packet[4] = {0};
-    long gyro[3], accel[3];
-
-    result = mpu_run_self_test(gyro, accel);
-    if (result == 0x7) {
-        /* Test passed. We can trust the gyro data here, so let's push it down
-         * to the DMP.
-         */
-        float sens;
-        unsigned short accel_sens;
-        mpu_get_gyro_sens(&sens);
-        gyro[0] = (long)(gyro[0] * sens);
-        gyro[1] = (long)(gyro[1] * sens);
-        gyro[2] = (long)(gyro[2] * sens);
-        dmp_set_gyro_bias(gyro);
-        mpu_get_accel_sens(&accel_sens);
-        accel[0] *= accel_sens;
-        accel[1] *= accel_sens;
-        accel[2] *= accel_sens;
-        dmp_set_accel_bias(accel);
-    }
-
-    /* Report results. */
-    test_packet[0] = 't';
-    test_packet[1] = result;
-    send_packet(PACKET_TYPE_MISC, test_packet);
-}
-
-
-#define INT_EXIT_LPM0 12
-
-void DMP_Init1(void)
-{
-    struct int_param_s int_param;
-
-	/* Set up gyro.
-	 * Every function preceded by mpu_ is a driver function and can be found
-	 * in inv_mpu.h.
-	 */
-	int_param.cb = gyro_data_ready_cb;
-	int_param.pin = 16;
-	int_param.lp_exit = INT_EXIT_LPM0;
-	int_param.active_low = 1;
-
-	int result = mpu_init(&int_param);
-
-	printf("mpu_init, %d\r\n", result);
-
-	if(result == 0)     //mpu初始化
-	{
-		if(!mpu_set_sensors(INV_XYZ_GYRO | INV_XYZ_ACCEL))    //设置需要的传感器
-			printf("mpu_set_sensor complete ......\r\n");
-
-		if(!mpu_configure_fifo(INV_XYZ_GYRO | INV_XYZ_ACCEL)) //设置fifo
-			printf("mpu_configure_fifo complete ......\r\n");
-
-		if(!mpu_set_sample_rate(DEFAULT_MPU_HZ))              //设置采集样率
-			printf("mpu_set_sample_rate complete ......\r\n");
-
-
-		unsigned short gyro_rate = 0, gyro_fsr = 0;
-		unsigned char accel_fsr = 0;
-
-	    mpu_get_sample_rate(&gyro_rate);
-	    mpu_get_gyro_fsr(&gyro_fsr);
-	    mpu_get_accel_fsr(&accel_fsr);
-
-	    printf("gyro_rate %d, gyro_fsr %d, accel_fsr %d\r\n", gyro_rate, gyro_fsr, accel_fsr);
-
-
-
-		if(!dmp_load_motion_driver_firmware())                //加载dmp固件
-			printf("dmp_load_motion_driver_firmware complete ......\r\n");
-
-		if(!dmp_set_orientation(inv_orientation_matrix_to_scalar(gyro_orientation)))
-			printf("dmp_set_orientation complete ......\r\n"); //设置陀螺仪方向
-
-		if(!dmp_enable_feature(DMP_FEATURE_6X_LP_QUAT | DMP_FEATURE_TAP |
-				DMP_FEATURE_ANDROID_ORIENT | DMP_FEATURE_SEND_RAW_ACCEL | DMP_FEATURE_SEND_CAL_GYRO |
-				DMP_FEATURE_GYRO_CAL))
-			printf("dmp_enable_feature complete ......\r\n");
-
-		if(!dmp_set_fifo_rate(DEFAULT_MPU_HZ))    //设置速率
-			printf("dmp_set_fifo_rate complete ......\r\n");
-
-		run_self_test();                          //自检(非必要)
-
-		if(!mpu_set_dmp_state(1))                 //使能
-			printf("mpu_set_dmp_state complete ......\r\n");
-	}
-
-}
-
-#define q30 1073741824.0
-
-uint8_t Read_DMP1(float* Pitch,float* Roll,float* Yaw)
-{
-	short gyro[3], accel[3], sensors;
-	float q0=1.0f,q1=0.0f,q2=0.0f,q3=0.0f;
-	unsigned long sensor_timestamp;
-	unsigned char more;
-	long quat[4];
-
-	int ret = dmp_read_fifo(gyro, accel, quat, &sensor_timestamp, &sensors, &more);
-
-//	printf("dmp_read_fifo, %d\r\n", ret);
-
-	if(ret)
-	{
-		return 1;
-	}
-
-	if (sensors & INV_WXYZ_QUAT)
-	{
-		q0=quat[0] / q30;
-		q1=quat[1] / q30;
-		q2=quat[2] / q30;
-		q3=quat[3] / q30;
-		*Pitch = (float)asin(-2 * q1 * q3 + 2 * q0* q2)* 57.3;
-		*Roll =  (float)atan2(2 * q2 * q3 + 2 * q0 * q1, -2 * q1 * q1 - 2 * q2* q2 + 1)* 57.3; // roll
-		*Yaw =   (float)atan2(2*(q1*q2 + q0*q3),q0*q0+q1*q1-q2*q2-q3*q3) * 57.3;
-		return 0;
-	}
-	else
-	{
-		return 2;
-	}
-
-}
-
-
-
-
-
-

+ 0 - 117
Core备份3/imu1/MPU60501.h

@@ -1,117 +0,0 @@
-/*
- * MPU6050.h
- *
- *  Created on: Oct 26, 2021
- *      Author: Administrator
- */
-
-#ifndef INC_MPU6050_H_
-#define INC_MPU6050_H_
-
-#include "i2c.h"
-#include "inv_mpu1.h"
-
-//#define MPU_ACCEL_OFFS_REG		0X06	//accel_offs寄存器,可读取版本号,寄存器手册未提到
-//#define MPU_PROD_ID_REG			0X0C	//prod id寄存器,在寄存器手册未提到
-#define MPU_SELF_TESTX_REG		0X0D	//自检寄存器X
-#define MPU_SELF_TESTY_REG		0X0E	//自检寄存器Y
-#define MPU_SELF_TESTZ_REG		0X0F	//自检寄存器Z
-#define MPU_SELF_TESTA_REG		0X10	//自检寄存器A
-#define MPU_SAMPLE_RATE_REG		0X19	//采样频率分频器
-#define MPU_CFG_REG				0X1A	//配置寄存器
-#define MPU_GYRO_CFG_REG		0X1B	//陀螺仪配置寄存器
-#define MPU_ACCEL_CFG_REG		0X1C	//加速度计配置寄存器
-#define MPU_MOTION_DET_REG		0X1F	//运动检测阀值设置寄存器
-#define MPU_FIFO_EN_REG			0X23	//FIFO使能寄存器
-#define MPU_I2CMST_CTRL_REG		0X24	//IIC主机控制寄存器
-#define MPU_I2CSLV0_ADDR_REG	0X25	//IIC从机0器件地址寄存器
-#define MPU_I2CSLV0_REG			0X26	//IIC从机0数据地址寄存器
-#define MPU_I2CSLV0_CTRL_REG	0X27	//IIC从机0控制寄存器
-#define MPU_I2CSLV1_ADDR_REG	0X28	//IIC从机1器件地址寄存器
-#define MPU_I2CSLV1_REG			0X29	//IIC从机1数据地址寄存器
-#define MPU_I2CSLV1_CTRL_REG	0X2A	//IIC从机1控制寄存器
-#define MPU_I2CSLV2_ADDR_REG	0X2B	//IIC从机2器件地址寄存器
-#define MPU_I2CSLV2_REG			0X2C	//IIC从机2数据地址寄存器
-#define MPU_I2CSLV2_CTRL_REG	0X2D	//IIC从机2控制寄存器
-#define MPU_I2CSLV3_ADDR_REG	0X2E	//IIC从机3器件地址寄存器
-#define MPU_I2CSLV3_REG			0X2F	//IIC从机3数据地址寄存器
-#define MPU_I2CSLV3_CTRL_REG	0X30	//IIC从机3控制寄存器
-#define MPU_I2CSLV4_ADDR_REG	0X31	//IIC从机4器件地址寄存器
-#define MPU_I2CSLV4_REG			0X32	//IIC从机4数据地址寄存器
-#define MPU_I2CSLV4_DO_REG		0X33	//IIC从机4写数据寄存器
-#define MPU_I2CSLV4_CTRL_REG	0X34	//IIC从机4控制寄存器
-#define MPU_I2CSLV4_DI_REG		0X35	//IIC从机4读数据寄存器
-
-#define MPU_I2CMST_STA_REG		0X36	//IIC主机状态寄存器
-#define MPU_INTBP_CFG_REG		0X37	//中断/旁路设置寄存器
-#define MPU_INT_EN_REG			0X38	//中断使能寄存器
-#define MPU_INT_STA_REG			0X3A	//中断状态寄存器
-
-#define MPU_ACCEL_XOUTH_REG		0X3B	//加速度值,X轴高8位寄存器
-#define MPU_ACCEL_XOUTL_REG		0X3C	//加速度值,X轴低8位寄存器
-#define MPU_ACCEL_YOUTH_REG		0X3D	//加速度值,Y轴高8位寄存器
-#define MPU_ACCEL_YOUTL_REG		0X3E	//加速度值,Y轴低8位寄存器
-#define MPU_ACCEL_ZOUTH_REG		0X3F	//加速度值,Z轴高8位寄存器
-#define MPU_ACCEL_ZOUTL_REG		0X40	//加速度值,Z轴低8位寄存器
-
-#define MPU_TEMP_OUTH_REG		0X41	//温度值高八位寄存器
-#define MPU_TEMP_OUTL_REG		0X42	//温度值低8位寄存器
-
-#define MPU_GYRO_XOUTH_REG		0X43	//陀螺仪值,X轴高8位寄存器
-#define MPU_GYRO_XOUTL_REG		0X44	//陀螺仪值,X轴低8位寄存器
-#define MPU_GYRO_YOUTH_REG		0X45	//陀螺仪值,Y轴高8位寄存器
-#define MPU_GYRO_YOUTL_REG		0X46	//陀螺仪值,Y轴低8位寄存器
-#define MPU_GYRO_ZOUTH_REG		0X47	//陀螺仪值,Z轴高8位寄存器
-#define MPU_GYRO_ZOUTL_REG		0X48	//陀螺仪值,Z轴低8位寄存器
-
-#define MPU_I2CSLV0_DO_REG		0X63	//IIC从机0数据寄存器
-#define MPU_I2CSLV1_DO_REG		0X64	//IIC从机1数据寄存器
-#define MPU_I2CSLV2_DO_REG		0X65	//IIC从机2数据寄存器
-#define MPU_I2CSLV3_DO_REG		0X66	//IIC从机3数据寄存器
-
-#define MPU_I2CMST_DELAY_REG	0X67	//IIC主机延时管理寄存器
-#define MPU_SIGPATH_RST_REG		0X68	//信号通道复位寄存器
-#define MPU_MDETECT_CTRL_REG	0X69	//运动检测控制寄存器
-#define MPU_USER_CTRL_REG		0X6A	//用户控制寄存器
-#define MPU_PWR_MGMT1_REG		0X6B	//电源管理寄存器1
-#define MPU_PWR_MGMT2_REG		0X6C	//电源管理寄存器2
-#define MPU_FIFO_CNTH_REG		0X72	//FIFO计数寄存器高八位
-#define MPU_FIFO_CNTL_REG		0X73	//FIFO计数寄存器低八位
-#define MPU_FIFO_RW_REG			0X74	//FIFO读写寄存器
-#define MPU_DEVICE_ID_REG		0X75	//器件ID寄存器
-
-//如果AD0脚接地,IIC地址为0X68(不包含最低位).
-//如果接V3.3,则IIC地址为0X69(不包含最低位).
-#define MPU_ADDR				0X68
-
-
-//因为模块AD0默认接GND,所以转为读写地址后,为0XD1和0XD0(如果接VCC,则为0XD3和0XD2)
-#define MPU_READ    0XD1
-#define MPU_WRITE   0XD0
-
-#define u8 uint8_t
-#define u16 uint16_t
-
-u8 MPU_Init1(void); 								//初始化MPU6050
-u8 IIC_Write_Len1(u8 addr,u8 reg,u8 len,u8 *buf);//IIC连续写
-u8 IIC_Read_Len1(u8 addr,u8 reg,u8 len,u8 *buf); //IIC连续读
-u8 IIC_Write_Byte1(u8 reg,u8 data);				//IIC写一个字节
-u8 IIC_Read_Byte1(u8 reg);						//IIC读一个字节
-
-u8 MPU_Set_Gyro_Fsr1(u8 fsr);
-u8 MPU_Set_Accel_Fsr1(u8 fsr);
-u8 MPU_Set_LPF1(u16 lpf);
-u8 MPU_Set_Rate(u16 rate);
-u8 MPU_Set_Fifo1(u8 sens);
-
-
-short MPU_Get_Temperature1(void);
-u8 MPU_Get_Gyroscope1(short *gx,short *gy,short *gz);
-u8 MPU_Get_Accelerometer1(short *ax,short *ay,short *az);
-
-//----------------------DMP-------------------------------
-void DMP_Init1(void);
-uint8_t Read_DMP1(float* Pitch,float* Roll,float* Yaw);
-int get_tick_count1(unsigned long *count);
-
-#endif /* INC_MPU6050_H_ */

+ 0 - 494
Core备份3/imu1/dmpKey1.h

@@ -1,494 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011 InvenSense Corporation, All Rights Reserved.
- $
- */
-#ifndef DMPKEY_H__
-#define DMPKEY_H__
-
-#define KEY_CFG_25                  (0)
-#define KEY_CFG_24                  (KEY_CFG_25 + 1)
-#define KEY_CFG_26                  (KEY_CFG_24 + 1)
-#define KEY_CFG_27                  (KEY_CFG_26 + 1)
-#define KEY_CFG_21                  (KEY_CFG_27 + 1)
-#define KEY_CFG_20                  (KEY_CFG_21 + 1)
-#define KEY_CFG_TAP4                (KEY_CFG_20 + 1)
-#define KEY_CFG_TAP5                (KEY_CFG_TAP4 + 1)
-#define KEY_CFG_TAP6                (KEY_CFG_TAP5 + 1)
-#define KEY_CFG_TAP7                (KEY_CFG_TAP6 + 1)
-#define KEY_CFG_TAP0                (KEY_CFG_TAP7 + 1)
-#define KEY_CFG_TAP1                (KEY_CFG_TAP0 + 1)
-#define KEY_CFG_TAP2                (KEY_CFG_TAP1 + 1)
-#define KEY_CFG_TAP3                (KEY_CFG_TAP2 + 1)
-#define KEY_CFG_TAP_QUANTIZE        (KEY_CFG_TAP3 + 1)
-#define KEY_CFG_TAP_JERK            (KEY_CFG_TAP_QUANTIZE + 1)
-#define KEY_CFG_DR_INT              (KEY_CFG_TAP_JERK + 1)
-#define KEY_CFG_AUTH                (KEY_CFG_DR_INT + 1)
-#define KEY_CFG_TAP_SAVE_ACCB       (KEY_CFG_AUTH + 1)
-#define KEY_CFG_TAP_CLEAR_STICKY    (KEY_CFG_TAP_SAVE_ACCB + 1)
-#define KEY_CFG_FIFO_ON_EVENT       (KEY_CFG_TAP_CLEAR_STICKY + 1)
-#define KEY_FCFG_ACCEL_INPUT        (KEY_CFG_FIFO_ON_EVENT + 1)
-#define KEY_FCFG_ACCEL_INIT         (KEY_FCFG_ACCEL_INPUT + 1)
-#define KEY_CFG_23                  (KEY_FCFG_ACCEL_INIT + 1)
-#define KEY_FCFG_1                  (KEY_CFG_23 + 1)
-#define KEY_FCFG_3                  (KEY_FCFG_1 + 1)
-#define KEY_FCFG_2                  (KEY_FCFG_3 + 1)
-#define KEY_CFG_3D                  (KEY_FCFG_2 + 1)
-#define KEY_CFG_3B                  (KEY_CFG_3D + 1)
-#define KEY_CFG_3C                  (KEY_CFG_3B + 1)
-#define KEY_FCFG_5                  (KEY_CFG_3C + 1)
-#define KEY_FCFG_4                  (KEY_FCFG_5 + 1)
-#define KEY_FCFG_7                  (KEY_FCFG_4 + 1)
-#define KEY_FCFG_FSCALE             (KEY_FCFG_7 + 1)
-#define KEY_FCFG_AZ                 (KEY_FCFG_FSCALE + 1)
-#define KEY_FCFG_6                  (KEY_FCFG_AZ + 1)
-#define KEY_FCFG_LSB4               (KEY_FCFG_6 + 1)
-#define KEY_CFG_12                  (KEY_FCFG_LSB4 + 1)
-#define KEY_CFG_14                  (KEY_CFG_12 + 1)
-#define KEY_CFG_15                  (KEY_CFG_14 + 1)
-#define KEY_CFG_16                  (KEY_CFG_15 + 1)
-#define KEY_CFG_18                  (KEY_CFG_16 + 1)
-#define KEY_CFG_6                   (KEY_CFG_18 + 1)
-#define KEY_CFG_7                   (KEY_CFG_6 + 1)
-#define KEY_CFG_4                   (KEY_CFG_7 + 1)
-#define KEY_CFG_5                   (KEY_CFG_4 + 1)
-#define KEY_CFG_2                   (KEY_CFG_5 + 1)
-#define KEY_CFG_3                   (KEY_CFG_2 + 1)
-#define KEY_CFG_1                   (KEY_CFG_3 + 1)
-#define KEY_CFG_EXTERNAL            (KEY_CFG_1 + 1)
-#define KEY_CFG_8                   (KEY_CFG_EXTERNAL + 1)
-#define KEY_CFG_9                   (KEY_CFG_8 + 1)
-#define KEY_CFG_ORIENT_3            (KEY_CFG_9 + 1)
-#define KEY_CFG_ORIENT_2            (KEY_CFG_ORIENT_3 + 1)
-#define KEY_CFG_ORIENT_1            (KEY_CFG_ORIENT_2 + 1)
-#define KEY_CFG_GYRO_SOURCE         (KEY_CFG_ORIENT_1 + 1)
-#define KEY_CFG_ORIENT_IRQ_1        (KEY_CFG_GYRO_SOURCE + 1)
-#define KEY_CFG_ORIENT_IRQ_2        (KEY_CFG_ORIENT_IRQ_1 + 1)
-#define KEY_CFG_ORIENT_IRQ_3        (KEY_CFG_ORIENT_IRQ_2 + 1)
-#define KEY_FCFG_MAG_VAL            (KEY_CFG_ORIENT_IRQ_3 + 1)
-#define KEY_FCFG_MAG_MOV            (KEY_FCFG_MAG_VAL + 1)
-#define KEY_CFG_LP_QUAT             (KEY_FCFG_MAG_MOV + 1)
-
-/* MPU6050 keys */
-#define KEY_CFG_ACCEL_FILTER        (KEY_CFG_LP_QUAT + 1)
-#define KEY_CFG_MOTION_BIAS         (KEY_CFG_ACCEL_FILTER + 1)
-#define KEY_TEMPLABEL               (KEY_CFG_MOTION_BIAS + 1)
-
-#define KEY_D_0_22                  (KEY_TEMPLABEL + 1)
-#define KEY_D_0_24                  (KEY_D_0_22 + 1)
-#define KEY_D_0_36                  (KEY_D_0_24 + 1)
-#define KEY_D_0_52                  (KEY_D_0_36 + 1)
-#define KEY_D_0_96                  (KEY_D_0_52 + 1)
-#define KEY_D_0_104                 (KEY_D_0_96 + 1)
-#define KEY_D_0_108                 (KEY_D_0_104 + 1)
-#define KEY_D_0_163                 (KEY_D_0_108 + 1)
-#define KEY_D_0_188                 (KEY_D_0_163 + 1)
-#define KEY_D_0_192                 (KEY_D_0_188 + 1)
-#define KEY_D_0_224                 (KEY_D_0_192 + 1)
-#define KEY_D_0_228                 (KEY_D_0_224 + 1)
-#define KEY_D_0_232                 (KEY_D_0_228 + 1)
-#define KEY_D_0_236                 (KEY_D_0_232 + 1)
-
-#define KEY_DMP_PREVPTAT            (KEY_D_0_236 + 1)
-#define KEY_D_1_2                   (KEY_DMP_PREVPTAT + 1)
-#define KEY_D_1_4                   (KEY_D_1_2 + 1)
-#define KEY_D_1_8                   (KEY_D_1_4 + 1)
-#define KEY_D_1_10                  (KEY_D_1_8 + 1)
-#define KEY_D_1_24                  (KEY_D_1_10 + 1)
-#define KEY_D_1_28                  (KEY_D_1_24 + 1)
-#define KEY_D_1_36                  (KEY_D_1_28 + 1)
-#define KEY_D_1_40                  (KEY_D_1_36 + 1)
-#define KEY_D_1_44                  (KEY_D_1_40 + 1)
-#define KEY_D_1_72                  (KEY_D_1_44 + 1)
-#define KEY_D_1_74                  (KEY_D_1_72 + 1)
-#define KEY_D_1_79                  (KEY_D_1_74 + 1)
-#define KEY_D_1_88                  (KEY_D_1_79 + 1)
-#define KEY_D_1_90                  (KEY_D_1_88 + 1)
-#define KEY_D_1_92                  (KEY_D_1_90 + 1)
-#define KEY_D_1_96                  (KEY_D_1_92 + 1)
-#define KEY_D_1_98                  (KEY_D_1_96 + 1)
-#define KEY_D_1_100                 (KEY_D_1_98 + 1)
-#define KEY_D_1_106                 (KEY_D_1_100 + 1)
-#define KEY_D_1_108                 (KEY_D_1_106 + 1)
-#define KEY_D_1_112                 (KEY_D_1_108 + 1)
-#define KEY_D_1_128                 (KEY_D_1_112 + 1)
-#define KEY_D_1_152                 (KEY_D_1_128 + 1)
-#define KEY_D_1_160                 (KEY_D_1_152 + 1)
-#define KEY_D_1_168                 (KEY_D_1_160 + 1)
-#define KEY_D_1_175                 (KEY_D_1_168 + 1)
-#define KEY_D_1_176                 (KEY_D_1_175 + 1)
-#define KEY_D_1_178                 (KEY_D_1_176 + 1)
-#define KEY_D_1_179                 (KEY_D_1_178 + 1)
-#define KEY_D_1_218                 (KEY_D_1_179 + 1)
-#define KEY_D_1_232                 (KEY_D_1_218 + 1)
-#define KEY_D_1_236                 (KEY_D_1_232 + 1)
-#define KEY_D_1_240                 (KEY_D_1_236 + 1)
-#define KEY_D_1_244                 (KEY_D_1_240 + 1)
-#define KEY_D_1_250                 (KEY_D_1_244 + 1)
-#define KEY_D_1_252                 (KEY_D_1_250 + 1)
-#define KEY_D_2_12                  (KEY_D_1_252 + 1)
-#define KEY_D_2_96                  (KEY_D_2_12 + 1)
-#define KEY_D_2_108                 (KEY_D_2_96 + 1)
-#define KEY_D_2_208                 (KEY_D_2_108 + 1)
-#define KEY_FLICK_MSG               (KEY_D_2_208 + 1)
-#define KEY_FLICK_COUNTER           (KEY_FLICK_MSG + 1)
-#define KEY_FLICK_LOWER             (KEY_FLICK_COUNTER + 1)
-#define KEY_CFG_FLICK_IN            (KEY_FLICK_LOWER + 1)
-#define KEY_FLICK_UPPER             (KEY_CFG_FLICK_IN + 1)
-#define KEY_CGNOTICE_INTR           (KEY_FLICK_UPPER + 1)
-#define KEY_D_2_224                 (KEY_CGNOTICE_INTR + 1)
-#define KEY_D_2_244                 (KEY_D_2_224 + 1)
-#define KEY_D_2_248                 (KEY_D_2_244 + 1)
-#define KEY_D_2_252                 (KEY_D_2_248 + 1)
-
-#define KEY_D_GYRO_BIAS_X               (KEY_D_2_252 + 1)
-#define KEY_D_GYRO_BIAS_Y               (KEY_D_GYRO_BIAS_X + 1)
-#define KEY_D_GYRO_BIAS_Z               (KEY_D_GYRO_BIAS_Y + 1)
-#define KEY_D_ACC_BIAS_X                (KEY_D_GYRO_BIAS_Z + 1)
-#define KEY_D_ACC_BIAS_Y                (KEY_D_ACC_BIAS_X + 1)
-#define KEY_D_ACC_BIAS_Z                (KEY_D_ACC_BIAS_Y + 1)
-#define KEY_D_GYRO_ENABLE               (KEY_D_ACC_BIAS_Z + 1)
-#define KEY_D_ACCEL_ENABLE              (KEY_D_GYRO_ENABLE + 1)
-#define KEY_D_QUAT_ENABLE               (KEY_D_ACCEL_ENABLE +1)
-#define KEY_D_OUTPUT_ENABLE             (KEY_D_QUAT_ENABLE + 1)
-#define KEY_D_CR_TIME_G                 (KEY_D_OUTPUT_ENABLE + 1)
-#define KEY_D_CR_TIME_A                 (KEY_D_CR_TIME_G + 1)
-#define KEY_D_CR_TIME_Q                 (KEY_D_CR_TIME_A + 1)
-#define KEY_D_CS_TAX                    (KEY_D_CR_TIME_Q + 1)
-#define KEY_D_CS_TAY                    (KEY_D_CS_TAX + 1)
-#define KEY_D_CS_TAZ                    (KEY_D_CS_TAY + 1)
-#define KEY_D_CS_TGX                    (KEY_D_CS_TAZ + 1)
-#define KEY_D_CS_TGY                    (KEY_D_CS_TGX + 1)
-#define KEY_D_CS_TGZ                    (KEY_D_CS_TGY + 1)
-#define KEY_D_CS_TQ0                    (KEY_D_CS_TGZ + 1)
-#define KEY_D_CS_TQ1                    (KEY_D_CS_TQ0 + 1)
-#define KEY_D_CS_TQ2                    (KEY_D_CS_TQ1 + 1)
-#define KEY_D_CS_TQ3                    (KEY_D_CS_TQ2 + 1)
-
-/* Compass keys */
-#define KEY_CPASS_BIAS_X            (KEY_D_CS_TQ3 + 1)
-#define KEY_CPASS_BIAS_Y            (KEY_CPASS_BIAS_X + 1)
-#define KEY_CPASS_BIAS_Z            (KEY_CPASS_BIAS_Y + 1)
-#define KEY_CPASS_MTX_00            (KEY_CPASS_BIAS_Z + 1)
-#define KEY_CPASS_MTX_01            (KEY_CPASS_MTX_00 + 1)
-#define KEY_CPASS_MTX_02            (KEY_CPASS_MTX_01 + 1)
-#define KEY_CPASS_MTX_10            (KEY_CPASS_MTX_02 + 1)
-#define KEY_CPASS_MTX_11            (KEY_CPASS_MTX_10 + 1)
-#define KEY_CPASS_MTX_12            (KEY_CPASS_MTX_11 + 1)
-#define KEY_CPASS_MTX_20            (KEY_CPASS_MTX_12 + 1)
-#define KEY_CPASS_MTX_21            (KEY_CPASS_MTX_20 + 1)
-#define KEY_CPASS_MTX_22            (KEY_CPASS_MTX_21 + 1)
-
-/* Gesture Keys */
-#define KEY_DMP_TAPW_MIN            (KEY_CPASS_MTX_22 + 1)
-#define KEY_DMP_TAP_THR_X           (KEY_DMP_TAPW_MIN + 1)
-#define KEY_DMP_TAP_THR_Y           (KEY_DMP_TAP_THR_X + 1)
-#define KEY_DMP_TAP_THR_Z           (KEY_DMP_TAP_THR_Y + 1)
-#define KEY_DMP_SH_TH_Y             (KEY_DMP_TAP_THR_Z + 1)
-#define KEY_DMP_SH_TH_X             (KEY_DMP_SH_TH_Y + 1)
-#define KEY_DMP_SH_TH_Z             (KEY_DMP_SH_TH_X + 1)
-#define KEY_DMP_ORIENT              (KEY_DMP_SH_TH_Z + 1)
-#define KEY_D_ACT0                  (KEY_DMP_ORIENT + 1)
-#define KEY_D_ACSX                  (KEY_D_ACT0 + 1)
-#define KEY_D_ACSY                  (KEY_D_ACSX + 1)
-#define KEY_D_ACSZ                  (KEY_D_ACSY + 1)
-
-#define KEY_X_GRT_Y_TMP             (KEY_D_ACSZ + 1)
-#define KEY_SKIP_X_GRT_Y_TMP        (KEY_X_GRT_Y_TMP + 1)
-#define KEY_SKIP_END_COMPARE        (KEY_SKIP_X_GRT_Y_TMP + 1)
-#define KEY_END_COMPARE_Y_X_TMP2    (KEY_SKIP_END_COMPARE + 1)       
-#define KEY_CFG_ANDROID_ORIENT_INT  (KEY_END_COMPARE_Y_X_TMP2 + 1)
-#define KEY_NO_ORIENT_INTERRUPT     (KEY_CFG_ANDROID_ORIENT_INT + 1)
-#define KEY_END_COMPARE_Y_X_TMP     (KEY_NO_ORIENT_INTERRUPT + 1)
-#define KEY_END_ORIENT_1            (KEY_END_COMPARE_Y_X_TMP + 1)
-#define KEY_END_COMPARE_Y_X         (KEY_END_ORIENT_1 + 1) 
-#define KEY_END_ORIENT              (KEY_END_COMPARE_Y_X + 1)
-#define KEY_X_GRT_Y                 (KEY_END_ORIENT + 1)
-#define KEY_NOT_TIME_MINUS_1        (KEY_X_GRT_Y + 1)       
-#define KEY_END_COMPARE_Y_X_TMP3    (KEY_NOT_TIME_MINUS_1 + 1) 
-#define KEY_X_GRT_Y_TMP2            (KEY_END_COMPARE_Y_X_TMP3 + 1)
-
-/* Authenticate Keys */
-#define KEY_D_AUTH_OUT              (KEY_X_GRT_Y_TMP2 + 1)
-#define KEY_D_AUTH_IN               (KEY_D_AUTH_OUT + 1)
-#define KEY_D_AUTH_A                (KEY_D_AUTH_IN + 1)
-#define KEY_D_AUTH_B                (KEY_D_AUTH_A + 1)
-
-/* Pedometer standalone only keys */
-#define KEY_D_PEDSTD_BP_B           (KEY_D_AUTH_B + 1)
-#define KEY_D_PEDSTD_HP_A           (KEY_D_PEDSTD_BP_B + 1)
-#define KEY_D_PEDSTD_HP_B           (KEY_D_PEDSTD_HP_A + 1)
-#define KEY_D_PEDSTD_BP_A4          (KEY_D_PEDSTD_HP_B + 1)
-#define KEY_D_PEDSTD_BP_A3          (KEY_D_PEDSTD_BP_A4 + 1)
-#define KEY_D_PEDSTD_BP_A2          (KEY_D_PEDSTD_BP_A3 + 1)
-#define KEY_D_PEDSTD_BP_A1          (KEY_D_PEDSTD_BP_A2 + 1)
-#define KEY_D_PEDSTD_INT_THRSH      (KEY_D_PEDSTD_BP_A1 + 1)
-#define KEY_D_PEDSTD_CLIP           (KEY_D_PEDSTD_INT_THRSH + 1)
-#define KEY_D_PEDSTD_SB             (KEY_D_PEDSTD_CLIP + 1)
-#define KEY_D_PEDSTD_SB_TIME        (KEY_D_PEDSTD_SB + 1)
-#define KEY_D_PEDSTD_PEAKTHRSH      (KEY_D_PEDSTD_SB_TIME + 1)
-#define KEY_D_PEDSTD_TIML           (KEY_D_PEDSTD_PEAKTHRSH + 1)
-#define KEY_D_PEDSTD_TIMH           (KEY_D_PEDSTD_TIML + 1)
-#define KEY_D_PEDSTD_PEAK           (KEY_D_PEDSTD_TIMH + 1)
-#define KEY_D_PEDSTD_TIMECTR        (KEY_D_PEDSTD_PEAK + 1)
-#define KEY_D_PEDSTD_STEPCTR        (KEY_D_PEDSTD_TIMECTR + 1)
-#define KEY_D_PEDSTD_WALKTIME       (KEY_D_PEDSTD_STEPCTR + 1)
-#define KEY_D_PEDSTD_DECI           (KEY_D_PEDSTD_WALKTIME + 1)
-
-/*Host Based No Motion*/
-#define KEY_D_HOST_NO_MOT           (KEY_D_PEDSTD_DECI + 1)
-
-/* EIS keys */
-#define KEY_P_EIS_FIFO_FOOTER       (KEY_D_HOST_NO_MOT + 1)
-#define KEY_P_EIS_FIFO_YSHIFT       (KEY_P_EIS_FIFO_FOOTER + 1)
-#define KEY_P_EIS_DATA_RATE         (KEY_P_EIS_FIFO_YSHIFT + 1)
-#define KEY_P_EIS_FIFO_XSHIFT       (KEY_P_EIS_DATA_RATE + 1)
-#define KEY_P_EIS_FIFO_SYNC         (KEY_P_EIS_FIFO_XSHIFT + 1)
-#define KEY_P_EIS_FIFO_ZSHIFT       (KEY_P_EIS_FIFO_SYNC + 1)
-#define KEY_P_EIS_FIFO_READY        (KEY_P_EIS_FIFO_ZSHIFT + 1)
-#define KEY_DMP_FOOTER              (KEY_P_EIS_FIFO_READY + 1)
-#define KEY_DMP_INTX_HC             (KEY_DMP_FOOTER + 1)
-#define KEY_DMP_INTX_PH             (KEY_DMP_INTX_HC + 1)
-#define KEY_DMP_INTX_SH             (KEY_DMP_INTX_PH + 1)
-#define KEY_DMP_AINV_SH             (KEY_DMP_INTX_SH + 1)
-#define KEY_DMP_A_INV_XH            (KEY_DMP_AINV_SH + 1)
-#define KEY_DMP_AINV_PH             (KEY_DMP_A_INV_XH + 1)
-#define KEY_DMP_CTHX_H              (KEY_DMP_AINV_PH + 1)
-#define KEY_DMP_CTHY_H              (KEY_DMP_CTHX_H + 1)
-#define KEY_DMP_CTHZ_H              (KEY_DMP_CTHY_H + 1)
-#define KEY_DMP_NCTHX_H             (KEY_DMP_CTHZ_H + 1)
-#define KEY_DMP_NCTHY_H             (KEY_DMP_NCTHX_H + 1)
-#define KEY_DMP_NCTHZ_H             (KEY_DMP_NCTHY_H + 1)
-#define KEY_DMP_CTSQ_XH             (KEY_DMP_NCTHZ_H + 1)
-#define KEY_DMP_CTSQ_YH             (KEY_DMP_CTSQ_XH + 1)
-#define KEY_DMP_CTSQ_ZH             (KEY_DMP_CTSQ_YH + 1)
-#define KEY_DMP_INTX_H              (KEY_DMP_CTSQ_ZH + 1)
-#define KEY_DMP_INTY_H              (KEY_DMP_INTX_H + 1)
-#define KEY_DMP_INTZ_H              (KEY_DMP_INTY_H + 1)
-//#define KEY_DMP_HPX_H               (KEY_DMP_INTZ_H + 1)
-//#define KEY_DMP_HPY_H               (KEY_DMP_HPX_H + 1)
-//#define KEY_DMP_HPZ_H               (KEY_DMP_HPY_H + 1)
-
-/* Stream keys */
-#define KEY_STREAM_P_GYRO_Z         (KEY_DMP_INTZ_H + 1)
-#define KEY_STREAM_P_GYRO_Y         (KEY_STREAM_P_GYRO_Z + 1)
-#define KEY_STREAM_P_GYRO_X         (KEY_STREAM_P_GYRO_Y + 1)
-#define KEY_STREAM_P_TEMP           (KEY_STREAM_P_GYRO_X + 1)
-#define KEY_STREAM_P_AUX_Y          (KEY_STREAM_P_TEMP + 1)
-#define KEY_STREAM_P_AUX_X          (KEY_STREAM_P_AUX_Y + 1)
-#define KEY_STREAM_P_AUX_Z          (KEY_STREAM_P_AUX_X + 1)
-#define KEY_STREAM_P_ACCEL_Y        (KEY_STREAM_P_AUX_Z + 1)
-#define KEY_STREAM_P_ACCEL_X        (KEY_STREAM_P_ACCEL_Y + 1)
-#define KEY_STREAM_P_FOOTER         (KEY_STREAM_P_ACCEL_X + 1)
-#define KEY_STREAM_P_ACCEL_Z        (KEY_STREAM_P_FOOTER + 1)
-
-#define NUM_KEYS                    (KEY_STREAM_P_ACCEL_Z + 1)
-
-typedef struct {
-    unsigned short key;
-    unsigned short addr;
-} tKeyLabel;
-
-#define DINA0A 0x0a
-#define DINA22 0x22
-#define DINA42 0x42
-#define DINA5A 0x5a
-
-#define DINA06 0x06
-#define DINA0E 0x0e
-#define DINA16 0x16
-#define DINA1E 0x1e
-#define DINA26 0x26
-#define DINA2E 0x2e
-#define DINA36 0x36
-#define DINA3E 0x3e
-#define DINA46 0x46
-#define DINA4E 0x4e
-#define DINA56 0x56
-#define DINA5E 0x5e
-#define DINA66 0x66
-#define DINA6E 0x6e
-#define DINA76 0x76
-#define DINA7E 0x7e
-
-#define DINA00 0x00
-#define DINA08 0x08
-#define DINA10 0x10
-#define DINA18 0x18
-#define DINA20 0x20
-#define DINA28 0x28
-#define DINA30 0x30
-#define DINA38 0x38
-#define DINA40 0x40
-#define DINA48 0x48
-#define DINA50 0x50
-#define DINA58 0x58
-#define DINA60 0x60
-#define DINA68 0x68
-#define DINA70 0x70
-#define DINA78 0x78
-
-#define DINA04 0x04
-#define DINA0C 0x0c
-#define DINA14 0x14
-#define DINA1C 0x1C
-#define DINA24 0x24
-#define DINA2C 0x2c
-#define DINA34 0x34
-#define DINA3C 0x3c
-#define DINA44 0x44
-#define DINA4C 0x4c
-#define DINA54 0x54
-#define DINA5C 0x5c
-#define DINA64 0x64
-#define DINA6C 0x6c
-#define DINA74 0x74
-#define DINA7C 0x7c
-
-#define DINA01 0x01
-#define DINA09 0x09
-#define DINA11 0x11
-#define DINA19 0x19
-#define DINA21 0x21
-#define DINA29 0x29
-#define DINA31 0x31
-#define DINA39 0x39
-#define DINA41 0x41
-#define DINA49 0x49
-#define DINA51 0x51
-#define DINA59 0x59
-#define DINA61 0x61
-#define DINA69 0x69
-#define DINA71 0x71
-#define DINA79 0x79
-
-#define DINA25 0x25
-#define DINA2D 0x2d
-#define DINA35 0x35
-#define DINA3D 0x3d
-#define DINA4D 0x4d
-#define DINA55 0x55
-#define DINA5D 0x5D
-#define DINA6D 0x6d
-#define DINA75 0x75
-#define DINA7D 0x7d
-
-#define DINADC 0xdc
-#define DINAF2 0xf2
-#define DINAAB 0xab
-#define DINAAA 0xaa
-#define DINAF1 0xf1
-#define DINADF 0xdf
-#define DINADA 0xda
-#define DINAB1 0xb1
-#define DINAB9 0xb9
-#define DINAF3 0xf3
-#define DINA8B 0x8b
-#define DINAA3 0xa3
-#define DINA91 0x91
-#define DINAB6 0xb6
-#define DINAB4 0xb4
-
-
-#define DINC00 0x00
-#define DINC01 0x01
-#define DINC02 0x02
-#define DINC03 0x03
-#define DINC08 0x08
-#define DINC09 0x09
-#define DINC0A 0x0a
-#define DINC0B 0x0b
-#define DINC10 0x10
-#define DINC11 0x11
-#define DINC12 0x12
-#define DINC13 0x13
-#define DINC18 0x18
-#define DINC19 0x19
-#define DINC1A 0x1a
-#define DINC1B 0x1b
-
-#define DINC20 0x20
-#define DINC21 0x21
-#define DINC22 0x22
-#define DINC23 0x23
-#define DINC28 0x28
-#define DINC29 0x29
-#define DINC2A 0x2a
-#define DINC2B 0x2b
-#define DINC30 0x30
-#define DINC31 0x31
-#define DINC32 0x32
-#define DINC33 0x33
-#define DINC38 0x38
-#define DINC39 0x39
-#define DINC3A 0x3a
-#define DINC3B 0x3b
-
-#define DINC40 0x40
-#define DINC41 0x41
-#define DINC42 0x42
-#define DINC43 0x43
-#define DINC48 0x48
-#define DINC49 0x49
-#define DINC4A 0x4a
-#define DINC4B 0x4b
-#define DINC50 0x50
-#define DINC51 0x51
-#define DINC52 0x52
-#define DINC53 0x53
-#define DINC58 0x58
-#define DINC59 0x59
-#define DINC5A 0x5a
-#define DINC5B 0x5b
-
-#define DINC60 0x60
-#define DINC61 0x61
-#define DINC62 0x62
-#define DINC63 0x63
-#define DINC68 0x68
-#define DINC69 0x69
-#define DINC6A 0x6a
-#define DINC6B 0x6b
-#define DINC70 0x70
-#define DINC71 0x71
-#define DINC72 0x72
-#define DINC73 0x73
-#define DINC78 0x78
-#define DINC79 0x79
-#define DINC7A 0x7a
-#define DINC7B 0x7b
-
-#define DIND40 0x40
-
-
-#define DINA80 0x80
-#define DINA90 0x90
-#define DINAA0 0xa0
-#define DINAC9 0xc9
-#define DINACB 0xcb
-#define DINACD 0xcd
-#define DINACF 0xcf
-#define DINAC8 0xc8
-#define DINACA 0xca
-#define DINACC 0xcc
-#define DINACE 0xce
-#define DINAD8 0xd8
-#define DINADD 0xdd
-#define DINAF8 0xf0
-#define DINAFE 0xfe
-
-#define DINBF8 0xf8
-#define DINAC0 0xb0
-#define DINAC1 0xb1
-#define DINAC2 0xb4
-#define DINAC3 0xb5
-#define DINAC4 0xb8
-#define DINAC5 0xb9
-#define DINBC0 0xc0
-#define DINBC2 0xc2
-#define DINBC4 0xc4
-#define DINBC6 0xc6
-
-
-
-#endif // DMPKEY_H__

+ 0 - 264
Core备份3/imu1/dmpmap1.h

@@ -1,264 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011 InvenSense Corporation, All Rights Reserved.
- $
- */
-#ifndef DMPMAP_H
-#define DMPMAP_H
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#define DMP_PTAT    0
-#define DMP_XGYR    2
-#define DMP_YGYR    4
-#define DMP_ZGYR    6
-#define DMP_XACC    8
-#define DMP_YACC    10
-#define DMP_ZACC    12
-#define DMP_ADC1    14
-#define DMP_ADC2    16
-#define DMP_ADC3    18
-#define DMP_BIASUNC    20
-#define DMP_FIFORT    22
-#define DMP_INVGSFH    24
-#define DMP_INVGSFL    26
-#define DMP_1H    28
-#define DMP_1L    30
-#define DMP_BLPFSTCH    32
-#define DMP_BLPFSTCL    34
-#define DMP_BLPFSXH    36
-#define DMP_BLPFSXL    38
-#define DMP_BLPFSYH    40
-#define DMP_BLPFSYL    42
-#define DMP_BLPFSZH    44
-#define DMP_BLPFSZL    46
-#define DMP_BLPFMTC    48
-#define DMP_SMC    50
-#define DMP_BLPFMXH    52
-#define DMP_BLPFMXL    54
-#define DMP_BLPFMYH    56
-#define DMP_BLPFMYL    58
-#define DMP_BLPFMZH    60
-#define DMP_BLPFMZL    62
-#define DMP_BLPFC    64
-#define DMP_SMCTH    66
-#define DMP_0H2    68
-#define DMP_0L2    70
-#define DMP_BERR2H    72
-#define DMP_BERR2L    74
-#define DMP_BERR2NH    76
-#define DMP_SMCINC    78
-#define DMP_ANGVBXH    80
-#define DMP_ANGVBXL    82
-#define DMP_ANGVBYH    84
-#define DMP_ANGVBYL    86
-#define DMP_ANGVBZH    88
-#define DMP_ANGVBZL    90
-#define DMP_BERR1H    92
-#define DMP_BERR1L    94
-#define DMP_ATCH    96
-#define DMP_BIASUNCSF    98
-#define DMP_ACT2H    100
-#define DMP_ACT2L    102
-#define DMP_GSFH    104
-#define DMP_GSFL    106
-#define DMP_GH    108
-#define DMP_GL    110
-#define DMP_0_5H    112
-#define DMP_0_5L    114
-#define DMP_0_0H    116
-#define DMP_0_0L    118
-#define DMP_1_0H    120
-#define DMP_1_0L    122
-#define DMP_1_5H    124
-#define DMP_1_5L    126
-#define DMP_TMP1AH    128
-#define DMP_TMP1AL    130
-#define DMP_TMP2AH    132
-#define DMP_TMP2AL    134
-#define DMP_TMP3AH    136
-#define DMP_TMP3AL    138
-#define DMP_TMP4AH    140
-#define DMP_TMP4AL    142
-#define DMP_XACCW    144
-#define DMP_TMP5    146
-#define DMP_XACCB    148
-#define DMP_TMP8    150
-#define DMP_YACCB    152
-#define DMP_TMP9    154
-#define DMP_ZACCB    156
-#define DMP_TMP10    158
-#define DMP_DZH    160
-#define DMP_DZL    162
-#define DMP_XGCH    164
-#define DMP_XGCL    166
-#define DMP_YGCH    168
-#define DMP_YGCL    170
-#define DMP_ZGCH    172
-#define DMP_ZGCL    174
-#define DMP_YACCW    176
-#define DMP_TMP7    178
-#define DMP_AFB1H    180
-#define DMP_AFB1L    182
-#define DMP_AFB2H    184
-#define DMP_AFB2L    186
-#define DMP_MAGFBH    188
-#define DMP_MAGFBL    190
-#define DMP_QT1H    192
-#define DMP_QT1L    194
-#define DMP_QT2H    196
-#define DMP_QT2L    198
-#define DMP_QT3H    200
-#define DMP_QT3L    202
-#define DMP_QT4H    204
-#define DMP_QT4L    206
-#define DMP_CTRL1H    208
-#define DMP_CTRL1L    210
-#define DMP_CTRL2H    212
-#define DMP_CTRL2L    214
-#define DMP_CTRL3H    216
-#define DMP_CTRL3L    218
-#define DMP_CTRL4H    220
-#define DMP_CTRL4L    222
-#define DMP_CTRLS1    224
-#define DMP_CTRLSF1    226
-#define DMP_CTRLS2    228
-#define DMP_CTRLSF2    230
-#define DMP_CTRLS3    232
-#define DMP_CTRLSFNLL    234
-#define DMP_CTRLS4    236
-#define DMP_CTRLSFNL2    238
-#define DMP_CTRLSFNL    240
-#define DMP_TMP30    242
-#define DMP_CTRLSFJT    244
-#define DMP_TMP31    246
-#define DMP_TMP11    248
-#define DMP_CTRLSF2_2    250
-#define DMP_TMP12    252
-#define DMP_CTRLSF1_2    254
-#define DMP_PREVPTAT    256
-#define DMP_ACCZB    258
-#define DMP_ACCXB    264
-#define DMP_ACCYB    266
-#define DMP_1HB    272
-#define DMP_1LB    274
-#define DMP_0H    276
-#define DMP_0L    278
-#define DMP_ASR22H    280
-#define DMP_ASR22L    282
-#define DMP_ASR6H    284
-#define DMP_ASR6L    286
-#define DMP_TMP13    288
-#define DMP_TMP14    290
-#define DMP_FINTXH    292
-#define DMP_FINTXL    294
-#define DMP_FINTYH    296
-#define DMP_FINTYL    298
-#define DMP_FINTZH    300
-#define DMP_FINTZL    302
-#define DMP_TMP1BH    304
-#define DMP_TMP1BL    306
-#define DMP_TMP2BH    308
-#define DMP_TMP2BL    310
-#define DMP_TMP3BH    312
-#define DMP_TMP3BL    314
-#define DMP_TMP4BH    316
-#define DMP_TMP4BL    318
-#define DMP_STXG    320
-#define DMP_ZCTXG    322
-#define DMP_STYG    324
-#define DMP_ZCTYG    326
-#define DMP_STZG    328
-#define DMP_ZCTZG    330
-#define DMP_CTRLSFJT2    332
-#define DMP_CTRLSFJTCNT    334
-#define DMP_PVXG    336
-#define DMP_TMP15    338
-#define DMP_PVYG    340
-#define DMP_TMP16    342
-#define DMP_PVZG    344
-#define DMP_TMP17    346
-#define DMP_MNMFLAGH    352
-#define DMP_MNMFLAGL    354
-#define DMP_MNMTMH    356
-#define DMP_MNMTML    358
-#define DMP_MNMTMTHRH    360
-#define DMP_MNMTMTHRL    362
-#define DMP_MNMTHRH    364
-#define DMP_MNMTHRL    366
-#define DMP_ACCQD4H    368
-#define DMP_ACCQD4L    370
-#define DMP_ACCQD5H    372
-#define DMP_ACCQD5L    374
-#define DMP_ACCQD6H    376
-#define DMP_ACCQD6L    378
-#define DMP_ACCQD7H    380
-#define DMP_ACCQD7L    382
-#define DMP_ACCQD0H    384
-#define DMP_ACCQD0L    386
-#define DMP_ACCQD1H    388
-#define DMP_ACCQD1L    390
-#define DMP_ACCQD2H    392
-#define DMP_ACCQD2L    394
-#define DMP_ACCQD3H    396
-#define DMP_ACCQD3L    398
-#define DMP_XN2H    400
-#define DMP_XN2L    402
-#define DMP_XN1H    404
-#define DMP_XN1L    406
-#define DMP_YN2H    408
-#define DMP_YN2L    410
-#define DMP_YN1H    412
-#define DMP_YN1L    414
-#define DMP_YH    416
-#define DMP_YL    418
-#define DMP_B0H    420
-#define DMP_B0L    422
-#define DMP_A1H    424
-#define DMP_A1L    426
-#define DMP_A2H    428
-#define DMP_A2L    430
-#define DMP_SEM1    432
-#define DMP_FIFOCNT    434
-#define DMP_SH_TH_X    436
-#define DMP_PACKET    438
-#define DMP_SH_TH_Y    440
-#define DMP_FOOTER    442
-#define DMP_SH_TH_Z    444
-#define DMP_TEMP29    448
-#define DMP_TEMP30    450
-#define DMP_XACCB_PRE    452
-#define DMP_XACCB_PREL    454
-#define DMP_YACCB_PRE    456
-#define DMP_YACCB_PREL    458
-#define DMP_ZACCB_PRE    460
-#define DMP_ZACCB_PREL    462
-#define DMP_TMP22    464
-#define DMP_TAP_TIMER    466
-#define DMP_TAP_THX    468
-#define DMP_TAP_THY    472
-#define DMP_TAP_THZ    476
-#define DMP_TAPW_MIN    478
-#define DMP_TMP25    480
-#define DMP_TMP26    482
-#define DMP_TMP27    484
-#define DMP_TMP28    486
-#define DMP_ORIENT    488
-#define DMP_THRSH    490
-#define DMP_ENDIANH    492
-#define DMP_ENDIANL    494
-#define DMP_BLPFNMTCH    496
-#define DMP_BLPFNMTCL    498
-#define DMP_BLPFNMXH    500
-#define DMP_BLPFNMXL    502
-#define DMP_BLPFNMYH    504
-#define DMP_BLPFNMYL    506
-#define DMP_BLPFNMZH    508
-#define DMP_BLPFNMZL    510
-#ifdef __cplusplus
-}
-#endif
-#endif // DMPMAP_H

+ 0 - 2774
Core备份3/imu1/inv_mpu1.c

@@ -1,2774 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011-2012 InvenSense Corporation, All Rights Reserved.
-    See included License.txt for License information.
- $
- */
-/**
- *  @addtogroup  DRIVERS Sensor Driver Layer
- *  @brief       Hardware drivers to communicate with sensors via I2C.
- *
- *  @{
- *      @file       inv_mpu.c
- *      @brief      An I2C-based driver for Invensense gyroscopes.
- *      @details    This driver currently works for the following devices:
- *                  MPU6050
- *                  MPU6500
- *                  MPU9150 (or MPU6050 w/ AK8975 on the auxiliary bus)
- *                  MPU9250 (or MPU6500 w/ AK8963 on the auxiliary bus)
- */
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include "inv_mpu1.h"
-
-#include "MPU60501.h"
-
-
-/* The following functions must be defined for this platform:
- * i2c_write(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char const *data)
- * i2c_read(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char *data)
- * delay_ms(unsigned long num_ms)
- * get_ms(unsigned long *count)
- * reg_int_cb(void (*cb)(void), unsigned char port, unsigned char pin)
- * labs(long x)
- * fabsf(float x)
- * min(int a, int b)
- */
-#if defined MOTION_DRIVER_TARGET_MSP430
-#include "msp430.h"
-#include "msp430_i2c.h"
-#include "msp430_clock.h"
-#include "msp430_interrupt.h"
-#define i2c_write   msp430_i2c_write
-#define i2c_read    msp430_i2c_read
-#define delay_ms    msp430_delay_ms
-#define get_ms      msp430_get_clock_ms
-static inline int reg_int_cb(struct int_param_s *int_param)
-{
-    return msp430_reg_int_cb(int_param->cb, int_param->pin, int_param->lp_exit,
-        int_param->active_low);
-}
-#define log_i(...)     do {} while (0)
-#define log_e(...)     do {} while (0)
-/* labs is already defined by TI's toolchain. */
-/* fabs is for doubles. fabsf is for floats. */
-#define fabs        fabsf
-#define min(a,b) ((a<b)?a:b)
-#elif defined EMPL_TARGET_MSP430
-#include "msp430.h"
-#include "msp430_i2c.h"
-#include "msp430_clock.h"
-#include "msp430_interrupt.h"
-#include "log.h"
-#define i2c_write   msp430_i2c_write
-#define i2c_read    msp430_i2c_read
-#define delay_ms    msp430_delay_ms
-#define get_ms      msp430_get_clock_ms
-static inline int reg_int_cb(struct int_param_s *int_param)
-{
-    return msp430_reg_int_cb(int_param->cb, int_param->pin, int_param->lp_exit,
-        int_param->active_low);
-}
-#define log_i       MPL_LOGI
-#define log_e       MPL_LOGE
-/* labs is already defined by TI's toolchain. */
-/* fabs is for doubles. fabsf is for floats. */
-#define fabs        fabsf
-#define min(a,b) ((a<b)?a:b)
-#elif defined EMPL_TARGET_UC3L0
-/* Instead of using the standard TWI driver from the ASF library, we're using
- * a TWI driver that follows the slave address + register address convention.
- */
-#include "twi.h"
-#include "delay.h"
-#include "sysclk.h"
-#include "log.h"
-#include "sensors_xplained.h"
-#include "uc3l0_clock.h"
-#define i2c_write(a, b, c, d)   twi_write(a, b, d, c)
-#define i2c_read(a, b, c, d)    twi_read(a, b, d, c)
-/* delay_ms is a function already defined in ASF. */
-#define get_ms  uc3l0_get_clock_ms
-static inline int reg_int_cb(struct int_param_s *int_param)
-{
-    sensor_board_irq_connect(int_param->pin, int_param->cb, int_param->arg);
-    return 0;
-}
-#define log_i       MPL_LOGI
-#define log_e       MPL_LOGE
-/* UC3 is a 32-bit processor, so abs and labs are equivalent. */
-#define labs        abs
-#define fabs(x)     (((x)>0)?(x):-(x))
-#elif defined MOTION_DRIVER_TARGET_STM32
-
-/* The following functions must be defined for this platform:
- * i2c_write(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char const *data)
- * i2c_read(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char *data)
- * delay_ms(unsigned long num_ms)
- * get_ms(unsigned long *count)
- * reg_int_cb(void (*cb)(void), unsigned char port, unsigned char pin)
- * labs(long x)
- * fabsf(float x)
- * min(int a, int b)
- */
-
-#define i2c_write   IIC_Write_Len
-#define i2c_read    IIC_Read_Len
-#define delay_ms    HAL_Delay
-#define get_ms      get_tick_count
-//static inline int reg_int_cb(struct int_param_s *int_param)
-//{
-////    return msp430_reg_int_cb(int_param->cb, int_param->pin, int_param->lp_exit,
-////        int_param->active_low);
-//}
-//#define log_i(...)     do {} while (0)
-//#define log_e(...)     do {} while (0)
-
-#define log_i     printf
-#define log_e     printf
-
-/* labs is already defined by TI's toolchain. */
-/* fabs is for doubles. fabsf is for floats. */
-#define fabs        fabsf
-#define min(a,b) ((a<b)?a:b)
-
-#else
-#error  Gyro driver is missing the system layer implementations.
-#endif
-
-#if !defined MPU6050 && !defined MPU9150 && !defined MPU6500 && !defined MPU9250
-#error  Which gyro are you using? Define MPUxxxx in your compiler options.
-#endif
-
-/* Time for some messy macro work. =]
- * #define MPU9150
- * is equivalent to..
- * #define MPU6050
- * #define AK8975_SECONDARY
- *
- * #define MPU9250
- * is equivalent to..
- * #define MPU6500
- * #define AK8963_SECONDARY
- */
-#if defined MPU9150
-#ifndef MPU6050
-#define MPU6050
-#endif                          /* #ifndef MPU6050 */
-#if defined AK8963_SECONDARY
-#error "MPU9150 and AK8963_SECONDARY cannot both be defined."
-#elif !defined AK8975_SECONDARY /* #if defined AK8963_SECONDARY */
-#define AK8975_SECONDARY
-#endif                          /* #if defined AK8963_SECONDARY */
-#elif defined MPU9250           /* #if defined MPU9150 */
-#ifndef MPU6500
-#define MPU6500
-#endif                          /* #ifndef MPU6500 */
-#if defined AK8975_SECONDARY
-#error "MPU9250 and AK8975_SECONDARY cannot both be defined."
-#elif !defined AK8963_SECONDARY /* #if defined AK8975_SECONDARY */
-#define AK8963_SECONDARY
-#endif                          /* #if defined AK8975_SECONDARY */
-#endif                          /* #if defined MPU9150 */
-
-#if defined AK8975_SECONDARY || defined AK8963_SECONDARY
-#define AK89xx_SECONDARY
-#else
-/* #warning "No compass = less profit for Invensense. Lame." */
-#endif
-
-static int set_int_enable(unsigned char enable);
-
-/* Hardware registers needed by driver. */
-struct gyro_reg_s {
-    unsigned char who_am_i;
-    unsigned char rate_div;
-    unsigned char lpf;
-    unsigned char prod_id;
-    unsigned char user_ctrl;
-    unsigned char fifo_en;
-    unsigned char gyro_cfg;
-    unsigned char accel_cfg;
-    unsigned char accel_cfg2;
-    unsigned char lp_accel_odr;
-    unsigned char motion_thr;
-    unsigned char motion_dur;
-    unsigned char fifo_count_h;
-    unsigned char fifo_r_w;
-    unsigned char raw_gyro;
-    unsigned char raw_accel;
-    unsigned char temp;
-    unsigned char int_enable;
-    unsigned char dmp_int_status;
-    unsigned char int_status;
-    unsigned char accel_intel;
-    unsigned char pwr_mgmt_1;
-    unsigned char pwr_mgmt_2;
-    unsigned char int_pin_cfg;
-    unsigned char mem_r_w;
-    unsigned char accel_offs;
-    unsigned char i2c_mst;
-    unsigned char bank_sel;
-    unsigned char mem_start_addr;
-    unsigned char prgm_start_h;
-#if defined AK89xx_SECONDARY
-    unsigned char s0_addr;
-    unsigned char s0_reg;
-    unsigned char s0_ctrl;
-    unsigned char s1_addr;
-    unsigned char s1_reg;
-    unsigned char s1_ctrl;
-    unsigned char s4_ctrl;
-    unsigned char s0_do;
-    unsigned char s1_do;
-    unsigned char i2c_delay_ctrl;
-    unsigned char raw_compass;
-    /* The I2C_MST_VDDIO bit is in this register. */
-    unsigned char yg_offs_tc;
-#endif
-};
-
-/* Information specific to a particular device. */
-struct hw_s {
-    unsigned char addr;
-    unsigned short max_fifo;
-    unsigned char num_reg;
-    unsigned short temp_sens;
-    short temp_offset;
-    unsigned short bank_size;
-#if defined AK89xx_SECONDARY
-    unsigned short compass_fsr;
-#endif
-};
-
-/* When entering motion interrupt mode, the driver keeps track of the
- * previous state so that it can be restored at a later time.
- * TODO: This is tacky. Fix it.
- */
-struct motion_int_cache_s {
-    unsigned short gyro_fsr;
-    unsigned char accel_fsr;
-    unsigned short lpf;
-    unsigned short sample_rate;
-    unsigned char sensors_on;
-    unsigned char fifo_sensors;
-    unsigned char dmp_on;
-};
-
-/* Cached chip configuration data.
- * TODO: A lot of these can be handled with a bitmask.
- */
-struct chip_cfg_s {
-    /* Matches gyro_cfg >> 3 & 0x03 */
-    unsigned char gyro_fsr;
-    /* Matches accel_cfg >> 3 & 0x03 */
-    unsigned char accel_fsr;
-    /* Enabled sensors. Uses same masks as fifo_en, NOT pwr_mgmt_2. */
-    unsigned char sensors;
-    /* Matches config register. */
-    unsigned char lpf;
-    unsigned char clk_src;
-    /* Sample rate, NOT rate divider. */
-    unsigned short sample_rate;
-    /* Matches fifo_en register. */
-    unsigned char fifo_enable;
-    /* Matches int enable register. */
-    unsigned char int_enable;
-    /* 1 if devices on auxiliary I2C bus appear on the primary. */
-    unsigned char bypass_mode;
-    /* 1 if half-sensitivity.
-     * NOTE: This doesn't belong here, but everything else in hw_s is const,
-     * and this allows us to save some precious RAM.
-     */
-    unsigned char accel_half;
-    /* 1 if device in low-power accel-only mode. */
-    unsigned char lp_accel_mode;
-    /* 1 if interrupts are only triggered on motion events. */
-    unsigned char int_motion_only;
-    struct motion_int_cache_s cache;
-    /* 1 for active low interrupts. */
-    unsigned char active_low_int;
-    /* 1 for latched interrupts. */
-    unsigned char latched_int;
-    /* 1 if DMP is enabled. */
-    unsigned char dmp_on;
-    /* Ensures that DMP will only be loaded once. */
-    unsigned char dmp_loaded;
-    /* Sampling rate used when DMP is enabled. */
-    unsigned short dmp_sample_rate;
-#ifdef AK89xx_SECONDARY
-    /* Compass sample rate. */
-    unsigned short compass_sample_rate;
-    unsigned char compass_addr;
-    short mag_sens_adj[3];
-#endif
-};
-
-/* Information for self-test. */
-struct test_s {
-    unsigned long gyro_sens;
-    unsigned long accel_sens;
-    unsigned char reg_rate_div;
-    unsigned char reg_lpf;
-    unsigned char reg_gyro_fsr;
-    unsigned char reg_accel_fsr;
-    unsigned short wait_ms;
-    unsigned char packet_thresh;
-    float min_dps;
-    float max_dps;
-    float max_gyro_var;
-    float min_g;
-    float max_g;
-    float max_accel_var;
-};
-
-/* Gyro driver state variables. */
-struct gyro_state_s {
-    const struct gyro_reg_s *reg;
-    const struct hw_s *hw;
-    struct chip_cfg_s chip_cfg;
-    const struct test_s *test;
-};
-
-/* Filter configurations. */
-enum lpf_e {
-    INV_FILTER_256HZ_NOLPF2 = 0,
-    INV_FILTER_188HZ,
-    INV_FILTER_98HZ,
-    INV_FILTER_42HZ,
-    INV_FILTER_20HZ,
-    INV_FILTER_10HZ,
-    INV_FILTER_5HZ,
-    INV_FILTER_2100HZ_NOLPF,
-    NUM_FILTER
-};
-
-/* Full scale ranges. */
-enum gyro_fsr_e {
-    INV_FSR_250DPS = 0,
-    INV_FSR_500DPS,
-    INV_FSR_1000DPS,
-    INV_FSR_2000DPS,
-    NUM_GYRO_FSR
-};
-
-/* Full scale ranges. */
-enum accel_fsr_e {
-    INV_FSR_2G = 0,
-    INV_FSR_4G,
-    INV_FSR_8G,
-    INV_FSR_16G,
-    NUM_ACCEL_FSR
-};
-
-/* Clock sources. */
-enum clock_sel_e {
-    INV_CLK_INTERNAL = 0,
-    INV_CLK_PLL,
-    NUM_CLK
-};
-
-/* Low-power accel wakeup rates. */
-enum lp_accel_rate_e {
-#if defined MPU6050
-    INV_LPA_1_25HZ,
-    INV_LPA_5HZ,
-    INV_LPA_20HZ,
-    INV_LPA_40HZ
-#elif defined MPU6500
-    INV_LPA_0_3125HZ,
-    INV_LPA_0_625HZ,
-    INV_LPA_1_25HZ,
-    INV_LPA_2_5HZ,
-    INV_LPA_5HZ,
-    INV_LPA_10HZ,
-    INV_LPA_20HZ,
-    INV_LPA_40HZ,
-    INV_LPA_80HZ,
-    INV_LPA_160HZ,
-    INV_LPA_320HZ,
-    INV_LPA_640HZ
-#endif
-};
-
-#define BIT_I2C_MST_VDDIO   (0x80)
-#define BIT_FIFO_EN         (0x40)
-#define BIT_DMP_EN          (0x80)
-#define BIT_FIFO_RST        (0x04)
-#define BIT_DMP_RST         (0x08)
-#define BIT_FIFO_OVERFLOW   (0x10)
-#define BIT_DATA_RDY_EN     (0x01)
-#define BIT_DMP_INT_EN      (0x02)
-#define BIT_MOT_INT_EN      (0x40)
-#define BITS_FSR            (0x18)
-#define BITS_LPF            (0x07)
-#define BITS_HPF            (0x07)
-#define BITS_CLK            (0x07)
-#define BIT_FIFO_SIZE_1024  (0x40)
-#define BIT_FIFO_SIZE_2048  (0x80)
-#define BIT_FIFO_SIZE_4096  (0xC0)
-#define BIT_RESET           (0x80)
-#define BIT_SLEEP           (0x40)
-#define BIT_S0_DELAY_EN     (0x01)
-#define BIT_S2_DELAY_EN     (0x04)
-#define BITS_SLAVE_LENGTH   (0x0F)
-#define BIT_SLAVE_BYTE_SW   (0x40)
-#define BIT_SLAVE_GROUP     (0x10)
-#define BIT_SLAVE_EN        (0x80)
-#define BIT_I2C_READ        (0x80)
-#define BITS_I2C_MASTER_DLY (0x1F)
-#define BIT_AUX_IF_EN       (0x20)
-#define BIT_ACTL            (0x80)
-#define BIT_LATCH_EN        (0x20)
-#define BIT_ANY_RD_CLR      (0x10)
-#define BIT_BYPASS_EN       (0x02)
-#define BITS_WOM_EN         (0xC0)
-#define BIT_LPA_CYCLE       (0x20)
-#define BIT_STBY_XA         (0x20)
-#define BIT_STBY_YA         (0x10)
-#define BIT_STBY_ZA         (0x08)
-#define BIT_STBY_XG         (0x04)
-#define BIT_STBY_YG         (0x02)
-#define BIT_STBY_ZG         (0x01)
-#define BIT_STBY_XYZA       (BIT_STBY_XA | BIT_STBY_YA | BIT_STBY_ZA)
-#define BIT_STBY_XYZG       (BIT_STBY_XG | BIT_STBY_YG | BIT_STBY_ZG)
-
-#if defined AK8975_SECONDARY
-#define SUPPORTS_AK89xx_HIGH_SENS   (0x00)
-#define AK89xx_FSR                  (9830)
-#elif defined AK8963_SECONDARY
-#define SUPPORTS_AK89xx_HIGH_SENS   (0x10)
-#define AK89xx_FSR                  (4915)
-#endif
-
-#ifdef AK89xx_SECONDARY
-#define AKM_REG_WHOAMI      (0x00)
-
-#define AKM_REG_ST1         (0x02)
-#define AKM_REG_HXL         (0x03)
-#define AKM_REG_ST2         (0x09)
-
-#define AKM_REG_CNTL        (0x0A)
-#define AKM_REG_ASTC        (0x0C)
-#define AKM_REG_ASAX        (0x10)
-#define AKM_REG_ASAY        (0x11)
-#define AKM_REG_ASAZ        (0x12)
-
-#define AKM_DATA_READY      (0x01)
-#define AKM_DATA_OVERRUN    (0x02)
-#define AKM_OVERFLOW        (0x80)
-#define AKM_DATA_ERROR      (0x40)
-
-#define AKM_BIT_SELF_TEST   (0x40)
-
-#define AKM_POWER_DOWN          (0x00 | SUPPORTS_AK89xx_HIGH_SENS)
-#define AKM_SINGLE_MEASUREMENT  (0x01 | SUPPORTS_AK89xx_HIGH_SENS)
-#define AKM_FUSE_ROM_ACCESS     (0x0F | SUPPORTS_AK89xx_HIGH_SENS)
-#define AKM_MODE_SELF_TEST      (0x08 | SUPPORTS_AK89xx_HIGH_SENS)
-
-#define AKM_WHOAMI      (0x48)
-#endif
-
-#if defined MPU6050
-const struct gyro_reg_s reg = {
-    .who_am_i       = 0x75,
-    .rate_div       = 0x19,
-    .lpf            = 0x1A,
-    .prod_id        = 0x0C,
-    .user_ctrl      = 0x6A,
-    .fifo_en        = 0x23,
-    .gyro_cfg       = 0x1B,
-    .accel_cfg      = 0x1C,
-    .motion_thr     = 0x1F,
-    .motion_dur     = 0x20,
-    .fifo_count_h   = 0x72,
-    .fifo_r_w       = 0x74,
-    .raw_gyro       = 0x43,
-    .raw_accel      = 0x3B,
-    .temp           = 0x41,
-    .int_enable     = 0x38,
-    .dmp_int_status = 0x39,
-    .int_status     = 0x3A,
-    .pwr_mgmt_1     = 0x6B,
-    .pwr_mgmt_2     = 0x6C,
-    .int_pin_cfg    = 0x37,
-    .mem_r_w        = 0x6F,
-    .accel_offs     = 0x06,
-    .i2c_mst        = 0x24,
-    .bank_sel       = 0x6D,
-    .mem_start_addr = 0x6E,
-    .prgm_start_h   = 0x70
-#ifdef AK89xx_SECONDARY
-    ,.raw_compass   = 0x49,
-    .yg_offs_tc     = 0x01,
-    .s0_addr        = 0x25,
-    .s0_reg         = 0x26,
-    .s0_ctrl        = 0x27,
-    .s1_addr        = 0x28,
-    .s1_reg         = 0x29,
-    .s1_ctrl        = 0x2A,
-    .s4_ctrl        = 0x34,
-    .s0_do          = 0x63,
-    .s1_do          = 0x64,
-    .i2c_delay_ctrl = 0x67
-#endif
-};
-const struct hw_s hw = {
-    .addr           = 0x68,
-    .max_fifo       = 1024,
-    .num_reg        = 118,
-    .temp_sens      = 340,
-    .temp_offset    = -521,
-    .bank_size      = 256
-#if defined AK89xx_SECONDARY
-    ,.compass_fsr    = AK89xx_FSR
-#endif
-};
-
-const struct test_s test = {
-    .gyro_sens      = 32768/250,
-    .accel_sens     = 32768/16,
-    .reg_rate_div   = 0,    /* 1kHz. */
-    .reg_lpf        = 1,    /* 188Hz. */
-    .reg_gyro_fsr   = 0,    /* 250dps. */
-    .reg_accel_fsr  = 0x18, /* 16g. */
-    .wait_ms        = 50,
-    .packet_thresh  = 5,    /* 5% */
-    .min_dps        = 10.f,
-    .max_dps        = 105.f,
-    .max_gyro_var   = 0.14f,
-    .min_g          = 0.3f,
-    .max_g          = 0.95f,
-    .max_accel_var  = 0.14f
-};
-
-static struct gyro_state_s st = {
-    .reg = &reg,
-    .hw = &hw,
-    .test = &test
-};
-#elif defined MPU6500
-const struct gyro_reg_s reg = {
-    .who_am_i       = 0x75,
-    .rate_div       = 0x19,
-    .lpf            = 0x1A,
-    .prod_id        = 0x0C,
-    .user_ctrl      = 0x6A,
-    .fifo_en        = 0x23,
-    .gyro_cfg       = 0x1B,
-    .accel_cfg      = 0x1C,
-    .accel_cfg2     = 0x1D,
-    .lp_accel_odr   = 0x1E,
-    .motion_thr     = 0x1F,
-    .motion_dur     = 0x20,
-    .fifo_count_h   = 0x72,
-    .fifo_r_w       = 0x74,
-    .raw_gyro       = 0x43,
-    .raw_accel      = 0x3B,
-    .temp           = 0x41,
-    .int_enable     = 0x38,
-    .dmp_int_status = 0x39,
-    .int_status     = 0x3A,
-    .accel_intel    = 0x69,
-    .pwr_mgmt_1     = 0x6B,
-    .pwr_mgmt_2     = 0x6C,
-    .int_pin_cfg    = 0x37,
-    .mem_r_w        = 0x6F,
-    .accel_offs     = 0x77,
-    .i2c_mst        = 0x24,
-    .bank_sel       = 0x6D,
-    .mem_start_addr = 0x6E,
-    .prgm_start_h   = 0x70
-#ifdef AK89xx_SECONDARY
-    ,.raw_compass   = 0x49,
-    .s0_addr        = 0x25,
-    .s0_reg         = 0x26,
-    .s0_ctrl        = 0x27,
-    .s1_addr        = 0x28,
-    .s1_reg         = 0x29,
-    .s1_ctrl        = 0x2A,
-    .s4_ctrl        = 0x34,
-    .s0_do          = 0x63,
-    .s1_do          = 0x64,
-    .i2c_delay_ctrl = 0x67
-#endif
-};
-const struct hw_s hw = {
-    .addr           = 0x68,
-    .max_fifo       = 1024,
-    .num_reg        = 128,
-    .temp_sens      = 321,
-    .temp_offset    = 0,
-    .bank_size      = 256
-#if defined AK89xx_SECONDARY
-    ,.compass_fsr    = AK89xx_FSR
-#endif
-};
-
-const struct test_s test = {
-    .gyro_sens      = 32768/250,
-    .accel_sens     = 32768/16,
-    .reg_rate_div   = 0,    /* 1kHz. */
-    .reg_lpf        = 1,    /* 188Hz. */
-    .reg_gyro_fsr   = 0,    /* 250dps. */
-    .reg_accel_fsr  = 0x18, /* 16g. */
-    .wait_ms        = 50,
-    .packet_thresh  = 5,    /* 5% */
-    .min_dps        = 10.f,
-    .max_dps        = 105.f,
-    .max_gyro_var   = 0.14f,
-    .min_g          = 0.3f,
-    .max_g          = 0.95f,
-    .max_accel_var  = 0.14f
-};
-
-static struct gyro_state_s st = {
-    .reg = &reg,
-    .hw = &hw,
-    .test = &test
-};
-#endif
-
-#define MAX_PACKET_LENGTH (12)
-
-#ifdef AK89xx_SECONDARY
-static int setup_compass(void);
-#define MAX_COMPASS_SAMPLE_RATE (100)
-#endif
-
-/**
- *  @brief      Enable/disable data ready interrupt.
- *  If the DMP is on, the DMP interrupt is enabled. Otherwise, the data ready
- *  interrupt is used.
- *  @param[in]  enable      1 to enable interrupt.
- *  @return     0 if successful.
- */
-static int set_int_enable(unsigned char enable)
-{
-    unsigned char tmp;
-
-    if (st.chip_cfg.dmp_on) {
-        if (enable)
-            tmp = BIT_DMP_INT_EN;
-        else
-            tmp = 0x00;
-        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &tmp))
-            return -1;
-        st.chip_cfg.int_enable = tmp;
-    } else {
-        if (!st.chip_cfg.sensors)
-            return -1;
-        if (enable && st.chip_cfg.int_enable)
-            return 0;
-        if (enable)
-            tmp = BIT_DATA_RDY_EN;
-        else
-            tmp = 0x00;
-        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &tmp))
-            return -1;
-        st.chip_cfg.int_enable = tmp;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Register dump for testing.
- *  @return     0 if successful.
- */
-int mpu_reg_dump(void)
-{
-    unsigned char ii;
-    unsigned char data;
-
-    for (ii = 0; ii < st.hw->num_reg; ii++) {
-        if (ii == st.reg->fifo_r_w || ii == st.reg->mem_r_w)
-            continue;
-        if (i2c_read(st.hw->addr, ii, 1, &data))
-            return -1;
-        log_i("%#5x: %#5x\r\n", ii, data);
-    }
-    return 0;
-}
-
-/**
- *  @brief      Read from a single register.
- *  NOTE: The memory and FIFO read/write registers cannot be accessed.
- *  @param[in]  reg     Register address.
- *  @param[out] data    Register data.
- *  @return     0 if successful.
- */
-int mpu_read_reg(unsigned char reg, unsigned char *data)
-{
-    if (reg == st.reg->fifo_r_w || reg == st.reg->mem_r_w)
-        return -1;
-    if (reg >= st.hw->num_reg)
-        return -1;
-    return i2c_read(st.hw->addr, reg, 1, data);
-}
-
-/**
- *  @brief      Initialize hardware.
- *  Initial configuration:\n
- *  Gyro FSR: +/- 2000DPS\n
- *  Accel FSR +/- 2G\n
- *  DLPF: 42Hz\n
- *  FIFO rate: 50Hz\n
- *  Clock source: Gyro PLL\n
- *  FIFO: Disabled.\n
- *  Data ready interrupt: Disabled, active low, unlatched.
- *  @param[in]  int_param   Platform-specific parameters to interrupt API.
- *  @return     0 if successful.
- */
-int mpu_init(struct int_param_s *int_param)
-{
-    unsigned char data[6], rev;
-
-    /* Reset device. */
-    data[0] = BIT_RESET;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, data))
-        return -1;
-    delay_ms(100);
-
-    /* Wake up chip. */
-    data[0] = 0x00;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, data))
-        return -1;
-
-#if defined MPU6050
-    /* Check product revision. */
-    if (i2c_read(st.hw->addr, st.reg->accel_offs, 6, data))
-        return -1;
-    rev = ((data[5] & 0x01) << 2) | ((data[3] & 0x01) << 1) |
-        (data[1] & 0x01);
-
-    if (rev) {
-        /* Congrats, these parts are better. */
-        if (rev == 1)
-            st.chip_cfg.accel_half = 1;
-        else if (rev == 2)
-            st.chip_cfg.accel_half = 0;
-        else {
-            log_e("Unsupported software product rev %d.\n", rev);
-            return -1;
-        }
-    } else {
-        if (i2c_read(st.hw->addr, st.reg->prod_id, 1, data))
-            return -1;
-        rev = data[0] & 0x0F;
-        if (!rev) {
-            log_e("Product ID read as 0 indicates device is either "
-                "incompatible or an MPU3050.\n");
-            return -1;
-        } else if (rev == 4) {
-            log_i("Half sensitivity part found.\n");
-            st.chip_cfg.accel_half = 1;
-        } else
-            st.chip_cfg.accel_half = 0;
-    }
-#elif defined MPU6500
-#define MPU6500_MEM_REV_ADDR    (0x17)
-    if (mpu_read_mem(MPU6500_MEM_REV_ADDR, 1, &rev))
-        return -1;
-    if (rev == 0x1)
-        st.chip_cfg.accel_half = 0;
-    else {
-        log_e("Unsupported software product rev %d.\n", rev);
-        return -1;
-    }
-
-    /* MPU6500 shares 4kB of memory between the DMP and the FIFO. Since the
-     * first 3kB are needed by the DMP, we'll use the last 1kB for the FIFO.
-     */
-    data[0] = BIT_FIFO_SIZE_1024 | 0x8;
-    if (i2c_write(st.hw->addr, st.reg->accel_cfg2, 1, data))
-        return -1;
-#endif
-
-    /* Set to invalid values to ensure no I2C writes are skipped. */
-    st.chip_cfg.sensors = 0xFF;
-    st.chip_cfg.gyro_fsr = 0xFF;
-    st.chip_cfg.accel_fsr = 0xFF;
-    st.chip_cfg.lpf = 0xFF;
-    st.chip_cfg.sample_rate = 0xFFFF;
-    st.chip_cfg.fifo_enable = 0xFF;
-    st.chip_cfg.bypass_mode = 0xFF;
-#ifdef AK89xx_SECONDARY
-    st.chip_cfg.compass_sample_rate = 0xFFFF;
-#endif
-    /* mpu_set_sensors always preserves this setting. */
-    st.chip_cfg.clk_src = INV_CLK_PLL;
-    /* Handled in next call to mpu_set_bypass. */
-    st.chip_cfg.active_low_int = 1;
-    st.chip_cfg.latched_int = 0;
-    st.chip_cfg.int_motion_only = 0;
-    st.chip_cfg.lp_accel_mode = 0;
-    memset(&st.chip_cfg.cache, 0, sizeof(st.chip_cfg.cache));
-    st.chip_cfg.dmp_on = 0;
-    st.chip_cfg.dmp_loaded = 0;
-    st.chip_cfg.dmp_sample_rate = 0;
-
-    if (mpu_set_gyro_fsr(2000))
-        return -1;
-    if (mpu_set_accel_fsr(2))
-        return -1;
-    if (mpu_set_lpf(42))
-        return -1;
-    if (mpu_set_sample_rate(50))
-        return -1;
-    if (mpu_configure_fifo(0))
-        return -1;
-
-#ifndef MOTION_DRIVER_TARGET_STM32
-    if (int_param)
-        reg_int_cb(int_param);
-#endif
-
-#ifdef AK89xx_SECONDARY
-    setup_compass();
-    if (mpu_set_compass_sample_rate(10))
-        return -1;
-#else
-    /* Already disabled by setup_compass. */
-    if (mpu_set_bypass(0))
-        return -1;
-#endif
-
-    mpu_set_sensors(0);
-    return 0;
-}
-
-/**
- *  @brief      Enter low-power accel-only mode.
- *  In low-power accel mode, the chip goes to sleep and only wakes up to sample
- *  the accelerometer at one of the following frequencies:
- *  \n MPU6050: 1.25Hz, 5Hz, 20Hz, 40Hz
- *  \n MPU6500: 1.25Hz, 2.5Hz, 5Hz, 10Hz, 20Hz, 40Hz, 80Hz, 160Hz, 320Hz, 640Hz
- *  \n If the requested rate is not one listed above, the device will be set to
- *  the next highest rate. Requesting a rate above the maximum supported
- *  frequency will result in an error.
- *  \n To select a fractional wake-up frequency, round down the value passed to
- *  @e rate.
- *  @param[in]  rate        Minimum sampling rate, or zero to disable LP
- *                          accel mode.
- *  @return     0 if successful.
- */
-int mpu_lp_accel_mode(unsigned char rate)
-{
-    unsigned char tmp[2];
-
-    if (rate > 40)
-        return -1;
-
-    if (!rate) {
-        mpu_set_int_latched(0);
-        tmp[0] = 0;
-        tmp[1] = BIT_STBY_XYZG;
-        if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 2, tmp))
-            return -1;
-        st.chip_cfg.lp_accel_mode = 0;
-        return 0;
-    }
-    /* For LP accel, we automatically configure the hardware to produce latched
-     * interrupts. In LP accel mode, the hardware cycles into sleep mode before
-     * it gets a chance to deassert the interrupt pin; therefore, we shift this
-     * responsibility over to the MCU.
-     *
-     * Any register read will clear the interrupt.
-     */
-    mpu_set_int_latched(1);
-#if defined MPU6050
-    tmp[0] = BIT_LPA_CYCLE;
-    if (rate == 1) {
-        tmp[1] = INV_LPA_1_25HZ;
-        mpu_set_lpf(5);
-    } else if (rate <= 5) {
-        tmp[1] = INV_LPA_5HZ;
-        mpu_set_lpf(5);
-    } else if (rate <= 20) {
-        tmp[1] = INV_LPA_20HZ;
-        mpu_set_lpf(10);
-    } else {
-        tmp[1] = INV_LPA_40HZ;
-        mpu_set_lpf(20);
-    }
-    tmp[1] = (tmp[1] << 6) | BIT_STBY_XYZG;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 2, tmp))
-        return -1;
-#elif defined MPU6500
-    /* Set wake frequency. */
-    if (rate == 1)
-        tmp[0] = INV_LPA_1_25HZ;
-    else if (rate == 2)
-        tmp[0] = INV_LPA_2_5HZ;
-    else if (rate <= 5)
-        tmp[0] = INV_LPA_5HZ;
-    else if (rate <= 10)
-        tmp[0] = INV_LPA_10HZ;
-    else if (rate <= 20)
-        tmp[0] = INV_LPA_20HZ;
-    else if (rate <= 40)
-        tmp[0] = INV_LPA_40HZ;
-    else if (rate <= 80)
-        tmp[0] = INV_LPA_80HZ;
-    else if (rate <= 160)
-        tmp[0] = INV_LPA_160HZ;
-    else if (rate <= 320)
-        tmp[0] = INV_LPA_320HZ;
-    else
-        tmp[0] = INV_LPA_640HZ;
-    if (i2c_write(st.hw->addr, st.reg->lp_accel_odr, 1, tmp))
-        return -1;
-    tmp[0] = BIT_LPA_CYCLE;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, tmp))
-        return -1;
-#endif
-    st.chip_cfg.sensors = INV_XYZ_ACCEL;
-    st.chip_cfg.clk_src = 0;
-    st.chip_cfg.lp_accel_mode = 1;
-    mpu_configure_fifo(0);
-
-    return 0;
-}
-
-/**
- *  @brief      Read raw gyro data directly from the registers.
- *  @param[out] data        Raw data in hardware units.
- *  @param[out] timestamp   Timestamp in milliseconds. Null if not needed.
- *  @return     0 if successful.
- */
-int mpu_get_gyro_reg(short *data, unsigned long *timestamp)
-{
-    unsigned char tmp[6];
-
-    if (!(st.chip_cfg.sensors & INV_XYZ_GYRO))
-        return -1;
-
-    if (i2c_read(st.hw->addr, st.reg->raw_gyro, 6, tmp))
-        return -1;
-    data[0] = (tmp[0] << 8) | tmp[1];
-    data[1] = (tmp[2] << 8) | tmp[3];
-    data[2] = (tmp[4] << 8) | tmp[5];
-    if (timestamp)
-        get_ms(timestamp);
-    return 0;
-}
-
-/**
- *  @brief      Read raw accel data directly from the registers.
- *  @param[out] data        Raw data in hardware units.
- *  @param[out] timestamp   Timestamp in milliseconds. Null if not needed.
- *  @return     0 if successful.
- */
-int mpu_get_accel_reg(short *data, unsigned long *timestamp)
-{
-    unsigned char tmp[6];
-
-    if (!(st.chip_cfg.sensors & INV_XYZ_ACCEL))
-        return -1;
-
-    if (i2c_read(st.hw->addr, st.reg->raw_accel, 6, tmp))
-        return -1;
-    data[0] = (tmp[0] << 8) | tmp[1];
-    data[1] = (tmp[2] << 8) | tmp[3];
-    data[2] = (tmp[4] << 8) | tmp[5];
-    if (timestamp)
-        get_ms(timestamp);
-    return 0;
-}
-
-/**
- *  @brief      Read temperature data directly from the registers.
- *  @param[out] data        Data in q16 format.
- *  @param[out] timestamp   Timestamp in milliseconds. Null if not needed.
- *  @return     0 if successful.
- */
-int mpu_get_temperature(long *data, unsigned long *timestamp)
-{
-    unsigned char tmp[2];
-    short raw;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    if (i2c_read(st.hw->addr, st.reg->temp, 2, tmp))
-        return -1;
-    raw = (tmp[0] << 8) | tmp[1];
-    if (timestamp)
-        get_ms(timestamp);
-
-    data[0] = (long)((35 + ((raw - (float)st.hw->temp_offset) / st.hw->temp_sens)) * 65536L);
-    return 0;
-}
-
-/**
- *  @brief      Push biases to the accel bias registers.
- *  This function expects biases relative to the current sensor output, and
- *  these biases will be added to the factory-supplied values.
- *  @param[in]  accel_bias  New biases.
- *  @return     0 if successful.
- */
-int mpu_set_accel_bias(const long *accel_bias)
-{
-    unsigned char data[6];
-    short accel_hw[3];
-    short got_accel[3];
-    short fg[3];
-
-    if (!accel_bias)
-        return -1;
-    if (!accel_bias[0] && !accel_bias[1] && !accel_bias[2])
-        return 0;
-
-    if (i2c_read(st.hw->addr, 3, 3, data))
-        return -1;
-    fg[0] = ((data[0] >> 4) + 8) & 0xf;
-    fg[1] = ((data[1] >> 4) + 8) & 0xf;
-    fg[2] = ((data[2] >> 4) + 8) & 0xf;
-
-    accel_hw[0] = (short)(accel_bias[0] * 2 / (64 + fg[0]));
-    accel_hw[1] = (short)(accel_bias[1] * 2 / (64 + fg[1]));
-    accel_hw[2] = (short)(accel_bias[2] * 2 / (64 + fg[2]));
-
-    if (i2c_read(st.hw->addr, 0x06, 6, data))
-        return -1;
-
-    got_accel[0] = ((short)data[0] << 8) | data[1];
-    got_accel[1] = ((short)data[2] << 8) | data[3];
-    got_accel[2] = ((short)data[4] << 8) | data[5];
-
-    accel_hw[0] += got_accel[0];
-    accel_hw[1] += got_accel[1];
-    accel_hw[2] += got_accel[2];
-
-    data[0] = (accel_hw[0] >> 8) & 0xff;
-    data[1] = (accel_hw[0]) & 0xff;
-    data[2] = (accel_hw[1] >> 8) & 0xff;
-    data[3] = (accel_hw[1]) & 0xff;
-    data[4] = (accel_hw[2] >> 8) & 0xff;
-    data[5] = (accel_hw[2]) & 0xff;
-
-    if (i2c_write(st.hw->addr, 0x06, 6, data))
-        return -1;
-    return 0;
-}
-
-/**
- *  @brief  Reset FIFO read/write pointers.
- *  @return 0 if successful.
- */
-int mpu_reset_fifo(void)
-{
-    unsigned char data;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    data = 0;
-    if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, &data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
-        return -1;
-
-    if (st.chip_cfg.dmp_on) {
-        data = BIT_FIFO_RST | BIT_DMP_RST;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
-            return -1;
-        delay_ms(50);
-        data = BIT_DMP_EN | BIT_FIFO_EN;
-        if (st.chip_cfg.sensors & INV_XYZ_COMPASS)
-            data |= BIT_AUX_IF_EN;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
-            return -1;
-        if (st.chip_cfg.int_enable)
-            data = BIT_DMP_INT_EN;
-        else
-            data = 0;
-        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &data))
-            return -1;
-        data = 0;
-        if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, &data))
-            return -1;
-    } else {
-        data = BIT_FIFO_RST;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
-            return -1;
-        if (st.chip_cfg.bypass_mode || !(st.chip_cfg.sensors & INV_XYZ_COMPASS))
-            data = BIT_FIFO_EN;
-        else
-            data = BIT_FIFO_EN | BIT_AUX_IF_EN;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
-            return -1;
-        delay_ms(50);
-        if (st.chip_cfg.int_enable)
-            data = BIT_DATA_RDY_EN;
-        else
-            data = 0;
-        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &data))
-            return -1;
-        if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, &st.chip_cfg.fifo_enable))
-            return -1;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Get the gyro full-scale range.
- *  @param[out] fsr Current full-scale range.
- *  @return     0 if successful.
- */
-int mpu_get_gyro_fsr(unsigned short *fsr)
-{
-    switch (st.chip_cfg.gyro_fsr) {
-    case INV_FSR_250DPS:
-        fsr[0] = 250;
-        break;
-    case INV_FSR_500DPS:
-        fsr[0] = 500;
-        break;
-    case INV_FSR_1000DPS:
-        fsr[0] = 1000;
-        break;
-    case INV_FSR_2000DPS:
-        fsr[0] = 2000;
-        break;
-    default:
-        fsr[0] = 0;
-        break;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Set the gyro full-scale range.
- *  @param[in]  fsr Desired full-scale range.
- *  @return     0 if successful.
- */
-int mpu_set_gyro_fsr(unsigned short fsr)
-{
-    unsigned char data;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    switch (fsr) {
-    case 250:
-        data = INV_FSR_250DPS << 3;
-        break;
-    case 500:
-        data = INV_FSR_500DPS << 3;
-        break;
-    case 1000:
-        data = INV_FSR_1000DPS << 3;
-        break;
-    case 2000:
-        data = INV_FSR_2000DPS << 3;
-        break;
-    default:
-        return -1;
-    }
-
-    if (st.chip_cfg.gyro_fsr == (data >> 3))
-        return 0;
-    if (i2c_write(st.hw->addr, st.reg->gyro_cfg, 1, &data))
-        return -1;
-    st.chip_cfg.gyro_fsr = data >> 3;
-    return 0;
-}
-
-/**
- *  @brief      Get the accel full-scale range.
- *  @param[out] fsr Current full-scale range.
- *  @return     0 if successful.
- */
-int mpu_get_accel_fsr(unsigned char *fsr)
-{
-    switch (st.chip_cfg.accel_fsr) {
-    case INV_FSR_2G:
-        fsr[0] = 2;
-        break;
-    case INV_FSR_4G:
-        fsr[0] = 4;
-        break;
-    case INV_FSR_8G:
-        fsr[0] = 8;
-        break;
-    case INV_FSR_16G:
-        fsr[0] = 16;
-        break;
-    default:
-        return -1;
-    }
-    if (st.chip_cfg.accel_half)
-        fsr[0] <<= 1;
-    return 0;
-}
-
-/**
- *  @brief      Set the accel full-scale range.
- *  @param[in]  fsr Desired full-scale range.
- *  @return     0 if successful.
- */
-int mpu_set_accel_fsr(unsigned char fsr)
-{
-    unsigned char data;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    switch (fsr) {
-    case 2:
-        data = INV_FSR_2G << 3;
-        break;
-    case 4:
-        data = INV_FSR_4G << 3;
-        break;
-    case 8:
-        data = INV_FSR_8G << 3;
-        break;
-    case 16:
-        data = INV_FSR_16G << 3;
-        break;
-    default:
-        return -1;
-    }
-
-    if (st.chip_cfg.accel_fsr == (data >> 3))
-        return 0;
-    if (i2c_write(st.hw->addr, st.reg->accel_cfg, 1, &data))
-        return -1;
-    st.chip_cfg.accel_fsr = data >> 3;
-    return 0;
-}
-
-/**
- *  @brief      Get the current DLPF setting.
- *  @param[out] lpf Current LPF setting.
- *  0 if successful.
- */
-int mpu_get_lpf(unsigned short *lpf)
-{
-    switch (st.chip_cfg.lpf) {
-    case INV_FILTER_188HZ:
-        lpf[0] = 188;
-        break;
-    case INV_FILTER_98HZ:
-        lpf[0] = 98;
-        break;
-    case INV_FILTER_42HZ:
-        lpf[0] = 42;
-        break;
-    case INV_FILTER_20HZ:
-        lpf[0] = 20;
-        break;
-    case INV_FILTER_10HZ:
-        lpf[0] = 10;
-        break;
-    case INV_FILTER_5HZ:
-        lpf[0] = 5;
-        break;
-    case INV_FILTER_256HZ_NOLPF2:
-    case INV_FILTER_2100HZ_NOLPF:
-    default:
-        lpf[0] = 0;
-        break;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Set digital low pass filter.
- *  The following LPF settings are supported: 188, 98, 42, 20, 10, 5.
- *  @param[in]  lpf Desired LPF setting.
- *  @return     0 if successful.
- */
-int mpu_set_lpf(unsigned short lpf)
-{
-    unsigned char data;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    if (lpf >= 188)
-        data = INV_FILTER_188HZ;
-    else if (lpf >= 98)
-        data = INV_FILTER_98HZ;
-    else if (lpf >= 42)
-        data = INV_FILTER_42HZ;
-    else if (lpf >= 20)
-        data = INV_FILTER_20HZ;
-    else if (lpf >= 10)
-        data = INV_FILTER_10HZ;
-    else
-        data = INV_FILTER_5HZ;
-
-    if (st.chip_cfg.lpf == data)
-        return 0;
-    if (i2c_write(st.hw->addr, st.reg->lpf, 1, &data))
-        return -1;
-    st.chip_cfg.lpf = data;
-    return 0;
-}
-
-/**
- *  @brief      Get sampling rate.
- *  @param[out] rate    Current sampling rate (Hz).
- *  @return     0 if successful.
- */
-int mpu_get_sample_rate(unsigned short *rate)
-{
-    if (st.chip_cfg.dmp_on)
-        return -1;
-    else
-        rate[0] = st.chip_cfg.sample_rate;
-
-    return 0;
-}
-
-/**
- *  @brief      Set sampling rate.
- *  Sampling rate must be between 4Hz and 1kHz.
- *  @param[in]  rate    Desired sampling rate (Hz).
- *  @return     0 if successful.
- */
-int mpu_set_sample_rate(unsigned short rate)
-{
-    unsigned char data;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    if (st.chip_cfg.dmp_on)
-        return -1;
-    else {
-        if (st.chip_cfg.lp_accel_mode) {
-            if (rate && (rate <= 40)) {
-                /* Just stay in low-power accel mode. */
-                mpu_lp_accel_mode(rate);
-                return 0;
-            }
-            /* Requested rate exceeds the allowed frequencies in LP accel mode,
-             * switch back to full-power mode.
-             */
-            mpu_lp_accel_mode(0);
-        }
-        if (rate < 4)
-            rate = 4;
-        else if (rate > 1000)
-            rate = 1000;
-
-        data = 1000 / rate - 1;
-        if (i2c_write(st.hw->addr, st.reg->rate_div, 1, &data))
-            return -1;
-
-        st.chip_cfg.sample_rate = 1000 / (1 + data);
-
-#ifdef AK89xx_SECONDARY
-        mpu_set_compass_sample_rate(min(st.chip_cfg.compass_sample_rate, MAX_COMPASS_SAMPLE_RATE));
-#endif
-
-        /* Automatically set LPF to 1/2 sampling rate. */
-        mpu_set_lpf(st.chip_cfg.sample_rate >> 1);
-        return 0;
-    }
-}
-
-/**
- *  @brief      Get compass sampling rate.
- *  @param[out] rate    Current compass sampling rate (Hz).
- *  @return     0 if successful.
- */
-int mpu_get_compass_sample_rate(unsigned short *rate)
-{
-#ifdef AK89xx_SECONDARY
-    rate[0] = st.chip_cfg.compass_sample_rate;
-    return 0;
-#else
-    rate[0] = 0;
-    return -1;
-#endif
-}
-
-/**
- *  @brief      Set compass sampling rate.
- *  The compass on the auxiliary I2C bus is read by the MPU hardware at a
- *  maximum of 100Hz. The actual rate can be set to a fraction of the gyro
- *  sampling rate.
- *
- *  \n WARNING: The new rate may be different than what was requested. Call
- *  mpu_get_compass_sample_rate to check the actual setting.
- *  @param[in]  rate    Desired compass sampling rate (Hz).
- *  @return     0 if successful.
- */
-int mpu_set_compass_sample_rate(unsigned short rate)
-{
-#ifdef AK89xx_SECONDARY
-    unsigned char div;
-    if (!rate || rate > st.chip_cfg.sample_rate || rate > MAX_COMPASS_SAMPLE_RATE)
-        return -1;
-
-    div = st.chip_cfg.sample_rate / rate - 1;
-    if (i2c_write(st.hw->addr, st.reg->s4_ctrl, 1, &div))
-        return -1;
-    st.chip_cfg.compass_sample_rate = st.chip_cfg.sample_rate / (div + 1);
-    return 0;
-#else
-    return -1;
-#endif
-}
-
-/**
- *  @brief      Get gyro sensitivity scale factor.
- *  @param[out] sens    Conversion from hardware units to dps.
- *  @return     0 if successful.
- */
-int mpu_get_gyro_sens(float *sens)
-{
-    switch (st.chip_cfg.gyro_fsr) {
-    case INV_FSR_250DPS:
-        sens[0] = 131.f;
-        break;
-    case INV_FSR_500DPS:
-        sens[0] = 65.5f;
-        break;
-    case INV_FSR_1000DPS:
-        sens[0] = 32.8f;
-        break;
-    case INV_FSR_2000DPS:
-        sens[0] = 16.4f;
-        break;
-    default:
-        return -1;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Get accel sensitivity scale factor.
- *  @param[out] sens    Conversion from hardware units to g's.
- *  @return     0 if successful.
- */
-int mpu_get_accel_sens(unsigned short *sens)
-{
-    switch (st.chip_cfg.accel_fsr) {
-    case INV_FSR_2G:
-        sens[0] = 16384;
-        break;
-    case INV_FSR_4G:
-        sens[0] = 8092;
-        break;
-    case INV_FSR_8G:
-        sens[0] = 4096;
-        break;
-    case INV_FSR_16G:
-        sens[0] = 2048;
-        break;
-    default:
-        return -1;
-    }
-    if (st.chip_cfg.accel_half)
-        sens[0] >>= 1;
-    return 0;
-}
-
-/**
- *  @brief      Get current FIFO configuration.
- *  @e sensors can contain a combination of the following flags:
- *  \n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
- *  \n INV_XYZ_GYRO
- *  \n INV_XYZ_ACCEL
- *  @param[out] sensors Mask of sensors in FIFO.
- *  @return     0 if successful.
- */
-int mpu_get_fifo_config(unsigned char *sensors)
-{
-    sensors[0] = st.chip_cfg.fifo_enable;
-    return 0;
-}
-
-/**
- *  @brief      Select which sensors are pushed to FIFO.
- *  @e sensors can contain a combination of the following flags:
- *  \n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
- *  \n INV_XYZ_GYRO
- *  \n INV_XYZ_ACCEL
- *  @param[in]  sensors Mask of sensors to push to FIFO.
- *  @return     0 if successful.
- */
-int mpu_configure_fifo(unsigned char sensors)
-{
-    unsigned char prev;
-    int result = 0;
-
-    /* Compass data isn't going into the FIFO. Stop trying. */
-    sensors &= ~INV_XYZ_COMPASS;
-
-    if (st.chip_cfg.dmp_on)
-        return 0;
-    else {
-        if (!(st.chip_cfg.sensors))
-            return -1;
-        prev = st.chip_cfg.fifo_enable;
-        st.chip_cfg.fifo_enable = sensors & st.chip_cfg.sensors;
-        if (st.chip_cfg.fifo_enable != sensors)
-            /* You're not getting what you asked for. Some sensors are
-             * asleep.
-             */
-            result = -1;
-        else
-            result = 0;
-        if (sensors || st.chip_cfg.lp_accel_mode)
-            set_int_enable(1);
-        else
-            set_int_enable(0);
-        if (sensors) {
-            if (mpu_reset_fifo()) {
-                st.chip_cfg.fifo_enable = prev;
-                return -1;
-            }
-        }
-    }
-
-    return result;
-}
-
-/**
- *  @brief      Get current power state.
- *  @param[in]  power_on    1 if turned on, 0 if suspended.
- *  @return     0 if successful.
- */
-int mpu_get_power_state(unsigned char *power_on)
-{
-    if (st.chip_cfg.sensors)
-        power_on[0] = 1;
-    else
-        power_on[0] = 0;
-    return 0;
-}
-
-/**
- *  @brief      Turn specific sensors on/off.
- *  @e sensors can contain a combination of the following flags:
- *  \n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
- *  \n INV_XYZ_GYRO
- *  \n INV_XYZ_ACCEL
- *  \n INV_XYZ_COMPASS
- *  @param[in]  sensors    Mask of sensors to wake.
- *  @return     0 if successful.
- */
-int mpu_set_sensors(unsigned char sensors)
-{
-    unsigned char data;
-#ifdef AK89xx_SECONDARY
-    unsigned char user_ctrl;
-#endif
-
-    if (sensors & INV_XYZ_GYRO)
-        data = INV_CLK_PLL;
-    else if (sensors)
-        data = 0;
-    else
-        data = BIT_SLEEP;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, &data)) {
-        st.chip_cfg.sensors = 0;
-        return -1;
-    }
-    st.chip_cfg.clk_src = data & ~BIT_SLEEP;
-
-    data = 0;
-    if (!(sensors & INV_X_GYRO))
-        data |= BIT_STBY_XG;
-    if (!(sensors & INV_Y_GYRO))
-        data |= BIT_STBY_YG;
-    if (!(sensors & INV_Z_GYRO))
-        data |= BIT_STBY_ZG;
-    if (!(sensors & INV_XYZ_ACCEL))
-        data |= BIT_STBY_XYZA;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_2, 1, &data)) {
-        st.chip_cfg.sensors = 0;
-        return -1;
-    }
-
-    if (sensors && (sensors != INV_XYZ_ACCEL))
-        /* Latched interrupts only used in LP accel mode. */
-        mpu_set_int_latched(0);
-
-#ifdef AK89xx_SECONDARY
-#ifdef AK89xx_BYPASS
-    if (sensors & INV_XYZ_COMPASS)
-        mpu_set_bypass(1);
-    else
-        mpu_set_bypass(0);
-#else
-    if (i2c_read(st.hw->addr, st.reg->user_ctrl, 1, &user_ctrl))
-        return -1;
-    /* Handle AKM power management. */
-    if (sensors & INV_XYZ_COMPASS) {
-        data = AKM_SINGLE_MEASUREMENT;
-        user_ctrl |= BIT_AUX_IF_EN;
-    } else {
-        data = AKM_POWER_DOWN;
-        user_ctrl &= ~BIT_AUX_IF_EN;
-    }
-    if (st.chip_cfg.dmp_on)
-        user_ctrl |= BIT_DMP_EN;
-    else
-        user_ctrl &= ~BIT_DMP_EN;
-    if (i2c_write(st.hw->addr, st.reg->s1_do, 1, &data))
-        return -1;
-    /* Enable/disable I2C master mode. */
-    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &user_ctrl))
-        return -1;
-#endif
-#endif
-
-    st.chip_cfg.sensors = sensors;
-    st.chip_cfg.lp_accel_mode = 0;
-    delay_ms(50);
-    return 0;
-}
-
-/**
- *  @brief      Read the MPU interrupt status registers.
- *  @param[out] status  Mask of interrupt bits.
- *  @return     0 if successful.
- */
-int mpu_get_int_status(short *status)
-{
-    unsigned char tmp[2];
-    if (!st.chip_cfg.sensors)
-        return -1;
-    if (i2c_read(st.hw->addr, st.reg->dmp_int_status, 2, tmp))
-        return -1;
-    status[0] = (tmp[0] << 8) | tmp[1];
-    return 0;
-}
-
-/**
- *  @brief      Get one packet from the FIFO.
- *  If @e sensors does not contain a particular sensor, disregard the data
- *  returned to that pointer.
- *  \n @e sensors can contain a combination of the following flags:
- *  \n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
- *  \n INV_XYZ_GYRO
- *  \n INV_XYZ_ACCEL
- *  \n If the FIFO has no new data, @e sensors will be zero.
- *  \n If the FIFO is disabled, @e sensors will be zero and this function will
- *  return a non-zero error code.
- *  @param[out] gyro        Gyro data in hardware units.
- *  @param[out] accel       Accel data in hardware units.
- *  @param[out] timestamp   Timestamp in milliseconds.
- *  @param[out] sensors     Mask of sensors read from FIFO.
- *  @param[out] more        Number of remaining packets.
- *  @return     0 if successful.
- */
-int mpu_read_fifo(short *gyro, short *accel, unsigned long *timestamp,
-        unsigned char *sensors, unsigned char *more)
-{
-    /* Assumes maximum packet size is gyro (6) + accel (6). */
-    unsigned char data[MAX_PACKET_LENGTH];
-    unsigned char packet_size = 0;
-    unsigned short fifo_count, index = 0;
-
-    if (st.chip_cfg.dmp_on)
-        return -1;
-
-    sensors[0] = 0;
-    if (!st.chip_cfg.sensors)
-        return -1;
-    if (!st.chip_cfg.fifo_enable)
-        return -1;
-
-    if (st.chip_cfg.fifo_enable & INV_X_GYRO)
-        packet_size += 2;
-    if (st.chip_cfg.fifo_enable & INV_Y_GYRO)
-        packet_size += 2;
-    if (st.chip_cfg.fifo_enable & INV_Z_GYRO)
-        packet_size += 2;
-    if (st.chip_cfg.fifo_enable & INV_XYZ_ACCEL)
-        packet_size += 6;
-
-    if (i2c_read(st.hw->addr, st.reg->fifo_count_h, 2, data))
-        return -1;
-    fifo_count = (data[0] << 8) | data[1];
-    if (fifo_count < packet_size)
-        return 0;
-//    log_i("FIFO count: %hd\n", fifo_count);
-    if (fifo_count > (st.hw->max_fifo >> 1)) {
-        /* FIFO is 50% full, better check overflow bit. */
-        if (i2c_read(st.hw->addr, st.reg->int_status, 1, data))
-            return -1;
-        if (data[0] & BIT_FIFO_OVERFLOW) {
-            mpu_reset_fifo();
-            return -2;
-        }
-    }
-    get_ms((unsigned long*)timestamp);
-
-    if (i2c_read(st.hw->addr, st.reg->fifo_r_w, packet_size, data))
-        return -1;
-    more[0] = fifo_count / packet_size - 1;
-    sensors[0] = 0;
-
-    if ((index != packet_size) && st.chip_cfg.fifo_enable & INV_XYZ_ACCEL) {
-        accel[0] = (data[index+0] << 8) | data[index+1];
-        accel[1] = (data[index+2] << 8) | data[index+3];
-        accel[2] = (data[index+4] << 8) | data[index+5];
-        sensors[0] |= INV_XYZ_ACCEL;
-        index += 6;
-    }
-    if ((index != packet_size) && st.chip_cfg.fifo_enable & INV_X_GYRO) {
-        gyro[0] = (data[index+0] << 8) | data[index+1];
-        sensors[0] |= INV_X_GYRO;
-        index += 2;
-    }
-    if ((index != packet_size) && st.chip_cfg.fifo_enable & INV_Y_GYRO) {
-        gyro[1] = (data[index+0] << 8) | data[index+1];
-        sensors[0] |= INV_Y_GYRO;
-        index += 2;
-    }
-    if ((index != packet_size) && st.chip_cfg.fifo_enable & INV_Z_GYRO) {
-        gyro[2] = (data[index+0] << 8) | data[index+1];
-        sensors[0] |= INV_Z_GYRO;
-        index += 2;
-    }
-
-    return 0;
-}
-
-/**
- *  @brief      Get one unparsed packet from the FIFO.
- *  This function should be used if the packet is to be parsed elsewhere.
- *  @param[in]  length  Length of one FIFO packet.
- *  @param[in]  data    FIFO packet.
- *  @param[in]  more    Number of remaining packets.
- */
-int mpu_read_fifo_stream(unsigned short length, unsigned char *data,
-    unsigned char *more)
-{
-    unsigned char tmp[2];
-    unsigned short fifo_count;
-
-//    printf("addr %d, dmp_on %d, sensors %d\r\n", st.hw->addr, st.chip_cfg.dmp_on, st.chip_cfg.sensors);
-
-    if (!st.chip_cfg.dmp_on)
-        return -1;
-    if (!st.chip_cfg.sensors)
-        return -1;
-
-//    printf("----1\r\n");
-
-    if (i2c_read(st.hw->addr, st.reg->fifo_count_h, 2, tmp))
-        return -1;
-
-//    printf("----2\r\n");
-
-    fifo_count = (tmp[0] << 8) | tmp[1];
-    if (fifo_count < length) {
-        more[0] = 0;
-        return -1;
-    }
-
-//    printf("----3\r\n");
-    if (fifo_count > (st.hw->max_fifo >> 1)) {
-
-//        printf("----3.1\r\n");
-        /* FIFO is 50% full, better check overflow bit. */
-        if (i2c_read(st.hw->addr, st.reg->int_status, 1, tmp))
-            return -1;
-
-//        printf("----3.2\r\n");
-        if (tmp[0] & BIT_FIFO_OVERFLOW) {
-            mpu_reset_fifo();
-            return -2;
-        }
-    }
-
-//    printf("----4\r\n");
-    if (i2c_read(st.hw->addr, st.reg->fifo_r_w, length, data))
-        return -1;
-
-    more[0] = fifo_count / length - 1;
-    return 0;
-}
-
-/**
- *  @brief      Set device to bypass mode.
- *  @param[in]  bypass_on   1 to enable bypass mode.
- *  @return     0 if successful.
- */
-int mpu_set_bypass(unsigned char bypass_on)
-{
-    unsigned char tmp;
-
-    if (st.chip_cfg.bypass_mode == bypass_on)
-        return 0;
-
-    if (bypass_on) {
-        if (i2c_read(st.hw->addr, st.reg->user_ctrl, 1, &tmp))
-            return -1;
-        tmp &= ~BIT_AUX_IF_EN;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &tmp))
-            return -1;
-        delay_ms(3);
-        tmp = BIT_BYPASS_EN;
-        if (st.chip_cfg.active_low_int)
-            tmp |= BIT_ACTL;
-        if (st.chip_cfg.latched_int)
-            tmp |= BIT_LATCH_EN | BIT_ANY_RD_CLR;
-        if (i2c_write(st.hw->addr, st.reg->int_pin_cfg, 1, &tmp))
-            return -1;
-    } else {
-        /* Enable I2C master mode if compass is being used. */
-        if (i2c_read(st.hw->addr, st.reg->user_ctrl, 1, &tmp))
-            return -1;
-        if (st.chip_cfg.sensors & INV_XYZ_COMPASS)
-            tmp |= BIT_AUX_IF_EN;
-        else
-            tmp &= ~BIT_AUX_IF_EN;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &tmp))
-            return -1;
-        delay_ms(3);
-        if (st.chip_cfg.active_low_int)
-            tmp = BIT_ACTL;
-        else
-            tmp = 0;
-        if (st.chip_cfg.latched_int)
-            tmp |= BIT_LATCH_EN | BIT_ANY_RD_CLR;
-        if (i2c_write(st.hw->addr, st.reg->int_pin_cfg, 1, &tmp))
-            return -1;
-    }
-    st.chip_cfg.bypass_mode = bypass_on;
-    return 0;
-}
-
-/**
- *  @brief      Set interrupt level.
- *  @param[in]  active_low  1 for active low, 0 for active high.
- *  @return     0 if successful.
- */
-int mpu_set_int_level(unsigned char active_low)
-{
-    st.chip_cfg.active_low_int = active_low;
-    return 0;
-}
-
-/**
- *  @brief      Enable latched interrupts.
- *  Any MPU register will clear the interrupt.
- *  @param[in]  enable  1 to enable, 0 to disable.
- *  @return     0 if successful.
- */
-int mpu_set_int_latched(unsigned char enable)
-{
-    unsigned char tmp;
-    if (st.chip_cfg.latched_int == enable)
-        return 0;
-
-    if (enable)
-        tmp = BIT_LATCH_EN | BIT_ANY_RD_CLR;
-    else
-        tmp = 0;
-    if (st.chip_cfg.bypass_mode)
-        tmp |= BIT_BYPASS_EN;
-    if (st.chip_cfg.active_low_int)
-        tmp |= BIT_ACTL;
-    if (i2c_write(st.hw->addr, st.reg->int_pin_cfg, 1, &tmp))
-        return -1;
-    st.chip_cfg.latched_int = enable;
-    return 0;
-}
-
-#ifdef MPU6050
-static int get_accel_prod_shift(float *st_shift)
-{
-    unsigned char tmp[4], shift_code[3], ii;
-
-    if (i2c_read(st.hw->addr, 0x0D, 4, tmp))
-        return 0x07;
-
-    shift_code[0] = ((tmp[0] & 0xE0) >> 3) | ((tmp[3] & 0x30) >> 4);
-    shift_code[1] = ((tmp[1] & 0xE0) >> 3) | ((tmp[3] & 0x0C) >> 2);
-    shift_code[2] = ((tmp[2] & 0xE0) >> 3) | (tmp[3] & 0x03);
-    for (ii = 0; ii < 3; ii++) {
-        if (!shift_code[ii]) {
-            st_shift[ii] = 0.f;
-            continue;
-        }
-        /* Equivalent to..
-         * st_shift[ii] = 0.34f * powf(0.92f/0.34f, (shift_code[ii]-1) / 30.f)
-         */
-        st_shift[ii] = 0.34f;
-        while (--shift_code[ii])
-            st_shift[ii] *= 1.034f;
-    }
-    return 0;
-}
-
-static int accel_self_test(long *bias_regular, long *bias_st)
-{
-    int jj, result = 0;
-    float st_shift[3], st_shift_cust, st_shift_var;
-
-    get_accel_prod_shift(st_shift);
-    for(jj = 0; jj < 3; jj++) {
-        st_shift_cust = labs(bias_regular[jj] - bias_st[jj]) / 65536.f;
-        if (st_shift[jj]) {
-            st_shift_var = st_shift_cust / st_shift[jj] - 1.f;
-            if (fabs(st_shift_var) > test.max_accel_var)
-                result |= 1 << jj;
-        } else if ((st_shift_cust < test.min_g) ||
-            (st_shift_cust > test.max_g))
-            result |= 1 << jj;
-    }
-
-    return result;
-}
-
-static int gyro_self_test(long *bias_regular, long *bias_st)
-{
-    int jj, result = 0;
-    unsigned char tmp[3];
-    float st_shift, st_shift_cust, st_shift_var;
-
-    if (i2c_read(st.hw->addr, 0x0D, 3, tmp))
-        return 0x07;
-
-    tmp[0] &= 0x1F;
-    tmp[1] &= 0x1F;
-    tmp[2] &= 0x1F;
-
-    for (jj = 0; jj < 3; jj++) {
-        st_shift_cust = labs(bias_regular[jj] - bias_st[jj]) / 65536.f;
-        if (tmp[jj]) {
-            st_shift = 3275.f / test.gyro_sens;
-            while (--tmp[jj])
-                st_shift *= 1.046f;
-            st_shift_var = st_shift_cust / st_shift - 1.f;
-            if (fabs(st_shift_var) > test.max_gyro_var)
-                result |= 1 << jj;
-        } else if ((st_shift_cust < test.min_dps) ||
-            (st_shift_cust > test.max_dps))
-            result |= 1 << jj;
-    }
-    return result;
-}
-
-#ifdef AK89xx_SECONDARY
-static int compass_self_test(void)
-{
-    unsigned char tmp[6];
-    unsigned char tries = 10;
-    int result = 0x07;
-    short data;
-
-    mpu_set_bypass(1);
-
-    tmp[0] = AKM_POWER_DOWN;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, tmp))
-        return 0x07;
-    tmp[0] = AKM_BIT_SELF_TEST;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_ASTC, 1, tmp))
-        goto AKM_restore;
-    tmp[0] = AKM_MODE_SELF_TEST;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, tmp))
-        goto AKM_restore;
-
-    do {
-        delay_ms(10);
-        if (i2c_read(st.chip_cfg.compass_addr, AKM_REG_ST1, 1, tmp))
-            goto AKM_restore;
-        if (tmp[0] & AKM_DATA_READY)
-            break;
-    } while (tries--);
-    if (!(tmp[0] & AKM_DATA_READY))
-        goto AKM_restore;
-
-    if (i2c_read(st.chip_cfg.compass_addr, AKM_REG_HXL, 6, tmp))
-        goto AKM_restore;
-
-    result = 0;
-    data = (short)(tmp[1] << 8) | tmp[0];
-    if ((data > 100) || (data < -100))
-        result |= 0x01;
-    data = (short)(tmp[3] << 8) | tmp[2];
-    if ((data > 100) || (data < -100))
-        result |= 0x02;
-    data = (short)(tmp[5] << 8) | tmp[4];
-    if ((data > -300) || (data < -1000))
-        result |= 0x04;
-
-AKM_restore:
-    tmp[0] = 0 | SUPPORTS_AK89xx_HIGH_SENS;
-    i2c_write(st.chip_cfg.compass_addr, AKM_REG_ASTC, 1, tmp);
-    tmp[0] = SUPPORTS_AK89xx_HIGH_SENS;
-    i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, tmp);
-    mpu_set_bypass(0);
-    return result;
-}
-#endif
-#endif
-
-static int get_st_biases(long *gyro, long *accel, unsigned char hw_test)
-{
-    unsigned char data[MAX_PACKET_LENGTH];
-    unsigned char packet_count, ii;
-    unsigned short fifo_count;
-
-    data[0] = 0x01;
-    data[1] = 0;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 2, data))
-        return -1;
-    delay_ms(200);
-    data[0] = 0;
-    if (i2c_write(st.hw->addr, st.reg->int_enable, 1, data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->i2c_mst, 1, data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, data))
-        return -1;
-    data[0] = BIT_FIFO_RST | BIT_DMP_RST;
-    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, data))
-        return -1;
-    delay_ms(15);
-    data[0] = st.test->reg_lpf;
-    if (i2c_write(st.hw->addr, st.reg->lpf, 1, data))
-        return -1;
-    data[0] = st.test->reg_rate_div;
-    if (i2c_write(st.hw->addr, st.reg->rate_div, 1, data))
-        return -1;
-    if (hw_test)
-        data[0] = st.test->reg_gyro_fsr | 0xE0;
-    else
-        data[0] = st.test->reg_gyro_fsr;
-    if (i2c_write(st.hw->addr, st.reg->gyro_cfg, 1, data))
-        return -1;
-
-    if (hw_test)
-        data[0] = st.test->reg_accel_fsr | 0xE0;
-    else
-        data[0] = test.reg_accel_fsr;
-    if (i2c_write(st.hw->addr, st.reg->accel_cfg, 1, data))
-        return -1;
-    if (hw_test)
-        delay_ms(200);
-
-    /* Fill FIFO for test.wait_ms milliseconds. */
-    data[0] = BIT_FIFO_EN;
-    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, data))
-        return -1;
-
-    data[0] = INV_XYZ_GYRO | INV_XYZ_ACCEL;
-    if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, data))
-        return -1;
-    delay_ms(test.wait_ms);
-    data[0] = 0;
-    if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, data))
-        return -1;
-
-    if (i2c_read(st.hw->addr, st.reg->fifo_count_h, 2, data))
-        return -1;
-
-    fifo_count = (data[0] << 8) | data[1];
-    packet_count = fifo_count / MAX_PACKET_LENGTH;
-    gyro[0] = gyro[1] = gyro[2] = 0;
-    accel[0] = accel[1] = accel[2] = 0;
-
-    for (ii = 0; ii < packet_count; ii++) {
-        short accel_cur[3], gyro_cur[3];
-        if (i2c_read(st.hw->addr, st.reg->fifo_r_w, MAX_PACKET_LENGTH, data))
-            return -1;
-        accel_cur[0] = ((short)data[0] << 8) | data[1];
-        accel_cur[1] = ((short)data[2] << 8) | data[3];
-        accel_cur[2] = ((short)data[4] << 8) | data[5];
-        accel[0] += (long)accel_cur[0];
-        accel[1] += (long)accel_cur[1];
-        accel[2] += (long)accel_cur[2];
-        gyro_cur[0] = (((short)data[6] << 8) | data[7]);
-        gyro_cur[1] = (((short)data[8] << 8) | data[9]);
-        gyro_cur[2] = (((short)data[10] << 8) | data[11]);
-        gyro[0] += (long)gyro_cur[0];
-        gyro[1] += (long)gyro_cur[1];
-        gyro[2] += (long)gyro_cur[2];
-    }
-#ifdef EMPL_NO_64BIT
-    gyro[0] = (long)(((float)gyro[0]*65536.f) / test.gyro_sens / packet_count);
-    gyro[1] = (long)(((float)gyro[1]*65536.f) / test.gyro_sens / packet_count);
-    gyro[2] = (long)(((float)gyro[2]*65536.f) / test.gyro_sens / packet_count);
-    if (has_accel) {
-        accel[0] = (long)(((float)accel[0]*65536.f) / test.accel_sens /
-            packet_count);
-        accel[1] = (long)(((float)accel[1]*65536.f) / test.accel_sens /
-            packet_count);
-        accel[2] = (long)(((float)accel[2]*65536.f) / test.accel_sens /
-            packet_count);
-        /* Don't remove gravity! */
-        accel[2] -= 65536L;
-    }
-#else
-    gyro[0] = (long)(((long long)gyro[0]<<16) / test.gyro_sens / packet_count);
-    gyro[1] = (long)(((long long)gyro[1]<<16) / test.gyro_sens / packet_count);
-    gyro[2] = (long)(((long long)gyro[2]<<16) / test.gyro_sens / packet_count);
-    accel[0] = (long)(((long long)accel[0]<<16) / test.accel_sens /
-        packet_count);
-    accel[1] = (long)(((long long)accel[1]<<16) / test.accel_sens /
-        packet_count);
-    accel[2] = (long)(((long long)accel[2]<<16) / test.accel_sens /
-        packet_count);
-    /* Don't remove gravity! */
-    if (accel[2] > 0L)
-        accel[2] -= 65536L;
-    else
-        accel[2] += 65536L;
-#endif
-
-    return 0;
-}
-
-/**
- *  @brief      Trigger gyro/accel/compass self-test.
- *  On success/error, the self-test returns a mask representing the sensor(s)
- *  that failed. For each bit, a one (1) represents a "pass" case; conversely,
- *  a zero (0) indicates a failure.
- *
- *  \n The mask is defined as follows:
- *  \n Bit 0:   Gyro.
- *  \n Bit 1:   Accel.
- *  \n Bit 2:   Compass.
- *
- *  \n Currently, the hardware self-test is unsupported for MPU6500. However,
- *  this function can still be used to obtain the accel and gyro biases.
- *
- *  \n This function must be called with the device either face-up or face-down
- *  (z-axis is parallel to gravity).
- *  @param[out] gyro        Gyro biases in q16 format.
- *  @param[out] accel       Accel biases (if applicable) in q16 format.
- *  @return     Result mask (see above).
- */
-int mpu_run_self_test(long *gyro, long *accel)
-{
-#ifdef MPU6050
-    const unsigned char tries = 2;
-    long gyro_st[3], accel_st[3];
-    unsigned char accel_result, gyro_result;
-#ifdef AK89xx_SECONDARY
-    unsigned char compass_result;
-#endif
-    int ii;
-#endif
-    int result;
-    unsigned char accel_fsr, fifo_sensors, sensors_on;
-    unsigned short gyro_fsr, sample_rate, lpf;
-    unsigned char dmp_was_on;
-
-    if (st.chip_cfg.dmp_on) {
-        mpu_set_dmp_state(0);
-        dmp_was_on = 1;
-    } else
-        dmp_was_on = 0;
-
-    /* Get initial settings. */
-    mpu_get_gyro_fsr(&gyro_fsr);
-    mpu_get_accel_fsr(&accel_fsr);
-    mpu_get_lpf(&lpf);
-    mpu_get_sample_rate(&sample_rate);
-    sensors_on = st.chip_cfg.sensors;
-    mpu_get_fifo_config(&fifo_sensors);
-
-    /* For older chips, the self-test will be different. */
-#if defined MPU6050
-    for (ii = 0; ii < tries; ii++)
-        if (!get_st_biases(gyro, accel, 0))
-            break;
-    if (ii == tries) {
-        /* If we reach this point, we most likely encountered an I2C error.
-         * We'll just report an error for all three sensors.
-         */
-        result = 0;
-        goto restore;
-    }
-    for (ii = 0; ii < tries; ii++)
-        if (!get_st_biases(gyro_st, accel_st, 1))
-            break;
-    if (ii == tries) {
-        /* Again, probably an I2C error. */
-        result = 0;
-        goto restore;
-    }
-    accel_result = accel_self_test(accel, accel_st);
-    gyro_result = gyro_self_test(gyro, gyro_st);
-
-    result = 0;
-    if (!gyro_result)
-        result |= 0x01;
-    if (!accel_result)
-        result |= 0x02;
-
-#ifdef AK89xx_SECONDARY
-    compass_result = compass_self_test();
-    if (!compass_result)
-        result |= 0x04;
-#endif
-restore:
-#elif defined MPU6500
-    /* For now, this function will return a "pass" result for all three sensors
-     * for compatibility with current test applications.
-     */
-    get_st_biases(gyro, accel, 0);
-    result = 0x7;
-#endif
-    /* Set to invalid values to ensure no I2C writes are skipped. */
-    st.chip_cfg.gyro_fsr = 0xFF;
-    st.chip_cfg.accel_fsr = 0xFF;
-    st.chip_cfg.lpf = 0xFF;
-    st.chip_cfg.sample_rate = 0xFFFF;
-    st.chip_cfg.sensors = 0xFF;
-    st.chip_cfg.fifo_enable = 0xFF;
-    st.chip_cfg.clk_src = INV_CLK_PLL;
-    mpu_set_gyro_fsr(gyro_fsr);
-    mpu_set_accel_fsr(accel_fsr);
-    mpu_set_lpf(lpf);
-    mpu_set_sample_rate(sample_rate);
-    mpu_set_sensors(sensors_on);
-    mpu_configure_fifo(fifo_sensors);
-
-    if (dmp_was_on)
-        mpu_set_dmp_state(1);
-
-    return result;
-}
-
-/**
- *  @brief      Write to the DMP memory.
- *  This function prevents I2C writes past the bank boundaries. The DMP memory
- *  is only accessible when the chip is awake.
- *  @param[in]  mem_addr    Memory location (bank << 8 | start address)
- *  @param[in]  length      Number of bytes to write.
- *  @param[in]  data        Bytes to write to memory.
- *  @return     0 if successful.
- */
-int mpu_write_mem(unsigned short mem_addr, unsigned short length,
-        unsigned char *data)
-{
-    unsigned char tmp[2];
-
-    if (!data)
-        return -1;
-    if (!st.chip_cfg.sensors)
-        return -1;
-
-    tmp[0] = (unsigned char)(mem_addr >> 8);
-    tmp[1] = (unsigned char)(mem_addr & 0xFF);
-
-    /* Check bank boundaries. */
-    if (tmp[1] + length > st.hw->bank_size)
-        return -1;
-
-    if (i2c_write(st.hw->addr, st.reg->bank_sel, 2, tmp))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->mem_r_w, length, data))
-        return -1;
-    return 0;
-}
-
-/**
- *  @brief      Read from the DMP memory.
- *  This function prevents I2C reads past the bank boundaries. The DMP memory
- *  is only accessible when the chip is awake.
- *  @param[in]  mem_addr    Memory location (bank << 8 | start address)
- *  @param[in]  length      Number of bytes to read.
- *  @param[out] data        Bytes read from memory.
- *  @return     0 if successful.
- */
-int mpu_read_mem(unsigned short mem_addr, unsigned short length,
-        unsigned char *data)
-{
-    unsigned char tmp[2];
-
-    if (!data)
-        return -1;
-    if (!st.chip_cfg.sensors)
-        return -1;
-
-    tmp[0] = (unsigned char)(mem_addr >> 8);
-    tmp[1] = (unsigned char)(mem_addr & 0xFF);
-
-    /* Check bank boundaries. */
-    if (tmp[1] + length > st.hw->bank_size)
-        return -1;
-
-    if (i2c_write(st.hw->addr, st.reg->bank_sel, 2, tmp))
-        return -1;
-    if (i2c_read(st.hw->addr, st.reg->mem_r_w, length, data))
-        return -1;
-    return 0;
-}
-
-/**
- *  @brief      Load and verify DMP image.
- *  @param[in]  length      Length of DMP image.
- *  @param[in]  firmware    DMP code.
- *  @param[in]  start_addr  Starting address of DMP code memory.
- *  @param[in]  sample_rate Fixed sampling rate used when DMP is enabled.
- *  @return     0 if successful.
- */
-int mpu_load_firmware(unsigned short length, const unsigned char *firmware,
-    unsigned short start_addr, unsigned short sample_rate)
-{
-    unsigned short ii;
-    unsigned short this_write;
-    /* Must divide evenly into st.hw->bank_size to avoid bank crossings. */
-#define LOAD_CHUNK  (16)
-    unsigned char cur[LOAD_CHUNK], tmp[2];
-
-    if (st.chip_cfg.dmp_loaded)
-        /* DMP should only be loaded once. */
-        return -1;
-
-    if (!firmware)
-        return -1;
-    for (ii = 0; ii < length; ii += this_write) {
-        this_write = min(LOAD_CHUNK, length - ii);
-        if (mpu_write_mem(ii, this_write, (unsigned char*)&firmware[ii]))
-            return -1;
-        if (mpu_read_mem(ii, this_write, cur))
-            return -1;
-        if (memcmp(firmware+ii, cur, this_write))
-            return -2;
-    }
-
-    /* Set program start address. */
-    tmp[0] = start_addr >> 8;
-    tmp[1] = start_addr & 0xFF;
-    if (i2c_write(st.hw->addr, st.reg->prgm_start_h, 2, tmp))
-        return -1;
-
-    st.chip_cfg.dmp_loaded = 1;
-    st.chip_cfg.dmp_sample_rate = sample_rate;
-    return 0;
-}
-
-/**
- *  @brief      Enable/disable DMP support.
- *  @param[in]  enable  1 to turn on the DMP.
- *  @return     0 if successful.
- */
-int mpu_set_dmp_state(unsigned char enable)
-{
-    unsigned char tmp;
-    if (st.chip_cfg.dmp_on == enable)
-        return 0;
-
-    if (enable) {
-        if (!st.chip_cfg.dmp_loaded)
-            return -1;
-        /* Disable data ready interrupt. */
-        set_int_enable(0);
-        /* Disable bypass mode. */
-        mpu_set_bypass(0);
-        /* Keep constant sample rate, FIFO rate controlled by DMP. */
-        mpu_set_sample_rate(st.chip_cfg.dmp_sample_rate);
-        /* Remove FIFO elements. */
-        tmp = 0;
-        i2c_write(st.hw->addr, 0x23, 1, &tmp);
-        st.chip_cfg.dmp_on = 1;
-        /* Enable DMP interrupt. */
-        set_int_enable(1);
-        mpu_reset_fifo();
-    } else {
-        /* Disable DMP interrupt. */
-        set_int_enable(0);
-        /* Restore FIFO settings. */
-        tmp = st.chip_cfg.fifo_enable;
-        i2c_write(st.hw->addr, 0x23, 1, &tmp);
-        st.chip_cfg.dmp_on = 0;
-        mpu_reset_fifo();
-    }
-    return 0;
-}
-
-/**
- *  @brief      Get DMP state.
- *  @param[out] enabled 1 if enabled.
- *  @return     0 if successful.
- */
-int mpu_get_dmp_state(unsigned char *enabled)
-{
-    enabled[0] = st.chip_cfg.dmp_on;
-    return 0;
-}
-
-
-/* This initialization is similar to the one in ak8975.c. */
-static int setup_compass(void)
-{
-#ifdef AK89xx_SECONDARY
-    unsigned char data[4], akm_addr;
-
-    mpu_set_bypass(1);
-
-    /* Find compass. Possible addresses range from 0x0C to 0x0F. */
-    for (akm_addr = 0x0C; akm_addr <= 0x0F; akm_addr++) {
-        int result;
-        result = i2c_read(akm_addr, AKM_REG_WHOAMI, 1, data);
-        if (!result && (data[0] == AKM_WHOAMI))
-            break;
-    }
-
-    if (akm_addr > 0x0F) {
-        /* TODO: Handle this case in all compass-related functions. */
-        log_e("Compass not found.\n");
-        return -1;
-    }
-
-    st.chip_cfg.compass_addr = akm_addr;
-
-    data[0] = AKM_POWER_DOWN;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, data))
-        return -1;
-    delay_ms(1);
-
-    data[0] = AKM_FUSE_ROM_ACCESS;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, data))
-        return -1;
-    delay_ms(1);
-
-    /* Get sensitivity adjustment data from fuse ROM. */
-    if (i2c_read(st.chip_cfg.compass_addr, AKM_REG_ASAX, 3, data))
-        return -1;
-    st.chip_cfg.mag_sens_adj[0] = (long)data[0] + 128;
-    st.chip_cfg.mag_sens_adj[1] = (long)data[1] + 128;
-    st.chip_cfg.mag_sens_adj[2] = (long)data[2] + 128;
-
-    data[0] = AKM_POWER_DOWN;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, data))
-        return -1;
-    delay_ms(1);
-
-    mpu_set_bypass(0);
-
-    /* Set up master mode, master clock, and ES bit. */
-    data[0] = 0x40;
-    if (i2c_write(st.hw->addr, st.reg->i2c_mst, 1, data))
-        return -1;
-
-    /* Slave 0 reads from AKM data registers. */
-    data[0] = BIT_I2C_READ | st.chip_cfg.compass_addr;
-    if (i2c_write(st.hw->addr, st.reg->s0_addr, 1, data))
-        return -1;
-
-    /* Compass reads start at this register. */
-    data[0] = AKM_REG_ST1;
-    if (i2c_write(st.hw->addr, st.reg->s0_reg, 1, data))
-        return -1;
-
-    /* Enable slave 0, 8-byte reads. */
-    data[0] = BIT_SLAVE_EN | 8;
-    if (i2c_write(st.hw->addr, st.reg->s0_ctrl, 1, data))
-        return -1;
-
-    /* Slave 1 changes AKM measurement mode. */
-    data[0] = st.chip_cfg.compass_addr;
-    if (i2c_write(st.hw->addr, st.reg->s1_addr, 1, data))
-        return -1;
-
-    /* AKM measurement mode register. */
-    data[0] = AKM_REG_CNTL;
-    if (i2c_write(st.hw->addr, st.reg->s1_reg, 1, data))
-        return -1;
-
-    /* Enable slave 1, 1-byte writes. */
-    data[0] = BIT_SLAVE_EN | 1;
-    if (i2c_write(st.hw->addr, st.reg->s1_ctrl, 1, data))
-        return -1;
-
-    /* Set slave 1 data. */
-    data[0] = AKM_SINGLE_MEASUREMENT;
-    if (i2c_write(st.hw->addr, st.reg->s1_do, 1, data))
-        return -1;
-
-    /* Trigger slave 0 and slave 1 actions at each sample. */
-    data[0] = 0x03;
-    if (i2c_write(st.hw->addr, st.reg->i2c_delay_ctrl, 1, data))
-        return -1;
-
-#ifdef MPU9150
-    /* For the MPU9150, the auxiliary I2C bus needs to be set to VDD. */
-    data[0] = BIT_I2C_MST_VDDIO;
-    if (i2c_write(st.hw->addr, st.reg->yg_offs_tc, 1, data))
-        return -1;
-#endif
-
-    return 0;
-#else
-    return -1;
-#endif
-}
-
-/**
- *  @brief      Read raw compass data.
- *  @param[out] data        Raw data in hardware units.
- *  @param[out] timestamp   Timestamp in milliseconds. Null if not needed.
- *  @return     0 if successful.
- */
-int mpu_get_compass_reg(short *data, unsigned long *timestamp)
-{
-#ifdef AK89xx_SECONDARY
-    unsigned char tmp[9];
-
-    if (!(st.chip_cfg.sensors & INV_XYZ_COMPASS))
-        return -1;
-
-#ifdef AK89xx_BYPASS
-    if (i2c_read(st.chip_cfg.compass_addr, AKM_REG_ST1, 8, tmp))
-        return -1;
-    tmp[8] = AKM_SINGLE_MEASUREMENT;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, tmp+8))
-        return -1;
-#else
-    if (i2c_read(st.hw->addr, st.reg->raw_compass, 8, tmp))
-        return -1;
-#endif
-
-#if defined AK8975_SECONDARY
-    /* AK8975 doesn't have the overrun error bit. */
-    if (!(tmp[0] & AKM_DATA_READY))
-        return -2;
-    if ((tmp[7] & AKM_OVERFLOW) || (tmp[7] & AKM_DATA_ERROR))
-        return -3;
-#elif defined AK8963_SECONDARY
-    /* AK8963 doesn't have the data read error bit. */
-    if (!(tmp[0] & AKM_DATA_READY) || (tmp[0] & AKM_DATA_OVERRUN))
-        return -2;
-    if (tmp[7] & AKM_OVERFLOW)
-        return -3;
-#endif
-    data[0] = (tmp[2] << 8) | tmp[1];
-    data[1] = (tmp[4] << 8) | tmp[3];
-    data[2] = (tmp[6] << 8) | tmp[5];
-
-    data[0] = ((long)data[0] * st.chip_cfg.mag_sens_adj[0]) >> 8;
-    data[1] = ((long)data[1] * st.chip_cfg.mag_sens_adj[1]) >> 8;
-    data[2] = ((long)data[2] * st.chip_cfg.mag_sens_adj[2]) >> 8;
-
-    if (timestamp)
-        get_ms(timestamp);
-    return 0;
-#else
-    return -1;
-#endif
-}
-
-/**
- *  @brief      Get the compass full-scale range.
- *  @param[out] fsr Current full-scale range.
- *  @return     0 if successful.
- */
-int mpu_get_compass_fsr(unsigned short *fsr)
-{
-#ifdef AK89xx_SECONDARY
-    fsr[0] = st.hw->compass_fsr;
-    return 0;
-#else
-    return -1;
-#endif
-}
-
-/**
- *  @brief      Enters LP accel motion interrupt mode.
- *  The behaviour of this feature is very different between the MPU6050 and the
- *  MPU6500. Each chip's version of this feature is explained below.
- *
- *  \n The hardware motion threshold can be between 32mg and 8160mg in 32mg
- *  increments.
- *
- *  \n Low-power accel mode supports the following frequencies:
- *  \n 1.25Hz, 5Hz, 20Hz, 40Hz
- *
- *  \n MPU6500:
- *  \n Unlike the MPU6050 version, the hardware does not "lock in" a reference
- *  sample. The hardware monitors the accel data and detects any large change
- *  over a short period of time.
- *
- *  \n The hardware motion threshold can be between 4mg and 1020mg in 4mg
- *  increments.
- *
- *  \n MPU6500 Low-power accel mode supports the following frequencies:
- *  \n 1.25Hz, 2.5Hz, 5Hz, 10Hz, 20Hz, 40Hz, 80Hz, 160Hz, 320Hz, 640Hz
- *
- *  \n\n NOTES:
- *  \n The driver will round down @e thresh to the nearest supported value if
- *  an unsupported threshold is selected.
- *  \n To select a fractional wake-up frequency, round down the value passed to
- *  @e lpa_freq.
- *  \n The MPU6500 does not support a delay parameter. If this function is used
- *  for the MPU6500, the value passed to @e time will be ignored.
- *  \n To disable this mode, set @e lpa_freq to zero. The driver will restore
- *  the previous configuration.
- *
- *  @param[in]  thresh      Motion threshold in mg.
- *  @param[in]  time        Duration in milliseconds that the accel data must
- *                          exceed @e thresh before motion is reported.
- *  @param[in]  lpa_freq    Minimum sampling rate, or zero to disable.
- *  @return     0 if successful.
- */
-int mpu_lp_motion_interrupt(unsigned short thresh, unsigned char time,
-    unsigned char lpa_freq)
-{
-    unsigned char data[3];
-
-    if (lpa_freq) {
-        unsigned char thresh_hw;
-
-#if defined MPU6500
-        /* 1LSb = 4mg. */
-        if (thresh > 1020)
-            thresh_hw = 255;
-        else if (thresh < 4)
-            thresh_hw = 1;
-        else
-            thresh_hw = thresh >> 2;
-#endif
-
-        if (!time)
-            /* Minimum duration must be 1ms. */
-            time = 1;
-
-#if defined MPU6500
-        if (lpa_freq > 640)
-#endif
-            /* At this point, the chip has not been re-configured, so the
-             * function can safely exit.
-             */
-            return -1;
-
-        if (!st.chip_cfg.int_motion_only) {
-            /* Store current settings for later. */
-            if (st.chip_cfg.dmp_on) {
-                mpu_set_dmp_state(0);
-                st.chip_cfg.cache.dmp_on = 1;
-            } else
-                st.chip_cfg.cache.dmp_on = 0;
-            mpu_get_gyro_fsr(&st.chip_cfg.cache.gyro_fsr);
-            mpu_get_accel_fsr(&st.chip_cfg.cache.accel_fsr);
-            mpu_get_lpf(&st.chip_cfg.cache.lpf);
-            mpu_get_sample_rate(&st.chip_cfg.cache.sample_rate);
-            st.chip_cfg.cache.sensors_on = st.chip_cfg.sensors;
-            mpu_get_fifo_config(&st.chip_cfg.cache.fifo_sensors);
-        }
-
-#if defined MPU6500
-        /* Disable hardware interrupts. */
-        set_int_enable(0);
-
-        /* Enter full-power accel-only mode, no FIFO/DMP. */
-        data[0] = 0;
-        data[1] = 0;
-        data[2] = BIT_STBY_XYZG;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 3, data))
-            goto lp_int_restore;
-
-        /* Set motion threshold. */
-        data[0] = thresh_hw;
-        if (i2c_write(st.hw->addr, st.reg->motion_thr, 1, data))
-            goto lp_int_restore;
-
-        /* Set wake frequency. */
-        if (lpa_freq == 1)
-            data[0] = INV_LPA_1_25HZ;
-        else if (lpa_freq == 2)
-            data[0] = INV_LPA_2_5HZ;
-        else if (lpa_freq <= 5)
-            data[0] = INV_LPA_5HZ;
-        else if (lpa_freq <= 10)
-            data[0] = INV_LPA_10HZ;
-        else if (lpa_freq <= 20)
-            data[0] = INV_LPA_20HZ;
-        else if (lpa_freq <= 40)
-            data[0] = INV_LPA_40HZ;
-        else if (lpa_freq <= 80)
-            data[0] = INV_LPA_80HZ;
-        else if (lpa_freq <= 160)
-            data[0] = INV_LPA_160HZ;
-        else if (lpa_freq <= 320)
-            data[0] = INV_LPA_320HZ;
-        else
-            data[0] = INV_LPA_640HZ;
-        if (i2c_write(st.hw->addr, st.reg->lp_accel_odr, 1, data))
-            goto lp_int_restore;
-
-        /* Enable motion interrupt (MPU6500 version). */
-        data[0] = BITS_WOM_EN;
-        if (i2c_write(st.hw->addr, st.reg->accel_intel, 1, data))
-            goto lp_int_restore;
-
-        /* Enable cycle mode. */
-        data[0] = BIT_LPA_CYCLE;
-        if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, data))
-            goto lp_int_restore;
-
-        /* Enable interrupt. */
-        data[0] = BIT_MOT_INT_EN;
-        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, data))
-            goto lp_int_restore;
-
-        st.chip_cfg.int_motion_only = 1;
-        return 0;
-#endif
-    } else {
-        /* Don't "restore" the previous state if no state has been saved. */
-        int ii;
-        char *cache_ptr = (char*)&st.chip_cfg.cache;
-        for (ii = 0; ii < sizeof(st.chip_cfg.cache); ii++) {
-            if (cache_ptr[ii] != 0)
-                goto lp_int_restore;
-        }
-        /* If we reach this point, motion interrupt mode hasn't been used yet. */
-        return -1;
-    }
-lp_int_restore:
-    /* Set to invalid values to ensure no I2C writes are skipped. */
-    st.chip_cfg.gyro_fsr = 0xFF;
-    st.chip_cfg.accel_fsr = 0xFF;
-    st.chip_cfg.lpf = 0xFF;
-    st.chip_cfg.sample_rate = 0xFFFF;
-    st.chip_cfg.sensors = 0xFF;
-    st.chip_cfg.fifo_enable = 0xFF;
-    st.chip_cfg.clk_src = INV_CLK_PLL;
-    mpu_set_sensors(st.chip_cfg.cache.sensors_on);
-    mpu_set_gyro_fsr(st.chip_cfg.cache.gyro_fsr);
-    mpu_set_accel_fsr(st.chip_cfg.cache.accel_fsr);
-    mpu_set_lpf(st.chip_cfg.cache.lpf);
-    mpu_set_sample_rate(st.chip_cfg.cache.sample_rate);
-    mpu_configure_fifo(st.chip_cfg.cache.fifo_sensors);
-
-    if (st.chip_cfg.cache.dmp_on)
-        mpu_set_dmp_state(1);
-
-#ifdef MPU6500
-    /* Disable motion interrupt (MPU6500 version). */
-    data[0] = 0;
-    if (i2c_write(st.hw->addr, st.reg->accel_intel, 1, data))
-        goto lp_int_restore;
-#endif
-
-    st.chip_cfg.int_motion_only = 0;
-    return 0;
-}
-
-/**
- *  @}
- */
-

+ 0 - 132
Core备份3/imu1/inv_mpu1.h

@@ -1,132 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011-2012 InvenSense Corporation, All Rights Reserved.
-    See included License.txt for License information.
- $
- */
-/**
- *  @addtogroup  DRIVERS Sensor Driver Layer
- *  @brief       Hardware drivers to communicate with sensors via I2C.
- *
- *  @{
- *      @file       inv_mpu.h
- *      @brief      An I2C-based driver for Invensense gyroscopes.
- *      @details    This driver currently works for the following devices:
- *                  MPU6050
- *                  MPU6500
- *                  MPU9150 (or MPU6050 w/ AK8975 on the auxiliary bus)
- *                  MPU9250 (or MPU6500 w/ AK8963 on the auxiliary bus)
- */
-
-#ifndef _INV_MPU_H_
-#define _INV_MPU_H_
-
-#define MOTION_DRIVER_TARGET_STM32
-#define MPU6050
-//#define EMPL
-//#define USE_DMP
-
-#define INV_X_GYRO      (0x40)
-#define INV_Y_GYRO      (0x20)
-#define INV_Z_GYRO      (0x10)
-#define INV_XYZ_GYRO    (INV_X_GYRO | INV_Y_GYRO | INV_Z_GYRO)
-#define INV_XYZ_ACCEL   (0x08)
-#define INV_XYZ_COMPASS (0x01)
-
-struct int_param_s {
-#if defined EMPL_TARGET_MSP430 || defined MOTION_DRIVER_TARGET_MSP430 || defined MOTION_DRIVER_TARGET_STM32
-    void (*cb)(void);
-    unsigned short pin;
-    unsigned char lp_exit;
-    unsigned char active_low;
-#elif defined EMPL_TARGET_UC3L0
-    unsigned long pin;
-    void (*cb)(volatile void*);
-    void *arg;
-#endif
-};
-
-#define MPU_INT_STATUS_DATA_READY       (0x0001)
-#define MPU_INT_STATUS_DMP              (0x0002)
-#define MPU_INT_STATUS_PLL_READY        (0x0004)
-#define MPU_INT_STATUS_I2C_MST          (0x0008)
-#define MPU_INT_STATUS_FIFO_OVERFLOW    (0x0010)
-#define MPU_INT_STATUS_ZMOT             (0x0020)
-#define MPU_INT_STATUS_MOT              (0x0040)
-#define MPU_INT_STATUS_FREE_FALL        (0x0080)
-#define MPU_INT_STATUS_DMP_0            (0x0100)
-#define MPU_INT_STATUS_DMP_1            (0x0200)
-#define MPU_INT_STATUS_DMP_2            (0x0400)
-#define MPU_INT_STATUS_DMP_3            (0x0800)
-#define MPU_INT_STATUS_DMP_4            (0x1000)
-#define MPU_INT_STATUS_DMP_5            (0x2000)
-
-/* Set up APIs */
-int mpu_init(struct int_param_s *int_param);
-int mpu_init_slave(void);
-int mpu_set_bypass(unsigned char bypass_on);
-
-/* Configuration APIs */
-int mpu_lp_accel_mode(unsigned char rate);
-int mpu_lp_motion_interrupt(unsigned short thresh, unsigned char time,
-    unsigned char lpa_freq);
-int mpu_set_int_level(unsigned char active_low);
-int mpu_set_int_latched(unsigned char enable);
-
-int mpu_set_dmp_state(unsigned char enable);
-int mpu_get_dmp_state(unsigned char *enabled);
-
-int mpu_get_lpf(unsigned short *lpf);
-int mpu_set_lpf(unsigned short lpf);
-
-int mpu_get_gyro_fsr(unsigned short *fsr);
-int mpu_set_gyro_fsr(unsigned short fsr);
-
-int mpu_get_accel_fsr(unsigned char *fsr);
-int mpu_set_accel_fsr(unsigned char fsr);
-
-int mpu_get_compass_fsr(unsigned short *fsr);
-
-int mpu_get_gyro_sens(float *sens);
-int mpu_get_accel_sens(unsigned short *sens);
-
-int mpu_get_sample_rate(unsigned short *rate);
-int mpu_set_sample_rate(unsigned short rate);
-int mpu_get_compass_sample_rate(unsigned short *rate);
-int mpu_set_compass_sample_rate(unsigned short rate);
-
-int mpu_get_fifo_config(unsigned char *sensors);
-int mpu_configure_fifo(unsigned char sensors);
-
-int mpu_get_power_state(unsigned char *power_on);
-int mpu_set_sensors(unsigned char sensors);
-
-int mpu_set_accel_bias(const long *accel_bias);
-
-/* Data getter/setter APIs */
-int mpu_get_gyro_reg(short *data, unsigned long *timestamp);
-int mpu_get_accel_reg(short *data, unsigned long *timestamp);
-int mpu_get_compass_reg(short *data, unsigned long *timestamp);
-int mpu_get_temperature(long *data, unsigned long *timestamp);
-
-int mpu_get_int_status(short *status);
-int mpu_read_fifo(short *gyro, short *accel, unsigned long *timestamp,
-    unsigned char *sensors, unsigned char *more);
-int mpu_read_fifo_stream(unsigned short length, unsigned char *data,
-    unsigned char *more);
-int mpu_reset_fifo(void);
-
-int mpu_write_mem(unsigned short mem_addr, unsigned short length,
-    unsigned char *data);
-int mpu_read_mem(unsigned short mem_addr, unsigned short length,
-    unsigned char *data);
-int mpu_load_firmware(unsigned short length, const unsigned char *firmware,
-    unsigned short start_addr, unsigned short sample_rate);
-
-int mpu_reg_dump(void);
-int mpu_read_reg(unsigned char reg, unsigned char *data);
-int mpu_run_self_test(long *gyro, long *accel);
-int mpu_register_tap_cb(void (*func)(unsigned char, unsigned char));
-
-#endif  /* #ifndef _INV_MPU_H_ */
-

+ 0 - 1380
Core备份3/imu1/inv_mpu_dmp_motion_driver1.c

@@ -1,1380 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011-2012 InvenSense Corporation, All Rights Reserved.
-    See included License.txt for License information.
- $
- */
-/**
- *  @addtogroup  DRIVERS Sensor Driver Layer
- *  @brief       Hardware drivers to communicate with sensors via I2C.
- *
- *  @{
- *      @file       inv_mpu_dmp_motion_driver.c
- *      @brief      DMP image and interface functions.
- *      @details    All functions are preceded by the dmp_ prefix to
- *                  differentiate among MPL and general driver function calls.
- */
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include "inv_mpu1.h"
-#include "inv_mpu_dmp_motion_driver1.h"
-#include "dmpKey1.h"
-#include "dmpmap1.h"
-
-#include "MPU60501.h"
-
-/* The following functions must be defined for this platform:
- * i2c_write(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char const *data)
- * i2c_read(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char *data)
- * delay_ms(unsigned long num_ms)
- * get_ms(unsigned long *count)
- */
-#if defined MOTION_DRIVER_TARGET_MSP430
-#include "msp430.h"
-#include "msp430_clock.h"
-#define delay_ms    msp430_delay_ms
-#define get_ms      msp430_get_clock_ms
-#define log_i(...)     do {} while (0)
-#define log_e(...)     do {} while (0)
-
-#elif defined EMPL_TARGET_MSP430
-#include "msp430.h"
-#include "msp430_clock.h"
-#include "log.h"
-#define delay_ms    msp430_delay_ms
-#define get_ms      msp430_get_clock_ms
-#define log_i       MPL_LOGI
-#define log_e       MPL_LOGE
-
-#elif defined EMPL_TARGET_UC3L0
-/* Instead of using the standard TWI driver from the ASF library, we're using
- * a TWI driver that follows the slave address + register address convention.
- */
-#include "delay.h"
-#include "sysclk.h"
-#include "log.h"
-#include "uc3l0_clock.h"
-/* delay_ms is a function already defined in ASF. */
-#define get_ms  uc3l0_get_clock_ms
-#define log_i       MPL_LOGI
-#define log_e       MPL_LOGE
-
-#elif defined MOTION_DRIVER_TARGET_STM32
-
-#define delay_ms    HAL_Delay
-#define get_ms      get_tick_count
-
-#define log_i(...)     do {} while (0)
-#define log_e(...)     do {} while (0)
-
-#else
-#error  Gyro driver is missing the system layer implementations.
-#endif
-
-/* These defines are copied from dmpDefaultMPU6050.c in the general MPL
- * releases. These defines may change for each DMP image, so be sure to modify
- * these values when switching to a new image.
- */
-#define CFG_LP_QUAT             (2712)
-#define END_ORIENT_TEMP         (1866)
-#define CFG_27                  (2742)
-#define CFG_20                  (2224)
-#define CFG_23                  (2745)
-#define CFG_FIFO_ON_EVENT       (2690)
-#define END_PREDICTION_UPDATE   (1761)
-#define CGNOTICE_INTR           (2620)
-#define X_GRT_Y_TMP             (1358)
-#define CFG_DR_INT              (1029)
-#define CFG_AUTH                (1035)
-#define UPDATE_PROP_ROT         (1835)
-#define END_COMPARE_Y_X_TMP2    (1455)
-#define SKIP_X_GRT_Y_TMP        (1359)
-#define SKIP_END_COMPARE        (1435)
-#define FCFG_3                  (1088)
-#define FCFG_2                  (1066)
-#define FCFG_1                  (1062)
-#define END_COMPARE_Y_X_TMP3    (1434)
-#define FCFG_7                  (1073)
-#define FCFG_6                  (1106)
-#define FLAT_STATE_END          (1713)
-#define SWING_END_4             (1616)
-#define SWING_END_2             (1565)
-#define SWING_END_3             (1587)
-#define SWING_END_1             (1550)
-#define CFG_8                   (2718)
-#define CFG_15                  (2727)
-#define CFG_16                  (2746)
-#define CFG_EXT_GYRO_BIAS       (1189)
-#define END_COMPARE_Y_X_TMP     (1407)
-#define DO_NOT_UPDATE_PROP_ROT  (1839)
-#define CFG_7                   (1205)
-#define FLAT_STATE_END_TEMP     (1683)
-#define END_COMPARE_Y_X         (1484)
-#define SKIP_SWING_END_1        (1551)
-#define SKIP_SWING_END_3        (1588)
-#define SKIP_SWING_END_2        (1566)
-#define TILTG75_START           (1672)
-#define CFG_6                   (2753)
-#define TILTL75_END             (1669)
-#define END_ORIENT              (1884)
-#define CFG_FLICK_IN            (2573)
-#define TILTL75_START           (1643)
-#define CFG_MOTION_BIAS         (1208)
-#define X_GRT_Y                 (1408)
-#define TEMPLABEL               (2324)
-#define CFG_ANDROID_ORIENT_INT  (1853)
-#define CFG_GYRO_RAW_DATA       (2722)
-#define X_GRT_Y_TMP2            (1379)
-
-#define D_0_22                  (22+512)
-#define D_0_24                  (24+512)
-
-#define D_0_36                  (36)
-#define D_0_52                  (52)
-#define D_0_96                  (96)
-#define D_0_104                 (104)
-#define D_0_108                 (108)
-#define D_0_163                 (163)
-#define D_0_188                 (188)
-#define D_0_192                 (192)
-#define D_0_224                 (224)
-#define D_0_228                 (228)
-#define D_0_232                 (232)
-#define D_0_236                 (236)
-
-#define D_1_2                   (256 + 2)
-#define D_1_4                   (256 + 4)
-#define D_1_8                   (256 + 8)
-#define D_1_10                  (256 + 10)
-#define D_1_24                  (256 + 24)
-#define D_1_28                  (256 + 28)
-#define D_1_36                  (256 + 36)
-#define D_1_40                  (256 + 40)
-#define D_1_44                  (256 + 44)
-#define D_1_72                  (256 + 72)
-#define D_1_74                  (256 + 74)
-#define D_1_79                  (256 + 79)
-#define D_1_88                  (256 + 88)
-#define D_1_90                  (256 + 90)
-#define D_1_92                  (256 + 92)
-#define D_1_96                  (256 + 96)
-#define D_1_98                  (256 + 98)
-#define D_1_106                 (256 + 106)
-#define D_1_108                 (256 + 108)
-#define D_1_112                 (256 + 112)
-#define D_1_128                 (256 + 144)
-#define D_1_152                 (256 + 12)
-#define D_1_160                 (256 + 160)
-#define D_1_176                 (256 + 176)
-#define D_1_178                 (256 + 178)
-#define D_1_218                 (256 + 218)
-#define D_1_232                 (256 + 232)
-#define D_1_236                 (256 + 236)
-#define D_1_240                 (256 + 240)
-#define D_1_244                 (256 + 244)
-#define D_1_250                 (256 + 250)
-#define D_1_252                 (256 + 252)
-#define D_2_12                  (512 + 12)
-#define D_2_96                  (512 + 96)
-#define D_2_108                 (512 + 108)
-#define D_2_208                 (512 + 208)
-#define D_2_224                 (512 + 224)
-#define D_2_236                 (512 + 236)
-#define D_2_244                 (512 + 244)
-#define D_2_248                 (512 + 248)
-#define D_2_252                 (512 + 252)
-
-#define CPASS_BIAS_X            (35 * 16 + 4)
-#define CPASS_BIAS_Y            (35 * 16 + 8)
-#define CPASS_BIAS_Z            (35 * 16 + 12)
-#define CPASS_MTX_00            (36 * 16)
-#define CPASS_MTX_01            (36 * 16 + 4)
-#define CPASS_MTX_02            (36 * 16 + 8)
-#define CPASS_MTX_10            (36 * 16 + 12)
-#define CPASS_MTX_11            (37 * 16)
-#define CPASS_MTX_12            (37 * 16 + 4)
-#define CPASS_MTX_20            (37 * 16 + 8)
-#define CPASS_MTX_21            (37 * 16 + 12)
-#define CPASS_MTX_22            (43 * 16 + 12)
-#define D_EXT_GYRO_BIAS_X       (61 * 16)
-#define D_EXT_GYRO_BIAS_Y       (61 * 16) + 4
-#define D_EXT_GYRO_BIAS_Z       (61 * 16) + 8
-#define D_ACT0                  (40 * 16)
-#define D_ACSX                  (40 * 16 + 4)
-#define D_ACSY                  (40 * 16 + 8)
-#define D_ACSZ                  (40 * 16 + 12)
-
-#define FLICK_MSG               (45 * 16 + 4)
-#define FLICK_COUNTER           (45 * 16 + 8)
-#define FLICK_LOWER             (45 * 16 + 12)
-#define FLICK_UPPER             (46 * 16 + 12)
-
-#define D_AUTH_OUT              (992)
-#define D_AUTH_IN               (996)
-#define D_AUTH_A                (1000)
-#define D_AUTH_B                (1004)
-
-#define D_PEDSTD_BP_B           (768 + 0x1C)
-#define D_PEDSTD_HP_A           (768 + 0x78)
-#define D_PEDSTD_HP_B           (768 + 0x7C)
-#define D_PEDSTD_BP_A4          (768 + 0x40)
-#define D_PEDSTD_BP_A3          (768 + 0x44)
-#define D_PEDSTD_BP_A2          (768 + 0x48)
-#define D_PEDSTD_BP_A1          (768 + 0x4C)
-#define D_PEDSTD_INT_THRSH      (768 + 0x68)
-#define D_PEDSTD_CLIP           (768 + 0x6C)
-#define D_PEDSTD_SB             (768 + 0x28)
-#define D_PEDSTD_SB_TIME        (768 + 0x2C)
-#define D_PEDSTD_PEAKTHRSH      (768 + 0x98)
-#define D_PEDSTD_TIML           (768 + 0x2A)
-#define D_PEDSTD_TIMH           (768 + 0x2E)
-#define D_PEDSTD_PEAK           (768 + 0X94)
-#define D_PEDSTD_STEPCTR        (768 + 0x60)
-#define D_PEDSTD_TIMECTR        (964)
-#define D_PEDSTD_DECI           (768 + 0xA0)
-
-#define D_HOST_NO_MOT           (976)
-#define D_ACCEL_BIAS            (660)
-
-#define D_ORIENT_GAP            (76)
-
-#define D_TILT0_H               (48)
-#define D_TILT0_L               (50)
-#define D_TILT1_H               (52)
-#define D_TILT1_L               (54)
-#define D_TILT2_H               (56)
-#define D_TILT2_L               (58)
-#define D_TILT3_H               (60)
-#define D_TILT3_L               (62)
-
-#define DMP_CODE_SIZE           (3062)
-
-static const unsigned char dmp_memory[DMP_CODE_SIZE] = {
-    /* bank # 0 */
-    0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x00, 0x00,
-    0x00, 0x65, 0x00, 0x54, 0xff, 0xef, 0x00, 0x00, 0xfa, 0x80, 0x00, 0x0b, 0x12, 0x82, 0x00, 0x01,
-    0x03, 0x0c, 0x30, 0xc3, 0x0e, 0x8c, 0x8c, 0xe9, 0x14, 0xd5, 0x40, 0x02, 0x13, 0x71, 0x0f, 0x8e,
-    0x38, 0x83, 0xf8, 0x83, 0x30, 0x00, 0xf8, 0x83, 0x25, 0x8e, 0xf8, 0x83, 0x30, 0x00, 0xf8, 0x83,
-    0xff, 0xff, 0xff, 0xff, 0x0f, 0xfe, 0xa9, 0xd6, 0x24, 0x00, 0x04, 0x00, 0x1a, 0x82, 0x79, 0xa1,
-    0x00, 0x00, 0x00, 0x3c, 0xff, 0xff, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x38, 0x83, 0x6f, 0xa2,
-    0x00, 0x3e, 0x03, 0x30, 0x40, 0x00, 0x00, 0x00, 0x02, 0xca, 0xe3, 0x09, 0x3e, 0x80, 0x00, 0x00,
-    0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
-    0x00, 0x0c, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x6e, 0x00, 0x00, 0x06, 0x92, 0x0a, 0x16, 0xc0, 0xdf,
-    0xff, 0xff, 0x02, 0x56, 0xfd, 0x8c, 0xd3, 0x77, 0xff, 0xe1, 0xc4, 0x96, 0xe0, 0xc5, 0xbe, 0xaa,
-    0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0b, 0x2b, 0x00, 0x00, 0x16, 0x57, 0x00, 0x00, 0x03, 0x59,
-    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0xfa, 0x00, 0x02, 0x6c, 0x1d, 0x00, 0x00, 0x00, 0x00,
-    0x3f, 0xff, 0xdf, 0xeb, 0x00, 0x3e, 0xb3, 0xb6, 0x00, 0x0d, 0x22, 0x78, 0x00, 0x00, 0x2f, 0x3c,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x42, 0xb5, 0x00, 0x00, 0x39, 0xa2, 0x00, 0x00, 0xb3, 0x65,
-    0xd9, 0x0e, 0x9f, 0xc9, 0x1d, 0xcf, 0x4c, 0x34, 0x30, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00,
-    0x3b, 0xb6, 0x7a, 0xe8, 0x00, 0x64, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    /* bank # 1 */
-    0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0xfa, 0x92, 0x10, 0x00, 0x22, 0x5e, 0x00, 0x0d, 0x22, 0x9f,
-    0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0xff, 0x46, 0x00, 0x00, 0x63, 0xd4, 0x00, 0x00,
-    0x10, 0x00, 0x00, 0x00, 0x04, 0xd6, 0x00, 0x00, 0x04, 0xcc, 0x00, 0x00, 0x04, 0xcc, 0x00, 0x00,
-    0x00, 0x00, 0x10, 0x72, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x06, 0x00, 0x02, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x64, 0x00, 0x20, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, 0x00,
-    0x00, 0x00, 0x00, 0x32, 0xf8, 0x98, 0x00, 0x00, 0xff, 0x65, 0x00, 0x00, 0x83, 0x0f, 0x00, 0x00,
-    0xff, 0x9b, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
-    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0xb2, 0x6a, 0x00, 0x02, 0x00, 0x00,
-    0x00, 0x01, 0xfb, 0x83, 0x00, 0x68, 0x00, 0x00, 0x00, 0xd9, 0xfc, 0x00, 0x7c, 0xf1, 0xff, 0x83,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x64, 0x03, 0xe8, 0x00, 0x64, 0x00, 0x28,
-    0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x16, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
-    0x00, 0x00, 0x10, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x01, 0xf4, 0x00, 0x00, 0x10, 0x00,
-    /* bank # 2 */
-    0x00, 0x28, 0x00, 0x00, 0xff, 0xff, 0x45, 0x81, 0xff, 0xff, 0xfa, 0x72, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x05, 0x00, 0x05, 0xba, 0xc6, 0x00, 0x47, 0x78, 0xa2,
-    0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x14,
-    0x00, 0x00, 0x25, 0x4d, 0x00, 0x2f, 0x70, 0x6d, 0x00, 0x00, 0x05, 0xae, 0x00, 0x0c, 0x02, 0xd0,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x64, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x0e,
-    0x00, 0x00, 0x0a, 0xc7, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0xff, 0xff, 0xff, 0x9c,
-    0x00, 0x00, 0x0b, 0x2b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x64,
-    0xff, 0xe5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    /* bank # 3 */
-    0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x24, 0x26, 0xd3,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x96, 0x00, 0x3c,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x0c, 0x0a, 0x4e, 0x68, 0xcd, 0xcf, 0x77, 0x09, 0x50, 0x16, 0x67, 0x59, 0xc6, 0x19, 0xce, 0x82,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xd7, 0x84, 0x00, 0x03, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc7, 0x93, 0x8f, 0x9d, 0x1e, 0x1b, 0x1c, 0x19,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x18, 0x85, 0x00, 0x00, 0x40, 0x00,
-    0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x67, 0x7d, 0xdf, 0x7e, 0x72, 0x90, 0x2e, 0x55, 0x4c, 0xf6, 0xe6, 0x88,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-
-    /* bank # 4 */
-    0xd8, 0xdc, 0xb4, 0xb8, 0xb0, 0xd8, 0xb9, 0xab, 0xf3, 0xf8, 0xfa, 0xb3, 0xb7, 0xbb, 0x8e, 0x9e,
-    0xae, 0xf1, 0x32, 0xf5, 0x1b, 0xf1, 0xb4, 0xb8, 0xb0, 0x80, 0x97, 0xf1, 0xa9, 0xdf, 0xdf, 0xdf,
-    0xaa, 0xdf, 0xdf, 0xdf, 0xf2, 0xaa, 0xc5, 0xcd, 0xc7, 0xa9, 0x0c, 0xc9, 0x2c, 0x97, 0xf1, 0xa9,
-    0x89, 0x26, 0x46, 0x66, 0xb2, 0x89, 0x99, 0xa9, 0x2d, 0x55, 0x7d, 0xb0, 0xb0, 0x8a, 0xa8, 0x96,
-    0x36, 0x56, 0x76, 0xf1, 0xba, 0xa3, 0xb4, 0xb2, 0x80, 0xc0, 0xb8, 0xa8, 0x97, 0x11, 0xb2, 0x83,
-    0x98, 0xba, 0xa3, 0xf0, 0x24, 0x08, 0x44, 0x10, 0x64, 0x18, 0xb2, 0xb9, 0xb4, 0x98, 0x83, 0xf1,
-    0xa3, 0x29, 0x55, 0x7d, 0xba, 0xb5, 0xb1, 0xa3, 0x83, 0x93, 0xf0, 0x00, 0x28, 0x50, 0xf5, 0xb2,
-    0xb6, 0xaa, 0x83, 0x93, 0x28, 0x54, 0x7c, 0xf1, 0xb9, 0xa3, 0x82, 0x93, 0x61, 0xba, 0xa2, 0xda,
-    0xde, 0xdf, 0xdb, 0x81, 0x9a, 0xb9, 0xae, 0xf5, 0x60, 0x68, 0x70, 0xf1, 0xda, 0xba, 0xa2, 0xdf,
-    0xd9, 0xba, 0xa2, 0xfa, 0xb9, 0xa3, 0x82, 0x92, 0xdb, 0x31, 0xba, 0xa2, 0xd9, 0xba, 0xa2, 0xf8,
-    0xdf, 0x85, 0xa4, 0xd0, 0xc1, 0xbb, 0xad, 0x83, 0xc2, 0xc5, 0xc7, 0xb8, 0xa2, 0xdf, 0xdf, 0xdf,
-    0xba, 0xa0, 0xdf, 0xdf, 0xdf, 0xd8, 0xd8, 0xf1, 0xb8, 0xaa, 0xb3, 0x8d, 0xb4, 0x98, 0x0d, 0x35,
-    0x5d, 0xb2, 0xb6, 0xba, 0xaf, 0x8c, 0x96, 0x19, 0x8f, 0x9f, 0xa7, 0x0e, 0x16, 0x1e, 0xb4, 0x9a,
-    0xb8, 0xaa, 0x87, 0x2c, 0x54, 0x7c, 0xba, 0xa4, 0xb0, 0x8a, 0xb6, 0x91, 0x32, 0x56, 0x76, 0xb2,
-    0x84, 0x94, 0xa4, 0xc8, 0x08, 0xcd, 0xd8, 0xb8, 0xb4, 0xb0, 0xf1, 0x99, 0x82, 0xa8, 0x2d, 0x55,
-    0x7d, 0x98, 0xa8, 0x0e, 0x16, 0x1e, 0xa2, 0x2c, 0x54, 0x7c, 0x92, 0xa4, 0xf0, 0x2c, 0x50, 0x78,
-    /* bank # 5 */
-    0xf1, 0x84, 0xa8, 0x98, 0xc4, 0xcd, 0xfc, 0xd8, 0x0d, 0xdb, 0xa8, 0xfc, 0x2d, 0xf3, 0xd9, 0xba,
-    0xa6, 0xf8, 0xda, 0xba, 0xa6, 0xde, 0xd8, 0xba, 0xb2, 0xb6, 0x86, 0x96, 0xa6, 0xd0, 0xf3, 0xc8,
-    0x41, 0xda, 0xa6, 0xc8, 0xf8, 0xd8, 0xb0, 0xb4, 0xb8, 0x82, 0xa8, 0x92, 0xf5, 0x2c, 0x54, 0x88,
-    0x98, 0xf1, 0x35, 0xd9, 0xf4, 0x18, 0xd8, 0xf1, 0xa2, 0xd0, 0xf8, 0xf9, 0xa8, 0x84, 0xd9, 0xc7,
-    0xdf, 0xf8, 0xf8, 0x83, 0xc5, 0xda, 0xdf, 0x69, 0xdf, 0x83, 0xc1, 0xd8, 0xf4, 0x01, 0x14, 0xf1,
-    0xa8, 0x82, 0x4e, 0xa8, 0x84, 0xf3, 0x11, 0xd1, 0x82, 0xf5, 0xd9, 0x92, 0x28, 0x97, 0x88, 0xf1,
-    0x09, 0xf4, 0x1c, 0x1c, 0xd8, 0x84, 0xa8, 0xf3, 0xc0, 0xf9, 0xd1, 0xd9, 0x97, 0x82, 0xf1, 0x29,
-    0xf4, 0x0d, 0xd8, 0xf3, 0xf9, 0xf9, 0xd1, 0xd9, 0x82, 0xf4, 0xc2, 0x03, 0xd8, 0xde, 0xdf, 0x1a,
-    0xd8, 0xf1, 0xa2, 0xfa, 0xf9, 0xa8, 0x84, 0x98, 0xd9, 0xc7, 0xdf, 0xf8, 0xf8, 0xf8, 0x83, 0xc7,
-    0xda, 0xdf, 0x69, 0xdf, 0xf8, 0x83, 0xc3, 0xd8, 0xf4, 0x01, 0x14, 0xf1, 0x98, 0xa8, 0x82, 0x2e,
-    0xa8, 0x84, 0xf3, 0x11, 0xd1, 0x82, 0xf5, 0xd9, 0x92, 0x50, 0x97, 0x88, 0xf1, 0x09, 0xf4, 0x1c,
-    0xd8, 0x84, 0xa8, 0xf3, 0xc0, 0xf8, 0xf9, 0xd1, 0xd9, 0x97, 0x82, 0xf1, 0x49, 0xf4, 0x0d, 0xd8,
-    0xf3, 0xf9, 0xf9, 0xd1, 0xd9, 0x82, 0xf4, 0xc4, 0x03, 0xd8, 0xde, 0xdf, 0xd8, 0xf1, 0xad, 0x88,
-    0x98, 0xcc, 0xa8, 0x09, 0xf9, 0xd9, 0x82, 0x92, 0xa8, 0xf5, 0x7c, 0xf1, 0x88, 0x3a, 0xcf, 0x94,
-    0x4a, 0x6e, 0x98, 0xdb, 0x69, 0x31, 0xda, 0xad, 0xf2, 0xde, 0xf9, 0xd8, 0x87, 0x95, 0xa8, 0xf2,
-    0x21, 0xd1, 0xda, 0xa5, 0xf9, 0xf4, 0x17, 0xd9, 0xf1, 0xae, 0x8e, 0xd0, 0xc0, 0xc3, 0xae, 0x82,
-    /* bank # 6 */
-    0xc6, 0x84, 0xc3, 0xa8, 0x85, 0x95, 0xc8, 0xa5, 0x88, 0xf2, 0xc0, 0xf1, 0xf4, 0x01, 0x0e, 0xf1,
-    0x8e, 0x9e, 0xa8, 0xc6, 0x3e, 0x56, 0xf5, 0x54, 0xf1, 0x88, 0x72, 0xf4, 0x01, 0x15, 0xf1, 0x98,
-    0x45, 0x85, 0x6e, 0xf5, 0x8e, 0x9e, 0x04, 0x88, 0xf1, 0x42, 0x98, 0x5a, 0x8e, 0x9e, 0x06, 0x88,
-    0x69, 0xf4, 0x01, 0x1c, 0xf1, 0x98, 0x1e, 0x11, 0x08, 0xd0, 0xf5, 0x04, 0xf1, 0x1e, 0x97, 0x02,
-    0x02, 0x98, 0x36, 0x25, 0xdb, 0xf9, 0xd9, 0x85, 0xa5, 0xf3, 0xc1, 0xda, 0x85, 0xa5, 0xf3, 0xdf,
-    0xd8, 0x85, 0x95, 0xa8, 0xf3, 0x09, 0xda, 0xa5, 0xfa, 0xd8, 0x82, 0x92, 0xa8, 0xf5, 0x78, 0xf1,
-    0x88, 0x1a, 0x84, 0x9f, 0x26, 0x88, 0x98, 0x21, 0xda, 0xf4, 0x1d, 0xf3, 0xd8, 0x87, 0x9f, 0x39,
-    0xd1, 0xaf, 0xd9, 0xdf, 0xdf, 0xfb, 0xf9, 0xf4, 0x0c, 0xf3, 0xd8, 0xfa, 0xd0, 0xf8, 0xda, 0xf9,
-    0xf9, 0xd0, 0xdf, 0xd9, 0xf9, 0xd8, 0xf4, 0x0b, 0xd8, 0xf3, 0x87, 0x9f, 0x39, 0xd1, 0xaf, 0xd9,
-    0xdf, 0xdf, 0xf4, 0x1d, 0xf3, 0xd8, 0xfa, 0xfc, 0xa8, 0x69, 0xf9, 0xf9, 0xaf, 0xd0, 0xda, 0xde,
-    0xfa, 0xd9, 0xf8, 0x8f, 0x9f, 0xa8, 0xf1, 0xcc, 0xf3, 0x98, 0xdb, 0x45, 0xd9, 0xaf, 0xdf, 0xd0,
-    0xf8, 0xd8, 0xf1, 0x8f, 0x9f, 0xa8, 0xca, 0xf3, 0x88, 0x09, 0xda, 0xaf, 0x8f, 0xcb, 0xf8, 0xd8,
-    0xf2, 0xad, 0x97, 0x8d, 0x0c, 0xd9, 0xa5, 0xdf, 0xf9, 0xba, 0xa6, 0xf3, 0xfa, 0xf4, 0x12, 0xf2,
-    0xd8, 0x95, 0x0d, 0xd1, 0xd9, 0xba, 0xa6, 0xf3, 0xfa, 0xda, 0xa5, 0xf2, 0xc1, 0xba, 0xa6, 0xf3,
-    0xdf, 0xd8, 0xf1, 0xba, 0xb2, 0xb6, 0x86, 0x96, 0xa6, 0xd0, 0xca, 0xf3, 0x49, 0xda, 0xa6, 0xcb,
-    0xf8, 0xd8, 0xb0, 0xb4, 0xb8, 0xd8, 0xad, 0x84, 0xf2, 0xc0, 0xdf, 0xf1, 0x8f, 0xcb, 0xc3, 0xa8,
-    /* bank # 7 */
-    0xb2, 0xb6, 0x86, 0x96, 0xc8, 0xc1, 0xcb, 0xc3, 0xf3, 0xb0, 0xb4, 0x88, 0x98, 0xa8, 0x21, 0xdb,
-    0x71, 0x8d, 0x9d, 0x71, 0x85, 0x95, 0x21, 0xd9, 0xad, 0xf2, 0xfa, 0xd8, 0x85, 0x97, 0xa8, 0x28,
-    0xd9, 0xf4, 0x08, 0xd8, 0xf2, 0x8d, 0x29, 0xda, 0xf4, 0x05, 0xd9, 0xf2, 0x85, 0xa4, 0xc2, 0xf2,
-    0xd8, 0xa8, 0x8d, 0x94, 0x01, 0xd1, 0xd9, 0xf4, 0x11, 0xf2, 0xd8, 0x87, 0x21, 0xd8, 0xf4, 0x0a,
-    0xd8, 0xf2, 0x84, 0x98, 0xa8, 0xc8, 0x01, 0xd1, 0xd9, 0xf4, 0x11, 0xd8, 0xf3, 0xa4, 0xc8, 0xbb,
-    0xaf, 0xd0, 0xf2, 0xde, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xd8, 0xf1, 0xb8, 0xf6,
-    0xb5, 0xb9, 0xb0, 0x8a, 0x95, 0xa3, 0xde, 0x3c, 0xa3, 0xd9, 0xf8, 0xd8, 0x5c, 0xa3, 0xd9, 0xf8,
-    0xd8, 0x7c, 0xa3, 0xd9, 0xf8, 0xd8, 0xf8, 0xf9, 0xd1, 0xa5, 0xd9, 0xdf, 0xda, 0xfa, 0xd8, 0xb1,
-    0x85, 0x30, 0xf7, 0xd9, 0xde, 0xd8, 0xf8, 0x30, 0xad, 0xda, 0xde, 0xd8, 0xf2, 0xb4, 0x8c, 0x99,
-    0xa3, 0x2d, 0x55, 0x7d, 0xa0, 0x83, 0xdf, 0xdf, 0xdf, 0xb5, 0x91, 0xa0, 0xf6, 0x29, 0xd9, 0xfb,
-    0xd8, 0xa0, 0xfc, 0x29, 0xd9, 0xfa, 0xd8, 0xa0, 0xd0, 0x51, 0xd9, 0xf8, 0xd8, 0xfc, 0x51, 0xd9,
-    0xf9, 0xd8, 0x79, 0xd9, 0xfb, 0xd8, 0xa0, 0xd0, 0xfc, 0x79, 0xd9, 0xfa, 0xd8, 0xa1, 0xf9, 0xf9,
-    0xf9, 0xf9, 0xf9, 0xa0, 0xda, 0xdf, 0xdf, 0xdf, 0xd8, 0xa1, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xac,
-    0xde, 0xf8, 0xad, 0xde, 0x83, 0x93, 0xac, 0x2c, 0x54, 0x7c, 0xf1, 0xa8, 0xdf, 0xdf, 0xdf, 0xf6,
-    0x9d, 0x2c, 0xda, 0xa0, 0xdf, 0xd9, 0xfa, 0xdb, 0x2d, 0xf8, 0xd8, 0xa8, 0x50, 0xda, 0xa0, 0xd0,
-    0xde, 0xd9, 0xd0, 0xf8, 0xf8, 0xf8, 0xdb, 0x55, 0xf8, 0xd8, 0xa8, 0x78, 0xda, 0xa0, 0xd0, 0xdf,
-    /* bank # 8 */
-    0xd9, 0xd0, 0xfa, 0xf8, 0xf8, 0xf8, 0xf8, 0xdb, 0x7d, 0xf8, 0xd8, 0x9c, 0xa8, 0x8c, 0xf5, 0x30,
-    0xdb, 0x38, 0xd9, 0xd0, 0xde, 0xdf, 0xa0, 0xd0, 0xde, 0xdf, 0xd8, 0xa8, 0x48, 0xdb, 0x58, 0xd9,
-    0xdf, 0xd0, 0xde, 0xa0, 0xdf, 0xd0, 0xde, 0xd8, 0xa8, 0x68, 0xdb, 0x70, 0xd9, 0xdf, 0xdf, 0xa0,
-    0xdf, 0xdf, 0xd8, 0xf1, 0xa8, 0x88, 0x90, 0x2c, 0x54, 0x7c, 0x98, 0xa8, 0xd0, 0x5c, 0x38, 0xd1,
-    0xda, 0xf2, 0xae, 0x8c, 0xdf, 0xf9, 0xd8, 0xb0, 0x87, 0xa8, 0xc1, 0xc1, 0xb1, 0x88, 0xa8, 0xc6,
-    0xf9, 0xf9, 0xda, 0x36, 0xd8, 0xa8, 0xf9, 0xda, 0x36, 0xd8, 0xa8, 0xf9, 0xda, 0x36, 0xd8, 0xa8,
-    0xf9, 0xda, 0x36, 0xd8, 0xa8, 0xf9, 0xda, 0x36, 0xd8, 0xf7, 0x8d, 0x9d, 0xad, 0xf8, 0x18, 0xda,
-    0xf2, 0xae, 0xdf, 0xd8, 0xf7, 0xad, 0xfa, 0x30, 0xd9, 0xa4, 0xde, 0xf9, 0xd8, 0xf2, 0xae, 0xde,
-    0xfa, 0xf9, 0x83, 0xa7, 0xd9, 0xc3, 0xc5, 0xc7, 0xf1, 0x88, 0x9b, 0xa7, 0x7a, 0xad, 0xf7, 0xde,
-    0xdf, 0xa4, 0xf8, 0x84, 0x94, 0x08, 0xa7, 0x97, 0xf3, 0x00, 0xae, 0xf2, 0x98, 0x19, 0xa4, 0x88,
-    0xc6, 0xa3, 0x94, 0x88, 0xf6, 0x32, 0xdf, 0xf2, 0x83, 0x93, 0xdb, 0x09, 0xd9, 0xf2, 0xaa, 0xdf,
-    0xd8, 0xd8, 0xae, 0xf8, 0xf9, 0xd1, 0xda, 0xf3, 0xa4, 0xde, 0xa7, 0xf1, 0x88, 0x9b, 0x7a, 0xd8,
-    0xf3, 0x84, 0x94, 0xae, 0x19, 0xf9, 0xda, 0xaa, 0xf1, 0xdf, 0xd8, 0xa8, 0x81, 0xc0, 0xc3, 0xc5,
-    0xc7, 0xa3, 0x92, 0x83, 0xf6, 0x28, 0xad, 0xde, 0xd9, 0xf8, 0xd8, 0xa3, 0x50, 0xad, 0xd9, 0xf8,
-    0xd8, 0xa3, 0x78, 0xad, 0xd9, 0xf8, 0xd8, 0xf8, 0xf9, 0xd1, 0xa1, 0xda, 0xde, 0xc3, 0xc5, 0xc7,
-    0xd8, 0xa1, 0x81, 0x94, 0xf8, 0x18, 0xf2, 0xb0, 0x89, 0xac, 0xc3, 0xc5, 0xc7, 0xf1, 0xd8, 0xb8,
-    /* bank # 9 */
-    0xb4, 0xb0, 0x97, 0x86, 0xa8, 0x31, 0x9b, 0x06, 0x99, 0x07, 0xab, 0x97, 0x28, 0x88, 0x9b, 0xf0,
-    0x0c, 0x20, 0x14, 0x40, 0xb0, 0xb4, 0xb8, 0xf0, 0xa8, 0x8a, 0x9a, 0x28, 0x50, 0x78, 0xb7, 0x9b,
-    0xa8, 0x29, 0x51, 0x79, 0x24, 0x70, 0x59, 0x44, 0x69, 0x38, 0x64, 0x48, 0x31, 0xf1, 0xbb, 0xab,
-    0x88, 0x00, 0x2c, 0x54, 0x7c, 0xf0, 0xb3, 0x8b, 0xb8, 0xa8, 0x04, 0x28, 0x50, 0x78, 0xf1, 0xb0,
-    0x88, 0xb4, 0x97, 0x26, 0xa8, 0x59, 0x98, 0xbb, 0xab, 0xb3, 0x8b, 0x02, 0x26, 0x46, 0x66, 0xb0,
-    0xb8, 0xf0, 0x8a, 0x9c, 0xa8, 0x29, 0x51, 0x79, 0x8b, 0x29, 0x51, 0x79, 0x8a, 0x24, 0x70, 0x59,
-    0x8b, 0x20, 0x58, 0x71, 0x8a, 0x44, 0x69, 0x38, 0x8b, 0x39, 0x40, 0x68, 0x8a, 0x64, 0x48, 0x31,
-    0x8b, 0x30, 0x49, 0x60, 0x88, 0xf1, 0xac, 0x00, 0x2c, 0x54, 0x7c, 0xf0, 0x8c, 0xa8, 0x04, 0x28,
-    0x50, 0x78, 0xf1, 0x88, 0x97, 0x26, 0xa8, 0x59, 0x98, 0xac, 0x8c, 0x02, 0x26, 0x46, 0x66, 0xf0,
-    0x89, 0x9c, 0xa8, 0x29, 0x51, 0x79, 0x24, 0x70, 0x59, 0x44, 0x69, 0x38, 0x64, 0x48, 0x31, 0xa9,
-    0x88, 0x09, 0x20, 0x59, 0x70, 0xab, 0x11, 0x38, 0x40, 0x69, 0xa8, 0x19, 0x31, 0x48, 0x60, 0x8c,
-    0xa8, 0x3c, 0x41, 0x5c, 0x20, 0x7c, 0x00, 0xf1, 0x87, 0x98, 0x19, 0x86, 0xa8, 0x6e, 0x76, 0x7e,
-    0xa9, 0x99, 0x88, 0x2d, 0x55, 0x7d, 0xd8, 0xb1, 0xb5, 0xb9, 0xa3, 0xdf, 0xdf, 0xdf, 0xae, 0xd0,
-    0xdf, 0xaa, 0xd0, 0xde, 0xf2, 0xab, 0xf8, 0xf9, 0xd9, 0xb0, 0x87, 0xc4, 0xaa, 0xf1, 0xdf, 0xdf,
-    0xbb, 0xaf, 0xdf, 0xdf, 0xb9, 0xd8, 0xb1, 0xf1, 0xa3, 0x97, 0x8e, 0x60, 0xdf, 0xb0, 0x84, 0xf2,
-    0xc8, 0xf8, 0xf9, 0xd9, 0xde, 0xd8, 0x93, 0x85, 0xf1, 0x4a, 0xb1, 0x83, 0xa3, 0x08, 0xb5, 0x83,
-    /* bank # 10 */
-    0x9a, 0x08, 0x10, 0xb7, 0x9f, 0x10, 0xd8, 0xf1, 0xb0, 0xba, 0xae, 0xb0, 0x8a, 0xc2, 0xb2, 0xb6,
-    0x8e, 0x9e, 0xf1, 0xfb, 0xd9, 0xf4, 0x1d, 0xd8, 0xf9, 0xd9, 0x0c, 0xf1, 0xd8, 0xf8, 0xf8, 0xad,
-    0x61, 0xd9, 0xae, 0xfb, 0xd8, 0xf4, 0x0c, 0xf1, 0xd8, 0xf8, 0xf8, 0xad, 0x19, 0xd9, 0xae, 0xfb,
-    0xdf, 0xd8, 0xf4, 0x16, 0xf1, 0xd8, 0xf8, 0xad, 0x8d, 0x61, 0xd9, 0xf4, 0xf4, 0xac, 0xf5, 0x9c,
-    0x9c, 0x8d, 0xdf, 0x2b, 0xba, 0xb6, 0xae, 0xfa, 0xf8, 0xf4, 0x0b, 0xd8, 0xf1, 0xae, 0xd0, 0xf8,
-    0xad, 0x51, 0xda, 0xae, 0xfa, 0xf8, 0xf1, 0xd8, 0xb9, 0xb1, 0xb6, 0xa3, 0x83, 0x9c, 0x08, 0xb9,
-    0xb1, 0x83, 0x9a, 0xb5, 0xaa, 0xc0, 0xfd, 0x30, 0x83, 0xb7, 0x9f, 0x10, 0xb5, 0x8b, 0x93, 0xf2,
-    0x02, 0x02, 0xd1, 0xab, 0xda, 0xde, 0xd8, 0xf1, 0xb0, 0x80, 0xba, 0xab, 0xc0, 0xc3, 0xb2, 0x84,
-    0xc1, 0xc3, 0xd8, 0xb1, 0xb9, 0xf3, 0x8b, 0xa3, 0x91, 0xb6, 0x09, 0xb4, 0xd9, 0xab, 0xde, 0xb0,
-    0x87, 0x9c, 0xb9, 0xa3, 0xdd, 0xf1, 0xb3, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0xb0, 0x87, 0xa3, 0xa3,
-    0xa3, 0xa3, 0xb2, 0x8b, 0xb6, 0x9b, 0xf2, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3,
-    0xa3, 0xf1, 0xb0, 0x87, 0xb5, 0x9a, 0xa3, 0xf3, 0x9b, 0xa3, 0xa3, 0xdc, 0xba, 0xac, 0xdf, 0xb9,
-    0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3,
-    0xd8, 0xd8, 0xd8, 0xbb, 0xb3, 0xb7, 0xf1, 0xaa, 0xf9, 0xda, 0xff, 0xd9, 0x80, 0x9a, 0xaa, 0x28,
-    0xb4, 0x80, 0x98, 0xa7, 0x20, 0xb7, 0x97, 0x87, 0xa8, 0x66, 0x88, 0xf0, 0x79, 0x51, 0xf1, 0x90,
-    0x2c, 0x87, 0x0c, 0xa7, 0x81, 0x97, 0x62, 0x93, 0xf0, 0x71, 0x71, 0x60, 0x85, 0x94, 0x01, 0x29,
-    /* bank # 11 */
-    0x51, 0x79, 0x90, 0xa5, 0xf1, 0x28, 0x4c, 0x6c, 0x87, 0x0c, 0x95, 0x18, 0x85, 0x78, 0xa3, 0x83,
-    0x90, 0x28, 0x4c, 0x6c, 0x88, 0x6c, 0xd8, 0xf3, 0xa2, 0x82, 0x00, 0xf2, 0x10, 0xa8, 0x92, 0x19,
-    0x80, 0xa2, 0xf2, 0xd9, 0x26, 0xd8, 0xf1, 0x88, 0xa8, 0x4d, 0xd9, 0x48, 0xd8, 0x96, 0xa8, 0x39,
-    0x80, 0xd9, 0x3c, 0xd8, 0x95, 0x80, 0xa8, 0x39, 0xa6, 0x86, 0x98, 0xd9, 0x2c, 0xda, 0x87, 0xa7,
-    0x2c, 0xd8, 0xa8, 0x89, 0x95, 0x19, 0xa9, 0x80, 0xd9, 0x38, 0xd8, 0xa8, 0x89, 0x39, 0xa9, 0x80,
-    0xda, 0x3c, 0xd8, 0xa8, 0x2e, 0xa8, 0x39, 0x90, 0xd9, 0x0c, 0xd8, 0xa8, 0x95, 0x31, 0x98, 0xd9,
-    0x0c, 0xd8, 0xa8, 0x09, 0xd9, 0xff, 0xd8, 0x01, 0xda, 0xff, 0xd8, 0x95, 0x39, 0xa9, 0xda, 0x26,
-    0xff, 0xd8, 0x90, 0xa8, 0x0d, 0x89, 0x99, 0xa8, 0x10, 0x80, 0x98, 0x21, 0xda, 0x2e, 0xd8, 0x89,
-    0x99, 0xa8, 0x31, 0x80, 0xda, 0x2e, 0xd8, 0xa8, 0x86, 0x96, 0x31, 0x80, 0xda, 0x2e, 0xd8, 0xa8,
-    0x87, 0x31, 0x80, 0xda, 0x2e, 0xd8, 0xa8, 0x82, 0x92, 0xf3, 0x41, 0x80, 0xf1, 0xd9, 0x2e, 0xd8,
-    0xa8, 0x82, 0xf3, 0x19, 0x80, 0xf1, 0xd9, 0x2e, 0xd8, 0x82, 0xac, 0xf3, 0xc0, 0xa2, 0x80, 0x22,
-    0xf1, 0xa6, 0x2e, 0xa7, 0x2e, 0xa9, 0x22, 0x98, 0xa8, 0x29, 0xda, 0xac, 0xde, 0xff, 0xd8, 0xa2,
-    0xf2, 0x2a, 0xf1, 0xa9, 0x2e, 0x82, 0x92, 0xa8, 0xf2, 0x31, 0x80, 0xa6, 0x96, 0xf1, 0xd9, 0x00,
-    0xac, 0x8c, 0x9c, 0x0c, 0x30, 0xac, 0xde, 0xd0, 0xde, 0xff, 0xd8, 0x8c, 0x9c, 0xac, 0xd0, 0x10,
-    0xac, 0xde, 0x80, 0x92, 0xa2, 0xf2, 0x4c, 0x82, 0xa8, 0xf1, 0xca, 0xf2, 0x35, 0xf1, 0x96, 0x88,
-    0xa6, 0xd9, 0x00, 0xd8, 0xf1, 0xff
-};
-
-static const unsigned short sStartAddress = 0x0400;
-
-/* END OF SECTION COPIED FROM dmpDefaultMPU6050.c */
-
-#define INT_SRC_TAP             (0x01)
-#define INT_SRC_ANDROID_ORIENT  (0x08)
-
-#define DMP_FEATURE_SEND_ANY_GYRO   (DMP_FEATURE_SEND_RAW_GYRO | \
-                                     DMP_FEATURE_SEND_CAL_GYRO)
-
-#define MAX_PACKET_LENGTH   (32)
-
-#define DMP_SAMPLE_RATE     (200)
-#define GYRO_SF             (46850825LL * 200 / DMP_SAMPLE_RATE)
-
-#define FIFO_CORRUPTION_CHECK
-#ifdef FIFO_CORRUPTION_CHECK
-#define QUAT_ERROR_THRESH       (1L<<24)
-#define QUAT_MAG_SQ_NORMALIZED  (1L<<28)
-#define QUAT_MAG_SQ_MIN         (QUAT_MAG_SQ_NORMALIZED - QUAT_ERROR_THRESH)
-#define QUAT_MAG_SQ_MAX         (QUAT_MAG_SQ_NORMALIZED + QUAT_ERROR_THRESH)
-#endif
-
-struct dmp_s {
-    void (*tap_cb)(unsigned char count, unsigned char direction);
-    void (*android_orient_cb)(unsigned char orientation);
-    unsigned short orient;
-    unsigned short feature_mask;
-    unsigned short fifo_rate;
-    unsigned char packet_length;
-};
-
-static struct dmp_s dmp = {
-    .tap_cb = NULL,
-    .android_orient_cb = NULL,
-    .orient = 0,
-    .feature_mask = 0,
-    .fifo_rate = 0,
-    .packet_length = 0
-};
-
-/**
- *  @brief  Load the DMP with this image.
- *  @return 0 if successful.
- */
-int dmp_load_motion_driver_firmware(void)
-{
-    return mpu_load_firmware(DMP_CODE_SIZE, dmp_memory, sStartAddress,
-        DMP_SAMPLE_RATE);
-}
-
-/**
- *  @brief      Push gyro and accel orientation to the DMP.
- *  The orientation is represented here as the output of
- *  @e inv_orientation_matrix_to_scalar.
- *  @param[in]  orient  Gyro and accel orientation in body frame.
- *  @return     0 if successful.
- */
-int dmp_set_orientation(unsigned short orient)
-{
-    unsigned char gyro_regs[3], accel_regs[3];
-    const unsigned char gyro_axes[3] = {DINA4C, DINACD, DINA6C};
-    const unsigned char accel_axes[3] = {DINA0C, DINAC9, DINA2C};
-    const unsigned char gyro_sign[3] = {DINA36, DINA56, DINA76};
-    const unsigned char accel_sign[3] = {DINA26, DINA46, DINA66};
-
-    gyro_regs[0] = gyro_axes[orient & 3];
-    gyro_regs[1] = gyro_axes[(orient >> 3) & 3];
-    gyro_regs[2] = gyro_axes[(orient >> 6) & 3];
-    accel_regs[0] = accel_axes[orient & 3];
-    accel_regs[1] = accel_axes[(orient >> 3) & 3];
-    accel_regs[2] = accel_axes[(orient >> 6) & 3];
-
-    /* Chip-to-body, axes only. */
-    if (mpu_write_mem(FCFG_1, 3, gyro_regs))
-        return -1;
-    if (mpu_write_mem(FCFG_2, 3, accel_regs))
-        return -1;
-
-    memcpy(gyro_regs, gyro_sign, 3);
-    memcpy(accel_regs, accel_sign, 3);
-    if (orient & 4) {
-        gyro_regs[0] |= 1;
-        accel_regs[0] |= 1;
-    }
-    if (orient & 0x20) {
-        gyro_regs[1] |= 1;
-        accel_regs[1] |= 1;
-    }
-    if (orient & 0x100) {
-        gyro_regs[2] |= 1;
-        accel_regs[2] |= 1;
-    }
-
-    /* Chip-to-body, sign only. */
-    if (mpu_write_mem(FCFG_3, 3, gyro_regs))
-        return -1;
-    if (mpu_write_mem(FCFG_7, 3, accel_regs))
-        return -1;
-    dmp.orient = orient;
-    return 0;
-}
-
-/**
- *  @brief      Push gyro biases to the DMP.
- *  Because the gyro integration is handled in the DMP, any gyro biases
- *  calculated by the MPL should be pushed down to DMP memory to remove
- *  3-axis quaternion drift.
- *  \n NOTE: If the DMP-based gyro calibration is enabled, the DMP will
- *  overwrite the biases written to this location once a new one is computed.
- *  @param[in]  bias    Gyro biases in q16.
- *  @return     0 if successful.
- */
-int dmp_set_gyro_bias(long *bias)
-{
-    long gyro_bias_body[3];
-    unsigned char regs[4];
-
-    gyro_bias_body[0] = bias[dmp.orient & 3];
-    if (dmp.orient & 4)
-        gyro_bias_body[0] *= -1;
-    gyro_bias_body[1] = bias[(dmp.orient >> 3) & 3];
-    if (dmp.orient & 0x20)
-        gyro_bias_body[1] *= -1;
-    gyro_bias_body[2] = bias[(dmp.orient >> 6) & 3];
-    if (dmp.orient & 0x100)
-        gyro_bias_body[2] *= -1;
-
-#ifdef EMPL_NO_64BIT
-    gyro_bias_body[0] = (long)(((float)gyro_bias_body[0] * GYRO_SF) / 1073741824.f);
-    gyro_bias_body[1] = (long)(((float)gyro_bias_body[1] * GYRO_SF) / 1073741824.f);
-    gyro_bias_body[2] = (long)(((float)gyro_bias_body[2] * GYRO_SF) / 1073741824.f);
-#else
-    gyro_bias_body[0] = (long)(((long long)gyro_bias_body[0] * GYRO_SF) >> 30);
-    gyro_bias_body[1] = (long)(((long long)gyro_bias_body[1] * GYRO_SF) >> 30);
-    gyro_bias_body[2] = (long)(((long long)gyro_bias_body[2] * GYRO_SF) >> 30);
-#endif
-
-    regs[0] = (unsigned char)((gyro_bias_body[0] >> 24) & 0xFF);
-    regs[1] = (unsigned char)((gyro_bias_body[0] >> 16) & 0xFF);
-    regs[2] = (unsigned char)((gyro_bias_body[0] >> 8) & 0xFF);
-    regs[3] = (unsigned char)(gyro_bias_body[0] & 0xFF);
-    if (mpu_write_mem(D_EXT_GYRO_BIAS_X, 4, regs))
-        return -1;
-
-    regs[0] = (unsigned char)((gyro_bias_body[1] >> 24) & 0xFF);
-    regs[1] = (unsigned char)((gyro_bias_body[1] >> 16) & 0xFF);
-    regs[2] = (unsigned char)((gyro_bias_body[1] >> 8) & 0xFF);
-    regs[3] = (unsigned char)(gyro_bias_body[1] & 0xFF);
-    if (mpu_write_mem(D_EXT_GYRO_BIAS_Y, 4, regs))
-        return -1;
-
-    regs[0] = (unsigned char)((gyro_bias_body[2] >> 24) & 0xFF);
-    regs[1] = (unsigned char)((gyro_bias_body[2] >> 16) & 0xFF);
-    regs[2] = (unsigned char)((gyro_bias_body[2] >> 8) & 0xFF);
-    regs[3] = (unsigned char)(gyro_bias_body[2] & 0xFF);
-    return mpu_write_mem(D_EXT_GYRO_BIAS_Z, 4, regs);
-}
-
-/**
- *  @brief      Push accel biases to the DMP.
- *  These biases will be removed from the DMP 6-axis quaternion.
- *  @param[in]  bias    Accel biases in q16.
- *  @return     0 if successful.
- */
-int dmp_set_accel_bias(long *bias)
-{
-    long accel_bias_body[3];
-    unsigned char regs[12];
-    long long accel_sf;
-    unsigned short accel_sens;
-
-    mpu_get_accel_sens(&accel_sens);
-    accel_sf = (long long)accel_sens << 15;
-//    __no_operation();
-    __NOP();
-
-    accel_bias_body[0] = bias[dmp.orient & 3];
-    if (dmp.orient & 4)
-        accel_bias_body[0] *= -1;
-    accel_bias_body[1] = bias[(dmp.orient >> 3) & 3];
-    if (dmp.orient & 0x20)
-        accel_bias_body[1] *= -1;
-    accel_bias_body[2] = bias[(dmp.orient >> 6) & 3];
-    if (dmp.orient & 0x100)
-        accel_bias_body[2] *= -1;
-
-#ifdef EMPL_NO_64BIT
-    accel_bias_body[0] = (long)(((float)accel_bias_body[0] * accel_sf) / 1073741824.f);
-    accel_bias_body[1] = (long)(((float)accel_bias_body[1] * accel_sf) / 1073741824.f);
-    accel_bias_body[2] = (long)(((float)accel_bias_body[2] * accel_sf) / 1073741824.f);
-#else
-    accel_bias_body[0] = (long)(((long long)accel_bias_body[0] * accel_sf) >> 30);
-    accel_bias_body[1] = (long)(((long long)accel_bias_body[1] * accel_sf) >> 30);
-    accel_bias_body[2] = (long)(((long long)accel_bias_body[2] * accel_sf) >> 30);
-#endif
-
-    regs[0] = (unsigned char)((accel_bias_body[0] >> 24) & 0xFF);
-    regs[1] = (unsigned char)((accel_bias_body[0] >> 16) & 0xFF);
-    regs[2] = (unsigned char)((accel_bias_body[0] >> 8) & 0xFF);
-    regs[3] = (unsigned char)(accel_bias_body[0] & 0xFF);
-    regs[4] = (unsigned char)((accel_bias_body[1] >> 24) & 0xFF);
-    regs[5] = (unsigned char)((accel_bias_body[1] >> 16) & 0xFF);
-    regs[6] = (unsigned char)((accel_bias_body[1] >> 8) & 0xFF);
-    regs[7] = (unsigned char)(accel_bias_body[1] & 0xFF);
-    regs[8] = (unsigned char)((accel_bias_body[2] >> 24) & 0xFF);
-    regs[9] = (unsigned char)((accel_bias_body[2] >> 16) & 0xFF);
-    regs[10] = (unsigned char)((accel_bias_body[2] >> 8) & 0xFF);
-    regs[11] = (unsigned char)(accel_bias_body[2] & 0xFF);
-    return mpu_write_mem(D_ACCEL_BIAS, 12, regs);
-}
-
-/**
- *  @brief      Set DMP output rate.
- *  Only used when DMP is on.
- *  @param[in]  rate    Desired fifo rate (Hz).
- *  @return     0 if successful.
- */
-int dmp_set_fifo_rate(unsigned short rate)
-{
-    const unsigned char regs_end[12] = {DINAFE, DINAF2, DINAAB,
-        0xc4, DINAAA, DINAF1, DINADF, DINADF, 0xBB, 0xAF, DINADF, DINADF};
-    unsigned short div;
-    unsigned char tmp[8];
-
-    if (rate > DMP_SAMPLE_RATE)
-        return -1;
-    div = DMP_SAMPLE_RATE / rate - 1;
-    tmp[0] = (unsigned char)((div >> 8) & 0xFF);
-    tmp[1] = (unsigned char)(div & 0xFF);
-    if (mpu_write_mem(D_0_22, 2, tmp))
-        return -1;
-    if (mpu_write_mem(CFG_6, 12, (unsigned char*)regs_end))
-        return -1;
-
-    dmp.fifo_rate = rate;
-    return 0;
-}
-
-/**
- *  @brief      Get DMP output rate.
- *  @param[out] rate    Current fifo rate (Hz).
- *  @return     0 if successful.
- */
-int dmp_get_fifo_rate(unsigned short *rate)
-{
-    rate[0] = dmp.fifo_rate;
-    return 0;
-}
-
-/**
- *  @brief      Set tap threshold for a specific axis.
- *  @param[in]  axis    1, 2, and 4 for XYZ accel, respectively.
- *  @param[in]  thresh  Tap threshold, in mg/ms.
- *  @return     0 if successful.
- */
-int dmp_set_tap_thresh(unsigned char axis, unsigned short thresh)
-{
-    unsigned char tmp[4], accel_fsr;
-    float scaled_thresh;
-    unsigned short dmp_thresh, dmp_thresh_2;
-    if (!(axis & TAP_XYZ) || thresh > 1600)
-        return -1;
-
-    scaled_thresh = (float)thresh / DMP_SAMPLE_RATE;
-
-    mpu_get_accel_fsr(&accel_fsr);
-    switch (accel_fsr) {
-    case 2:
-        dmp_thresh = (unsigned short)(scaled_thresh * 16384);
-        /* dmp_thresh * 0.75 */
-        dmp_thresh_2 = (unsigned short)(scaled_thresh * 12288);
-        break;
-    case 4:
-        dmp_thresh = (unsigned short)(scaled_thresh * 8192);
-        /* dmp_thresh * 0.75 */
-        dmp_thresh_2 = (unsigned short)(scaled_thresh * 6144);
-        break;
-    case 8:
-        dmp_thresh = (unsigned short)(scaled_thresh * 4096);
-        /* dmp_thresh * 0.75 */
-        dmp_thresh_2 = (unsigned short)(scaled_thresh * 3072);
-        break;
-    case 16:
-        dmp_thresh = (unsigned short)(scaled_thresh * 2048);
-        /* dmp_thresh * 0.75 */
-        dmp_thresh_2 = (unsigned short)(scaled_thresh * 1536);
-        break;
-    default:
-        return -1;
-    }
-    tmp[0] = (unsigned char)(dmp_thresh >> 8);
-    tmp[1] = (unsigned char)(dmp_thresh & 0xFF);
-    tmp[2] = (unsigned char)(dmp_thresh_2 >> 8);
-    tmp[3] = (unsigned char)(dmp_thresh_2 & 0xFF);
-
-    if (axis & TAP_X) {
-        if (mpu_write_mem(DMP_TAP_THX, 2, tmp))
-            return -1;
-        if (mpu_write_mem(D_1_36, 2, tmp+2))
-            return -1;
-    }
-    if (axis & TAP_Y) {
-        if (mpu_write_mem(DMP_TAP_THY, 2, tmp))
-            return -1;
-        if (mpu_write_mem(D_1_40, 2, tmp+2))
-            return -1;
-    }
-    if (axis & TAP_Z) {
-        if (mpu_write_mem(DMP_TAP_THZ, 2, tmp))
-            return -1;
-        if (mpu_write_mem(D_1_44, 2, tmp+2))
-            return -1;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Set which axes will register a tap.
- *  @param[in]  axis    1, 2, and 4 for XYZ, respectively.
- *  @return     0 if successful.
- */
-int dmp_set_tap_axes(unsigned char axis)
-{
-    unsigned char tmp = 0;
-
-    if (axis & TAP_X)
-        tmp |= 0x30;
-    if (axis & TAP_Y)
-        tmp |= 0x0C;
-    if (axis & TAP_Z)
-        tmp |= 0x03;
-    return mpu_write_mem(D_1_72, 1, &tmp);
-}
-
-/**
- *  @brief      Set minimum number of taps needed for an interrupt.
- *  @param[in]  min_taps    Minimum consecutive taps (1-4).
- *  @return     0 if successful.
- */
-int dmp_set_tap_count(unsigned char min_taps)
-{
-    unsigned char tmp;
-
-    if (min_taps < 1)
-        min_taps = 1;
-    else if (min_taps > 4)
-        min_taps = 4;
-
-    tmp = min_taps - 1;
-    return mpu_write_mem(D_1_79, 1, &tmp);
-}
-
-/**
- *  @brief      Set length between valid taps.
- *  @param[in]  time    Milliseconds between taps.
- *  @return     0 if successful.
- */
-int dmp_set_tap_time(unsigned short time)
-{
-    unsigned short dmp_time;
-    unsigned char tmp[2];
-
-    dmp_time = time / (1000 / DMP_SAMPLE_RATE);
-    tmp[0] = (unsigned char)(dmp_time >> 8);
-    tmp[1] = (unsigned char)(dmp_time & 0xFF);
-    return mpu_write_mem(DMP_TAPW_MIN, 2, tmp);
-}
-
-/**
- *  @brief      Set max time between taps to register as a multi-tap.
- *  @param[in]  time    Max milliseconds between taps.
- *  @return     0 if successful.
- */
-int dmp_set_tap_time_multi(unsigned short time)
-{
-    unsigned short dmp_time;
-    unsigned char tmp[2];
-
-    dmp_time = time / (1000 / DMP_SAMPLE_RATE);
-    tmp[0] = (unsigned char)(dmp_time >> 8);
-    tmp[1] = (unsigned char)(dmp_time & 0xFF);
-    return mpu_write_mem(D_1_218, 2, tmp);
-}
-
-/**
- *  @brief      Set shake rejection threshold.
- *  If the DMP detects a gyro sample larger than @e thresh, taps are rejected.
- *  @param[in]  sf      Gyro scale factor.
- *  @param[in]  thresh  Gyro threshold in dps.
- *  @return     0 if successful.
- */
-int dmp_set_shake_reject_thresh(long sf, unsigned short thresh)
-{
-    unsigned char tmp[4];
-    long thresh_scaled = sf / 1000 * thresh;
-    tmp[0] = (unsigned char)(((long)thresh_scaled >> 24) & 0xFF);
-    tmp[1] = (unsigned char)(((long)thresh_scaled >> 16) & 0xFF);
-    tmp[2] = (unsigned char)(((long)thresh_scaled >> 8) & 0xFF);
-    tmp[3] = (unsigned char)((long)thresh_scaled & 0xFF);
-    return mpu_write_mem(D_1_92, 4, tmp);
-}
-
-/**
- *  @brief      Set shake rejection time.
- *  Sets the length of time that the gyro must be outside of the threshold set
- *  by @e gyro_set_shake_reject_thresh before taps are rejected. A mandatory
- *  60 ms is added to this parameter.
- *  @param[in]  time    Time in milliseconds.
- *  @return     0 if successful.
- */
-int dmp_set_shake_reject_time(unsigned short time)
-{
-    unsigned char tmp[2];
-
-    time /= (1000 / DMP_SAMPLE_RATE);
-    tmp[0] = time >> 8;
-    tmp[1] = time & 0xFF;
-    return mpu_write_mem(D_1_90,2,tmp);
-}
-
-/**
- *  @brief      Set shake rejection timeout.
- *  Sets the length of time after a shake rejection that the gyro must stay
- *  inside of the threshold before taps can be detected again. A mandatory
- *  60 ms is added to this parameter.
- *  @param[in]  time    Time in milliseconds.
- *  @return     0 if successful.
- */
-int dmp_set_shake_reject_timeout(unsigned short time)
-{
-    unsigned char tmp[2];
-
-    time /= (1000 / DMP_SAMPLE_RATE);
-    tmp[0] = time >> 8;
-    tmp[1] = time & 0xFF;
-    return mpu_write_mem(D_1_88,2,tmp);
-}
-
-/**
- *  @brief      Get current step count.
- *  @param[out] count   Number of steps detected.
- *  @return     0 if successful.
- */
-int dmp_get_pedometer_step_count(unsigned long *count)
-{
-    unsigned char tmp[4];
-    if (!count)
-        return -1;
-
-    if (mpu_read_mem(D_PEDSTD_STEPCTR, 4, tmp))
-        return -1;
-
-    count[0] = ((unsigned long)tmp[0] << 24) | ((unsigned long)tmp[1] << 16) |
-        ((unsigned long)tmp[2] << 8) | tmp[3];
-    return 0;
-}
-
-/**
- *  @brief      Overwrite current step count.
- *  WARNING: This function writes to DMP memory and could potentially encounter
- *  a race condition if called while the pedometer is enabled.
- *  @param[in]  count   New step count.
- *  @return     0 if successful.
- */
-int dmp_set_pedometer_step_count(unsigned long count)
-{
-    unsigned char tmp[4];
-
-    tmp[0] = (unsigned char)((count >> 24) & 0xFF);
-    tmp[1] = (unsigned char)((count >> 16) & 0xFF);
-    tmp[2] = (unsigned char)((count >> 8) & 0xFF);
-    tmp[3] = (unsigned char)(count & 0xFF);
-    return mpu_write_mem(D_PEDSTD_STEPCTR, 4, tmp);
-}
-
-/**
- *  @brief      Get duration of walking time.
- *  @param[in]  time    Walk time in milliseconds.
- *  @return     0 if successful.
- */
-int dmp_get_pedometer_walk_time(unsigned long *time)
-{
-    unsigned char tmp[4];
-    if (!time)
-        return -1;
-
-    if (mpu_read_mem(D_PEDSTD_TIMECTR, 4, tmp))
-        return -1;
-
-    time[0] = (((unsigned long)tmp[0] << 24) | ((unsigned long)tmp[1] << 16) |
-        ((unsigned long)tmp[2] << 8) | tmp[3]) * 20;
-    return 0;
-}
-
-/**
- *  @brief      Overwrite current walk time.
- *  WARNING: This function writes to DMP memory and could potentially encounter
- *  a race condition if called while the pedometer is enabled.
- *  @param[in]  time    New walk time in milliseconds.
- */
-int dmp_set_pedometer_walk_time(unsigned long time)
-{
-    unsigned char tmp[4];
-
-    time /= 20;
-
-    tmp[0] = (unsigned char)((time >> 24) & 0xFF);
-    tmp[1] = (unsigned char)((time >> 16) & 0xFF);
-    tmp[2] = (unsigned char)((time >> 8) & 0xFF);
-    tmp[3] = (unsigned char)(time & 0xFF);
-    return mpu_write_mem(D_PEDSTD_TIMECTR, 4, tmp);
-}
-
-/**
- *  @brief      Enable DMP features.
- *  The following \#define's are used in the input mask:
- *  \n DMP_FEATURE_TAP
- *  \n DMP_FEATURE_ANDROID_ORIENT
- *  \n DMP_FEATURE_LP_QUAT
- *  \n DMP_FEATURE_6X_LP_QUAT
- *  \n DMP_FEATURE_GYRO_CAL
- *  \n DMP_FEATURE_SEND_RAW_ACCEL
- *  \n DMP_FEATURE_SEND_RAW_GYRO
- *  \n NOTE: DMP_FEATURE_LP_QUAT and DMP_FEATURE_6X_LP_QUAT are mutually
- *  exclusive.
- *  \n NOTE: DMP_FEATURE_SEND_RAW_GYRO and DMP_FEATURE_SEND_CAL_GYRO are also
- *  mutually exclusive.
- *  @param[in]  mask    Mask of features to enable.
- *  @return     0 if successful.
- */
-int dmp_enable_feature(unsigned short mask)
-{
-    unsigned char tmp[10];
-
-    /* TODO: All of these settings can probably be integrated into the default
-     * DMP image.
-     */
-    /* Set integration scale factor. */
-    tmp[0] = (unsigned char)((GYRO_SF >> 24) & 0xFF);
-    tmp[1] = (unsigned char)((GYRO_SF >> 16) & 0xFF);
-    tmp[2] = (unsigned char)((GYRO_SF >> 8) & 0xFF);
-    tmp[3] = (unsigned char)(GYRO_SF & 0xFF);
-    mpu_write_mem(D_0_104, 4, tmp);
-
-    /* Send sensor data to the FIFO. */
-    tmp[0] = 0xA3;
-    if (mask & DMP_FEATURE_SEND_RAW_ACCEL) {
-        tmp[1] = 0xC0;
-        tmp[2] = 0xC8;
-        tmp[3] = 0xC2;
-    } else {
-        tmp[1] = 0xA3;
-        tmp[2] = 0xA3;
-        tmp[3] = 0xA3;
-    }
-    if (mask & DMP_FEATURE_SEND_ANY_GYRO) {
-        tmp[4] = 0xC4;
-        tmp[5] = 0xCC;
-        tmp[6] = 0xC6;
-    } else {
-        tmp[4] = 0xA3;
-        tmp[5] = 0xA3;
-        tmp[6] = 0xA3;
-    }
-    tmp[7] = 0xA3;
-    tmp[8] = 0xA3;
-    tmp[9] = 0xA3;
-    mpu_write_mem(CFG_15,10,tmp);
-
-    /* Send gesture data to the FIFO. */
-    if (mask & (DMP_FEATURE_TAP | DMP_FEATURE_ANDROID_ORIENT))
-        tmp[0] = DINA20;
-    else
-        tmp[0] = 0xD8;
-    mpu_write_mem(CFG_27,1,tmp);
-
-    if (mask & DMP_FEATURE_GYRO_CAL)
-        dmp_enable_gyro_cal(1);
-    else
-        dmp_enable_gyro_cal(0);
-
-    if (mask & DMP_FEATURE_SEND_ANY_GYRO) {
-        if (mask & DMP_FEATURE_SEND_CAL_GYRO) {
-            tmp[0] = 0xB2;
-            tmp[1] = 0x8B;
-            tmp[2] = 0xB6;
-            tmp[3] = 0x9B;
-        } else {
-            tmp[0] = DINAC0;
-            tmp[1] = DINA80;
-            tmp[2] = DINAC2;
-            tmp[3] = DINA90;
-        }
-        mpu_write_mem(CFG_GYRO_RAW_DATA, 4, tmp);
-    }
-
-    if (mask & DMP_FEATURE_TAP) {
-        /* Enable tap. */
-        tmp[0] = 0xF8;
-        mpu_write_mem(CFG_20, 1, tmp);
-        dmp_set_tap_thresh(TAP_XYZ, 250);
-        dmp_set_tap_axes(TAP_XYZ);
-        dmp_set_tap_count(1);
-        dmp_set_tap_time(100);
-        dmp_set_tap_time_multi(500);
-
-        dmp_set_shake_reject_thresh(GYRO_SF, 200);
-        dmp_set_shake_reject_time(40);
-        dmp_set_shake_reject_timeout(10);
-    } else {
-        tmp[0] = 0xD8;
-        mpu_write_mem(CFG_20, 1, tmp);
-    }
-
-    if (mask & DMP_FEATURE_ANDROID_ORIENT) {
-        tmp[0] = 0xD9;
-    } else
-        tmp[0] = 0xD8;
-    mpu_write_mem(CFG_ANDROID_ORIENT_INT, 1, tmp);
-
-    if (mask & DMP_FEATURE_LP_QUAT)
-        dmp_enable_lp_quat(1);
-    else
-        dmp_enable_lp_quat(0);
-
-    if (mask & DMP_FEATURE_6X_LP_QUAT)
-        dmp_enable_6x_lp_quat(1);
-    else
-        dmp_enable_6x_lp_quat(0);
-
-    /* Pedometer is always enabled. */
-    dmp.feature_mask = mask | DMP_FEATURE_PEDOMETER;
-    mpu_reset_fifo();
-
-    dmp.packet_length = 0;
-    if (mask & DMP_FEATURE_SEND_RAW_ACCEL)
-        dmp.packet_length += 6;
-    if (mask & DMP_FEATURE_SEND_ANY_GYRO)
-        dmp.packet_length += 6;
-    if (mask & (DMP_FEATURE_LP_QUAT | DMP_FEATURE_6X_LP_QUAT))
-        dmp.packet_length += 16;
-    if (mask & (DMP_FEATURE_TAP | DMP_FEATURE_ANDROID_ORIENT))
-        dmp.packet_length += 4;
-
-    return 0;
-}
-
-/**
- *  @brief      Get list of currently enabled DMP features.
- *  @param[out] Mask of enabled features.
- *  @return     0 if successful.
- */
-int dmp_get_enabled_features(unsigned short *mask)
-{
-    mask[0] = dmp.feature_mask;
-    return 0;
-}
-
-/**
- *  @brief      Calibrate the gyro data in the DMP.
- *  After eight seconds of no motion, the DMP will compute gyro biases and
- *  subtract them from the quaternion output. If @e dmp_enable_feature is
- *  called with @e DMP_FEATURE_SEND_CAL_GYRO, the biases will also be
- *  subtracted from the gyro output.
- *  @param[in]  enable  1 to enable gyro calibration.
- *  @return     0 if successful.
- */
-int dmp_enable_gyro_cal(unsigned char enable)
-{
-    if (enable) {
-        unsigned char regs[9] = {0xb8, 0xaa, 0xb3, 0x8d, 0xb4, 0x98, 0x0d, 0x35, 0x5d};
-        return mpu_write_mem(CFG_MOTION_BIAS, 9, regs);
-    } else {
-        unsigned char regs[9] = {0xb8, 0xaa, 0xaa, 0xaa, 0xb0, 0x88, 0xc3, 0xc5, 0xc7};
-        return mpu_write_mem(CFG_MOTION_BIAS, 9, regs);
-    }
-}
-
-/**
- *  @brief      Generate 3-axis quaternions from the DMP.
- *  In this driver, the 3-axis and 6-axis DMP quaternion features are mutually
- *  exclusive.
- *  @param[in]  enable  1 to enable 3-axis quaternion.
- *  @return     0 if successful.
- */
-int dmp_enable_lp_quat(unsigned char enable)
-{
-    unsigned char regs[4];
-    if (enable) {
-        regs[0] = DINBC0;
-        regs[1] = DINBC2;
-        regs[2] = DINBC4;
-        regs[3] = DINBC6;
-    }
-    else
-        memset(regs, 0x8B, 4);
-
-    mpu_write_mem(CFG_LP_QUAT, 4, regs);
-
-    return mpu_reset_fifo();
-}
-
-/**
- *  @brief       Generate 6-axis quaternions from the DMP.
- *  In this driver, the 3-axis and 6-axis DMP quaternion features are mutually
- *  exclusive.
- *  @param[in]   enable  1 to enable 6-axis quaternion.
- *  @return      0 if successful.
- */
-int dmp_enable_6x_lp_quat(unsigned char enable)
-{
-    unsigned char regs[4];
-    if (enable) {
-        regs[0] = DINA20;
-        regs[1] = DINA28;
-        regs[2] = DINA30;
-        regs[3] = DINA38;
-    } else
-        memset(regs, 0xA3, 4);
-
-    mpu_write_mem(CFG_8, 4, regs);
-
-    return mpu_reset_fifo();
-}
-
-/**
- *  @brief      Decode the four-byte gesture data and execute any callbacks.
- *  @param[in]  gesture Gesture data from DMP packet.
- *  @return     0 if successful.
- */
-static int decode_gesture(unsigned char *gesture)
-{
-    unsigned char tap, android_orient;
-
-    android_orient = gesture[3] & 0xC0;
-    tap = 0x3F & gesture[3];
-
-    if (gesture[1] & INT_SRC_TAP) {
-        unsigned char direction, count;
-        direction = tap >> 3;
-        count = (tap % 8) + 1;
-        if (dmp.tap_cb)
-            dmp.tap_cb(direction, count);
-    }
-
-    if (gesture[1] & INT_SRC_ANDROID_ORIENT) {
-        if (dmp.android_orient_cb)
-            dmp.android_orient_cb(android_orient >> 6);
-    }
-
-    return 0;
-}
-
-/**
- *  @brief      Specify when a DMP interrupt should occur.
- *  A DMP interrupt can be configured to trigger on either of the two
- *  conditions below:
- *  \n a. One FIFO period has elapsed (set by @e mpu_set_sample_rate).
- *  \n b. A tap event has been detected.
- *  @param[in]  mode    DMP_INT_GESTURE or DMP_INT_CONTINUOUS.
- *  @return     0 if successful.
- */
-int dmp_set_interrupt_mode(unsigned char mode)
-{
-    const unsigned char regs_continuous[11] =
-        {0xd8, 0xb1, 0xb9, 0xf3, 0x8b, 0xa3, 0x91, 0xb6, 0x09, 0xb4, 0xd9};
-    const unsigned char regs_gesture[11] =
-        {0xda, 0xb1, 0xb9, 0xf3, 0x8b, 0xa3, 0x91, 0xb6, 0xda, 0xb4, 0xda};
-
-    switch (mode) {
-    case DMP_INT_CONTINUOUS:
-        return mpu_write_mem(CFG_FIFO_ON_EVENT, 11,
-            (unsigned char*)regs_continuous);
-    case DMP_INT_GESTURE:
-        return mpu_write_mem(CFG_FIFO_ON_EVENT, 11,
-            (unsigned char*)regs_gesture);
-    default:
-        return -1;
-    }
-}
-
-/**
- *  @brief      Get one packet from the FIFO.
- *  If @e sensors does not contain a particular sensor, disregard the data
- *  returned to that pointer.
- *  \n @e sensors can contain a combination of the following flags:
- *  \n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
- *  \n INV_XYZ_GYRO
- *  \n INV_XYZ_ACCEL
- *  \n INV_WXYZ_QUAT
- *  \n If the FIFO has no new data, @e sensors will be zero.
- *  \n If the FIFO is disabled, @e sensors will be zero and this function will
- *  return a non-zero error code.
- *  @param[out] gyro        Gyro data in hardware units.
- *  @param[out] accel       Accel data in hardware units.
- *  @param[out] quat        3-axis quaternion data in hardware units.
- *  @param[out] timestamp   Timestamp in milliseconds.
- *  @param[out] sensors     Mask of sensors read from FIFO.
- *  @param[out] more        Number of remaining packets.
- *  @return     0 if successful.
- */
-int dmp_read_fifo(short *gyro, short *accel, long *quat,
-    unsigned long *timestamp, short *sensors, unsigned char *more)
-{
-    unsigned char fifo_data[MAX_PACKET_LENGTH];
-    unsigned char ii = 0;
-
-    /* TODO: sensors[0] only changes when dmp_enable_feature is called. We can
-     * cache this value and save some cycles.
-     */
-    sensors[0] = 0;
-
-    /* Get a packet. */
-    if (mpu_read_fifo_stream(dmp.packet_length, fifo_data, more))
-        return -1;
-
-    /* Parse DMP packet. */
-    if (dmp.feature_mask & (DMP_FEATURE_LP_QUAT | DMP_FEATURE_6X_LP_QUAT)) {
-#ifdef FIFO_CORRUPTION_CHECK
-        long quat_q14[4], quat_mag_sq;
-#endif
-        quat[0] = ((long)fifo_data[0] << 24) | ((long)fifo_data[1] << 16) |
-            ((long)fifo_data[2] << 8) | fifo_data[3];
-        quat[1] = ((long)fifo_data[4] << 24) | ((long)fifo_data[5] << 16) |
-            ((long)fifo_data[6] << 8) | fifo_data[7];
-        quat[2] = ((long)fifo_data[8] << 24) | ((long)fifo_data[9] << 16) |
-            ((long)fifo_data[10] << 8) | fifo_data[11];
-        quat[3] = ((long)fifo_data[12] << 24) | ((long)fifo_data[13] << 16) |
-            ((long)fifo_data[14] << 8) | fifo_data[15];
-        ii += 16;
-#ifdef FIFO_CORRUPTION_CHECK
-        /* We can detect a corrupted FIFO by monitoring the quaternion data and
-         * ensuring that the magnitude is always normalized to one. This
-         * shouldn't happen in normal operation, but if an I2C error occurs,
-         * the FIFO reads might become misaligned.
-         *
-         * Let's start by scaling down the quaternion data to avoid long long
-         * math.
-         */
-        quat_q14[0] = quat[0] >> 16;
-        quat_q14[1] = quat[1] >> 16;
-        quat_q14[2] = quat[2] >> 16;
-        quat_q14[3] = quat[3] >> 16;
-        quat_mag_sq = quat_q14[0] * quat_q14[0] + quat_q14[1] * quat_q14[1] +
-            quat_q14[2] * quat_q14[2] + quat_q14[3] * quat_q14[3];
-        if ((quat_mag_sq < QUAT_MAG_SQ_MIN) ||
-            (quat_mag_sq > QUAT_MAG_SQ_MAX)) {
-            /* Quaternion is outside of the acceptable threshold. */
-            mpu_reset_fifo();
-            sensors[0] = 0;
-            return -1;
-        }
-        sensors[0] |= INV_WXYZ_QUAT;
-#endif
-    }
-
-    if (dmp.feature_mask & DMP_FEATURE_SEND_RAW_ACCEL) {
-        accel[0] = ((short)fifo_data[ii+0] << 8) | fifo_data[ii+1];
-        accel[1] = ((short)fifo_data[ii+2] << 8) | fifo_data[ii+3];
-        accel[2] = ((short)fifo_data[ii+4] << 8) | fifo_data[ii+5];
-        ii += 6;
-        sensors[0] |= INV_XYZ_ACCEL;
-    }
-
-    if (dmp.feature_mask & DMP_FEATURE_SEND_ANY_GYRO) {
-        gyro[0] = ((short)fifo_data[ii+0] << 8) | fifo_data[ii+1];
-        gyro[1] = ((short)fifo_data[ii+2] << 8) | fifo_data[ii+3];
-        gyro[2] = ((short)fifo_data[ii+4] << 8) | fifo_data[ii+5];
-        ii += 6;
-        sensors[0] |= INV_XYZ_GYRO;
-    }
-
-    /* Gesture data is at the end of the DMP packet. Parse it and call
-     * the gesture callbacks (if registered).
-     */
-    if (dmp.feature_mask & (DMP_FEATURE_TAP | DMP_FEATURE_ANDROID_ORIENT))
-        decode_gesture(fifo_data + ii);
-
-    get_ms(timestamp);
-    return 0;
-}
-
-/**
- *  @brief      Register a function to be executed on a tap event.
- *  The tap direction is represented by one of the following:
- *  \n TAP_X_UP
- *  \n TAP_X_DOWN
- *  \n TAP_Y_UP
- *  \n TAP_Y_DOWN
- *  \n TAP_Z_UP
- *  \n TAP_Z_DOWN
- *  @param[in]  func    Callback function.
- *  @return     0 if successful.
- */
-int dmp_register_tap_cb(void (*func)(unsigned char, unsigned char))
-{
-    dmp.tap_cb = func;
-    return 0;
-}
-
-/**
- *  @brief      Register a function to be executed on a android orientation event.
- *  @param[in]  func    Callback function.
- *  @return     0 if successful.
- */
-int dmp_register_android_orient_cb(void (*func)(unsigned char))
-{
-    dmp.android_orient_cb = func;
-    return 0;
-}
-
-/**
- *  @}
- */
-

+ 0 - 97
Core备份3/imu1/inv_mpu_dmp_motion_driver1.h

@@ -1,97 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011-2012 InvenSense Corporation, All Rights Reserved.
-    See included License.txt for License information.
- $
- */
-/**
- *  @addtogroup  DRIVERS Sensor Driver Layer
- *  @brief       Hardware drivers to communicate with sensors via I2C.
- *
- *  @{
- *      @file       inv_mpu_dmp_motion_driver.h
- *      @brief      DMP image and interface functions.
- *      @details    All functions are preceded by the dmp_ prefix to
- *                  differentiate among MPL and general driver function calls.
- */
-#ifndef _INV_MPU_DMP_MOTION_DRIVER_H_
-#define _INV_MPU_DMP_MOTION_DRIVER_H_
-
-#define TAP_X               (0x01)
-#define TAP_Y               (0x02)
-#define TAP_Z               (0x04)
-#define TAP_XYZ             (0x07)
-
-#define TAP_X_UP            (0x01)
-#define TAP_X_DOWN          (0x02)
-#define TAP_Y_UP            (0x03)
-#define TAP_Y_DOWN          (0x04)
-#define TAP_Z_UP            (0x05)
-#define TAP_Z_DOWN          (0x06)
-
-#define ANDROID_ORIENT_PORTRAIT             (0x00)
-#define ANDROID_ORIENT_LANDSCAPE            (0x01)
-#define ANDROID_ORIENT_REVERSE_PORTRAIT     (0x02)
-#define ANDROID_ORIENT_REVERSE_LANDSCAPE    (0x03)
-
-#define DMP_INT_GESTURE     (0x01)
-#define DMP_INT_CONTINUOUS  (0x02)
-
-#define DMP_FEATURE_TAP             (0x001)
-#define DMP_FEATURE_ANDROID_ORIENT  (0x002)
-#define DMP_FEATURE_LP_QUAT         (0x004)
-#define DMP_FEATURE_PEDOMETER       (0x008)
-#define DMP_FEATURE_6X_LP_QUAT      (0x010)
-#define DMP_FEATURE_GYRO_CAL        (0x020)
-#define DMP_FEATURE_SEND_RAW_ACCEL  (0x040)
-#define DMP_FEATURE_SEND_RAW_GYRO   (0x080)
-#define DMP_FEATURE_SEND_CAL_GYRO   (0x100)
-
-#define INV_WXYZ_QUAT       (0x100)
-
-/* Set up functions. */
-int dmp_load_motion_driver_firmware(void);
-int dmp_set_fifo_rate(unsigned short rate);
-int dmp_get_fifo_rate(unsigned short *rate);
-int dmp_enable_feature(unsigned short mask);
-int dmp_get_enabled_features(unsigned short *mask);
-int dmp_set_interrupt_mode(unsigned char mode);
-int dmp_set_orientation(unsigned short orient);
-int dmp_set_gyro_bias(long *bias);
-int dmp_set_accel_bias(long *bias);
-
-/* Tap functions. */
-int dmp_register_tap_cb(void (*func)(unsigned char, unsigned char));
-int dmp_set_tap_thresh(unsigned char axis, unsigned short thresh);
-int dmp_set_tap_axes(unsigned char axis);
-int dmp_set_tap_count(unsigned char min_taps);
-int dmp_set_tap_time(unsigned short time);
-int dmp_set_tap_time_multi(unsigned short time);
-int dmp_set_shake_reject_thresh(long sf, unsigned short thresh);
-int dmp_set_shake_reject_time(unsigned short time);
-int dmp_set_shake_reject_timeout(unsigned short time);
-
-/* Android orientation functions. */
-int dmp_register_android_orient_cb(void (*func)(unsigned char));
-
-/* LP quaternion functions. */
-int dmp_enable_lp_quat(unsigned char enable);
-int dmp_enable_6x_lp_quat(unsigned char enable);
-
-/* Pedometer functions. */
-int dmp_get_pedometer_step_count(unsigned long *count);
-int dmp_set_pedometer_step_count(unsigned long count);
-int dmp_get_pedometer_walk_time(unsigned long *time);
-int dmp_set_pedometer_walk_time(unsigned long time);
-
-/* DMP gyro calibration functions. */
-int dmp_enable_gyro_cal(unsigned char enable);
-
-/* Read function. This function should be called whenever the MPU interrupt is
- * detected.
- */
-int dmp_read_fifo(short *gyro, short *accel, long *quat,
-    unsigned long *timestamp, short *sensors, unsigned char *more);
-
-#endif  /* #ifndef _INV_MPU_DMP_MOTION_DRIVER_H_ */
-

+ 0 - 542
Core备份3/imu2/MPU60502.c

@@ -1,542 +0,0 @@
-/*
- * MPU6050.c
- *
- *  Created on: Oct 26, 2021
- *      Author: Administrator
- */
-
-#include "MPU60502.h"
-
-#include <stdio.h>
-
- u8 IIC_Write_Byte(u8 reg, u8 value)
- {
-	 return IIC_Write_Len(MPU_ADDR, reg, 1, &value);
- }
-
- u8 IIC_Read_Byte(u8 reg)
- {
-	 u8 value = 0;
-
-	 IIC_Read_Len(MPU_ADDR, reg, 1, &value);
-
-	 return value;
- }
-
- //IIC连续写
- u8 IIC_Write_Len(u8 addr,u8 reg, u8 len, u8 *buf)
- {
-	 addr = (addr << 1) | 0;
-
-	 u8 data[10] = {0};
-	 data[0] = reg;
-	 for(int i = 0; i < len; i++)
-	 {
-		 data[1 + i] = buf[i];
-	 }
-
-	 if(HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)addr, (uint8_t*)data, len + 1, 10000)!= HAL_OK)
-	 {
-		 printf("++write len byte fail\r\n");
-		 return 1;
-	 }
-
-	 return 0;
- }
-
- //IIC连续读
- u8 IIC_Read_Len(u8 addr,u8 reg,u8 len,u8 *buf)
- {
-	 u8 tmp  = (addr << 1) | 0;
-	 if(HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)tmp, (uint8_t*)&reg, 1, 10000)!= HAL_OK)
-	 {
-		 printf("++write byte fail\r\n");
-		 return 1;
-	 }
-
-	 tmp  = (addr << 1) | 1;
-	 if(HAL_I2C_Master_Receive(&hi2c1, (uint16_t)tmp, (uint8_t *)buf, len, 10000) != HAL_OK)
-	 {
-		 printf("--read byte fail\r\n");
-	 }
-
- }
-
-
-//初始化MPU6050
-//返回值: 0,成功
-//        其他,错误代码
-u8 MPU_Init(void)
-{
-    u8 res = 0;
-
-    IIC_Write_Byte(MPU_PWR_MGMT1_REG,0X80);//复位MPU6050
-
-    HAL_Delay(100);
-
-    IIC_Write_Byte(MPU_PWR_MGMT1_REG,0X00);//唤醒MPU6050
-
-    MPU_Set_Gyro_Fsr(3); //陀螺仪传感器,±2000dps
-    MPU_Set_Accel_Fsr(0); //加速度传感器 ±2g
-    MPU_Set_Rate(50); //设置采样率50HZ
-    IIC_Write_Byte(MPU_INT_EN_REG,0X00); //关闭所有中断
-    IIC_Write_Byte(MPU_USER_CTRL_REG,0X00);//I2C主模式关闭
-    IIC_Write_Byte(MPU_FIFO_EN_REG,0X00);//关闭FIFO
-    IIC_Write_Byte(MPU_INTBP_CFG_REG,0X80);//INT引脚低电平有效
-
-    res=IIC_Read_Byte(MPU_DEVICE_ID_REG);
-
-    printf("the addr is:%d\r\n", res);
-
-    if(res==MPU_ADDR)//器件ID正确
-    {
-        IIC_Write_Byte(MPU_PWR_MGMT1_REG,0X01);//设置CLKSEL,PLL X 轴为参考
-        IIC_Write_Byte(MPU_PWR_MGMT2_REG,0X00);//加速度陀螺仪都工作
-        MPU_Set_Rate(50); //设置采样率为50HZ
-    }
-    else
-    {
-    	return 1;
-    }
-
-    return 0;
-}
-
-//设置MPU6050陀螺仪传感器满量程范围
-//fsr:0,±250dps;1,±500dps;2,±1000dps;3,±2000dps
-//返回值:0,设置成功
-//    其他,设置失败
-u8 MPU_Set_Gyro_Fsr(u8 fsr)
-{
-    return IIC_Write_Byte(MPU_GYRO_CFG_REG, fsr<<3);//设置陀螺仪满量程范围
-}
-
-//设置MPU6050加速度传感器满量程范围
-//fsr:0,±2g;1,±4g;2,±8g;3,±16g
-//返回值:0,设置成功
-//    其他,设置失败
-u8 MPU_Set_Accel_Fsr(u8 fsr)
-{
-    return IIC_Write_Byte(MPU_ACCEL_CFG_REG, fsr<<3);//设置加速度传感器满量程范围
-}
-
-//设置MPU6050的数字低通滤波器
-//lpf:数字低通滤波频率(Hz)
-//返回值:0,设置成功
-//    其他,设置失败
-u8 MPU_Set_LPF(u16 lpf)
-{
-    u8 data=0;
-    if(lpf>=188) data=1;
-    else if(lpf>=98) data=2;
-    else if(lpf>=42) data=2;
-    else if(lpf>=42) data=3;
-    else if(lpf>=20) data=4;
-    else if(lpf>=10) data=5;
-    else data=6;
-    return IIC_Write_Byte(MPU_CFG_REG,data);//设置数字低通滤波器
-}
-
-//设置MPU6050的采样率(假定Fs=1KHz)
-//rate:4~1000(Hz)
-//返回值:0,设置成功
-//    其他,设置失败
-u8 MPU_Set_Rate(u16 rate)
-{
-    u8 data;
-    if(rate>1000)rate=1000;
-    if(rate<4)rate=4;
-    data=1000/rate-1;
-    data=IIC_Write_Byte(MPU_SAMPLE_RATE_REG, data);  //设置数字低通滤波器
-    return MPU_Set_LPF(rate/2); //自动设置LPF为采样率的一半
-}
-
-//得到温度值
-//返回值:温度值(扩大了100倍)
-short MPU_Get_Temperature(void)
-{
-    u8 buf[2];
-    short raw;
-    float temp;
-    IIC_Read_Len(MPU_ADDR, MPU_TEMP_OUTH_REG, 2, buf);
-    raw=((u16)buf[0]<<8)|buf[1];
-    temp=36.53+((double)raw)/340;
-
-    return temp*100;;
-}
-
-//得到陀螺仪值(原始值)
-//gx,gy,gz:陀螺仪x,y,z轴的原始读数(带符号)
-//返回值:0,成功
-// 其他,错误代码
-u8 MPU_Get_Gyroscope(short *gx,short *gy,short *gz)
-{
-    u8 buf[6],res;
-    res=IIC_Read_Len(MPU_ADDR,MPU_GYRO_XOUTH_REG,6,buf);
-    if(res==0)
-    {
-        *gx=((u16)buf[0]<<8)|buf[1];
-        *gy=((u16)buf[2]<<8)|buf[3];
-        *gz=((u16)buf[4]<<8)|buf[5];
-    }
-    return res;
-}
-
-//得到加速度值(原始值)
-//ax,ay,az:陀螺仪x,y,z轴的原始读数(带符号)
-//返回值:0,成功
-//    其他,错误代码
-u8 MPU_Get_Accelerometer(short *ax,short *ay,short *az)
-{
-    u8 buf[6],res;
-    res=IIC_Read_Len(MPU_ADDR,MPU_ACCEL_XOUTH_REG,6,buf);
-    if(res==0)
-    {
-        *ax=((u16)buf[0]<<8)|buf[1];
-        *ay=((u16)buf[2]<<8)|buf[3];
-        *az=((u16)buf[4]<<8)|buf[5];
-    }
-    return res;;
-}
-
-/*--------------------以下为使用板载固件DMP的相关代码,这个融合得到的姿态角效果很好*/
-
-
-/**
-  * @brief  获取当前毫秒值
-  * @param  存储最新毫秒值的变量
-  * @retval 无
-  */
-int get_tick_count(unsigned long *count)
-{
-   count[0] = HAL_GetTick();
-	return 0;
-}
-
-
-#include "inv_mpu2.h"
-#include "inv_mpu_dmp_motion_driver2.h"
-
-/* Data requested by client. */
-#define PRINT_ACCEL     (0x01)
-#define PRINT_GYRO      (0x02)
-#define PRINT_QUAT      (0x04)
-
-#define ACCEL_ON        (0x01)
-#define GYRO_ON         (0x02)
-
-#define MOTION          (0)
-#define NO_MOTION       (1)
-
-/* Starting sampling rate. */ //100
-#define DEFAULT_MPU_HZ  (50)
-
-struct rx_s {
-    unsigned char header[3];
-    unsigned char cmd;
-};
-struct hal_s {
-    unsigned char sensors;
-    unsigned char dmp_on;
-    unsigned char wait_for_tap;
-    volatile unsigned char new_gyro;
-    unsigned short report;
-    unsigned short dmp_features;
-    unsigned char motion_int_mode;
-    struct rx_s rx;
-};
-static struct hal_s hal = {0};
-
-/* USB RX binary semaphore. Actually, it's just a flag. Not included in struct
- * because it's declared extern elsewhere.
- */
-volatile unsigned char rx_new;
-
-/* The sensors can be mounted onto the board in any orientation. The mounting
- * matrix seen below tells the MPL how to rotate the raw data from thei
- * driver(s).
- * TODO: The following matrices refer to the configuration on an internal test
- * board at Invensense. If needed, please modify the matrices to match the
- * chip-to-body matrix for your particular set up.
- */
-static signed char gyro_orientation[9] = {-1, 0, 0,
-                                           0,-1, 0,
-                                           0, 0, 1};
-
-/* Every time new gyro data is available, this function is called in an
- * ISR context. In this example, it sets a flag protecting the FIFO read
- * function.
- */
-static void gyro_data_ready_cb(void)
-{
-    hal.new_gyro = 1;
-}
-
-enum packet_type_e {
-    PACKET_TYPE_ACCEL,
-    PACKET_TYPE_GYRO,
-    PACKET_TYPE_QUAT,
-    PACKET_TYPE_TAP,
-    PACKET_TYPE_ANDROID_ORIENT,
-    PACKET_TYPE_PEDO,
-    PACKET_TYPE_MISC
-};
-
-#define BYTE u_char
-/* Send data to the Python client application.
- * Data is formatted as follows:
- * packet[0]    = $
- * packet[1]    = packet type (see packet_type_e)
- * packet[2+]   = data
- */
-void send_packet(char packet_type, void *data)
-{
-
-	#define MAX_BUF_LENGTH  (18)
-    char buf[MAX_BUF_LENGTH], length;
-
-    memset(buf, 0, MAX_BUF_LENGTH);
-    buf[0] = '$';
-    buf[1] = packet_type;
-
-    if (packet_type == PACKET_TYPE_ACCEL || packet_type == PACKET_TYPE_GYRO) {
-        short *sdata = (short*)data;
-        buf[2] = (char)(sdata[0] >> 8);
-        buf[3] = (char)sdata[0];
-        buf[4] = (char)(sdata[1] >> 8);
-        buf[5] = (char)sdata[1];
-        buf[6] = (char)(sdata[2] >> 8);
-        buf[7] = (char)sdata[2];
-        length = 8;
-    } else if (packet_type == PACKET_TYPE_QUAT) {
-        long *ldata = (long*)data;
-        buf[2] = (char)(ldata[0] >> 24);
-        buf[3] = (char)(ldata[0] >> 16);
-        buf[4] = (char)(ldata[0] >> 8);
-        buf[5] = (char)ldata[0];
-        buf[6] = (char)(ldata[1] >> 24);
-        buf[7] = (char)(ldata[1] >> 16);
-        buf[8] = (char)(ldata[1] >> 8);
-        buf[9] = (char)ldata[1];
-        buf[10] = (char)(ldata[2] >> 24);
-        buf[11] = (char)(ldata[2] >> 16);
-        buf[12] = (char)(ldata[2] >> 8);
-        buf[13] = (char)ldata[2];
-        buf[14] = (char)(ldata[3] >> 24);
-        buf[15] = (char)(ldata[3] >> 16);
-        buf[16] = (char)(ldata[3] >> 8);
-        buf[17] = (char)ldata[3];
-        length = 18;
-    } else if (packet_type == PACKET_TYPE_TAP) {
-        buf[2] = ((char*)data)[0];
-        buf[3] = ((char*)data)[1];
-        length = 4;
-    } else if (packet_type == PACKET_TYPE_ANDROID_ORIENT) {
-        buf[2] = ((char*)data)[0];
-        length = 3;
-    } else if (packet_type == PACKET_TYPE_PEDO) {
-        long *ldata = (long*)data;
-        buf[2] = (char)(ldata[0] >> 24);
-        buf[3] = (char)(ldata[0] >> 16);
-        buf[4] = (char)(ldata[0] >> 8);
-        buf[5] = (char)ldata[0];
-        buf[6] = (char)(ldata[1] >> 24);
-        buf[7] = (char)(ldata[1] >> 16);
-        buf[8] = (char)(ldata[1] >> 8);
-        buf[9] = (char)ldata[1];
-        length = 10;
-    } else if (packet_type == PACKET_TYPE_MISC) {
-        buf[2] = ((char*)data)[0];
-        buf[3] = ((char*)data)[1];
-        buf[4] = ((char*)data)[2];
-        buf[5] = ((char*)data)[3];
-        length = 6;
-    }
-
-//    cdcSendDataWaitTilDone((BYTE*)buf, length, CDC0_INTFNUM, 100);
-}
-
-/* These next two functions converts the orientation matrix (see
- * gyro_orientation) to a scalar representation for use by the DMP.
- * NOTE: These functions are borrowed from Invensense's MPL.
- */
-static inline unsigned short inv_row_2_scale(const signed char *row)
-{
-    unsigned short b;
-
-    if (row[0] > 0)
-        b = 0;
-    else if (row[0] < 0)
-        b = 4;
-    else if (row[1] > 0)
-        b = 1;
-    else if (row[1] < 0)
-        b = 5;
-    else if (row[2] > 0)
-        b = 2;
-    else if (row[2] < 0)
-        b = 6;
-    else
-        b = 7;      // error
-    return b;
-}
-static inline unsigned short inv_orientation_matrix_to_scalar(
-    const signed char *mtx)
-{
-    unsigned short scalar;
-
-    /*
-       XYZ  010_001_000 Identity Matrix
-       XZY  001_010_000
-       YXZ  010_000_001
-       YZX  000_010_001
-       ZXY  001_000_010
-       ZYX  000_001_010
-     */
-
-    scalar = inv_row_2_scale(mtx);
-    scalar |= inv_row_2_scale(mtx + 3) << 3;
-    scalar |= inv_row_2_scale(mtx + 6) << 6;
-
-
-    return scalar;
-}
-
-static inline void run_self_test(void)
-{
-    int result;
-    char test_packet[4] = {0};
-    long gyro[3], accel[3];
-
-    result = mpu_run_self_test(gyro, accel);
-    if (result == 0x7) {
-        /* Test passed. We can trust the gyro data here, so let's push it down
-         * to the DMP.
-         */
-        float sens;
-        unsigned short accel_sens;
-        mpu_get_gyro_sens(&sens);
-        gyro[0] = (long)(gyro[0] * sens);
-        gyro[1] = (long)(gyro[1] * sens);
-        gyro[2] = (long)(gyro[2] * sens);
-        dmp_set_gyro_bias(gyro);
-        mpu_get_accel_sens(&accel_sens);
-        accel[0] *= accel_sens;
-        accel[1] *= accel_sens;
-        accel[2] *= accel_sens;
-        dmp_set_accel_bias(accel);
-    }
-
-    /* Report results. */
-    test_packet[0] = 't';
-    test_packet[1] = result;
-    send_packet(PACKET_TYPE_MISC, test_packet);
-}
-
-
-#define INT_EXIT_LPM0 12
-
-void DMP_Init(void)
-{
-    struct int_param_s int_param;
-
-	/* Set up gyro.
-	 * Every function preceded by mpu_ is a driver function and can be found
-	 * in inv_mpu.h.
-	 */
-	int_param.cb = gyro_data_ready_cb;
-	int_param.pin = 16;
-	int_param.lp_exit = INT_EXIT_LPM0;
-	int_param.active_low = 1;
-
-	int result = mpu_init(&int_param);
-
-	printf("mpu_init, %d\r\n", result);
-
-	if(result == 0)     //mpu初始化
-	{
-		if(!mpu_set_sensors(INV_XYZ_GYRO | INV_XYZ_ACCEL))    //设置需要的传感器
-			printf("mpu_set_sensor complete ......\r\n");
-
-		if(!mpu_configure_fifo(INV_XYZ_GYRO | INV_XYZ_ACCEL)) //设置fifo
-			printf("mpu_configure_fifo complete ......\r\n");
-
-		if(!mpu_set_sample_rate(DEFAULT_MPU_HZ))              //设置采集样率
-			printf("mpu_set_sample_rate complete ......\r\n");
-
-
-		unsigned short gyro_rate = 0, gyro_fsr = 0;
-		unsigned char accel_fsr = 0;
-
-	    mpu_get_sample_rate(&gyro_rate);
-	    mpu_get_gyro_fsr(&gyro_fsr);
-	    mpu_get_accel_fsr(&accel_fsr);
-
-	    printf("gyro_rate %d, gyro_fsr %d, accel_fsr %d\r\n", gyro_rate, gyro_fsr, accel_fsr);
-
-
-
-		if(!dmp_load_motion_driver_firmware())                //加载dmp固件
-			printf("dmp_load_motion_driver_firmware complete ......\r\n");
-
-		if(!dmp_set_orientation(inv_orientation_matrix_to_scalar(gyro_orientation)))
-			printf("dmp_set_orientation complete ......\r\n"); //设置陀螺仪方向
-
-		if(!dmp_enable_feature(DMP_FEATURE_6X_LP_QUAT | DMP_FEATURE_TAP |
-				DMP_FEATURE_ANDROID_ORIENT | DMP_FEATURE_SEND_RAW_ACCEL | DMP_FEATURE_SEND_CAL_GYRO |
-				DMP_FEATURE_GYRO_CAL))
-			printf("dmp_enable_feature complete ......\r\n");
-
-		if(!dmp_set_fifo_rate(DEFAULT_MPU_HZ))    //设置速率
-			printf("dmp_set_fifo_rate complete ......\r\n");
-
-		run_self_test();                          //自检(非必要)
-
-		if(!mpu_set_dmp_state(1))                 //使能
-			printf("mpu_set_dmp_state complete ......\r\n");
-	}
-
-}
-
-#define q30 1073741824.0
-
-uint8_t Read_DMP(float* Pitch,float* Roll,float* Yaw)
-{
-	short gyro[3], accel[3], sensors;
-	float q0=1.0f,q1=0.0f,q2=0.0f,q3=0.0f;
-	unsigned long sensor_timestamp;
-	unsigned char more;
-	long quat[4];
-
-	int ret = dmp_read_fifo(gyro, accel, quat, &sensor_timestamp, &sensors, &more);
-
-//	printf("dmp_read_fifo, %d\r\n", ret);
-
-	if(ret)
-	{
-		return 1;
-	}
-
-	if (sensors & INV_WXYZ_QUAT)
-	{
-		q0=quat[0] / q30;
-		q1=quat[1] / q30;
-		q2=quat[2] / q30;
-		q3=quat[3] / q30;
-		*Pitch = (float)asin(-2 * q1 * q3 + 2 * q0* q2)* 57.3;
-		*Roll =  (float)atan2(2 * q2 * q3 + 2 * q0 * q1, -2 * q1 * q1 - 2 * q2* q2 + 1)* 57.3; // roll
-		*Yaw =   (float)atan2(2*(q1*q2 + q0*q3),q0*q0+q1*q1-q2*q2-q3*q3) * 57.3;
-		return 0;
-	}
-	else
-	{
-		return 2;
-	}
-
-}
-
-
-
-
-
-

+ 0 - 117
Core备份3/imu2/MPU60502.h

@@ -1,117 +0,0 @@
-/*
- * MPU6050.h
- *
- *  Created on: Oct 26, 2021
- *      Author: Administrator
- */
-
-#ifndef INC_MPU6050_H_
-#define INC_MPU6050_H_
-
-#include "i2c.h"
-#include "inv_mpu2.h"
-
-//#define MPU_ACCEL_OFFS_REG		0X06	//accel_offs寄存器,可读取版本号,寄存器手册未提到
-//#define MPU_PROD_ID_REG			0X0C	//prod id寄存器,在寄存器手册未提到
-#define MPU_SELF_TESTX_REG		0X0D	//自检寄存器X
-#define MPU_SELF_TESTY_REG		0X0E	//自检寄存器Y
-#define MPU_SELF_TESTZ_REG		0X0F	//自检寄存器Z
-#define MPU_SELF_TESTA_REG		0X10	//自检寄存器A
-#define MPU_SAMPLE_RATE_REG		0X19	//采样频率分频器
-#define MPU_CFG_REG				0X1A	//配置寄存器
-#define MPU_GYRO_CFG_REG		0X1B	//陀螺仪配置寄存器
-#define MPU_ACCEL_CFG_REG		0X1C	//加速度计配置寄存器
-#define MPU_MOTION_DET_REG		0X1F	//运动检测阀值设置寄存器
-#define MPU_FIFO_EN_REG			0X23	//FIFO使能寄存器
-#define MPU_I2CMST_CTRL_REG		0X24	//IIC主机控制寄存器
-#define MPU_I2CSLV0_ADDR_REG	0X25	//IIC从机0器件地址寄存器
-#define MPU_I2CSLV0_REG			0X26	//IIC从机0数据地址寄存器
-#define MPU_I2CSLV0_CTRL_REG	0X27	//IIC从机0控制寄存器
-#define MPU_I2CSLV1_ADDR_REG	0X28	//IIC从机1器件地址寄存器
-#define MPU_I2CSLV1_REG			0X29	//IIC从机1数据地址寄存器
-#define MPU_I2CSLV1_CTRL_REG	0X2A	//IIC从机1控制寄存器
-#define MPU_I2CSLV2_ADDR_REG	0X2B	//IIC从机2器件地址寄存器
-#define MPU_I2CSLV2_REG			0X2C	//IIC从机2数据地址寄存器
-#define MPU_I2CSLV2_CTRL_REG	0X2D	//IIC从机2控制寄存器
-#define MPU_I2CSLV3_ADDR_REG	0X2E	//IIC从机3器件地址寄存器
-#define MPU_I2CSLV3_REG			0X2F	//IIC从机3数据地址寄存器
-#define MPU_I2CSLV3_CTRL_REG	0X30	//IIC从机3控制寄存器
-#define MPU_I2CSLV4_ADDR_REG	0X31	//IIC从机4器件地址寄存器
-#define MPU_I2CSLV4_REG			0X32	//IIC从机4数据地址寄存器
-#define MPU_I2CSLV4_DO_REG		0X33	//IIC从机4写数据寄存器
-#define MPU_I2CSLV4_CTRL_REG	0X34	//IIC从机4控制寄存器
-#define MPU_I2CSLV4_DI_REG		0X35	//IIC从机4读数据寄存器
-
-#define MPU_I2CMST_STA_REG		0X36	//IIC主机状态寄存器
-#define MPU_INTBP_CFG_REG		0X37	//中断/旁路设置寄存器
-#define MPU_INT_EN_REG			0X38	//中断使能寄存器
-#define MPU_INT_STA_REG			0X3A	//中断状态寄存器
-
-#define MPU_ACCEL_XOUTH_REG		0X3B	//加速度值,X轴高8位寄存器
-#define MPU_ACCEL_XOUTL_REG		0X3C	//加速度值,X轴低8位寄存器
-#define MPU_ACCEL_YOUTH_REG		0X3D	//加速度值,Y轴高8位寄存器
-#define MPU_ACCEL_YOUTL_REG		0X3E	//加速度值,Y轴低8位寄存器
-#define MPU_ACCEL_ZOUTH_REG		0X3F	//加速度值,Z轴高8位寄存器
-#define MPU_ACCEL_ZOUTL_REG		0X40	//加速度值,Z轴低8位寄存器
-
-#define MPU_TEMP_OUTH_REG		0X41	//温度值高八位寄存器
-#define MPU_TEMP_OUTL_REG		0X42	//温度值低8位寄存器
-
-#define MPU_GYRO_XOUTH_REG		0X43	//陀螺仪值,X轴高8位寄存器
-#define MPU_GYRO_XOUTL_REG		0X44	//陀螺仪值,X轴低8位寄存器
-#define MPU_GYRO_YOUTH_REG		0X45	//陀螺仪值,Y轴高8位寄存器
-#define MPU_GYRO_YOUTL_REG		0X46	//陀螺仪值,Y轴低8位寄存器
-#define MPU_GYRO_ZOUTH_REG		0X47	//陀螺仪值,Z轴高8位寄存器
-#define MPU_GYRO_ZOUTL_REG		0X48	//陀螺仪值,Z轴低8位寄存器
-
-#define MPU_I2CSLV0_DO_REG		0X63	//IIC从机0数据寄存器
-#define MPU_I2CSLV1_DO_REG		0X64	//IIC从机1数据寄存器
-#define MPU_I2CSLV2_DO_REG		0X65	//IIC从机2数据寄存器
-#define MPU_I2CSLV3_DO_REG		0X66	//IIC从机3数据寄存器
-
-#define MPU_I2CMST_DELAY_REG	0X67	//IIC主机延时管理寄存器
-#define MPU_SIGPATH_RST_REG		0X68	//信号通道复位寄存器
-#define MPU_MDETECT_CTRL_REG	0X69	//运动检测控制寄存器
-#define MPU_USER_CTRL_REG		0X6A	//用户控制寄存器
-#define MPU_PWR_MGMT1_REG		0X6B	//电源管理寄存器1
-#define MPU_PWR_MGMT2_REG		0X6C	//电源管理寄存器2
-#define MPU_FIFO_CNTH_REG		0X72	//FIFO计数寄存器高八位
-#define MPU_FIFO_CNTL_REG		0X73	//FIFO计数寄存器低八位
-#define MPU_FIFO_RW_REG			0X74	//FIFO读写寄存器
-#define MPU_DEVICE_ID_REG		0X75	//器件ID寄存器
-
-//如果AD0脚接地,IIC地址为0X68(不包含最低位).
-//如果接V3.3,则IIC地址为0X69(不包含最低位).
-#define MPU_ADDR				0X68
-
-
-//因为模块AD0默认接GND,所以转为读写地址后,为0XD1和0XD0(如果接VCC,则为0XD3和0XD2)
-#define MPU_READ    0XD1
-#define MPU_WRITE   0XD0
-
-#define u8 uint8_t
-#define u16 uint16_t
-
-u8 MPU_Init(void); 								//初始化MPU6050
-u8 IIC_Write_Len(u8 addr,u8 reg,u8 len,u8 *buf);//IIC连续写
-u8 IIC_Read_Len(u8 addr,u8 reg,u8 len,u8 *buf); //IIC连续读
-u8 IIC_Write_Byte(u8 reg,u8 data);				//IIC写一个字节
-u8 IIC_Read_Byte(u8 reg);						//IIC读一个字节
-
-u8 MPU_Set_Gyro_Fsr(u8 fsr);
-u8 MPU_Set_Accel_Fsr(u8 fsr);
-u8 MPU_Set_LPF(u16 lpf);
-u8 MPU_Set_Rate(u16 rate);
-u8 MPU_Set_Fifo(u8 sens);
-
-
-short MPU_Get_Temperature(void);
-u8 MPU_Get_Gyroscope(short *gx,short *gy,short *gz);
-u8 MPU_Get_Accelerometer(short *ax,short *ay,short *az);
-
-//----------------------DMP-------------------------------
-void DMP_Init(void);
-uint8_t Read_DMP(float* Pitch,float* Roll,float* Yaw);
-int get_tick_count(unsigned long *count);
-
-#endif /* INC_MPU6050_H_ */

+ 0 - 494
Core备份3/imu2/dmpKey2.h

@@ -1,494 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011 InvenSense Corporation, All Rights Reserved.
- $
- */
-#ifndef DMPKEY_H__
-#define DMPKEY_H__
-
-#define KEY_CFG_25                  (0)
-#define KEY_CFG_24                  (KEY_CFG_25 + 1)
-#define KEY_CFG_26                  (KEY_CFG_24 + 1)
-#define KEY_CFG_27                  (KEY_CFG_26 + 1)
-#define KEY_CFG_21                  (KEY_CFG_27 + 1)
-#define KEY_CFG_20                  (KEY_CFG_21 + 1)
-#define KEY_CFG_TAP4                (KEY_CFG_20 + 1)
-#define KEY_CFG_TAP5                (KEY_CFG_TAP4 + 1)
-#define KEY_CFG_TAP6                (KEY_CFG_TAP5 + 1)
-#define KEY_CFG_TAP7                (KEY_CFG_TAP6 + 1)
-#define KEY_CFG_TAP0                (KEY_CFG_TAP7 + 1)
-#define KEY_CFG_TAP1                (KEY_CFG_TAP0 + 1)
-#define KEY_CFG_TAP2                (KEY_CFG_TAP1 + 1)
-#define KEY_CFG_TAP3                (KEY_CFG_TAP2 + 1)
-#define KEY_CFG_TAP_QUANTIZE        (KEY_CFG_TAP3 + 1)
-#define KEY_CFG_TAP_JERK            (KEY_CFG_TAP_QUANTIZE + 1)
-#define KEY_CFG_DR_INT              (KEY_CFG_TAP_JERK + 1)
-#define KEY_CFG_AUTH                (KEY_CFG_DR_INT + 1)
-#define KEY_CFG_TAP_SAVE_ACCB       (KEY_CFG_AUTH + 1)
-#define KEY_CFG_TAP_CLEAR_STICKY    (KEY_CFG_TAP_SAVE_ACCB + 1)
-#define KEY_CFG_FIFO_ON_EVENT       (KEY_CFG_TAP_CLEAR_STICKY + 1)
-#define KEY_FCFG_ACCEL_INPUT        (KEY_CFG_FIFO_ON_EVENT + 1)
-#define KEY_FCFG_ACCEL_INIT         (KEY_FCFG_ACCEL_INPUT + 1)
-#define KEY_CFG_23                  (KEY_FCFG_ACCEL_INIT + 1)
-#define KEY_FCFG_1                  (KEY_CFG_23 + 1)
-#define KEY_FCFG_3                  (KEY_FCFG_1 + 1)
-#define KEY_FCFG_2                  (KEY_FCFG_3 + 1)
-#define KEY_CFG_3D                  (KEY_FCFG_2 + 1)
-#define KEY_CFG_3B                  (KEY_CFG_3D + 1)
-#define KEY_CFG_3C                  (KEY_CFG_3B + 1)
-#define KEY_FCFG_5                  (KEY_CFG_3C + 1)
-#define KEY_FCFG_4                  (KEY_FCFG_5 + 1)
-#define KEY_FCFG_7                  (KEY_FCFG_4 + 1)
-#define KEY_FCFG_FSCALE             (KEY_FCFG_7 + 1)
-#define KEY_FCFG_AZ                 (KEY_FCFG_FSCALE + 1)
-#define KEY_FCFG_6                  (KEY_FCFG_AZ + 1)
-#define KEY_FCFG_LSB4               (KEY_FCFG_6 + 1)
-#define KEY_CFG_12                  (KEY_FCFG_LSB4 + 1)
-#define KEY_CFG_14                  (KEY_CFG_12 + 1)
-#define KEY_CFG_15                  (KEY_CFG_14 + 1)
-#define KEY_CFG_16                  (KEY_CFG_15 + 1)
-#define KEY_CFG_18                  (KEY_CFG_16 + 1)
-#define KEY_CFG_6                   (KEY_CFG_18 + 1)
-#define KEY_CFG_7                   (KEY_CFG_6 + 1)
-#define KEY_CFG_4                   (KEY_CFG_7 + 1)
-#define KEY_CFG_5                   (KEY_CFG_4 + 1)
-#define KEY_CFG_2                   (KEY_CFG_5 + 1)
-#define KEY_CFG_3                   (KEY_CFG_2 + 1)
-#define KEY_CFG_1                   (KEY_CFG_3 + 1)
-#define KEY_CFG_EXTERNAL            (KEY_CFG_1 + 1)
-#define KEY_CFG_8                   (KEY_CFG_EXTERNAL + 1)
-#define KEY_CFG_9                   (KEY_CFG_8 + 1)
-#define KEY_CFG_ORIENT_3            (KEY_CFG_9 + 1)
-#define KEY_CFG_ORIENT_2            (KEY_CFG_ORIENT_3 + 1)
-#define KEY_CFG_ORIENT_1            (KEY_CFG_ORIENT_2 + 1)
-#define KEY_CFG_GYRO_SOURCE         (KEY_CFG_ORIENT_1 + 1)
-#define KEY_CFG_ORIENT_IRQ_1        (KEY_CFG_GYRO_SOURCE + 1)
-#define KEY_CFG_ORIENT_IRQ_2        (KEY_CFG_ORIENT_IRQ_1 + 1)
-#define KEY_CFG_ORIENT_IRQ_3        (KEY_CFG_ORIENT_IRQ_2 + 1)
-#define KEY_FCFG_MAG_VAL            (KEY_CFG_ORIENT_IRQ_3 + 1)
-#define KEY_FCFG_MAG_MOV            (KEY_FCFG_MAG_VAL + 1)
-#define KEY_CFG_LP_QUAT             (KEY_FCFG_MAG_MOV + 1)
-
-/* MPU6050 keys */
-#define KEY_CFG_ACCEL_FILTER        (KEY_CFG_LP_QUAT + 1)
-#define KEY_CFG_MOTION_BIAS         (KEY_CFG_ACCEL_FILTER + 1)
-#define KEY_TEMPLABEL               (KEY_CFG_MOTION_BIAS + 1)
-
-#define KEY_D_0_22                  (KEY_TEMPLABEL + 1)
-#define KEY_D_0_24                  (KEY_D_0_22 + 1)
-#define KEY_D_0_36                  (KEY_D_0_24 + 1)
-#define KEY_D_0_52                  (KEY_D_0_36 + 1)
-#define KEY_D_0_96                  (KEY_D_0_52 + 1)
-#define KEY_D_0_104                 (KEY_D_0_96 + 1)
-#define KEY_D_0_108                 (KEY_D_0_104 + 1)
-#define KEY_D_0_163                 (KEY_D_0_108 + 1)
-#define KEY_D_0_188                 (KEY_D_0_163 + 1)
-#define KEY_D_0_192                 (KEY_D_0_188 + 1)
-#define KEY_D_0_224                 (KEY_D_0_192 + 1)
-#define KEY_D_0_228                 (KEY_D_0_224 + 1)
-#define KEY_D_0_232                 (KEY_D_0_228 + 1)
-#define KEY_D_0_236                 (KEY_D_0_232 + 1)
-
-#define KEY_DMP_PREVPTAT            (KEY_D_0_236 + 1)
-#define KEY_D_1_2                   (KEY_DMP_PREVPTAT + 1)
-#define KEY_D_1_4                   (KEY_D_1_2 + 1)
-#define KEY_D_1_8                   (KEY_D_1_4 + 1)
-#define KEY_D_1_10                  (KEY_D_1_8 + 1)
-#define KEY_D_1_24                  (KEY_D_1_10 + 1)
-#define KEY_D_1_28                  (KEY_D_1_24 + 1)
-#define KEY_D_1_36                  (KEY_D_1_28 + 1)
-#define KEY_D_1_40                  (KEY_D_1_36 + 1)
-#define KEY_D_1_44                  (KEY_D_1_40 + 1)
-#define KEY_D_1_72                  (KEY_D_1_44 + 1)
-#define KEY_D_1_74                  (KEY_D_1_72 + 1)
-#define KEY_D_1_79                  (KEY_D_1_74 + 1)
-#define KEY_D_1_88                  (KEY_D_1_79 + 1)
-#define KEY_D_1_90                  (KEY_D_1_88 + 1)
-#define KEY_D_1_92                  (KEY_D_1_90 + 1)
-#define KEY_D_1_96                  (KEY_D_1_92 + 1)
-#define KEY_D_1_98                  (KEY_D_1_96 + 1)
-#define KEY_D_1_100                 (KEY_D_1_98 + 1)
-#define KEY_D_1_106                 (KEY_D_1_100 + 1)
-#define KEY_D_1_108                 (KEY_D_1_106 + 1)
-#define KEY_D_1_112                 (KEY_D_1_108 + 1)
-#define KEY_D_1_128                 (KEY_D_1_112 + 1)
-#define KEY_D_1_152                 (KEY_D_1_128 + 1)
-#define KEY_D_1_160                 (KEY_D_1_152 + 1)
-#define KEY_D_1_168                 (KEY_D_1_160 + 1)
-#define KEY_D_1_175                 (KEY_D_1_168 + 1)
-#define KEY_D_1_176                 (KEY_D_1_175 + 1)
-#define KEY_D_1_178                 (KEY_D_1_176 + 1)
-#define KEY_D_1_179                 (KEY_D_1_178 + 1)
-#define KEY_D_1_218                 (KEY_D_1_179 + 1)
-#define KEY_D_1_232                 (KEY_D_1_218 + 1)
-#define KEY_D_1_236                 (KEY_D_1_232 + 1)
-#define KEY_D_1_240                 (KEY_D_1_236 + 1)
-#define KEY_D_1_244                 (KEY_D_1_240 + 1)
-#define KEY_D_1_250                 (KEY_D_1_244 + 1)
-#define KEY_D_1_252                 (KEY_D_1_250 + 1)
-#define KEY_D_2_12                  (KEY_D_1_252 + 1)
-#define KEY_D_2_96                  (KEY_D_2_12 + 1)
-#define KEY_D_2_108                 (KEY_D_2_96 + 1)
-#define KEY_D_2_208                 (KEY_D_2_108 + 1)
-#define KEY_FLICK_MSG               (KEY_D_2_208 + 1)
-#define KEY_FLICK_COUNTER           (KEY_FLICK_MSG + 1)
-#define KEY_FLICK_LOWER             (KEY_FLICK_COUNTER + 1)
-#define KEY_CFG_FLICK_IN            (KEY_FLICK_LOWER + 1)
-#define KEY_FLICK_UPPER             (KEY_CFG_FLICK_IN + 1)
-#define KEY_CGNOTICE_INTR           (KEY_FLICK_UPPER + 1)
-#define KEY_D_2_224                 (KEY_CGNOTICE_INTR + 1)
-#define KEY_D_2_244                 (KEY_D_2_224 + 1)
-#define KEY_D_2_248                 (KEY_D_2_244 + 1)
-#define KEY_D_2_252                 (KEY_D_2_248 + 1)
-
-#define KEY_D_GYRO_BIAS_X               (KEY_D_2_252 + 1)
-#define KEY_D_GYRO_BIAS_Y               (KEY_D_GYRO_BIAS_X + 1)
-#define KEY_D_GYRO_BIAS_Z               (KEY_D_GYRO_BIAS_Y + 1)
-#define KEY_D_ACC_BIAS_X                (KEY_D_GYRO_BIAS_Z + 1)
-#define KEY_D_ACC_BIAS_Y                (KEY_D_ACC_BIAS_X + 1)
-#define KEY_D_ACC_BIAS_Z                (KEY_D_ACC_BIAS_Y + 1)
-#define KEY_D_GYRO_ENABLE               (KEY_D_ACC_BIAS_Z + 1)
-#define KEY_D_ACCEL_ENABLE              (KEY_D_GYRO_ENABLE + 1)
-#define KEY_D_QUAT_ENABLE               (KEY_D_ACCEL_ENABLE +1)
-#define KEY_D_OUTPUT_ENABLE             (KEY_D_QUAT_ENABLE + 1)
-#define KEY_D_CR_TIME_G                 (KEY_D_OUTPUT_ENABLE + 1)
-#define KEY_D_CR_TIME_A                 (KEY_D_CR_TIME_G + 1)
-#define KEY_D_CR_TIME_Q                 (KEY_D_CR_TIME_A + 1)
-#define KEY_D_CS_TAX                    (KEY_D_CR_TIME_Q + 1)
-#define KEY_D_CS_TAY                    (KEY_D_CS_TAX + 1)
-#define KEY_D_CS_TAZ                    (KEY_D_CS_TAY + 1)
-#define KEY_D_CS_TGX                    (KEY_D_CS_TAZ + 1)
-#define KEY_D_CS_TGY                    (KEY_D_CS_TGX + 1)
-#define KEY_D_CS_TGZ                    (KEY_D_CS_TGY + 1)
-#define KEY_D_CS_TQ0                    (KEY_D_CS_TGZ + 1)
-#define KEY_D_CS_TQ1                    (KEY_D_CS_TQ0 + 1)
-#define KEY_D_CS_TQ2                    (KEY_D_CS_TQ1 + 1)
-#define KEY_D_CS_TQ3                    (KEY_D_CS_TQ2 + 1)
-
-/* Compass keys */
-#define KEY_CPASS_BIAS_X            (KEY_D_CS_TQ3 + 1)
-#define KEY_CPASS_BIAS_Y            (KEY_CPASS_BIAS_X + 1)
-#define KEY_CPASS_BIAS_Z            (KEY_CPASS_BIAS_Y + 1)
-#define KEY_CPASS_MTX_00            (KEY_CPASS_BIAS_Z + 1)
-#define KEY_CPASS_MTX_01            (KEY_CPASS_MTX_00 + 1)
-#define KEY_CPASS_MTX_02            (KEY_CPASS_MTX_01 + 1)
-#define KEY_CPASS_MTX_10            (KEY_CPASS_MTX_02 + 1)
-#define KEY_CPASS_MTX_11            (KEY_CPASS_MTX_10 + 1)
-#define KEY_CPASS_MTX_12            (KEY_CPASS_MTX_11 + 1)
-#define KEY_CPASS_MTX_20            (KEY_CPASS_MTX_12 + 1)
-#define KEY_CPASS_MTX_21            (KEY_CPASS_MTX_20 + 1)
-#define KEY_CPASS_MTX_22            (KEY_CPASS_MTX_21 + 1)
-
-/* Gesture Keys */
-#define KEY_DMP_TAPW_MIN            (KEY_CPASS_MTX_22 + 1)
-#define KEY_DMP_TAP_THR_X           (KEY_DMP_TAPW_MIN + 1)
-#define KEY_DMP_TAP_THR_Y           (KEY_DMP_TAP_THR_X + 1)
-#define KEY_DMP_TAP_THR_Z           (KEY_DMP_TAP_THR_Y + 1)
-#define KEY_DMP_SH_TH_Y             (KEY_DMP_TAP_THR_Z + 1)
-#define KEY_DMP_SH_TH_X             (KEY_DMP_SH_TH_Y + 1)
-#define KEY_DMP_SH_TH_Z             (KEY_DMP_SH_TH_X + 1)
-#define KEY_DMP_ORIENT              (KEY_DMP_SH_TH_Z + 1)
-#define KEY_D_ACT0                  (KEY_DMP_ORIENT + 1)
-#define KEY_D_ACSX                  (KEY_D_ACT0 + 1)
-#define KEY_D_ACSY                  (KEY_D_ACSX + 1)
-#define KEY_D_ACSZ                  (KEY_D_ACSY + 1)
-
-#define KEY_X_GRT_Y_TMP             (KEY_D_ACSZ + 1)
-#define KEY_SKIP_X_GRT_Y_TMP        (KEY_X_GRT_Y_TMP + 1)
-#define KEY_SKIP_END_COMPARE        (KEY_SKIP_X_GRT_Y_TMP + 1)
-#define KEY_END_COMPARE_Y_X_TMP2    (KEY_SKIP_END_COMPARE + 1)       
-#define KEY_CFG_ANDROID_ORIENT_INT  (KEY_END_COMPARE_Y_X_TMP2 + 1)
-#define KEY_NO_ORIENT_INTERRUPT     (KEY_CFG_ANDROID_ORIENT_INT + 1)
-#define KEY_END_COMPARE_Y_X_TMP     (KEY_NO_ORIENT_INTERRUPT + 1)
-#define KEY_END_ORIENT_1            (KEY_END_COMPARE_Y_X_TMP + 1)
-#define KEY_END_COMPARE_Y_X         (KEY_END_ORIENT_1 + 1) 
-#define KEY_END_ORIENT              (KEY_END_COMPARE_Y_X + 1)
-#define KEY_X_GRT_Y                 (KEY_END_ORIENT + 1)
-#define KEY_NOT_TIME_MINUS_1        (KEY_X_GRT_Y + 1)       
-#define KEY_END_COMPARE_Y_X_TMP3    (KEY_NOT_TIME_MINUS_1 + 1) 
-#define KEY_X_GRT_Y_TMP2            (KEY_END_COMPARE_Y_X_TMP3 + 1)
-
-/* Authenticate Keys */
-#define KEY_D_AUTH_OUT              (KEY_X_GRT_Y_TMP2 + 1)
-#define KEY_D_AUTH_IN               (KEY_D_AUTH_OUT + 1)
-#define KEY_D_AUTH_A                (KEY_D_AUTH_IN + 1)
-#define KEY_D_AUTH_B                (KEY_D_AUTH_A + 1)
-
-/* Pedometer standalone only keys */
-#define KEY_D_PEDSTD_BP_B           (KEY_D_AUTH_B + 1)
-#define KEY_D_PEDSTD_HP_A           (KEY_D_PEDSTD_BP_B + 1)
-#define KEY_D_PEDSTD_HP_B           (KEY_D_PEDSTD_HP_A + 1)
-#define KEY_D_PEDSTD_BP_A4          (KEY_D_PEDSTD_HP_B + 1)
-#define KEY_D_PEDSTD_BP_A3          (KEY_D_PEDSTD_BP_A4 + 1)
-#define KEY_D_PEDSTD_BP_A2          (KEY_D_PEDSTD_BP_A3 + 1)
-#define KEY_D_PEDSTD_BP_A1          (KEY_D_PEDSTD_BP_A2 + 1)
-#define KEY_D_PEDSTD_INT_THRSH      (KEY_D_PEDSTD_BP_A1 + 1)
-#define KEY_D_PEDSTD_CLIP           (KEY_D_PEDSTD_INT_THRSH + 1)
-#define KEY_D_PEDSTD_SB             (KEY_D_PEDSTD_CLIP + 1)
-#define KEY_D_PEDSTD_SB_TIME        (KEY_D_PEDSTD_SB + 1)
-#define KEY_D_PEDSTD_PEAKTHRSH      (KEY_D_PEDSTD_SB_TIME + 1)
-#define KEY_D_PEDSTD_TIML           (KEY_D_PEDSTD_PEAKTHRSH + 1)
-#define KEY_D_PEDSTD_TIMH           (KEY_D_PEDSTD_TIML + 1)
-#define KEY_D_PEDSTD_PEAK           (KEY_D_PEDSTD_TIMH + 1)
-#define KEY_D_PEDSTD_TIMECTR        (KEY_D_PEDSTD_PEAK + 1)
-#define KEY_D_PEDSTD_STEPCTR        (KEY_D_PEDSTD_TIMECTR + 1)
-#define KEY_D_PEDSTD_WALKTIME       (KEY_D_PEDSTD_STEPCTR + 1)
-#define KEY_D_PEDSTD_DECI           (KEY_D_PEDSTD_WALKTIME + 1)
-
-/*Host Based No Motion*/
-#define KEY_D_HOST_NO_MOT           (KEY_D_PEDSTD_DECI + 1)
-
-/* EIS keys */
-#define KEY_P_EIS_FIFO_FOOTER       (KEY_D_HOST_NO_MOT + 1)
-#define KEY_P_EIS_FIFO_YSHIFT       (KEY_P_EIS_FIFO_FOOTER + 1)
-#define KEY_P_EIS_DATA_RATE         (KEY_P_EIS_FIFO_YSHIFT + 1)
-#define KEY_P_EIS_FIFO_XSHIFT       (KEY_P_EIS_DATA_RATE + 1)
-#define KEY_P_EIS_FIFO_SYNC         (KEY_P_EIS_FIFO_XSHIFT + 1)
-#define KEY_P_EIS_FIFO_ZSHIFT       (KEY_P_EIS_FIFO_SYNC + 1)
-#define KEY_P_EIS_FIFO_READY        (KEY_P_EIS_FIFO_ZSHIFT + 1)
-#define KEY_DMP_FOOTER              (KEY_P_EIS_FIFO_READY + 1)
-#define KEY_DMP_INTX_HC             (KEY_DMP_FOOTER + 1)
-#define KEY_DMP_INTX_PH             (KEY_DMP_INTX_HC + 1)
-#define KEY_DMP_INTX_SH             (KEY_DMP_INTX_PH + 1)
-#define KEY_DMP_AINV_SH             (KEY_DMP_INTX_SH + 1)
-#define KEY_DMP_A_INV_XH            (KEY_DMP_AINV_SH + 1)
-#define KEY_DMP_AINV_PH             (KEY_DMP_A_INV_XH + 1)
-#define KEY_DMP_CTHX_H              (KEY_DMP_AINV_PH + 1)
-#define KEY_DMP_CTHY_H              (KEY_DMP_CTHX_H + 1)
-#define KEY_DMP_CTHZ_H              (KEY_DMP_CTHY_H + 1)
-#define KEY_DMP_NCTHX_H             (KEY_DMP_CTHZ_H + 1)
-#define KEY_DMP_NCTHY_H             (KEY_DMP_NCTHX_H + 1)
-#define KEY_DMP_NCTHZ_H             (KEY_DMP_NCTHY_H + 1)
-#define KEY_DMP_CTSQ_XH             (KEY_DMP_NCTHZ_H + 1)
-#define KEY_DMP_CTSQ_YH             (KEY_DMP_CTSQ_XH + 1)
-#define KEY_DMP_CTSQ_ZH             (KEY_DMP_CTSQ_YH + 1)
-#define KEY_DMP_INTX_H              (KEY_DMP_CTSQ_ZH + 1)
-#define KEY_DMP_INTY_H              (KEY_DMP_INTX_H + 1)
-#define KEY_DMP_INTZ_H              (KEY_DMP_INTY_H + 1)
-//#define KEY_DMP_HPX_H               (KEY_DMP_INTZ_H + 1)
-//#define KEY_DMP_HPY_H               (KEY_DMP_HPX_H + 1)
-//#define KEY_DMP_HPZ_H               (KEY_DMP_HPY_H + 1)
-
-/* Stream keys */
-#define KEY_STREAM_P_GYRO_Z         (KEY_DMP_INTZ_H + 1)
-#define KEY_STREAM_P_GYRO_Y         (KEY_STREAM_P_GYRO_Z + 1)
-#define KEY_STREAM_P_GYRO_X         (KEY_STREAM_P_GYRO_Y + 1)
-#define KEY_STREAM_P_TEMP           (KEY_STREAM_P_GYRO_X + 1)
-#define KEY_STREAM_P_AUX_Y          (KEY_STREAM_P_TEMP + 1)
-#define KEY_STREAM_P_AUX_X          (KEY_STREAM_P_AUX_Y + 1)
-#define KEY_STREAM_P_AUX_Z          (KEY_STREAM_P_AUX_X + 1)
-#define KEY_STREAM_P_ACCEL_Y        (KEY_STREAM_P_AUX_Z + 1)
-#define KEY_STREAM_P_ACCEL_X        (KEY_STREAM_P_ACCEL_Y + 1)
-#define KEY_STREAM_P_FOOTER         (KEY_STREAM_P_ACCEL_X + 1)
-#define KEY_STREAM_P_ACCEL_Z        (KEY_STREAM_P_FOOTER + 1)
-
-#define NUM_KEYS                    (KEY_STREAM_P_ACCEL_Z + 1)
-
-typedef struct {
-    unsigned short key;
-    unsigned short addr;
-} tKeyLabel;
-
-#define DINA0A 0x0a
-#define DINA22 0x22
-#define DINA42 0x42
-#define DINA5A 0x5a
-
-#define DINA06 0x06
-#define DINA0E 0x0e
-#define DINA16 0x16
-#define DINA1E 0x1e
-#define DINA26 0x26
-#define DINA2E 0x2e
-#define DINA36 0x36
-#define DINA3E 0x3e
-#define DINA46 0x46
-#define DINA4E 0x4e
-#define DINA56 0x56
-#define DINA5E 0x5e
-#define DINA66 0x66
-#define DINA6E 0x6e
-#define DINA76 0x76
-#define DINA7E 0x7e
-
-#define DINA00 0x00
-#define DINA08 0x08
-#define DINA10 0x10
-#define DINA18 0x18
-#define DINA20 0x20
-#define DINA28 0x28
-#define DINA30 0x30
-#define DINA38 0x38
-#define DINA40 0x40
-#define DINA48 0x48
-#define DINA50 0x50
-#define DINA58 0x58
-#define DINA60 0x60
-#define DINA68 0x68
-#define DINA70 0x70
-#define DINA78 0x78
-
-#define DINA04 0x04
-#define DINA0C 0x0c
-#define DINA14 0x14
-#define DINA1C 0x1C
-#define DINA24 0x24
-#define DINA2C 0x2c
-#define DINA34 0x34
-#define DINA3C 0x3c
-#define DINA44 0x44
-#define DINA4C 0x4c
-#define DINA54 0x54
-#define DINA5C 0x5c
-#define DINA64 0x64
-#define DINA6C 0x6c
-#define DINA74 0x74
-#define DINA7C 0x7c
-
-#define DINA01 0x01
-#define DINA09 0x09
-#define DINA11 0x11
-#define DINA19 0x19
-#define DINA21 0x21
-#define DINA29 0x29
-#define DINA31 0x31
-#define DINA39 0x39
-#define DINA41 0x41
-#define DINA49 0x49
-#define DINA51 0x51
-#define DINA59 0x59
-#define DINA61 0x61
-#define DINA69 0x69
-#define DINA71 0x71
-#define DINA79 0x79
-
-#define DINA25 0x25
-#define DINA2D 0x2d
-#define DINA35 0x35
-#define DINA3D 0x3d
-#define DINA4D 0x4d
-#define DINA55 0x55
-#define DINA5D 0x5D
-#define DINA6D 0x6d
-#define DINA75 0x75
-#define DINA7D 0x7d
-
-#define DINADC 0xdc
-#define DINAF2 0xf2
-#define DINAAB 0xab
-#define DINAAA 0xaa
-#define DINAF1 0xf1
-#define DINADF 0xdf
-#define DINADA 0xda
-#define DINAB1 0xb1
-#define DINAB9 0xb9
-#define DINAF3 0xf3
-#define DINA8B 0x8b
-#define DINAA3 0xa3
-#define DINA91 0x91
-#define DINAB6 0xb6
-#define DINAB4 0xb4
-
-
-#define DINC00 0x00
-#define DINC01 0x01
-#define DINC02 0x02
-#define DINC03 0x03
-#define DINC08 0x08
-#define DINC09 0x09
-#define DINC0A 0x0a
-#define DINC0B 0x0b
-#define DINC10 0x10
-#define DINC11 0x11
-#define DINC12 0x12
-#define DINC13 0x13
-#define DINC18 0x18
-#define DINC19 0x19
-#define DINC1A 0x1a
-#define DINC1B 0x1b
-
-#define DINC20 0x20
-#define DINC21 0x21
-#define DINC22 0x22
-#define DINC23 0x23
-#define DINC28 0x28
-#define DINC29 0x29
-#define DINC2A 0x2a
-#define DINC2B 0x2b
-#define DINC30 0x30
-#define DINC31 0x31
-#define DINC32 0x32
-#define DINC33 0x33
-#define DINC38 0x38
-#define DINC39 0x39
-#define DINC3A 0x3a
-#define DINC3B 0x3b
-
-#define DINC40 0x40
-#define DINC41 0x41
-#define DINC42 0x42
-#define DINC43 0x43
-#define DINC48 0x48
-#define DINC49 0x49
-#define DINC4A 0x4a
-#define DINC4B 0x4b
-#define DINC50 0x50
-#define DINC51 0x51
-#define DINC52 0x52
-#define DINC53 0x53
-#define DINC58 0x58
-#define DINC59 0x59
-#define DINC5A 0x5a
-#define DINC5B 0x5b
-
-#define DINC60 0x60
-#define DINC61 0x61
-#define DINC62 0x62
-#define DINC63 0x63
-#define DINC68 0x68
-#define DINC69 0x69
-#define DINC6A 0x6a
-#define DINC6B 0x6b
-#define DINC70 0x70
-#define DINC71 0x71
-#define DINC72 0x72
-#define DINC73 0x73
-#define DINC78 0x78
-#define DINC79 0x79
-#define DINC7A 0x7a
-#define DINC7B 0x7b
-
-#define DIND40 0x40
-
-
-#define DINA80 0x80
-#define DINA90 0x90
-#define DINAA0 0xa0
-#define DINAC9 0xc9
-#define DINACB 0xcb
-#define DINACD 0xcd
-#define DINACF 0xcf
-#define DINAC8 0xc8
-#define DINACA 0xca
-#define DINACC 0xcc
-#define DINACE 0xce
-#define DINAD8 0xd8
-#define DINADD 0xdd
-#define DINAF8 0xf0
-#define DINAFE 0xfe
-
-#define DINBF8 0xf8
-#define DINAC0 0xb0
-#define DINAC1 0xb1
-#define DINAC2 0xb4
-#define DINAC3 0xb5
-#define DINAC4 0xb8
-#define DINAC5 0xb9
-#define DINBC0 0xc0
-#define DINBC2 0xc2
-#define DINBC4 0xc4
-#define DINBC6 0xc6
-
-
-
-#endif // DMPKEY_H__

+ 0 - 264
Core备份3/imu2/dmpmap2.h

@@ -1,264 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011 InvenSense Corporation, All Rights Reserved.
- $
- */
-#ifndef DMPMAP_H
-#define DMPMAP_H
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#define DMP_PTAT    0
-#define DMP_XGYR    2
-#define DMP_YGYR    4
-#define DMP_ZGYR    6
-#define DMP_XACC    8
-#define DMP_YACC    10
-#define DMP_ZACC    12
-#define DMP_ADC1    14
-#define DMP_ADC2    16
-#define DMP_ADC3    18
-#define DMP_BIASUNC    20
-#define DMP_FIFORT    22
-#define DMP_INVGSFH    24
-#define DMP_INVGSFL    26
-#define DMP_1H    28
-#define DMP_1L    30
-#define DMP_BLPFSTCH    32
-#define DMP_BLPFSTCL    34
-#define DMP_BLPFSXH    36
-#define DMP_BLPFSXL    38
-#define DMP_BLPFSYH    40
-#define DMP_BLPFSYL    42
-#define DMP_BLPFSZH    44
-#define DMP_BLPFSZL    46
-#define DMP_BLPFMTC    48
-#define DMP_SMC    50
-#define DMP_BLPFMXH    52
-#define DMP_BLPFMXL    54
-#define DMP_BLPFMYH    56
-#define DMP_BLPFMYL    58
-#define DMP_BLPFMZH    60
-#define DMP_BLPFMZL    62
-#define DMP_BLPFC    64
-#define DMP_SMCTH    66
-#define DMP_0H2    68
-#define DMP_0L2    70
-#define DMP_BERR2H    72
-#define DMP_BERR2L    74
-#define DMP_BERR2NH    76
-#define DMP_SMCINC    78
-#define DMP_ANGVBXH    80
-#define DMP_ANGVBXL    82
-#define DMP_ANGVBYH    84
-#define DMP_ANGVBYL    86
-#define DMP_ANGVBZH    88
-#define DMP_ANGVBZL    90
-#define DMP_BERR1H    92
-#define DMP_BERR1L    94
-#define DMP_ATCH    96
-#define DMP_BIASUNCSF    98
-#define DMP_ACT2H    100
-#define DMP_ACT2L    102
-#define DMP_GSFH    104
-#define DMP_GSFL    106
-#define DMP_GH    108
-#define DMP_GL    110
-#define DMP_0_5H    112
-#define DMP_0_5L    114
-#define DMP_0_0H    116
-#define DMP_0_0L    118
-#define DMP_1_0H    120
-#define DMP_1_0L    122
-#define DMP_1_5H    124
-#define DMP_1_5L    126
-#define DMP_TMP1AH    128
-#define DMP_TMP1AL    130
-#define DMP_TMP2AH    132
-#define DMP_TMP2AL    134
-#define DMP_TMP3AH    136
-#define DMP_TMP3AL    138
-#define DMP_TMP4AH    140
-#define DMP_TMP4AL    142
-#define DMP_XACCW    144
-#define DMP_TMP5    146
-#define DMP_XACCB    148
-#define DMP_TMP8    150
-#define DMP_YACCB    152
-#define DMP_TMP9    154
-#define DMP_ZACCB    156
-#define DMP_TMP10    158
-#define DMP_DZH    160
-#define DMP_DZL    162
-#define DMP_XGCH    164
-#define DMP_XGCL    166
-#define DMP_YGCH    168
-#define DMP_YGCL    170
-#define DMP_ZGCH    172
-#define DMP_ZGCL    174
-#define DMP_YACCW    176
-#define DMP_TMP7    178
-#define DMP_AFB1H    180
-#define DMP_AFB1L    182
-#define DMP_AFB2H    184
-#define DMP_AFB2L    186
-#define DMP_MAGFBH    188
-#define DMP_MAGFBL    190
-#define DMP_QT1H    192
-#define DMP_QT1L    194
-#define DMP_QT2H    196
-#define DMP_QT2L    198
-#define DMP_QT3H    200
-#define DMP_QT3L    202
-#define DMP_QT4H    204
-#define DMP_QT4L    206
-#define DMP_CTRL1H    208
-#define DMP_CTRL1L    210
-#define DMP_CTRL2H    212
-#define DMP_CTRL2L    214
-#define DMP_CTRL3H    216
-#define DMP_CTRL3L    218
-#define DMP_CTRL4H    220
-#define DMP_CTRL4L    222
-#define DMP_CTRLS1    224
-#define DMP_CTRLSF1    226
-#define DMP_CTRLS2    228
-#define DMP_CTRLSF2    230
-#define DMP_CTRLS3    232
-#define DMP_CTRLSFNLL    234
-#define DMP_CTRLS4    236
-#define DMP_CTRLSFNL2    238
-#define DMP_CTRLSFNL    240
-#define DMP_TMP30    242
-#define DMP_CTRLSFJT    244
-#define DMP_TMP31    246
-#define DMP_TMP11    248
-#define DMP_CTRLSF2_2    250
-#define DMP_TMP12    252
-#define DMP_CTRLSF1_2    254
-#define DMP_PREVPTAT    256
-#define DMP_ACCZB    258
-#define DMP_ACCXB    264
-#define DMP_ACCYB    266
-#define DMP_1HB    272
-#define DMP_1LB    274
-#define DMP_0H    276
-#define DMP_0L    278
-#define DMP_ASR22H    280
-#define DMP_ASR22L    282
-#define DMP_ASR6H    284
-#define DMP_ASR6L    286
-#define DMP_TMP13    288
-#define DMP_TMP14    290
-#define DMP_FINTXH    292
-#define DMP_FINTXL    294
-#define DMP_FINTYH    296
-#define DMP_FINTYL    298
-#define DMP_FINTZH    300
-#define DMP_FINTZL    302
-#define DMP_TMP1BH    304
-#define DMP_TMP1BL    306
-#define DMP_TMP2BH    308
-#define DMP_TMP2BL    310
-#define DMP_TMP3BH    312
-#define DMP_TMP3BL    314
-#define DMP_TMP4BH    316
-#define DMP_TMP4BL    318
-#define DMP_STXG    320
-#define DMP_ZCTXG    322
-#define DMP_STYG    324
-#define DMP_ZCTYG    326
-#define DMP_STZG    328
-#define DMP_ZCTZG    330
-#define DMP_CTRLSFJT2    332
-#define DMP_CTRLSFJTCNT    334
-#define DMP_PVXG    336
-#define DMP_TMP15    338
-#define DMP_PVYG    340
-#define DMP_TMP16    342
-#define DMP_PVZG    344
-#define DMP_TMP17    346
-#define DMP_MNMFLAGH    352
-#define DMP_MNMFLAGL    354
-#define DMP_MNMTMH    356
-#define DMP_MNMTML    358
-#define DMP_MNMTMTHRH    360
-#define DMP_MNMTMTHRL    362
-#define DMP_MNMTHRH    364
-#define DMP_MNMTHRL    366
-#define DMP_ACCQD4H    368
-#define DMP_ACCQD4L    370
-#define DMP_ACCQD5H    372
-#define DMP_ACCQD5L    374
-#define DMP_ACCQD6H    376
-#define DMP_ACCQD6L    378
-#define DMP_ACCQD7H    380
-#define DMP_ACCQD7L    382
-#define DMP_ACCQD0H    384
-#define DMP_ACCQD0L    386
-#define DMP_ACCQD1H    388
-#define DMP_ACCQD1L    390
-#define DMP_ACCQD2H    392
-#define DMP_ACCQD2L    394
-#define DMP_ACCQD3H    396
-#define DMP_ACCQD3L    398
-#define DMP_XN2H    400
-#define DMP_XN2L    402
-#define DMP_XN1H    404
-#define DMP_XN1L    406
-#define DMP_YN2H    408
-#define DMP_YN2L    410
-#define DMP_YN1H    412
-#define DMP_YN1L    414
-#define DMP_YH    416
-#define DMP_YL    418
-#define DMP_B0H    420
-#define DMP_B0L    422
-#define DMP_A1H    424
-#define DMP_A1L    426
-#define DMP_A2H    428
-#define DMP_A2L    430
-#define DMP_SEM1    432
-#define DMP_FIFOCNT    434
-#define DMP_SH_TH_X    436
-#define DMP_PACKET    438
-#define DMP_SH_TH_Y    440
-#define DMP_FOOTER    442
-#define DMP_SH_TH_Z    444
-#define DMP_TEMP29    448
-#define DMP_TEMP30    450
-#define DMP_XACCB_PRE    452
-#define DMP_XACCB_PREL    454
-#define DMP_YACCB_PRE    456
-#define DMP_YACCB_PREL    458
-#define DMP_ZACCB_PRE    460
-#define DMP_ZACCB_PREL    462
-#define DMP_TMP22    464
-#define DMP_TAP_TIMER    466
-#define DMP_TAP_THX    468
-#define DMP_TAP_THY    472
-#define DMP_TAP_THZ    476
-#define DMP_TAPW_MIN    478
-#define DMP_TMP25    480
-#define DMP_TMP26    482
-#define DMP_TMP27    484
-#define DMP_TMP28    486
-#define DMP_ORIENT    488
-#define DMP_THRSH    490
-#define DMP_ENDIANH    492
-#define DMP_ENDIANL    494
-#define DMP_BLPFNMTCH    496
-#define DMP_BLPFNMTCL    498
-#define DMP_BLPFNMXH    500
-#define DMP_BLPFNMXL    502
-#define DMP_BLPFNMYH    504
-#define DMP_BLPFNMYL    506
-#define DMP_BLPFNMZH    508
-#define DMP_BLPFNMZL    510
-#ifdef __cplusplus
-}
-#endif
-#endif // DMPMAP_H

+ 0 - 2774
Core备份3/imu2/inv_mpu2.c

@@ -1,2774 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011-2012 InvenSense Corporation, All Rights Reserved.
-    See included License.txt for License information.
- $
- */
-/**
- *  @addtogroup  DRIVERS Sensor Driver Layer
- *  @brief       Hardware drivers to communicate with sensors via I2C.
- *
- *  @{
- *      @file       inv_mpu.c
- *      @brief      An I2C-based driver for Invensense gyroscopes.
- *      @details    This driver currently works for the following devices:
- *                  MPU6050
- *                  MPU6500
- *                  MPU9150 (or MPU6050 w/ AK8975 on the auxiliary bus)
- *                  MPU9250 (or MPU6500 w/ AK8963 on the auxiliary bus)
- */
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include "inv_mpu2.h"
-
-#include "MPU60502.h"
-
-
-/* The following functions must be defined for this platform:
- * i2c_write(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char const *data)
- * i2c_read(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char *data)
- * delay_ms(unsigned long num_ms)
- * get_ms(unsigned long *count)
- * reg_int_cb(void (*cb)(void), unsigned char port, unsigned char pin)
- * labs(long x)
- * fabsf(float x)
- * min(int a, int b)
- */
-#if defined MOTION_DRIVER_TARGET_MSP430
-#include "msp430.h"
-#include "msp430_i2c.h"
-#include "msp430_clock.h"
-#include "msp430_interrupt.h"
-#define i2c_write   msp430_i2c_write
-#define i2c_read    msp430_i2c_read
-#define delay_ms    msp430_delay_ms
-#define get_ms      msp430_get_clock_ms
-static inline int reg_int_cb(struct int_param_s *int_param)
-{
-    return msp430_reg_int_cb(int_param->cb, int_param->pin, int_param->lp_exit,
-        int_param->active_low);
-}
-#define log_i(...)     do {} while (0)
-#define log_e(...)     do {} while (0)
-/* labs is already defined by TI's toolchain. */
-/* fabs is for doubles. fabsf is for floats. */
-#define fabs        fabsf
-#define min(a,b) ((a<b)?a:b)
-#elif defined EMPL_TARGET_MSP430
-#include "msp430.h"
-#include "msp430_i2c.h"
-#include "msp430_clock.h"
-#include "msp430_interrupt.h"
-#include "log.h"
-#define i2c_write   msp430_i2c_write
-#define i2c_read    msp430_i2c_read
-#define delay_ms    msp430_delay_ms
-#define get_ms      msp430_get_clock_ms
-static inline int reg_int_cb(struct int_param_s *int_param)
-{
-    return msp430_reg_int_cb(int_param->cb, int_param->pin, int_param->lp_exit,
-        int_param->active_low);
-}
-#define log_i       MPL_LOGI
-#define log_e       MPL_LOGE
-/* labs is already defined by TI's toolchain. */
-/* fabs is for doubles. fabsf is for floats. */
-#define fabs        fabsf
-#define min(a,b) ((a<b)?a:b)
-#elif defined EMPL_TARGET_UC3L0
-/* Instead of using the standard TWI driver from the ASF library, we're using
- * a TWI driver that follows the slave address + register address convention.
- */
-#include "twi.h"
-#include "delay.h"
-#include "sysclk.h"
-#include "log.h"
-#include "sensors_xplained.h"
-#include "uc3l0_clock.h"
-#define i2c_write(a, b, c, d)   twi_write(a, b, d, c)
-#define i2c_read(a, b, c, d)    twi_read(a, b, d, c)
-/* delay_ms is a function already defined in ASF. */
-#define get_ms  uc3l0_get_clock_ms
-static inline int reg_int_cb(struct int_param_s *int_param)
-{
-    sensor_board_irq_connect(int_param->pin, int_param->cb, int_param->arg);
-    return 0;
-}
-#define log_i       MPL_LOGI
-#define log_e       MPL_LOGE
-/* UC3 is a 32-bit processor, so abs and labs are equivalent. */
-#define labs        abs
-#define fabs(x)     (((x)>0)?(x):-(x))
-#elif defined MOTION_DRIVER_TARGET_STM32
-
-/* The following functions must be defined for this platform:
- * i2c_write(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char const *data)
- * i2c_read(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char *data)
- * delay_ms(unsigned long num_ms)
- * get_ms(unsigned long *count)
- * reg_int_cb(void (*cb)(void), unsigned char port, unsigned char pin)
- * labs(long x)
- * fabsf(float x)
- * min(int a, int b)
- */
-
-#define i2c_write   IIC_Write_Len
-#define i2c_read    IIC_Read_Len
-#define delay_ms    HAL_Delay
-#define get_ms      get_tick_count
-//static inline int reg_int_cb(struct int_param_s *int_param)
-//{
-////    return msp430_reg_int_cb(int_param->cb, int_param->pin, int_param->lp_exit,
-////        int_param->active_low);
-//}
-//#define log_i(...)     do {} while (0)
-//#define log_e(...)     do {} while (0)
-
-#define log_i     printf
-#define log_e     printf
-
-/* labs is already defined by TI's toolchain. */
-/* fabs is for doubles. fabsf is for floats. */
-#define fabs        fabsf
-#define min(a,b) ((a<b)?a:b)
-
-#else
-#error  Gyro driver is missing the system layer implementations.
-#endif
-
-#if !defined MPU6050 && !defined MPU9150 && !defined MPU6500 && !defined MPU9250
-#error  Which gyro are you using? Define MPUxxxx in your compiler options.
-#endif
-
-/* Time for some messy macro work. =]
- * #define MPU9150
- * is equivalent to..
- * #define MPU6050
- * #define AK8975_SECONDARY
- *
- * #define MPU9250
- * is equivalent to..
- * #define MPU6500
- * #define AK8963_SECONDARY
- */
-#if defined MPU9150
-#ifndef MPU6050
-#define MPU6050
-#endif                          /* #ifndef MPU6050 */
-#if defined AK8963_SECONDARY
-#error "MPU9150 and AK8963_SECONDARY cannot both be defined."
-#elif !defined AK8975_SECONDARY /* #if defined AK8963_SECONDARY */
-#define AK8975_SECONDARY
-#endif                          /* #if defined AK8963_SECONDARY */
-#elif defined MPU9250           /* #if defined MPU9150 */
-#ifndef MPU6500
-#define MPU6500
-#endif                          /* #ifndef MPU6500 */
-#if defined AK8975_SECONDARY
-#error "MPU9250 and AK8975_SECONDARY cannot both be defined."
-#elif !defined AK8963_SECONDARY /* #if defined AK8975_SECONDARY */
-#define AK8963_SECONDARY
-#endif                          /* #if defined AK8975_SECONDARY */
-#endif                          /* #if defined MPU9150 */
-
-#if defined AK8975_SECONDARY || defined AK8963_SECONDARY
-#define AK89xx_SECONDARY
-#else
-/* #warning "No compass = less profit for Invensense. Lame." */
-#endif
-
-static int set_int_enable(unsigned char enable);
-
-/* Hardware registers needed by driver. */
-struct gyro_reg_s {
-    unsigned char who_am_i;
-    unsigned char rate_div;
-    unsigned char lpf;
-    unsigned char prod_id;
-    unsigned char user_ctrl;
-    unsigned char fifo_en;
-    unsigned char gyro_cfg;
-    unsigned char accel_cfg;
-    unsigned char accel_cfg2;
-    unsigned char lp_accel_odr;
-    unsigned char motion_thr;
-    unsigned char motion_dur;
-    unsigned char fifo_count_h;
-    unsigned char fifo_r_w;
-    unsigned char raw_gyro;
-    unsigned char raw_accel;
-    unsigned char temp;
-    unsigned char int_enable;
-    unsigned char dmp_int_status;
-    unsigned char int_status;
-    unsigned char accel_intel;
-    unsigned char pwr_mgmt_1;
-    unsigned char pwr_mgmt_2;
-    unsigned char int_pin_cfg;
-    unsigned char mem_r_w;
-    unsigned char accel_offs;
-    unsigned char i2c_mst;
-    unsigned char bank_sel;
-    unsigned char mem_start_addr;
-    unsigned char prgm_start_h;
-#if defined AK89xx_SECONDARY
-    unsigned char s0_addr;
-    unsigned char s0_reg;
-    unsigned char s0_ctrl;
-    unsigned char s1_addr;
-    unsigned char s1_reg;
-    unsigned char s1_ctrl;
-    unsigned char s4_ctrl;
-    unsigned char s0_do;
-    unsigned char s1_do;
-    unsigned char i2c_delay_ctrl;
-    unsigned char raw_compass;
-    /* The I2C_MST_VDDIO bit is in this register. */
-    unsigned char yg_offs_tc;
-#endif
-};
-
-/* Information specific to a particular device. */
-struct hw_s {
-    unsigned char addr;
-    unsigned short max_fifo;
-    unsigned char num_reg;
-    unsigned short temp_sens;
-    short temp_offset;
-    unsigned short bank_size;
-#if defined AK89xx_SECONDARY
-    unsigned short compass_fsr;
-#endif
-};
-
-/* When entering motion interrupt mode, the driver keeps track of the
- * previous state so that it can be restored at a later time.
- * TODO: This is tacky. Fix it.
- */
-struct motion_int_cache_s {
-    unsigned short gyro_fsr;
-    unsigned char accel_fsr;
-    unsigned short lpf;
-    unsigned short sample_rate;
-    unsigned char sensors_on;
-    unsigned char fifo_sensors;
-    unsigned char dmp_on;
-};
-
-/* Cached chip configuration data.
- * TODO: A lot of these can be handled with a bitmask.
- */
-struct chip_cfg_s {
-    /* Matches gyro_cfg >> 3 & 0x03 */
-    unsigned char gyro_fsr;
-    /* Matches accel_cfg >> 3 & 0x03 */
-    unsigned char accel_fsr;
-    /* Enabled sensors. Uses same masks as fifo_en, NOT pwr_mgmt_2. */
-    unsigned char sensors;
-    /* Matches config register. */
-    unsigned char lpf;
-    unsigned char clk_src;
-    /* Sample rate, NOT rate divider. */
-    unsigned short sample_rate;
-    /* Matches fifo_en register. */
-    unsigned char fifo_enable;
-    /* Matches int enable register. */
-    unsigned char int_enable;
-    /* 1 if devices on auxiliary I2C bus appear on the primary. */
-    unsigned char bypass_mode;
-    /* 1 if half-sensitivity.
-     * NOTE: This doesn't belong here, but everything else in hw_s is const,
-     * and this allows us to save some precious RAM.
-     */
-    unsigned char accel_half;
-    /* 1 if device in low-power accel-only mode. */
-    unsigned char lp_accel_mode;
-    /* 1 if interrupts are only triggered on motion events. */
-    unsigned char int_motion_only;
-    struct motion_int_cache_s cache;
-    /* 1 for active low interrupts. */
-    unsigned char active_low_int;
-    /* 1 for latched interrupts. */
-    unsigned char latched_int;
-    /* 1 if DMP is enabled. */
-    unsigned char dmp_on;
-    /* Ensures that DMP will only be loaded once. */
-    unsigned char dmp_loaded;
-    /* Sampling rate used when DMP is enabled. */
-    unsigned short dmp_sample_rate;
-#ifdef AK89xx_SECONDARY
-    /* Compass sample rate. */
-    unsigned short compass_sample_rate;
-    unsigned char compass_addr;
-    short mag_sens_adj[3];
-#endif
-};
-
-/* Information for self-test. */
-struct test_s {
-    unsigned long gyro_sens;
-    unsigned long accel_sens;
-    unsigned char reg_rate_div;
-    unsigned char reg_lpf;
-    unsigned char reg_gyro_fsr;
-    unsigned char reg_accel_fsr;
-    unsigned short wait_ms;
-    unsigned char packet_thresh;
-    float min_dps;
-    float max_dps;
-    float max_gyro_var;
-    float min_g;
-    float max_g;
-    float max_accel_var;
-};
-
-/* Gyro driver state variables. */
-struct gyro_state_s {
-    const struct gyro_reg_s *reg;
-    const struct hw_s *hw;
-    struct chip_cfg_s chip_cfg;
-    const struct test_s *test;
-};
-
-/* Filter configurations. */
-enum lpf_e {
-    INV_FILTER_256HZ_NOLPF2 = 0,
-    INV_FILTER_188HZ,
-    INV_FILTER_98HZ,
-    INV_FILTER_42HZ,
-    INV_FILTER_20HZ,
-    INV_FILTER_10HZ,
-    INV_FILTER_5HZ,
-    INV_FILTER_2100HZ_NOLPF,
-    NUM_FILTER
-};
-
-/* Full scale ranges. */
-enum gyro_fsr_e {
-    INV_FSR_250DPS = 0,
-    INV_FSR_500DPS,
-    INV_FSR_1000DPS,
-    INV_FSR_2000DPS,
-    NUM_GYRO_FSR
-};
-
-/* Full scale ranges. */
-enum accel_fsr_e {
-    INV_FSR_2G = 0,
-    INV_FSR_4G,
-    INV_FSR_8G,
-    INV_FSR_16G,
-    NUM_ACCEL_FSR
-};
-
-/* Clock sources. */
-enum clock_sel_e {
-    INV_CLK_INTERNAL = 0,
-    INV_CLK_PLL,
-    NUM_CLK
-};
-
-/* Low-power accel wakeup rates. */
-enum lp_accel_rate_e {
-#if defined MPU6050
-    INV_LPA_1_25HZ,
-    INV_LPA_5HZ,
-    INV_LPA_20HZ,
-    INV_LPA_40HZ
-#elif defined MPU6500
-    INV_LPA_0_3125HZ,
-    INV_LPA_0_625HZ,
-    INV_LPA_1_25HZ,
-    INV_LPA_2_5HZ,
-    INV_LPA_5HZ,
-    INV_LPA_10HZ,
-    INV_LPA_20HZ,
-    INV_LPA_40HZ,
-    INV_LPA_80HZ,
-    INV_LPA_160HZ,
-    INV_LPA_320HZ,
-    INV_LPA_640HZ
-#endif
-};
-
-#define BIT_I2C_MST_VDDIO   (0x80)
-#define BIT_FIFO_EN         (0x40)
-#define BIT_DMP_EN          (0x80)
-#define BIT_FIFO_RST        (0x04)
-#define BIT_DMP_RST         (0x08)
-#define BIT_FIFO_OVERFLOW   (0x10)
-#define BIT_DATA_RDY_EN     (0x01)
-#define BIT_DMP_INT_EN      (0x02)
-#define BIT_MOT_INT_EN      (0x40)
-#define BITS_FSR            (0x18)
-#define BITS_LPF            (0x07)
-#define BITS_HPF            (0x07)
-#define BITS_CLK            (0x07)
-#define BIT_FIFO_SIZE_1024  (0x40)
-#define BIT_FIFO_SIZE_2048  (0x80)
-#define BIT_FIFO_SIZE_4096  (0xC0)
-#define BIT_RESET           (0x80)
-#define BIT_SLEEP           (0x40)
-#define BIT_S0_DELAY_EN     (0x01)
-#define BIT_S2_DELAY_EN     (0x04)
-#define BITS_SLAVE_LENGTH   (0x0F)
-#define BIT_SLAVE_BYTE_SW   (0x40)
-#define BIT_SLAVE_GROUP     (0x10)
-#define BIT_SLAVE_EN        (0x80)
-#define BIT_I2C_READ        (0x80)
-#define BITS_I2C_MASTER_DLY (0x1F)
-#define BIT_AUX_IF_EN       (0x20)
-#define BIT_ACTL            (0x80)
-#define BIT_LATCH_EN        (0x20)
-#define BIT_ANY_RD_CLR      (0x10)
-#define BIT_BYPASS_EN       (0x02)
-#define BITS_WOM_EN         (0xC0)
-#define BIT_LPA_CYCLE       (0x20)
-#define BIT_STBY_XA         (0x20)
-#define BIT_STBY_YA         (0x10)
-#define BIT_STBY_ZA         (0x08)
-#define BIT_STBY_XG         (0x04)
-#define BIT_STBY_YG         (0x02)
-#define BIT_STBY_ZG         (0x01)
-#define BIT_STBY_XYZA       (BIT_STBY_XA | BIT_STBY_YA | BIT_STBY_ZA)
-#define BIT_STBY_XYZG       (BIT_STBY_XG | BIT_STBY_YG | BIT_STBY_ZG)
-
-#if defined AK8975_SECONDARY
-#define SUPPORTS_AK89xx_HIGH_SENS   (0x00)
-#define AK89xx_FSR                  (9830)
-#elif defined AK8963_SECONDARY
-#define SUPPORTS_AK89xx_HIGH_SENS   (0x10)
-#define AK89xx_FSR                  (4915)
-#endif
-
-#ifdef AK89xx_SECONDARY
-#define AKM_REG_WHOAMI      (0x00)
-
-#define AKM_REG_ST1         (0x02)
-#define AKM_REG_HXL         (0x03)
-#define AKM_REG_ST2         (0x09)
-
-#define AKM_REG_CNTL        (0x0A)
-#define AKM_REG_ASTC        (0x0C)
-#define AKM_REG_ASAX        (0x10)
-#define AKM_REG_ASAY        (0x11)
-#define AKM_REG_ASAZ        (0x12)
-
-#define AKM_DATA_READY      (0x01)
-#define AKM_DATA_OVERRUN    (0x02)
-#define AKM_OVERFLOW        (0x80)
-#define AKM_DATA_ERROR      (0x40)
-
-#define AKM_BIT_SELF_TEST   (0x40)
-
-#define AKM_POWER_DOWN          (0x00 | SUPPORTS_AK89xx_HIGH_SENS)
-#define AKM_SINGLE_MEASUREMENT  (0x01 | SUPPORTS_AK89xx_HIGH_SENS)
-#define AKM_FUSE_ROM_ACCESS     (0x0F | SUPPORTS_AK89xx_HIGH_SENS)
-#define AKM_MODE_SELF_TEST      (0x08 | SUPPORTS_AK89xx_HIGH_SENS)
-
-#define AKM_WHOAMI      (0x48)
-#endif
-
-#if defined MPU6050
-const struct gyro_reg_s reg = {
-    .who_am_i       = 0x75,
-    .rate_div       = 0x19,
-    .lpf            = 0x1A,
-    .prod_id        = 0x0C,
-    .user_ctrl      = 0x6A,
-    .fifo_en        = 0x23,
-    .gyro_cfg       = 0x1B,
-    .accel_cfg      = 0x1C,
-    .motion_thr     = 0x1F,
-    .motion_dur     = 0x20,
-    .fifo_count_h   = 0x72,
-    .fifo_r_w       = 0x74,
-    .raw_gyro       = 0x43,
-    .raw_accel      = 0x3B,
-    .temp           = 0x41,
-    .int_enable     = 0x38,
-    .dmp_int_status = 0x39,
-    .int_status     = 0x3A,
-    .pwr_mgmt_1     = 0x6B,
-    .pwr_mgmt_2     = 0x6C,
-    .int_pin_cfg    = 0x37,
-    .mem_r_w        = 0x6F,
-    .accel_offs     = 0x06,
-    .i2c_mst        = 0x24,
-    .bank_sel       = 0x6D,
-    .mem_start_addr = 0x6E,
-    .prgm_start_h   = 0x70
-#ifdef AK89xx_SECONDARY
-    ,.raw_compass   = 0x49,
-    .yg_offs_tc     = 0x01,
-    .s0_addr        = 0x25,
-    .s0_reg         = 0x26,
-    .s0_ctrl        = 0x27,
-    .s1_addr        = 0x28,
-    .s1_reg         = 0x29,
-    .s1_ctrl        = 0x2A,
-    .s4_ctrl        = 0x34,
-    .s0_do          = 0x63,
-    .s1_do          = 0x64,
-    .i2c_delay_ctrl = 0x67
-#endif
-};
-const struct hw_s hw = {
-    .addr           = 0x68,
-    .max_fifo       = 1024,
-    .num_reg        = 118,
-    .temp_sens      = 340,
-    .temp_offset    = -521,
-    .bank_size      = 256
-#if defined AK89xx_SECONDARY
-    ,.compass_fsr    = AK89xx_FSR
-#endif
-};
-
-const struct test_s test = {
-    .gyro_sens      = 32768/250,
-    .accel_sens     = 32768/16,
-    .reg_rate_div   = 0,    /* 1kHz. */
-    .reg_lpf        = 1,    /* 188Hz. */
-    .reg_gyro_fsr   = 0,    /* 250dps. */
-    .reg_accel_fsr  = 0x18, /* 16g. */
-    .wait_ms        = 50,
-    .packet_thresh  = 5,    /* 5% */
-    .min_dps        = 10.f,
-    .max_dps        = 105.f,
-    .max_gyro_var   = 0.14f,
-    .min_g          = 0.3f,
-    .max_g          = 0.95f,
-    .max_accel_var  = 0.14f
-};
-
-static struct gyro_state_s st = {
-    .reg = &reg,
-    .hw = &hw,
-    .test = &test
-};
-#elif defined MPU6500
-const struct gyro_reg_s reg = {
-    .who_am_i       = 0x75,
-    .rate_div       = 0x19,
-    .lpf            = 0x1A,
-    .prod_id        = 0x0C,
-    .user_ctrl      = 0x6A,
-    .fifo_en        = 0x23,
-    .gyro_cfg       = 0x1B,
-    .accel_cfg      = 0x1C,
-    .accel_cfg2     = 0x1D,
-    .lp_accel_odr   = 0x1E,
-    .motion_thr     = 0x1F,
-    .motion_dur     = 0x20,
-    .fifo_count_h   = 0x72,
-    .fifo_r_w       = 0x74,
-    .raw_gyro       = 0x43,
-    .raw_accel      = 0x3B,
-    .temp           = 0x41,
-    .int_enable     = 0x38,
-    .dmp_int_status = 0x39,
-    .int_status     = 0x3A,
-    .accel_intel    = 0x69,
-    .pwr_mgmt_1     = 0x6B,
-    .pwr_mgmt_2     = 0x6C,
-    .int_pin_cfg    = 0x37,
-    .mem_r_w        = 0x6F,
-    .accel_offs     = 0x77,
-    .i2c_mst        = 0x24,
-    .bank_sel       = 0x6D,
-    .mem_start_addr = 0x6E,
-    .prgm_start_h   = 0x70
-#ifdef AK89xx_SECONDARY
-    ,.raw_compass   = 0x49,
-    .s0_addr        = 0x25,
-    .s0_reg         = 0x26,
-    .s0_ctrl        = 0x27,
-    .s1_addr        = 0x28,
-    .s1_reg         = 0x29,
-    .s1_ctrl        = 0x2A,
-    .s4_ctrl        = 0x34,
-    .s0_do          = 0x63,
-    .s1_do          = 0x64,
-    .i2c_delay_ctrl = 0x67
-#endif
-};
-const struct hw_s hw = {
-    .addr           = 0x68,
-    .max_fifo       = 1024,
-    .num_reg        = 128,
-    .temp_sens      = 321,
-    .temp_offset    = 0,
-    .bank_size      = 256
-#if defined AK89xx_SECONDARY
-    ,.compass_fsr    = AK89xx_FSR
-#endif
-};
-
-const struct test_s test = {
-    .gyro_sens      = 32768/250,
-    .accel_sens     = 32768/16,
-    .reg_rate_div   = 0,    /* 1kHz. */
-    .reg_lpf        = 1,    /* 188Hz. */
-    .reg_gyro_fsr   = 0,    /* 250dps. */
-    .reg_accel_fsr  = 0x18, /* 16g. */
-    .wait_ms        = 50,
-    .packet_thresh  = 5,    /* 5% */
-    .min_dps        = 10.f,
-    .max_dps        = 105.f,
-    .max_gyro_var   = 0.14f,
-    .min_g          = 0.3f,
-    .max_g          = 0.95f,
-    .max_accel_var  = 0.14f
-};
-
-static struct gyro_state_s st = {
-    .reg = &reg,
-    .hw = &hw,
-    .test = &test
-};
-#endif
-
-#define MAX_PACKET_LENGTH (12)
-
-#ifdef AK89xx_SECONDARY
-static int setup_compass(void);
-#define MAX_COMPASS_SAMPLE_RATE (100)
-#endif
-
-/**
- *  @brief      Enable/disable data ready interrupt.
- *  If the DMP is on, the DMP interrupt is enabled. Otherwise, the data ready
- *  interrupt is used.
- *  @param[in]  enable      1 to enable interrupt.
- *  @return     0 if successful.
- */
-static int set_int_enable(unsigned char enable)
-{
-    unsigned char tmp;
-
-    if (st.chip_cfg.dmp_on) {
-        if (enable)
-            tmp = BIT_DMP_INT_EN;
-        else
-            tmp = 0x00;
-        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &tmp))
-            return -1;
-        st.chip_cfg.int_enable = tmp;
-    } else {
-        if (!st.chip_cfg.sensors)
-            return -1;
-        if (enable && st.chip_cfg.int_enable)
-            return 0;
-        if (enable)
-            tmp = BIT_DATA_RDY_EN;
-        else
-            tmp = 0x00;
-        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &tmp))
-            return -1;
-        st.chip_cfg.int_enable = tmp;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Register dump for testing.
- *  @return     0 if successful.
- */
-int mpu_reg_dump(void)
-{
-    unsigned char ii;
-    unsigned char data;
-
-    for (ii = 0; ii < st.hw->num_reg; ii++) {
-        if (ii == st.reg->fifo_r_w || ii == st.reg->mem_r_w)
-            continue;
-        if (i2c_read(st.hw->addr, ii, 1, &data))
-            return -1;
-        log_i("%#5x: %#5x\r\n", ii, data);
-    }
-    return 0;
-}
-
-/**
- *  @brief      Read from a single register.
- *  NOTE: The memory and FIFO read/write registers cannot be accessed.
- *  @param[in]  reg     Register address.
- *  @param[out] data    Register data.
- *  @return     0 if successful.
- */
-int mpu_read_reg(unsigned char reg, unsigned char *data)
-{
-    if (reg == st.reg->fifo_r_w || reg == st.reg->mem_r_w)
-        return -1;
-    if (reg >= st.hw->num_reg)
-        return -1;
-    return i2c_read(st.hw->addr, reg, 1, data);
-}
-
-/**
- *  @brief      Initialize hardware.
- *  Initial configuration:\n
- *  Gyro FSR: +/- 2000DPS\n
- *  Accel FSR +/- 2G\n
- *  DLPF: 42Hz\n
- *  FIFO rate: 50Hz\n
- *  Clock source: Gyro PLL\n
- *  FIFO: Disabled.\n
- *  Data ready interrupt: Disabled, active low, unlatched.
- *  @param[in]  int_param   Platform-specific parameters to interrupt API.
- *  @return     0 if successful.
- */
-int mpu_init(struct int_param_s *int_param)
-{
-    unsigned char data[6], rev;
-
-    /* Reset device. */
-    data[0] = BIT_RESET;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, data))
-        return -1;
-    delay_ms(100);
-
-    /* Wake up chip. */
-    data[0] = 0x00;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, data))
-        return -1;
-
-#if defined MPU6050
-    /* Check product revision. */
-    if (i2c_read(st.hw->addr, st.reg->accel_offs, 6, data))
-        return -1;
-    rev = ((data[5] & 0x01) << 2) | ((data[3] & 0x01) << 1) |
-        (data[1] & 0x01);
-
-    if (rev) {
-        /* Congrats, these parts are better. */
-        if (rev == 1)
-            st.chip_cfg.accel_half = 1;
-        else if (rev == 2)
-            st.chip_cfg.accel_half = 0;
-        else {
-            log_e("Unsupported software product rev %d.\n", rev);
-            return -1;
-        }
-    } else {
-        if (i2c_read(st.hw->addr, st.reg->prod_id, 1, data))
-            return -1;
-        rev = data[0] & 0x0F;
-        if (!rev) {
-            log_e("Product ID read as 0 indicates device is either "
-                "incompatible or an MPU3050.\n");
-            return -1;
-        } else if (rev == 4) {
-            log_i("Half sensitivity part found.\n");
-            st.chip_cfg.accel_half = 1;
-        } else
-            st.chip_cfg.accel_half = 0;
-    }
-#elif defined MPU6500
-#define MPU6500_MEM_REV_ADDR    (0x17)
-    if (mpu_read_mem(MPU6500_MEM_REV_ADDR, 1, &rev))
-        return -1;
-    if (rev == 0x1)
-        st.chip_cfg.accel_half = 0;
-    else {
-        log_e("Unsupported software product rev %d.\n", rev);
-        return -1;
-    }
-
-    /* MPU6500 shares 4kB of memory between the DMP and the FIFO. Since the
-     * first 3kB are needed by the DMP, we'll use the last 1kB for the FIFO.
-     */
-    data[0] = BIT_FIFO_SIZE_1024 | 0x8;
-    if (i2c_write(st.hw->addr, st.reg->accel_cfg2, 1, data))
-        return -1;
-#endif
-
-    /* Set to invalid values to ensure no I2C writes are skipped. */
-    st.chip_cfg.sensors = 0xFF;
-    st.chip_cfg.gyro_fsr = 0xFF;
-    st.chip_cfg.accel_fsr = 0xFF;
-    st.chip_cfg.lpf = 0xFF;
-    st.chip_cfg.sample_rate = 0xFFFF;
-    st.chip_cfg.fifo_enable = 0xFF;
-    st.chip_cfg.bypass_mode = 0xFF;
-#ifdef AK89xx_SECONDARY
-    st.chip_cfg.compass_sample_rate = 0xFFFF;
-#endif
-    /* mpu_set_sensors always preserves this setting. */
-    st.chip_cfg.clk_src = INV_CLK_PLL;
-    /* Handled in next call to mpu_set_bypass. */
-    st.chip_cfg.active_low_int = 1;
-    st.chip_cfg.latched_int = 0;
-    st.chip_cfg.int_motion_only = 0;
-    st.chip_cfg.lp_accel_mode = 0;
-    memset(&st.chip_cfg.cache, 0, sizeof(st.chip_cfg.cache));
-    st.chip_cfg.dmp_on = 0;
-    st.chip_cfg.dmp_loaded = 0;
-    st.chip_cfg.dmp_sample_rate = 0;
-
-    if (mpu_set_gyro_fsr(2000))
-        return -1;
-    if (mpu_set_accel_fsr(2))
-        return -1;
-    if (mpu_set_lpf(42))
-        return -1;
-    if (mpu_set_sample_rate(50))
-        return -1;
-    if (mpu_configure_fifo(0))
-        return -1;
-
-#ifndef MOTION_DRIVER_TARGET_STM32
-    if (int_param)
-        reg_int_cb(int_param);
-#endif
-
-#ifdef AK89xx_SECONDARY
-    setup_compass();
-    if (mpu_set_compass_sample_rate(10))
-        return -1;
-#else
-    /* Already disabled by setup_compass. */
-    if (mpu_set_bypass(0))
-        return -1;
-#endif
-
-    mpu_set_sensors(0);
-    return 0;
-}
-
-/**
- *  @brief      Enter low-power accel-only mode.
- *  In low-power accel mode, the chip goes to sleep and only wakes up to sample
- *  the accelerometer at one of the following frequencies:
- *  \n MPU6050: 1.25Hz, 5Hz, 20Hz, 40Hz
- *  \n MPU6500: 1.25Hz, 2.5Hz, 5Hz, 10Hz, 20Hz, 40Hz, 80Hz, 160Hz, 320Hz, 640Hz
- *  \n If the requested rate is not one listed above, the device will be set to
- *  the next highest rate. Requesting a rate above the maximum supported
- *  frequency will result in an error.
- *  \n To select a fractional wake-up frequency, round down the value passed to
- *  @e rate.
- *  @param[in]  rate        Minimum sampling rate, or zero to disable LP
- *                          accel mode.
- *  @return     0 if successful.
- */
-int mpu_lp_accel_mode(unsigned char rate)
-{
-    unsigned char tmp[2];
-
-    if (rate > 40)
-        return -1;
-
-    if (!rate) {
-        mpu_set_int_latched(0);
-        tmp[0] = 0;
-        tmp[1] = BIT_STBY_XYZG;
-        if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 2, tmp))
-            return -1;
-        st.chip_cfg.lp_accel_mode = 0;
-        return 0;
-    }
-    /* For LP accel, we automatically configure the hardware to produce latched
-     * interrupts. In LP accel mode, the hardware cycles into sleep mode before
-     * it gets a chance to deassert the interrupt pin; therefore, we shift this
-     * responsibility over to the MCU.
-     *
-     * Any register read will clear the interrupt.
-     */
-    mpu_set_int_latched(1);
-#if defined MPU6050
-    tmp[0] = BIT_LPA_CYCLE;
-    if (rate == 1) {
-        tmp[1] = INV_LPA_1_25HZ;
-        mpu_set_lpf(5);
-    } else if (rate <= 5) {
-        tmp[1] = INV_LPA_5HZ;
-        mpu_set_lpf(5);
-    } else if (rate <= 20) {
-        tmp[1] = INV_LPA_20HZ;
-        mpu_set_lpf(10);
-    } else {
-        tmp[1] = INV_LPA_40HZ;
-        mpu_set_lpf(20);
-    }
-    tmp[1] = (tmp[1] << 6) | BIT_STBY_XYZG;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 2, tmp))
-        return -1;
-#elif defined MPU6500
-    /* Set wake frequency. */
-    if (rate == 1)
-        tmp[0] = INV_LPA_1_25HZ;
-    else if (rate == 2)
-        tmp[0] = INV_LPA_2_5HZ;
-    else if (rate <= 5)
-        tmp[0] = INV_LPA_5HZ;
-    else if (rate <= 10)
-        tmp[0] = INV_LPA_10HZ;
-    else if (rate <= 20)
-        tmp[0] = INV_LPA_20HZ;
-    else if (rate <= 40)
-        tmp[0] = INV_LPA_40HZ;
-    else if (rate <= 80)
-        tmp[0] = INV_LPA_80HZ;
-    else if (rate <= 160)
-        tmp[0] = INV_LPA_160HZ;
-    else if (rate <= 320)
-        tmp[0] = INV_LPA_320HZ;
-    else
-        tmp[0] = INV_LPA_640HZ;
-    if (i2c_write(st.hw->addr, st.reg->lp_accel_odr, 1, tmp))
-        return -1;
-    tmp[0] = BIT_LPA_CYCLE;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, tmp))
-        return -1;
-#endif
-    st.chip_cfg.sensors = INV_XYZ_ACCEL;
-    st.chip_cfg.clk_src = 0;
-    st.chip_cfg.lp_accel_mode = 1;
-    mpu_configure_fifo(0);
-
-    return 0;
-}
-
-/**
- *  @brief      Read raw gyro data directly from the registers.
- *  @param[out] data        Raw data in hardware units.
- *  @param[out] timestamp   Timestamp in milliseconds. Null if not needed.
- *  @return     0 if successful.
- */
-int mpu_get_gyro_reg(short *data, unsigned long *timestamp)
-{
-    unsigned char tmp[6];
-
-    if (!(st.chip_cfg.sensors & INV_XYZ_GYRO))
-        return -1;
-
-    if (i2c_read(st.hw->addr, st.reg->raw_gyro, 6, tmp))
-        return -1;
-    data[0] = (tmp[0] << 8) | tmp[1];
-    data[1] = (tmp[2] << 8) | tmp[3];
-    data[2] = (tmp[4] << 8) | tmp[5];
-    if (timestamp)
-        get_ms(timestamp);
-    return 0;
-}
-
-/**
- *  @brief      Read raw accel data directly from the registers.
- *  @param[out] data        Raw data in hardware units.
- *  @param[out] timestamp   Timestamp in milliseconds. Null if not needed.
- *  @return     0 if successful.
- */
-int mpu_get_accel_reg(short *data, unsigned long *timestamp)
-{
-    unsigned char tmp[6];
-
-    if (!(st.chip_cfg.sensors & INV_XYZ_ACCEL))
-        return -1;
-
-    if (i2c_read(st.hw->addr, st.reg->raw_accel, 6, tmp))
-        return -1;
-    data[0] = (tmp[0] << 8) | tmp[1];
-    data[1] = (tmp[2] << 8) | tmp[3];
-    data[2] = (tmp[4] << 8) | tmp[5];
-    if (timestamp)
-        get_ms(timestamp);
-    return 0;
-}
-
-/**
- *  @brief      Read temperature data directly from the registers.
- *  @param[out] data        Data in q16 format.
- *  @param[out] timestamp   Timestamp in milliseconds. Null if not needed.
- *  @return     0 if successful.
- */
-int mpu_get_temperature(long *data, unsigned long *timestamp)
-{
-    unsigned char tmp[2];
-    short raw;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    if (i2c_read(st.hw->addr, st.reg->temp, 2, tmp))
-        return -1;
-    raw = (tmp[0] << 8) | tmp[1];
-    if (timestamp)
-        get_ms(timestamp);
-
-    data[0] = (long)((35 + ((raw - (float)st.hw->temp_offset) / st.hw->temp_sens)) * 65536L);
-    return 0;
-}
-
-/**
- *  @brief      Push biases to the accel bias registers.
- *  This function expects biases relative to the current sensor output, and
- *  these biases will be added to the factory-supplied values.
- *  @param[in]  accel_bias  New biases.
- *  @return     0 if successful.
- */
-int mpu_set_accel_bias(const long *accel_bias)
-{
-    unsigned char data[6];
-    short accel_hw[3];
-    short got_accel[3];
-    short fg[3];
-
-    if (!accel_bias)
-        return -1;
-    if (!accel_bias[0] && !accel_bias[1] && !accel_bias[2])
-        return 0;
-
-    if (i2c_read(st.hw->addr, 3, 3, data))
-        return -1;
-    fg[0] = ((data[0] >> 4) + 8) & 0xf;
-    fg[1] = ((data[1] >> 4) + 8) & 0xf;
-    fg[2] = ((data[2] >> 4) + 8) & 0xf;
-
-    accel_hw[0] = (short)(accel_bias[0] * 2 / (64 + fg[0]));
-    accel_hw[1] = (short)(accel_bias[1] * 2 / (64 + fg[1]));
-    accel_hw[2] = (short)(accel_bias[2] * 2 / (64 + fg[2]));
-
-    if (i2c_read(st.hw->addr, 0x06, 6, data))
-        return -1;
-
-    got_accel[0] = ((short)data[0] << 8) | data[1];
-    got_accel[1] = ((short)data[2] << 8) | data[3];
-    got_accel[2] = ((short)data[4] << 8) | data[5];
-
-    accel_hw[0] += got_accel[0];
-    accel_hw[1] += got_accel[1];
-    accel_hw[2] += got_accel[2];
-
-    data[0] = (accel_hw[0] >> 8) & 0xff;
-    data[1] = (accel_hw[0]) & 0xff;
-    data[2] = (accel_hw[1] >> 8) & 0xff;
-    data[3] = (accel_hw[1]) & 0xff;
-    data[4] = (accel_hw[2] >> 8) & 0xff;
-    data[5] = (accel_hw[2]) & 0xff;
-
-    if (i2c_write(st.hw->addr, 0x06, 6, data))
-        return -1;
-    return 0;
-}
-
-/**
- *  @brief  Reset FIFO read/write pointers.
- *  @return 0 if successful.
- */
-int mpu_reset_fifo(void)
-{
-    unsigned char data;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    data = 0;
-    if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, &data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
-        return -1;
-
-    if (st.chip_cfg.dmp_on) {
-        data = BIT_FIFO_RST | BIT_DMP_RST;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
-            return -1;
-        delay_ms(50);
-        data = BIT_DMP_EN | BIT_FIFO_EN;
-        if (st.chip_cfg.sensors & INV_XYZ_COMPASS)
-            data |= BIT_AUX_IF_EN;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
-            return -1;
-        if (st.chip_cfg.int_enable)
-            data = BIT_DMP_INT_EN;
-        else
-            data = 0;
-        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &data))
-            return -1;
-        data = 0;
-        if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, &data))
-            return -1;
-    } else {
-        data = BIT_FIFO_RST;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
-            return -1;
-        if (st.chip_cfg.bypass_mode || !(st.chip_cfg.sensors & INV_XYZ_COMPASS))
-            data = BIT_FIFO_EN;
-        else
-            data = BIT_FIFO_EN | BIT_AUX_IF_EN;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
-            return -1;
-        delay_ms(50);
-        if (st.chip_cfg.int_enable)
-            data = BIT_DATA_RDY_EN;
-        else
-            data = 0;
-        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &data))
-            return -1;
-        if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, &st.chip_cfg.fifo_enable))
-            return -1;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Get the gyro full-scale range.
- *  @param[out] fsr Current full-scale range.
- *  @return     0 if successful.
- */
-int mpu_get_gyro_fsr(unsigned short *fsr)
-{
-    switch (st.chip_cfg.gyro_fsr) {
-    case INV_FSR_250DPS:
-        fsr[0] = 250;
-        break;
-    case INV_FSR_500DPS:
-        fsr[0] = 500;
-        break;
-    case INV_FSR_1000DPS:
-        fsr[0] = 1000;
-        break;
-    case INV_FSR_2000DPS:
-        fsr[0] = 2000;
-        break;
-    default:
-        fsr[0] = 0;
-        break;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Set the gyro full-scale range.
- *  @param[in]  fsr Desired full-scale range.
- *  @return     0 if successful.
- */
-int mpu_set_gyro_fsr(unsigned short fsr)
-{
-    unsigned char data;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    switch (fsr) {
-    case 250:
-        data = INV_FSR_250DPS << 3;
-        break;
-    case 500:
-        data = INV_FSR_500DPS << 3;
-        break;
-    case 1000:
-        data = INV_FSR_1000DPS << 3;
-        break;
-    case 2000:
-        data = INV_FSR_2000DPS << 3;
-        break;
-    default:
-        return -1;
-    }
-
-    if (st.chip_cfg.gyro_fsr == (data >> 3))
-        return 0;
-    if (i2c_write(st.hw->addr, st.reg->gyro_cfg, 1, &data))
-        return -1;
-    st.chip_cfg.gyro_fsr = data >> 3;
-    return 0;
-}
-
-/**
- *  @brief      Get the accel full-scale range.
- *  @param[out] fsr Current full-scale range.
- *  @return     0 if successful.
- */
-int mpu_get_accel_fsr(unsigned char *fsr)
-{
-    switch (st.chip_cfg.accel_fsr) {
-    case INV_FSR_2G:
-        fsr[0] = 2;
-        break;
-    case INV_FSR_4G:
-        fsr[0] = 4;
-        break;
-    case INV_FSR_8G:
-        fsr[0] = 8;
-        break;
-    case INV_FSR_16G:
-        fsr[0] = 16;
-        break;
-    default:
-        return -1;
-    }
-    if (st.chip_cfg.accel_half)
-        fsr[0] <<= 1;
-    return 0;
-}
-
-/**
- *  @brief      Set the accel full-scale range.
- *  @param[in]  fsr Desired full-scale range.
- *  @return     0 if successful.
- */
-int mpu_set_accel_fsr(unsigned char fsr)
-{
-    unsigned char data;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    switch (fsr) {
-    case 2:
-        data = INV_FSR_2G << 3;
-        break;
-    case 4:
-        data = INV_FSR_4G << 3;
-        break;
-    case 8:
-        data = INV_FSR_8G << 3;
-        break;
-    case 16:
-        data = INV_FSR_16G << 3;
-        break;
-    default:
-        return -1;
-    }
-
-    if (st.chip_cfg.accel_fsr == (data >> 3))
-        return 0;
-    if (i2c_write(st.hw->addr, st.reg->accel_cfg, 1, &data))
-        return -1;
-    st.chip_cfg.accel_fsr = data >> 3;
-    return 0;
-}
-
-/**
- *  @brief      Get the current DLPF setting.
- *  @param[out] lpf Current LPF setting.
- *  0 if successful.
- */
-int mpu_get_lpf(unsigned short *lpf)
-{
-    switch (st.chip_cfg.lpf) {
-    case INV_FILTER_188HZ:
-        lpf[0] = 188;
-        break;
-    case INV_FILTER_98HZ:
-        lpf[0] = 98;
-        break;
-    case INV_FILTER_42HZ:
-        lpf[0] = 42;
-        break;
-    case INV_FILTER_20HZ:
-        lpf[0] = 20;
-        break;
-    case INV_FILTER_10HZ:
-        lpf[0] = 10;
-        break;
-    case INV_FILTER_5HZ:
-        lpf[0] = 5;
-        break;
-    case INV_FILTER_256HZ_NOLPF2:
-    case INV_FILTER_2100HZ_NOLPF:
-    default:
-        lpf[0] = 0;
-        break;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Set digital low pass filter.
- *  The following LPF settings are supported: 188, 98, 42, 20, 10, 5.
- *  @param[in]  lpf Desired LPF setting.
- *  @return     0 if successful.
- */
-int mpu_set_lpf(unsigned short lpf)
-{
-    unsigned char data;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    if (lpf >= 188)
-        data = INV_FILTER_188HZ;
-    else if (lpf >= 98)
-        data = INV_FILTER_98HZ;
-    else if (lpf >= 42)
-        data = INV_FILTER_42HZ;
-    else if (lpf >= 20)
-        data = INV_FILTER_20HZ;
-    else if (lpf >= 10)
-        data = INV_FILTER_10HZ;
-    else
-        data = INV_FILTER_5HZ;
-
-    if (st.chip_cfg.lpf == data)
-        return 0;
-    if (i2c_write(st.hw->addr, st.reg->lpf, 1, &data))
-        return -1;
-    st.chip_cfg.lpf = data;
-    return 0;
-}
-
-/**
- *  @brief      Get sampling rate.
- *  @param[out] rate    Current sampling rate (Hz).
- *  @return     0 if successful.
- */
-int mpu_get_sample_rate(unsigned short *rate)
-{
-    if (st.chip_cfg.dmp_on)
-        return -1;
-    else
-        rate[0] = st.chip_cfg.sample_rate;
-
-    return 0;
-}
-
-/**
- *  @brief      Set sampling rate.
- *  Sampling rate must be between 4Hz and 1kHz.
- *  @param[in]  rate    Desired sampling rate (Hz).
- *  @return     0 if successful.
- */
-int mpu_set_sample_rate(unsigned short rate)
-{
-    unsigned char data;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    if (st.chip_cfg.dmp_on)
-        return -1;
-    else {
-        if (st.chip_cfg.lp_accel_mode) {
-            if (rate && (rate <= 40)) {
-                /* Just stay in low-power accel mode. */
-                mpu_lp_accel_mode(rate);
-                return 0;
-            }
-            /* Requested rate exceeds the allowed frequencies in LP accel mode,
-             * switch back to full-power mode.
-             */
-            mpu_lp_accel_mode(0);
-        }
-        if (rate < 4)
-            rate = 4;
-        else if (rate > 1000)
-            rate = 1000;
-
-        data = 1000 / rate - 1;
-        if (i2c_write(st.hw->addr, st.reg->rate_div, 1, &data))
-            return -1;
-
-        st.chip_cfg.sample_rate = 1000 / (1 + data);
-
-#ifdef AK89xx_SECONDARY
-        mpu_set_compass_sample_rate(min(st.chip_cfg.compass_sample_rate, MAX_COMPASS_SAMPLE_RATE));
-#endif
-
-        /* Automatically set LPF to 1/2 sampling rate. */
-        mpu_set_lpf(st.chip_cfg.sample_rate >> 1);
-        return 0;
-    }
-}
-
-/**
- *  @brief      Get compass sampling rate.
- *  @param[out] rate    Current compass sampling rate (Hz).
- *  @return     0 if successful.
- */
-int mpu_get_compass_sample_rate(unsigned short *rate)
-{
-#ifdef AK89xx_SECONDARY
-    rate[0] = st.chip_cfg.compass_sample_rate;
-    return 0;
-#else
-    rate[0] = 0;
-    return -1;
-#endif
-}
-
-/**
- *  @brief      Set compass sampling rate.
- *  The compass on the auxiliary I2C bus is read by the MPU hardware at a
- *  maximum of 100Hz. The actual rate can be set to a fraction of the gyro
- *  sampling rate.
- *
- *  \n WARNING: The new rate may be different than what was requested. Call
- *  mpu_get_compass_sample_rate to check the actual setting.
- *  @param[in]  rate    Desired compass sampling rate (Hz).
- *  @return     0 if successful.
- */
-int mpu_set_compass_sample_rate(unsigned short rate)
-{
-#ifdef AK89xx_SECONDARY
-    unsigned char div;
-    if (!rate || rate > st.chip_cfg.sample_rate || rate > MAX_COMPASS_SAMPLE_RATE)
-        return -1;
-
-    div = st.chip_cfg.sample_rate / rate - 1;
-    if (i2c_write(st.hw->addr, st.reg->s4_ctrl, 1, &div))
-        return -1;
-    st.chip_cfg.compass_sample_rate = st.chip_cfg.sample_rate / (div + 1);
-    return 0;
-#else
-    return -1;
-#endif
-}
-
-/**
- *  @brief      Get gyro sensitivity scale factor.
- *  @param[out] sens    Conversion from hardware units to dps.
- *  @return     0 if successful.
- */
-int mpu_get_gyro_sens(float *sens)
-{
-    switch (st.chip_cfg.gyro_fsr) {
-    case INV_FSR_250DPS:
-        sens[0] = 131.f;
-        break;
-    case INV_FSR_500DPS:
-        sens[0] = 65.5f;
-        break;
-    case INV_FSR_1000DPS:
-        sens[0] = 32.8f;
-        break;
-    case INV_FSR_2000DPS:
-        sens[0] = 16.4f;
-        break;
-    default:
-        return -1;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Get accel sensitivity scale factor.
- *  @param[out] sens    Conversion from hardware units to g's.
- *  @return     0 if successful.
- */
-int mpu_get_accel_sens(unsigned short *sens)
-{
-    switch (st.chip_cfg.accel_fsr) {
-    case INV_FSR_2G:
-        sens[0] = 16384;
-        break;
-    case INV_FSR_4G:
-        sens[0] = 8092;
-        break;
-    case INV_FSR_8G:
-        sens[0] = 4096;
-        break;
-    case INV_FSR_16G:
-        sens[0] = 2048;
-        break;
-    default:
-        return -1;
-    }
-    if (st.chip_cfg.accel_half)
-        sens[0] >>= 1;
-    return 0;
-}
-
-/**
- *  @brief      Get current FIFO configuration.
- *  @e sensors can contain a combination of the following flags:
- *  \n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
- *  \n INV_XYZ_GYRO
- *  \n INV_XYZ_ACCEL
- *  @param[out] sensors Mask of sensors in FIFO.
- *  @return     0 if successful.
- */
-int mpu_get_fifo_config(unsigned char *sensors)
-{
-    sensors[0] = st.chip_cfg.fifo_enable;
-    return 0;
-}
-
-/**
- *  @brief      Select which sensors are pushed to FIFO.
- *  @e sensors can contain a combination of the following flags:
- *  \n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
- *  \n INV_XYZ_GYRO
- *  \n INV_XYZ_ACCEL
- *  @param[in]  sensors Mask of sensors to push to FIFO.
- *  @return     0 if successful.
- */
-int mpu_configure_fifo(unsigned char sensors)
-{
-    unsigned char prev;
-    int result = 0;
-
-    /* Compass data isn't going into the FIFO. Stop trying. */
-    sensors &= ~INV_XYZ_COMPASS;
-
-    if (st.chip_cfg.dmp_on)
-        return 0;
-    else {
-        if (!(st.chip_cfg.sensors))
-            return -1;
-        prev = st.chip_cfg.fifo_enable;
-        st.chip_cfg.fifo_enable = sensors & st.chip_cfg.sensors;
-        if (st.chip_cfg.fifo_enable != sensors)
-            /* You're not getting what you asked for. Some sensors are
-             * asleep.
-             */
-            result = -1;
-        else
-            result = 0;
-        if (sensors || st.chip_cfg.lp_accel_mode)
-            set_int_enable(1);
-        else
-            set_int_enable(0);
-        if (sensors) {
-            if (mpu_reset_fifo()) {
-                st.chip_cfg.fifo_enable = prev;
-                return -1;
-            }
-        }
-    }
-
-    return result;
-}
-
-/**
- *  @brief      Get current power state.
- *  @param[in]  power_on    1 if turned on, 0 if suspended.
- *  @return     0 if successful.
- */
-int mpu_get_power_state(unsigned char *power_on)
-{
-    if (st.chip_cfg.sensors)
-        power_on[0] = 1;
-    else
-        power_on[0] = 0;
-    return 0;
-}
-
-/**
- *  @brief      Turn specific sensors on/off.
- *  @e sensors can contain a combination of the following flags:
- *  \n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
- *  \n INV_XYZ_GYRO
- *  \n INV_XYZ_ACCEL
- *  \n INV_XYZ_COMPASS
- *  @param[in]  sensors    Mask of sensors to wake.
- *  @return     0 if successful.
- */
-int mpu_set_sensors(unsigned char sensors)
-{
-    unsigned char data;
-#ifdef AK89xx_SECONDARY
-    unsigned char user_ctrl;
-#endif
-
-    if (sensors & INV_XYZ_GYRO)
-        data = INV_CLK_PLL;
-    else if (sensors)
-        data = 0;
-    else
-        data = BIT_SLEEP;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, &data)) {
-        st.chip_cfg.sensors = 0;
-        return -1;
-    }
-    st.chip_cfg.clk_src = data & ~BIT_SLEEP;
-
-    data = 0;
-    if (!(sensors & INV_X_GYRO))
-        data |= BIT_STBY_XG;
-    if (!(sensors & INV_Y_GYRO))
-        data |= BIT_STBY_YG;
-    if (!(sensors & INV_Z_GYRO))
-        data |= BIT_STBY_ZG;
-    if (!(sensors & INV_XYZ_ACCEL))
-        data |= BIT_STBY_XYZA;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_2, 1, &data)) {
-        st.chip_cfg.sensors = 0;
-        return -1;
-    }
-
-    if (sensors && (sensors != INV_XYZ_ACCEL))
-        /* Latched interrupts only used in LP accel mode. */
-        mpu_set_int_latched(0);
-
-#ifdef AK89xx_SECONDARY
-#ifdef AK89xx_BYPASS
-    if (sensors & INV_XYZ_COMPASS)
-        mpu_set_bypass(1);
-    else
-        mpu_set_bypass(0);
-#else
-    if (i2c_read(st.hw->addr, st.reg->user_ctrl, 1, &user_ctrl))
-        return -1;
-    /* Handle AKM power management. */
-    if (sensors & INV_XYZ_COMPASS) {
-        data = AKM_SINGLE_MEASUREMENT;
-        user_ctrl |= BIT_AUX_IF_EN;
-    } else {
-        data = AKM_POWER_DOWN;
-        user_ctrl &= ~BIT_AUX_IF_EN;
-    }
-    if (st.chip_cfg.dmp_on)
-        user_ctrl |= BIT_DMP_EN;
-    else
-        user_ctrl &= ~BIT_DMP_EN;
-    if (i2c_write(st.hw->addr, st.reg->s1_do, 1, &data))
-        return -1;
-    /* Enable/disable I2C master mode. */
-    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &user_ctrl))
-        return -1;
-#endif
-#endif
-
-    st.chip_cfg.sensors = sensors;
-    st.chip_cfg.lp_accel_mode = 0;
-    delay_ms(50);
-    return 0;
-}
-
-/**
- *  @brief      Read the MPU interrupt status registers.
- *  @param[out] status  Mask of interrupt bits.
- *  @return     0 if successful.
- */
-int mpu_get_int_status(short *status)
-{
-    unsigned char tmp[2];
-    if (!st.chip_cfg.sensors)
-        return -1;
-    if (i2c_read(st.hw->addr, st.reg->dmp_int_status, 2, tmp))
-        return -1;
-    status[0] = (tmp[0] << 8) | tmp[1];
-    return 0;
-}
-
-/**
- *  @brief      Get one packet from the FIFO.
- *  If @e sensors does not contain a particular sensor, disregard the data
- *  returned to that pointer.
- *  \n @e sensors can contain a combination of the following flags:
- *  \n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
- *  \n INV_XYZ_GYRO
- *  \n INV_XYZ_ACCEL
- *  \n If the FIFO has no new data, @e sensors will be zero.
- *  \n If the FIFO is disabled, @e sensors will be zero and this function will
- *  return a non-zero error code.
- *  @param[out] gyro        Gyro data in hardware units.
- *  @param[out] accel       Accel data in hardware units.
- *  @param[out] timestamp   Timestamp in milliseconds.
- *  @param[out] sensors     Mask of sensors read from FIFO.
- *  @param[out] more        Number of remaining packets.
- *  @return     0 if successful.
- */
-int mpu_read_fifo(short *gyro, short *accel, unsigned long *timestamp,
-        unsigned char *sensors, unsigned char *more)
-{
-    /* Assumes maximum packet size is gyro (6) + accel (6). */
-    unsigned char data[MAX_PACKET_LENGTH];
-    unsigned char packet_size = 0;
-    unsigned short fifo_count, index = 0;
-
-    if (st.chip_cfg.dmp_on)
-        return -1;
-
-    sensors[0] = 0;
-    if (!st.chip_cfg.sensors)
-        return -1;
-    if (!st.chip_cfg.fifo_enable)
-        return -1;
-
-    if (st.chip_cfg.fifo_enable & INV_X_GYRO)
-        packet_size += 2;
-    if (st.chip_cfg.fifo_enable & INV_Y_GYRO)
-        packet_size += 2;
-    if (st.chip_cfg.fifo_enable & INV_Z_GYRO)
-        packet_size += 2;
-    if (st.chip_cfg.fifo_enable & INV_XYZ_ACCEL)
-        packet_size += 6;
-
-    if (i2c_read(st.hw->addr, st.reg->fifo_count_h, 2, data))
-        return -1;
-    fifo_count = (data[0] << 8) | data[1];
-    if (fifo_count < packet_size)
-        return 0;
-//    log_i("FIFO count: %hd\n", fifo_count);
-    if (fifo_count > (st.hw->max_fifo >> 1)) {
-        /* FIFO is 50% full, better check overflow bit. */
-        if (i2c_read(st.hw->addr, st.reg->int_status, 1, data))
-            return -1;
-        if (data[0] & BIT_FIFO_OVERFLOW) {
-            mpu_reset_fifo();
-            return -2;
-        }
-    }
-    get_ms((unsigned long*)timestamp);
-
-    if (i2c_read(st.hw->addr, st.reg->fifo_r_w, packet_size, data))
-        return -1;
-    more[0] = fifo_count / packet_size - 1;
-    sensors[0] = 0;
-
-    if ((index != packet_size) && st.chip_cfg.fifo_enable & INV_XYZ_ACCEL) {
-        accel[0] = (data[index+0] << 8) | data[index+1];
-        accel[1] = (data[index+2] << 8) | data[index+3];
-        accel[2] = (data[index+4] << 8) | data[index+5];
-        sensors[0] |= INV_XYZ_ACCEL;
-        index += 6;
-    }
-    if ((index != packet_size) && st.chip_cfg.fifo_enable & INV_X_GYRO) {
-        gyro[0] = (data[index+0] << 8) | data[index+1];
-        sensors[0] |= INV_X_GYRO;
-        index += 2;
-    }
-    if ((index != packet_size) && st.chip_cfg.fifo_enable & INV_Y_GYRO) {
-        gyro[1] = (data[index+0] << 8) | data[index+1];
-        sensors[0] |= INV_Y_GYRO;
-        index += 2;
-    }
-    if ((index != packet_size) && st.chip_cfg.fifo_enable & INV_Z_GYRO) {
-        gyro[2] = (data[index+0] << 8) | data[index+1];
-        sensors[0] |= INV_Z_GYRO;
-        index += 2;
-    }
-
-    return 0;
-}
-
-/**
- *  @brief      Get one unparsed packet from the FIFO.
- *  This function should be used if the packet is to be parsed elsewhere.
- *  @param[in]  length  Length of one FIFO packet.
- *  @param[in]  data    FIFO packet.
- *  @param[in]  more    Number of remaining packets.
- */
-int mpu_read_fifo_stream(unsigned short length, unsigned char *data,
-    unsigned char *more)
-{
-    unsigned char tmp[2];
-    unsigned short fifo_count;
-
-//    printf("addr %d, dmp_on %d, sensors %d\r\n", st.hw->addr, st.chip_cfg.dmp_on, st.chip_cfg.sensors);
-
-    if (!st.chip_cfg.dmp_on)
-        return -1;
-    if (!st.chip_cfg.sensors)
-        return -1;
-
-//    printf("----1\r\n");
-
-    if (i2c_read(st.hw->addr, st.reg->fifo_count_h, 2, tmp))
-        return -1;
-
-//    printf("----2\r\n");
-
-    fifo_count = (tmp[0] << 8) | tmp[1];
-    if (fifo_count < length) {
-        more[0] = 0;
-        return -1;
-    }
-
-//    printf("----3\r\n");
-    if (fifo_count > (st.hw->max_fifo >> 1)) {
-
-//        printf("----3.1\r\n");
-        /* FIFO is 50% full, better check overflow bit. */
-        if (i2c_read(st.hw->addr, st.reg->int_status, 1, tmp))
-            return -1;
-
-//        printf("----3.2\r\n");
-        if (tmp[0] & BIT_FIFO_OVERFLOW) {
-            mpu_reset_fifo();
-            return -2;
-        }
-    }
-
-//    printf("----4\r\n");
-    if (i2c_read(st.hw->addr, st.reg->fifo_r_w, length, data))
-        return -1;
-
-    more[0] = fifo_count / length - 1;
-    return 0;
-}
-
-/**
- *  @brief      Set device to bypass mode.
- *  @param[in]  bypass_on   1 to enable bypass mode.
- *  @return     0 if successful.
- */
-int mpu_set_bypass(unsigned char bypass_on)
-{
-    unsigned char tmp;
-
-    if (st.chip_cfg.bypass_mode == bypass_on)
-        return 0;
-
-    if (bypass_on) {
-        if (i2c_read(st.hw->addr, st.reg->user_ctrl, 1, &tmp))
-            return -1;
-        tmp &= ~BIT_AUX_IF_EN;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &tmp))
-            return -1;
-        delay_ms(3);
-        tmp = BIT_BYPASS_EN;
-        if (st.chip_cfg.active_low_int)
-            tmp |= BIT_ACTL;
-        if (st.chip_cfg.latched_int)
-            tmp |= BIT_LATCH_EN | BIT_ANY_RD_CLR;
-        if (i2c_write(st.hw->addr, st.reg->int_pin_cfg, 1, &tmp))
-            return -1;
-    } else {
-        /* Enable I2C master mode if compass is being used. */
-        if (i2c_read(st.hw->addr, st.reg->user_ctrl, 1, &tmp))
-            return -1;
-        if (st.chip_cfg.sensors & INV_XYZ_COMPASS)
-            tmp |= BIT_AUX_IF_EN;
-        else
-            tmp &= ~BIT_AUX_IF_EN;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &tmp))
-            return -1;
-        delay_ms(3);
-        if (st.chip_cfg.active_low_int)
-            tmp = BIT_ACTL;
-        else
-            tmp = 0;
-        if (st.chip_cfg.latched_int)
-            tmp |= BIT_LATCH_EN | BIT_ANY_RD_CLR;
-        if (i2c_write(st.hw->addr, st.reg->int_pin_cfg, 1, &tmp))
-            return -1;
-    }
-    st.chip_cfg.bypass_mode = bypass_on;
-    return 0;
-}
-
-/**
- *  @brief      Set interrupt level.
- *  @param[in]  active_low  1 for active low, 0 for active high.
- *  @return     0 if successful.
- */
-int mpu_set_int_level(unsigned char active_low)
-{
-    st.chip_cfg.active_low_int = active_low;
-    return 0;
-}
-
-/**
- *  @brief      Enable latched interrupts.
- *  Any MPU register will clear the interrupt.
- *  @param[in]  enable  1 to enable, 0 to disable.
- *  @return     0 if successful.
- */
-int mpu_set_int_latched(unsigned char enable)
-{
-    unsigned char tmp;
-    if (st.chip_cfg.latched_int == enable)
-        return 0;
-
-    if (enable)
-        tmp = BIT_LATCH_EN | BIT_ANY_RD_CLR;
-    else
-        tmp = 0;
-    if (st.chip_cfg.bypass_mode)
-        tmp |= BIT_BYPASS_EN;
-    if (st.chip_cfg.active_low_int)
-        tmp |= BIT_ACTL;
-    if (i2c_write(st.hw->addr, st.reg->int_pin_cfg, 1, &tmp))
-        return -1;
-    st.chip_cfg.latched_int = enable;
-    return 0;
-}
-
-#ifdef MPU6050
-static int get_accel_prod_shift(float *st_shift)
-{
-    unsigned char tmp[4], shift_code[3], ii;
-
-    if (i2c_read(st.hw->addr, 0x0D, 4, tmp))
-        return 0x07;
-
-    shift_code[0] = ((tmp[0] & 0xE0) >> 3) | ((tmp[3] & 0x30) >> 4);
-    shift_code[1] = ((tmp[1] & 0xE0) >> 3) | ((tmp[3] & 0x0C) >> 2);
-    shift_code[2] = ((tmp[2] & 0xE0) >> 3) | (tmp[3] & 0x03);
-    for (ii = 0; ii < 3; ii++) {
-        if (!shift_code[ii]) {
-            st_shift[ii] = 0.f;
-            continue;
-        }
-        /* Equivalent to..
-         * st_shift[ii] = 0.34f * powf(0.92f/0.34f, (shift_code[ii]-1) / 30.f)
-         */
-        st_shift[ii] = 0.34f;
-        while (--shift_code[ii])
-            st_shift[ii] *= 1.034f;
-    }
-    return 0;
-}
-
-static int accel_self_test(long *bias_regular, long *bias_st)
-{
-    int jj, result = 0;
-    float st_shift[3], st_shift_cust, st_shift_var;
-
-    get_accel_prod_shift(st_shift);
-    for(jj = 0; jj < 3; jj++) {
-        st_shift_cust = labs(bias_regular[jj] - bias_st[jj]) / 65536.f;
-        if (st_shift[jj]) {
-            st_shift_var = st_shift_cust / st_shift[jj] - 1.f;
-            if (fabs(st_shift_var) > test.max_accel_var)
-                result |= 1 << jj;
-        } else if ((st_shift_cust < test.min_g) ||
-            (st_shift_cust > test.max_g))
-            result |= 1 << jj;
-    }
-
-    return result;
-}
-
-static int gyro_self_test(long *bias_regular, long *bias_st)
-{
-    int jj, result = 0;
-    unsigned char tmp[3];
-    float st_shift, st_shift_cust, st_shift_var;
-
-    if (i2c_read(st.hw->addr, 0x0D, 3, tmp))
-        return 0x07;
-
-    tmp[0] &= 0x1F;
-    tmp[1] &= 0x1F;
-    tmp[2] &= 0x1F;
-
-    for (jj = 0; jj < 3; jj++) {
-        st_shift_cust = labs(bias_regular[jj] - bias_st[jj]) / 65536.f;
-        if (tmp[jj]) {
-            st_shift = 3275.f / test.gyro_sens;
-            while (--tmp[jj])
-                st_shift *= 1.046f;
-            st_shift_var = st_shift_cust / st_shift - 1.f;
-            if (fabs(st_shift_var) > test.max_gyro_var)
-                result |= 1 << jj;
-        } else if ((st_shift_cust < test.min_dps) ||
-            (st_shift_cust > test.max_dps))
-            result |= 1 << jj;
-    }
-    return result;
-}
-
-#ifdef AK89xx_SECONDARY
-static int compass_self_test(void)
-{
-    unsigned char tmp[6];
-    unsigned char tries = 10;
-    int result = 0x07;
-    short data;
-
-    mpu_set_bypass(1);
-
-    tmp[0] = AKM_POWER_DOWN;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, tmp))
-        return 0x07;
-    tmp[0] = AKM_BIT_SELF_TEST;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_ASTC, 1, tmp))
-        goto AKM_restore;
-    tmp[0] = AKM_MODE_SELF_TEST;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, tmp))
-        goto AKM_restore;
-
-    do {
-        delay_ms(10);
-        if (i2c_read(st.chip_cfg.compass_addr, AKM_REG_ST1, 1, tmp))
-            goto AKM_restore;
-        if (tmp[0] & AKM_DATA_READY)
-            break;
-    } while (tries--);
-    if (!(tmp[0] & AKM_DATA_READY))
-        goto AKM_restore;
-
-    if (i2c_read(st.chip_cfg.compass_addr, AKM_REG_HXL, 6, tmp))
-        goto AKM_restore;
-
-    result = 0;
-    data = (short)(tmp[1] << 8) | tmp[0];
-    if ((data > 100) || (data < -100))
-        result |= 0x01;
-    data = (short)(tmp[3] << 8) | tmp[2];
-    if ((data > 100) || (data < -100))
-        result |= 0x02;
-    data = (short)(tmp[5] << 8) | tmp[4];
-    if ((data > -300) || (data < -1000))
-        result |= 0x04;
-
-AKM_restore:
-    tmp[0] = 0 | SUPPORTS_AK89xx_HIGH_SENS;
-    i2c_write(st.chip_cfg.compass_addr, AKM_REG_ASTC, 1, tmp);
-    tmp[0] = SUPPORTS_AK89xx_HIGH_SENS;
-    i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, tmp);
-    mpu_set_bypass(0);
-    return result;
-}
-#endif
-#endif
-
-static int get_st_biases(long *gyro, long *accel, unsigned char hw_test)
-{
-    unsigned char data[MAX_PACKET_LENGTH];
-    unsigned char packet_count, ii;
-    unsigned short fifo_count;
-
-    data[0] = 0x01;
-    data[1] = 0;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 2, data))
-        return -1;
-    delay_ms(200);
-    data[0] = 0;
-    if (i2c_write(st.hw->addr, st.reg->int_enable, 1, data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->i2c_mst, 1, data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, data))
-        return -1;
-    data[0] = BIT_FIFO_RST | BIT_DMP_RST;
-    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, data))
-        return -1;
-    delay_ms(15);
-    data[0] = st.test->reg_lpf;
-    if (i2c_write(st.hw->addr, st.reg->lpf, 1, data))
-        return -1;
-    data[0] = st.test->reg_rate_div;
-    if (i2c_write(st.hw->addr, st.reg->rate_div, 1, data))
-        return -1;
-    if (hw_test)
-        data[0] = st.test->reg_gyro_fsr | 0xE0;
-    else
-        data[0] = st.test->reg_gyro_fsr;
-    if (i2c_write(st.hw->addr, st.reg->gyro_cfg, 1, data))
-        return -1;
-
-    if (hw_test)
-        data[0] = st.test->reg_accel_fsr | 0xE0;
-    else
-        data[0] = test.reg_accel_fsr;
-    if (i2c_write(st.hw->addr, st.reg->accel_cfg, 1, data))
-        return -1;
-    if (hw_test)
-        delay_ms(200);
-
-    /* Fill FIFO for test.wait_ms milliseconds. */
-    data[0] = BIT_FIFO_EN;
-    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, data))
-        return -1;
-
-    data[0] = INV_XYZ_GYRO | INV_XYZ_ACCEL;
-    if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, data))
-        return -1;
-    delay_ms(test.wait_ms);
-    data[0] = 0;
-    if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, data))
-        return -1;
-
-    if (i2c_read(st.hw->addr, st.reg->fifo_count_h, 2, data))
-        return -1;
-
-    fifo_count = (data[0] << 8) | data[1];
-    packet_count = fifo_count / MAX_PACKET_LENGTH;
-    gyro[0] = gyro[1] = gyro[2] = 0;
-    accel[0] = accel[1] = accel[2] = 0;
-
-    for (ii = 0; ii < packet_count; ii++) {
-        short accel_cur[3], gyro_cur[3];
-        if (i2c_read(st.hw->addr, st.reg->fifo_r_w, MAX_PACKET_LENGTH, data))
-            return -1;
-        accel_cur[0] = ((short)data[0] << 8) | data[1];
-        accel_cur[1] = ((short)data[2] << 8) | data[3];
-        accel_cur[2] = ((short)data[4] << 8) | data[5];
-        accel[0] += (long)accel_cur[0];
-        accel[1] += (long)accel_cur[1];
-        accel[2] += (long)accel_cur[2];
-        gyro_cur[0] = (((short)data[6] << 8) | data[7]);
-        gyro_cur[1] = (((short)data[8] << 8) | data[9]);
-        gyro_cur[2] = (((short)data[10] << 8) | data[11]);
-        gyro[0] += (long)gyro_cur[0];
-        gyro[1] += (long)gyro_cur[1];
-        gyro[2] += (long)gyro_cur[2];
-    }
-#ifdef EMPL_NO_64BIT
-    gyro[0] = (long)(((float)gyro[0]*65536.f) / test.gyro_sens / packet_count);
-    gyro[1] = (long)(((float)gyro[1]*65536.f) / test.gyro_sens / packet_count);
-    gyro[2] = (long)(((float)gyro[2]*65536.f) / test.gyro_sens / packet_count);
-    if (has_accel) {
-        accel[0] = (long)(((float)accel[0]*65536.f) / test.accel_sens /
-            packet_count);
-        accel[1] = (long)(((float)accel[1]*65536.f) / test.accel_sens /
-            packet_count);
-        accel[2] = (long)(((float)accel[2]*65536.f) / test.accel_sens /
-            packet_count);
-        /* Don't remove gravity! */
-        accel[2] -= 65536L;
-    }
-#else
-    gyro[0] = (long)(((long long)gyro[0]<<16) / test.gyro_sens / packet_count);
-    gyro[1] = (long)(((long long)gyro[1]<<16) / test.gyro_sens / packet_count);
-    gyro[2] = (long)(((long long)gyro[2]<<16) / test.gyro_sens / packet_count);
-    accel[0] = (long)(((long long)accel[0]<<16) / test.accel_sens /
-        packet_count);
-    accel[1] = (long)(((long long)accel[1]<<16) / test.accel_sens /
-        packet_count);
-    accel[2] = (long)(((long long)accel[2]<<16) / test.accel_sens /
-        packet_count);
-    /* Don't remove gravity! */
-    if (accel[2] > 0L)
-        accel[2] -= 65536L;
-    else
-        accel[2] += 65536L;
-#endif
-
-    return 0;
-}
-
-/**
- *  @brief      Trigger gyro/accel/compass self-test.
- *  On success/error, the self-test returns a mask representing the sensor(s)
- *  that failed. For each bit, a one (1) represents a "pass" case; conversely,
- *  a zero (0) indicates a failure.
- *
- *  \n The mask is defined as follows:
- *  \n Bit 0:   Gyro.
- *  \n Bit 1:   Accel.
- *  \n Bit 2:   Compass.
- *
- *  \n Currently, the hardware self-test is unsupported for MPU6500. However,
- *  this function can still be used to obtain the accel and gyro biases.
- *
- *  \n This function must be called with the device either face-up or face-down
- *  (z-axis is parallel to gravity).
- *  @param[out] gyro        Gyro biases in q16 format.
- *  @param[out] accel       Accel biases (if applicable) in q16 format.
- *  @return     Result mask (see above).
- */
-int mpu_run_self_test(long *gyro, long *accel)
-{
-#ifdef MPU6050
-    const unsigned char tries = 2;
-    long gyro_st[3], accel_st[3];
-    unsigned char accel_result, gyro_result;
-#ifdef AK89xx_SECONDARY
-    unsigned char compass_result;
-#endif
-    int ii;
-#endif
-    int result;
-    unsigned char accel_fsr, fifo_sensors, sensors_on;
-    unsigned short gyro_fsr, sample_rate, lpf;
-    unsigned char dmp_was_on;
-
-    if (st.chip_cfg.dmp_on) {
-        mpu_set_dmp_state(0);
-        dmp_was_on = 1;
-    } else
-        dmp_was_on = 0;
-
-    /* Get initial settings. */
-    mpu_get_gyro_fsr(&gyro_fsr);
-    mpu_get_accel_fsr(&accel_fsr);
-    mpu_get_lpf(&lpf);
-    mpu_get_sample_rate(&sample_rate);
-    sensors_on = st.chip_cfg.sensors;
-    mpu_get_fifo_config(&fifo_sensors);
-
-    /* For older chips, the self-test will be different. */
-#if defined MPU6050
-    for (ii = 0; ii < tries; ii++)
-        if (!get_st_biases(gyro, accel, 0))
-            break;
-    if (ii == tries) {
-        /* If we reach this point, we most likely encountered an I2C error.
-         * We'll just report an error for all three sensors.
-         */
-        result = 0;
-        goto restore;
-    }
-    for (ii = 0; ii < tries; ii++)
-        if (!get_st_biases(gyro_st, accel_st, 1))
-            break;
-    if (ii == tries) {
-        /* Again, probably an I2C error. */
-        result = 0;
-        goto restore;
-    }
-    accel_result = accel_self_test(accel, accel_st);
-    gyro_result = gyro_self_test(gyro, gyro_st);
-
-    result = 0;
-    if (!gyro_result)
-        result |= 0x01;
-    if (!accel_result)
-        result |= 0x02;
-
-#ifdef AK89xx_SECONDARY
-    compass_result = compass_self_test();
-    if (!compass_result)
-        result |= 0x04;
-#endif
-restore:
-#elif defined MPU6500
-    /* For now, this function will return a "pass" result for all three sensors
-     * for compatibility with current test applications.
-     */
-    get_st_biases(gyro, accel, 0);
-    result = 0x7;
-#endif
-    /* Set to invalid values to ensure no I2C writes are skipped. */
-    st.chip_cfg.gyro_fsr = 0xFF;
-    st.chip_cfg.accel_fsr = 0xFF;
-    st.chip_cfg.lpf = 0xFF;
-    st.chip_cfg.sample_rate = 0xFFFF;
-    st.chip_cfg.sensors = 0xFF;
-    st.chip_cfg.fifo_enable = 0xFF;
-    st.chip_cfg.clk_src = INV_CLK_PLL;
-    mpu_set_gyro_fsr(gyro_fsr);
-    mpu_set_accel_fsr(accel_fsr);
-    mpu_set_lpf(lpf);
-    mpu_set_sample_rate(sample_rate);
-    mpu_set_sensors(sensors_on);
-    mpu_configure_fifo(fifo_sensors);
-
-    if (dmp_was_on)
-        mpu_set_dmp_state(1);
-
-    return result;
-}
-
-/**
- *  @brief      Write to the DMP memory.
- *  This function prevents I2C writes past the bank boundaries. The DMP memory
- *  is only accessible when the chip is awake.
- *  @param[in]  mem_addr    Memory location (bank << 8 | start address)
- *  @param[in]  length      Number of bytes to write.
- *  @param[in]  data        Bytes to write to memory.
- *  @return     0 if successful.
- */
-int mpu_write_mem(unsigned short mem_addr, unsigned short length,
-        unsigned char *data)
-{
-    unsigned char tmp[2];
-
-    if (!data)
-        return -1;
-    if (!st.chip_cfg.sensors)
-        return -1;
-
-    tmp[0] = (unsigned char)(mem_addr >> 8);
-    tmp[1] = (unsigned char)(mem_addr & 0xFF);
-
-    /* Check bank boundaries. */
-    if (tmp[1] + length > st.hw->bank_size)
-        return -1;
-
-    if (i2c_write(st.hw->addr, st.reg->bank_sel, 2, tmp))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->mem_r_w, length, data))
-        return -1;
-    return 0;
-}
-
-/**
- *  @brief      Read from the DMP memory.
- *  This function prevents I2C reads past the bank boundaries. The DMP memory
- *  is only accessible when the chip is awake.
- *  @param[in]  mem_addr    Memory location (bank << 8 | start address)
- *  @param[in]  length      Number of bytes to read.
- *  @param[out] data        Bytes read from memory.
- *  @return     0 if successful.
- */
-int mpu_read_mem(unsigned short mem_addr, unsigned short length,
-        unsigned char *data)
-{
-    unsigned char tmp[2];
-
-    if (!data)
-        return -1;
-    if (!st.chip_cfg.sensors)
-        return -1;
-
-    tmp[0] = (unsigned char)(mem_addr >> 8);
-    tmp[1] = (unsigned char)(mem_addr & 0xFF);
-
-    /* Check bank boundaries. */
-    if (tmp[1] + length > st.hw->bank_size)
-        return -1;
-
-    if (i2c_write(st.hw->addr, st.reg->bank_sel, 2, tmp))
-        return -1;
-    if (i2c_read(st.hw->addr, st.reg->mem_r_w, length, data))
-        return -1;
-    return 0;
-}
-
-/**
- *  @brief      Load and verify DMP image.
- *  @param[in]  length      Length of DMP image.
- *  @param[in]  firmware    DMP code.
- *  @param[in]  start_addr  Starting address of DMP code memory.
- *  @param[in]  sample_rate Fixed sampling rate used when DMP is enabled.
- *  @return     0 if successful.
- */
-int mpu_load_firmware(unsigned short length, const unsigned char *firmware,
-    unsigned short start_addr, unsigned short sample_rate)
-{
-    unsigned short ii;
-    unsigned short this_write;
-    /* Must divide evenly into st.hw->bank_size to avoid bank crossings. */
-#define LOAD_CHUNK  (16)
-    unsigned char cur[LOAD_CHUNK], tmp[2];
-
-    if (st.chip_cfg.dmp_loaded)
-        /* DMP should only be loaded once. */
-        return -1;
-
-    if (!firmware)
-        return -1;
-    for (ii = 0; ii < length; ii += this_write) {
-        this_write = min(LOAD_CHUNK, length - ii);
-        if (mpu_write_mem(ii, this_write, (unsigned char*)&firmware[ii]))
-            return -1;
-        if (mpu_read_mem(ii, this_write, cur))
-            return -1;
-        if (memcmp(firmware+ii, cur, this_write))
-            return -2;
-    }
-
-    /* Set program start address. */
-    tmp[0] = start_addr >> 8;
-    tmp[1] = start_addr & 0xFF;
-    if (i2c_write(st.hw->addr, st.reg->prgm_start_h, 2, tmp))
-        return -1;
-
-    st.chip_cfg.dmp_loaded = 1;
-    st.chip_cfg.dmp_sample_rate = sample_rate;
-    return 0;
-}
-
-/**
- *  @brief      Enable/disable DMP support.
- *  @param[in]  enable  1 to turn on the DMP.
- *  @return     0 if successful.
- */
-int mpu_set_dmp_state(unsigned char enable)
-{
-    unsigned char tmp;
-    if (st.chip_cfg.dmp_on == enable)
-        return 0;
-
-    if (enable) {
-        if (!st.chip_cfg.dmp_loaded)
-            return -1;
-        /* Disable data ready interrupt. */
-        set_int_enable(0);
-        /* Disable bypass mode. */
-        mpu_set_bypass(0);
-        /* Keep constant sample rate, FIFO rate controlled by DMP. */
-        mpu_set_sample_rate(st.chip_cfg.dmp_sample_rate);
-        /* Remove FIFO elements. */
-        tmp = 0;
-        i2c_write(st.hw->addr, 0x23, 1, &tmp);
-        st.chip_cfg.dmp_on = 1;
-        /* Enable DMP interrupt. */
-        set_int_enable(1);
-        mpu_reset_fifo();
-    } else {
-        /* Disable DMP interrupt. */
-        set_int_enable(0);
-        /* Restore FIFO settings. */
-        tmp = st.chip_cfg.fifo_enable;
-        i2c_write(st.hw->addr, 0x23, 1, &tmp);
-        st.chip_cfg.dmp_on = 0;
-        mpu_reset_fifo();
-    }
-    return 0;
-}
-
-/**
- *  @brief      Get DMP state.
- *  @param[out] enabled 1 if enabled.
- *  @return     0 if successful.
- */
-int mpu_get_dmp_state(unsigned char *enabled)
-{
-    enabled[0] = st.chip_cfg.dmp_on;
-    return 0;
-}
-
-
-/* This initialization is similar to the one in ak8975.c. */
-static int setup_compass(void)
-{
-#ifdef AK89xx_SECONDARY
-    unsigned char data[4], akm_addr;
-
-    mpu_set_bypass(1);
-
-    /* Find compass. Possible addresses range from 0x0C to 0x0F. */
-    for (akm_addr = 0x0C; akm_addr <= 0x0F; akm_addr++) {
-        int result;
-        result = i2c_read(akm_addr, AKM_REG_WHOAMI, 1, data);
-        if (!result && (data[0] == AKM_WHOAMI))
-            break;
-    }
-
-    if (akm_addr > 0x0F) {
-        /* TODO: Handle this case in all compass-related functions. */
-        log_e("Compass not found.\n");
-        return -1;
-    }
-
-    st.chip_cfg.compass_addr = akm_addr;
-
-    data[0] = AKM_POWER_DOWN;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, data))
-        return -1;
-    delay_ms(1);
-
-    data[0] = AKM_FUSE_ROM_ACCESS;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, data))
-        return -1;
-    delay_ms(1);
-
-    /* Get sensitivity adjustment data from fuse ROM. */
-    if (i2c_read(st.chip_cfg.compass_addr, AKM_REG_ASAX, 3, data))
-        return -1;
-    st.chip_cfg.mag_sens_adj[0] = (long)data[0] + 128;
-    st.chip_cfg.mag_sens_adj[1] = (long)data[1] + 128;
-    st.chip_cfg.mag_sens_adj[2] = (long)data[2] + 128;
-
-    data[0] = AKM_POWER_DOWN;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, data))
-        return -1;
-    delay_ms(1);
-
-    mpu_set_bypass(0);
-
-    /* Set up master mode, master clock, and ES bit. */
-    data[0] = 0x40;
-    if (i2c_write(st.hw->addr, st.reg->i2c_mst, 1, data))
-        return -1;
-
-    /* Slave 0 reads from AKM data registers. */
-    data[0] = BIT_I2C_READ | st.chip_cfg.compass_addr;
-    if (i2c_write(st.hw->addr, st.reg->s0_addr, 1, data))
-        return -1;
-
-    /* Compass reads start at this register. */
-    data[0] = AKM_REG_ST1;
-    if (i2c_write(st.hw->addr, st.reg->s0_reg, 1, data))
-        return -1;
-
-    /* Enable slave 0, 8-byte reads. */
-    data[0] = BIT_SLAVE_EN | 8;
-    if (i2c_write(st.hw->addr, st.reg->s0_ctrl, 1, data))
-        return -1;
-
-    /* Slave 1 changes AKM measurement mode. */
-    data[0] = st.chip_cfg.compass_addr;
-    if (i2c_write(st.hw->addr, st.reg->s1_addr, 1, data))
-        return -1;
-
-    /* AKM measurement mode register. */
-    data[0] = AKM_REG_CNTL;
-    if (i2c_write(st.hw->addr, st.reg->s1_reg, 1, data))
-        return -1;
-
-    /* Enable slave 1, 1-byte writes. */
-    data[0] = BIT_SLAVE_EN | 1;
-    if (i2c_write(st.hw->addr, st.reg->s1_ctrl, 1, data))
-        return -1;
-
-    /* Set slave 1 data. */
-    data[0] = AKM_SINGLE_MEASUREMENT;
-    if (i2c_write(st.hw->addr, st.reg->s1_do, 1, data))
-        return -1;
-
-    /* Trigger slave 0 and slave 1 actions at each sample. */
-    data[0] = 0x03;
-    if (i2c_write(st.hw->addr, st.reg->i2c_delay_ctrl, 1, data))
-        return -1;
-
-#ifdef MPU9150
-    /* For the MPU9150, the auxiliary I2C bus needs to be set to VDD. */
-    data[0] = BIT_I2C_MST_VDDIO;
-    if (i2c_write(st.hw->addr, st.reg->yg_offs_tc, 1, data))
-        return -1;
-#endif
-
-    return 0;
-#else
-    return -1;
-#endif
-}
-
-/**
- *  @brief      Read raw compass data.
- *  @param[out] data        Raw data in hardware units.
- *  @param[out] timestamp   Timestamp in milliseconds. Null if not needed.
- *  @return     0 if successful.
- */
-int mpu_get_compass_reg(short *data, unsigned long *timestamp)
-{
-#ifdef AK89xx_SECONDARY
-    unsigned char tmp[9];
-
-    if (!(st.chip_cfg.sensors & INV_XYZ_COMPASS))
-        return -1;
-
-#ifdef AK89xx_BYPASS
-    if (i2c_read(st.chip_cfg.compass_addr, AKM_REG_ST1, 8, tmp))
-        return -1;
-    tmp[8] = AKM_SINGLE_MEASUREMENT;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, tmp+8))
-        return -1;
-#else
-    if (i2c_read(st.hw->addr, st.reg->raw_compass, 8, tmp))
-        return -1;
-#endif
-
-#if defined AK8975_SECONDARY
-    /* AK8975 doesn't have the overrun error bit. */
-    if (!(tmp[0] & AKM_DATA_READY))
-        return -2;
-    if ((tmp[7] & AKM_OVERFLOW) || (tmp[7] & AKM_DATA_ERROR))
-        return -3;
-#elif defined AK8963_SECONDARY
-    /* AK8963 doesn't have the data read error bit. */
-    if (!(tmp[0] & AKM_DATA_READY) || (tmp[0] & AKM_DATA_OVERRUN))
-        return -2;
-    if (tmp[7] & AKM_OVERFLOW)
-        return -3;
-#endif
-    data[0] = (tmp[2] << 8) | tmp[1];
-    data[1] = (tmp[4] << 8) | tmp[3];
-    data[2] = (tmp[6] << 8) | tmp[5];
-
-    data[0] = ((long)data[0] * st.chip_cfg.mag_sens_adj[0]) >> 8;
-    data[1] = ((long)data[1] * st.chip_cfg.mag_sens_adj[1]) >> 8;
-    data[2] = ((long)data[2] * st.chip_cfg.mag_sens_adj[2]) >> 8;
-
-    if (timestamp)
-        get_ms(timestamp);
-    return 0;
-#else
-    return -1;
-#endif
-}
-
-/**
- *  @brief      Get the compass full-scale range.
- *  @param[out] fsr Current full-scale range.
- *  @return     0 if successful.
- */
-int mpu_get_compass_fsr(unsigned short *fsr)
-{
-#ifdef AK89xx_SECONDARY
-    fsr[0] = st.hw->compass_fsr;
-    return 0;
-#else
-    return -1;
-#endif
-}
-
-/**
- *  @brief      Enters LP accel motion interrupt mode.
- *  The behaviour of this feature is very different between the MPU6050 and the
- *  MPU6500. Each chip's version of this feature is explained below.
- *
- *  \n The hardware motion threshold can be between 32mg and 8160mg in 32mg
- *  increments.
- *
- *  \n Low-power accel mode supports the following frequencies:
- *  \n 1.25Hz, 5Hz, 20Hz, 40Hz
- *
- *  \n MPU6500:
- *  \n Unlike the MPU6050 version, the hardware does not "lock in" a reference
- *  sample. The hardware monitors the accel data and detects any large change
- *  over a short period of time.
- *
- *  \n The hardware motion threshold can be between 4mg and 1020mg in 4mg
- *  increments.
- *
- *  \n MPU6500 Low-power accel mode supports the following frequencies:
- *  \n 1.25Hz, 2.5Hz, 5Hz, 10Hz, 20Hz, 40Hz, 80Hz, 160Hz, 320Hz, 640Hz
- *
- *  \n\n NOTES:
- *  \n The driver will round down @e thresh to the nearest supported value if
- *  an unsupported threshold is selected.
- *  \n To select a fractional wake-up frequency, round down the value passed to
- *  @e lpa_freq.
- *  \n The MPU6500 does not support a delay parameter. If this function is used
- *  for the MPU6500, the value passed to @e time will be ignored.
- *  \n To disable this mode, set @e lpa_freq to zero. The driver will restore
- *  the previous configuration.
- *
- *  @param[in]  thresh      Motion threshold in mg.
- *  @param[in]  time        Duration in milliseconds that the accel data must
- *                          exceed @e thresh before motion is reported.
- *  @param[in]  lpa_freq    Minimum sampling rate, or zero to disable.
- *  @return     0 if successful.
- */
-int mpu_lp_motion_interrupt(unsigned short thresh, unsigned char time,
-    unsigned char lpa_freq)
-{
-    unsigned char data[3];
-
-    if (lpa_freq) {
-        unsigned char thresh_hw;
-
-#if defined MPU6500
-        /* 1LSb = 4mg. */
-        if (thresh > 1020)
-            thresh_hw = 255;
-        else if (thresh < 4)
-            thresh_hw = 1;
-        else
-            thresh_hw = thresh >> 2;
-#endif
-
-        if (!time)
-            /* Minimum duration must be 1ms. */
-            time = 1;
-
-#if defined MPU6500
-        if (lpa_freq > 640)
-#endif
-            /* At this point, the chip has not been re-configured, so the
-             * function can safely exit.
-             */
-            return -1;
-
-        if (!st.chip_cfg.int_motion_only) {
-            /* Store current settings for later. */
-            if (st.chip_cfg.dmp_on) {
-                mpu_set_dmp_state(0);
-                st.chip_cfg.cache.dmp_on = 1;
-            } else
-                st.chip_cfg.cache.dmp_on = 0;
-            mpu_get_gyro_fsr(&st.chip_cfg.cache.gyro_fsr);
-            mpu_get_accel_fsr(&st.chip_cfg.cache.accel_fsr);
-            mpu_get_lpf(&st.chip_cfg.cache.lpf);
-            mpu_get_sample_rate(&st.chip_cfg.cache.sample_rate);
-            st.chip_cfg.cache.sensors_on = st.chip_cfg.sensors;
-            mpu_get_fifo_config(&st.chip_cfg.cache.fifo_sensors);
-        }
-
-#if defined MPU6500
-        /* Disable hardware interrupts. */
-        set_int_enable(0);
-
-        /* Enter full-power accel-only mode, no FIFO/DMP. */
-        data[0] = 0;
-        data[1] = 0;
-        data[2] = BIT_STBY_XYZG;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 3, data))
-            goto lp_int_restore;
-
-        /* Set motion threshold. */
-        data[0] = thresh_hw;
-        if (i2c_write(st.hw->addr, st.reg->motion_thr, 1, data))
-            goto lp_int_restore;
-
-        /* Set wake frequency. */
-        if (lpa_freq == 1)
-            data[0] = INV_LPA_1_25HZ;
-        else if (lpa_freq == 2)
-            data[0] = INV_LPA_2_5HZ;
-        else if (lpa_freq <= 5)
-            data[0] = INV_LPA_5HZ;
-        else if (lpa_freq <= 10)
-            data[0] = INV_LPA_10HZ;
-        else if (lpa_freq <= 20)
-            data[0] = INV_LPA_20HZ;
-        else if (lpa_freq <= 40)
-            data[0] = INV_LPA_40HZ;
-        else if (lpa_freq <= 80)
-            data[0] = INV_LPA_80HZ;
-        else if (lpa_freq <= 160)
-            data[0] = INV_LPA_160HZ;
-        else if (lpa_freq <= 320)
-            data[0] = INV_LPA_320HZ;
-        else
-            data[0] = INV_LPA_640HZ;
-        if (i2c_write(st.hw->addr, st.reg->lp_accel_odr, 1, data))
-            goto lp_int_restore;
-
-        /* Enable motion interrupt (MPU6500 version). */
-        data[0] = BITS_WOM_EN;
-        if (i2c_write(st.hw->addr, st.reg->accel_intel, 1, data))
-            goto lp_int_restore;
-
-        /* Enable cycle mode. */
-        data[0] = BIT_LPA_CYCLE;
-        if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, data))
-            goto lp_int_restore;
-
-        /* Enable interrupt. */
-        data[0] = BIT_MOT_INT_EN;
-        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, data))
-            goto lp_int_restore;
-
-        st.chip_cfg.int_motion_only = 1;
-        return 0;
-#endif
-    } else {
-        /* Don't "restore" the previous state if no state has been saved. */
-        int ii;
-        char *cache_ptr = (char*)&st.chip_cfg.cache;
-        for (ii = 0; ii < sizeof(st.chip_cfg.cache); ii++) {
-            if (cache_ptr[ii] != 0)
-                goto lp_int_restore;
-        }
-        /* If we reach this point, motion interrupt mode hasn't been used yet. */
-        return -1;
-    }
-lp_int_restore:
-    /* Set to invalid values to ensure no I2C writes are skipped. */
-    st.chip_cfg.gyro_fsr = 0xFF;
-    st.chip_cfg.accel_fsr = 0xFF;
-    st.chip_cfg.lpf = 0xFF;
-    st.chip_cfg.sample_rate = 0xFFFF;
-    st.chip_cfg.sensors = 0xFF;
-    st.chip_cfg.fifo_enable = 0xFF;
-    st.chip_cfg.clk_src = INV_CLK_PLL;
-    mpu_set_sensors(st.chip_cfg.cache.sensors_on);
-    mpu_set_gyro_fsr(st.chip_cfg.cache.gyro_fsr);
-    mpu_set_accel_fsr(st.chip_cfg.cache.accel_fsr);
-    mpu_set_lpf(st.chip_cfg.cache.lpf);
-    mpu_set_sample_rate(st.chip_cfg.cache.sample_rate);
-    mpu_configure_fifo(st.chip_cfg.cache.fifo_sensors);
-
-    if (st.chip_cfg.cache.dmp_on)
-        mpu_set_dmp_state(1);
-
-#ifdef MPU6500
-    /* Disable motion interrupt (MPU6500 version). */
-    data[0] = 0;
-    if (i2c_write(st.hw->addr, st.reg->accel_intel, 1, data))
-        goto lp_int_restore;
-#endif
-
-    st.chip_cfg.int_motion_only = 0;
-    return 0;
-}
-
-/**
- *  @}
- */
-

+ 0 - 132
Core备份3/imu2/inv_mpu2.h

@@ -1,132 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011-2012 InvenSense Corporation, All Rights Reserved.
-    See included License.txt for License information.
- $
- */
-/**
- *  @addtogroup  DRIVERS Sensor Driver Layer
- *  @brief       Hardware drivers to communicate with sensors via I2C.
- *
- *  @{
- *      @file       inv_mpu.h
- *      @brief      An I2C-based driver for Invensense gyroscopes.
- *      @details    This driver currently works for the following devices:
- *                  MPU6050
- *                  MPU6500
- *                  MPU9150 (or MPU6050 w/ AK8975 on the auxiliary bus)
- *                  MPU9250 (or MPU6500 w/ AK8963 on the auxiliary bus)
- */
-
-#ifndef _INV_MPU_H_
-#define _INV_MPU_H_
-
-#define MOTION_DRIVER_TARGET_STM32
-#define MPU6050
-//#define EMPL
-//#define USE_DMP
-
-#define INV_X_GYRO      (0x40)
-#define INV_Y_GYRO      (0x20)
-#define INV_Z_GYRO      (0x10)
-#define INV_XYZ_GYRO    (INV_X_GYRO | INV_Y_GYRO | INV_Z_GYRO)
-#define INV_XYZ_ACCEL   (0x08)
-#define INV_XYZ_COMPASS (0x01)
-
-struct int_param_s {
-#if defined EMPL_TARGET_MSP430 || defined MOTION_DRIVER_TARGET_MSP430 || defined MOTION_DRIVER_TARGET_STM32
-    void (*cb)(void);
-    unsigned short pin;
-    unsigned char lp_exit;
-    unsigned char active_low;
-#elif defined EMPL_TARGET_UC3L0
-    unsigned long pin;
-    void (*cb)(volatile void*);
-    void *arg;
-#endif
-};
-
-#define MPU_INT_STATUS_DATA_READY       (0x0001)
-#define MPU_INT_STATUS_DMP              (0x0002)
-#define MPU_INT_STATUS_PLL_READY        (0x0004)
-#define MPU_INT_STATUS_I2C_MST          (0x0008)
-#define MPU_INT_STATUS_FIFO_OVERFLOW    (0x0010)
-#define MPU_INT_STATUS_ZMOT             (0x0020)
-#define MPU_INT_STATUS_MOT              (0x0040)
-#define MPU_INT_STATUS_FREE_FALL        (0x0080)
-#define MPU_INT_STATUS_DMP_0            (0x0100)
-#define MPU_INT_STATUS_DMP_1            (0x0200)
-#define MPU_INT_STATUS_DMP_2            (0x0400)
-#define MPU_INT_STATUS_DMP_3            (0x0800)
-#define MPU_INT_STATUS_DMP_4            (0x1000)
-#define MPU_INT_STATUS_DMP_5            (0x2000)
-
-/* Set up APIs */
-int mpu_init(struct int_param_s *int_param);
-int mpu_init_slave(void);
-int mpu_set_bypass(unsigned char bypass_on);
-
-/* Configuration APIs */
-int mpu_lp_accel_mode(unsigned char rate);
-int mpu_lp_motion_interrupt(unsigned short thresh, unsigned char time,
-    unsigned char lpa_freq);
-int mpu_set_int_level(unsigned char active_low);
-int mpu_set_int_latched(unsigned char enable);
-
-int mpu_set_dmp_state(unsigned char enable);
-int mpu_get_dmp_state(unsigned char *enabled);
-
-int mpu_get_lpf(unsigned short *lpf);
-int mpu_set_lpf(unsigned short lpf);
-
-int mpu_get_gyro_fsr(unsigned short *fsr);
-int mpu_set_gyro_fsr(unsigned short fsr);
-
-int mpu_get_accel_fsr(unsigned char *fsr);
-int mpu_set_accel_fsr(unsigned char fsr);
-
-int mpu_get_compass_fsr(unsigned short *fsr);
-
-int mpu_get_gyro_sens(float *sens);
-int mpu_get_accel_sens(unsigned short *sens);
-
-int mpu_get_sample_rate(unsigned short *rate);
-int mpu_set_sample_rate(unsigned short rate);
-int mpu_get_compass_sample_rate(unsigned short *rate);
-int mpu_set_compass_sample_rate(unsigned short rate);
-
-int mpu_get_fifo_config(unsigned char *sensors);
-int mpu_configure_fifo(unsigned char sensors);
-
-int mpu_get_power_state(unsigned char *power_on);
-int mpu_set_sensors(unsigned char sensors);
-
-int mpu_set_accel_bias(const long *accel_bias);
-
-/* Data getter/setter APIs */
-int mpu_get_gyro_reg(short *data, unsigned long *timestamp);
-int mpu_get_accel_reg(short *data, unsigned long *timestamp);
-int mpu_get_compass_reg(short *data, unsigned long *timestamp);
-int mpu_get_temperature(long *data, unsigned long *timestamp);
-
-int mpu_get_int_status(short *status);
-int mpu_read_fifo(short *gyro, short *accel, unsigned long *timestamp,
-    unsigned char *sensors, unsigned char *more);
-int mpu_read_fifo_stream(unsigned short length, unsigned char *data,
-    unsigned char *more);
-int mpu_reset_fifo(void);
-
-int mpu_write_mem(unsigned short mem_addr, unsigned short length,
-    unsigned char *data);
-int mpu_read_mem(unsigned short mem_addr, unsigned short length,
-    unsigned char *data);
-int mpu_load_firmware(unsigned short length, const unsigned char *firmware,
-    unsigned short start_addr, unsigned short sample_rate);
-
-int mpu_reg_dump(void);
-int mpu_read_reg(unsigned char reg, unsigned char *data);
-int mpu_run_self_test(long *gyro, long *accel);
-int mpu_register_tap_cb(void (*func)(unsigned char, unsigned char));
-
-#endif  /* #ifndef _INV_MPU_H_ */
-

+ 0 - 1380
Core备份3/imu2/inv_mpu_dmp_motion_driver2.c

@@ -1,1380 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011-2012 InvenSense Corporation, All Rights Reserved.
-    See included License.txt for License information.
- $
- */
-/**
- *  @addtogroup  DRIVERS Sensor Driver Layer
- *  @brief       Hardware drivers to communicate with sensors via I2C.
- *
- *  @{
- *      @file       inv_mpu_dmp_motion_driver.c
- *      @brief      DMP image and interface functions.
- *      @details    All functions are preceded by the dmp_ prefix to
- *                  differentiate among MPL and general driver function calls.
- */
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include "inv_mpu2.h"
-#include "inv_mpu_dmp_motion_driver2.h"
-#include "dmpKey2.h"
-#include "dmpmap2.h"
-
-#include "MPU60502.h"
-
-/* The following functions must be defined for this platform:
- * i2c_write(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char const *data)
- * i2c_read(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char *data)
- * delay_ms(unsigned long num_ms)
- * get_ms(unsigned long *count)
- */
-#if defined MOTION_DRIVER_TARGET_MSP430
-#include "msp430.h"
-#include "msp430_clock.h"
-#define delay_ms    msp430_delay_ms
-#define get_ms      msp430_get_clock_ms
-#define log_i(...)     do {} while (0)
-#define log_e(...)     do {} while (0)
-
-#elif defined EMPL_TARGET_MSP430
-#include "msp430.h"
-#include "msp430_clock.h"
-#include "log.h"
-#define delay_ms    msp430_delay_ms
-#define get_ms      msp430_get_clock_ms
-#define log_i       MPL_LOGI
-#define log_e       MPL_LOGE
-
-#elif defined EMPL_TARGET_UC3L0
-/* Instead of using the standard TWI driver from the ASF library, we're using
- * a TWI driver that follows the slave address + register address convention.
- */
-#include "delay.h"
-#include "sysclk.h"
-#include "log.h"
-#include "uc3l0_clock.h"
-/* delay_ms is a function already defined in ASF. */
-#define get_ms  uc3l0_get_clock_ms
-#define log_i       MPL_LOGI
-#define log_e       MPL_LOGE
-
-#elif defined MOTION_DRIVER_TARGET_STM32
-
-#define delay_ms    HAL_Delay
-#define get_ms      get_tick_count
-
-#define log_i(...)     do {} while (0)
-#define log_e(...)     do {} while (0)
-
-#else
-#error  Gyro driver is missing the system layer implementations.
-#endif
-
-/* These defines are copied from dmpDefaultMPU6050.c in the general MPL
- * releases. These defines may change for each DMP image, so be sure to modify
- * these values when switching to a new image.
- */
-#define CFG_LP_QUAT             (2712)
-#define END_ORIENT_TEMP         (1866)
-#define CFG_27                  (2742)
-#define CFG_20                  (2224)
-#define CFG_23                  (2745)
-#define CFG_FIFO_ON_EVENT       (2690)
-#define END_PREDICTION_UPDATE   (1761)
-#define CGNOTICE_INTR           (2620)
-#define X_GRT_Y_TMP             (1358)
-#define CFG_DR_INT              (1029)
-#define CFG_AUTH                (1035)
-#define UPDATE_PROP_ROT         (1835)
-#define END_COMPARE_Y_X_TMP2    (1455)
-#define SKIP_X_GRT_Y_TMP        (1359)
-#define SKIP_END_COMPARE        (1435)
-#define FCFG_3                  (1088)
-#define FCFG_2                  (1066)
-#define FCFG_1                  (1062)
-#define END_COMPARE_Y_X_TMP3    (1434)
-#define FCFG_7                  (1073)
-#define FCFG_6                  (1106)
-#define FLAT_STATE_END          (1713)
-#define SWING_END_4             (1616)
-#define SWING_END_2             (1565)
-#define SWING_END_3             (1587)
-#define SWING_END_1             (1550)
-#define CFG_8                   (2718)
-#define CFG_15                  (2727)
-#define CFG_16                  (2746)
-#define CFG_EXT_GYRO_BIAS       (1189)
-#define END_COMPARE_Y_X_TMP     (1407)
-#define DO_NOT_UPDATE_PROP_ROT  (1839)
-#define CFG_7                   (1205)
-#define FLAT_STATE_END_TEMP     (1683)
-#define END_COMPARE_Y_X         (1484)
-#define SKIP_SWING_END_1        (1551)
-#define SKIP_SWING_END_3        (1588)
-#define SKIP_SWING_END_2        (1566)
-#define TILTG75_START           (1672)
-#define CFG_6                   (2753)
-#define TILTL75_END             (1669)
-#define END_ORIENT              (1884)
-#define CFG_FLICK_IN            (2573)
-#define TILTL75_START           (1643)
-#define CFG_MOTION_BIAS         (1208)
-#define X_GRT_Y                 (1408)
-#define TEMPLABEL               (2324)
-#define CFG_ANDROID_ORIENT_INT  (1853)
-#define CFG_GYRO_RAW_DATA       (2722)
-#define X_GRT_Y_TMP2            (1379)
-
-#define D_0_22                  (22+512)
-#define D_0_24                  (24+512)
-
-#define D_0_36                  (36)
-#define D_0_52                  (52)
-#define D_0_96                  (96)
-#define D_0_104                 (104)
-#define D_0_108                 (108)
-#define D_0_163                 (163)
-#define D_0_188                 (188)
-#define D_0_192                 (192)
-#define D_0_224                 (224)
-#define D_0_228                 (228)
-#define D_0_232                 (232)
-#define D_0_236                 (236)
-
-#define D_1_2                   (256 + 2)
-#define D_1_4                   (256 + 4)
-#define D_1_8                   (256 + 8)
-#define D_1_10                  (256 + 10)
-#define D_1_24                  (256 + 24)
-#define D_1_28                  (256 + 28)
-#define D_1_36                  (256 + 36)
-#define D_1_40                  (256 + 40)
-#define D_1_44                  (256 + 44)
-#define D_1_72                  (256 + 72)
-#define D_1_74                  (256 + 74)
-#define D_1_79                  (256 + 79)
-#define D_1_88                  (256 + 88)
-#define D_1_90                  (256 + 90)
-#define D_1_92                  (256 + 92)
-#define D_1_96                  (256 + 96)
-#define D_1_98                  (256 + 98)
-#define D_1_106                 (256 + 106)
-#define D_1_108                 (256 + 108)
-#define D_1_112                 (256 + 112)
-#define D_1_128                 (256 + 144)
-#define D_1_152                 (256 + 12)
-#define D_1_160                 (256 + 160)
-#define D_1_176                 (256 + 176)
-#define D_1_178                 (256 + 178)
-#define D_1_218                 (256 + 218)
-#define D_1_232                 (256 + 232)
-#define D_1_236                 (256 + 236)
-#define D_1_240                 (256 + 240)
-#define D_1_244                 (256 + 244)
-#define D_1_250                 (256 + 250)
-#define D_1_252                 (256 + 252)
-#define D_2_12                  (512 + 12)
-#define D_2_96                  (512 + 96)
-#define D_2_108                 (512 + 108)
-#define D_2_208                 (512 + 208)
-#define D_2_224                 (512 + 224)
-#define D_2_236                 (512 + 236)
-#define D_2_244                 (512 + 244)
-#define D_2_248                 (512 + 248)
-#define D_2_252                 (512 + 252)
-
-#define CPASS_BIAS_X            (35 * 16 + 4)
-#define CPASS_BIAS_Y            (35 * 16 + 8)
-#define CPASS_BIAS_Z            (35 * 16 + 12)
-#define CPASS_MTX_00            (36 * 16)
-#define CPASS_MTX_01            (36 * 16 + 4)
-#define CPASS_MTX_02            (36 * 16 + 8)
-#define CPASS_MTX_10            (36 * 16 + 12)
-#define CPASS_MTX_11            (37 * 16)
-#define CPASS_MTX_12            (37 * 16 + 4)
-#define CPASS_MTX_20            (37 * 16 + 8)
-#define CPASS_MTX_21            (37 * 16 + 12)
-#define CPASS_MTX_22            (43 * 16 + 12)
-#define D_EXT_GYRO_BIAS_X       (61 * 16)
-#define D_EXT_GYRO_BIAS_Y       (61 * 16) + 4
-#define D_EXT_GYRO_BIAS_Z       (61 * 16) + 8
-#define D_ACT0                  (40 * 16)
-#define D_ACSX                  (40 * 16 + 4)
-#define D_ACSY                  (40 * 16 + 8)
-#define D_ACSZ                  (40 * 16 + 12)
-
-#define FLICK_MSG               (45 * 16 + 4)
-#define FLICK_COUNTER           (45 * 16 + 8)
-#define FLICK_LOWER             (45 * 16 + 12)
-#define FLICK_UPPER             (46 * 16 + 12)
-
-#define D_AUTH_OUT              (992)
-#define D_AUTH_IN               (996)
-#define D_AUTH_A                (1000)
-#define D_AUTH_B                (1004)
-
-#define D_PEDSTD_BP_B           (768 + 0x1C)
-#define D_PEDSTD_HP_A           (768 + 0x78)
-#define D_PEDSTD_HP_B           (768 + 0x7C)
-#define D_PEDSTD_BP_A4          (768 + 0x40)
-#define D_PEDSTD_BP_A3          (768 + 0x44)
-#define D_PEDSTD_BP_A2          (768 + 0x48)
-#define D_PEDSTD_BP_A1          (768 + 0x4C)
-#define D_PEDSTD_INT_THRSH      (768 + 0x68)
-#define D_PEDSTD_CLIP           (768 + 0x6C)
-#define D_PEDSTD_SB             (768 + 0x28)
-#define D_PEDSTD_SB_TIME        (768 + 0x2C)
-#define D_PEDSTD_PEAKTHRSH      (768 + 0x98)
-#define D_PEDSTD_TIML           (768 + 0x2A)
-#define D_PEDSTD_TIMH           (768 + 0x2E)
-#define D_PEDSTD_PEAK           (768 + 0X94)
-#define D_PEDSTD_STEPCTR        (768 + 0x60)
-#define D_PEDSTD_TIMECTR        (964)
-#define D_PEDSTD_DECI           (768 + 0xA0)
-
-#define D_HOST_NO_MOT           (976)
-#define D_ACCEL_BIAS            (660)
-
-#define D_ORIENT_GAP            (76)
-
-#define D_TILT0_H               (48)
-#define D_TILT0_L               (50)
-#define D_TILT1_H               (52)
-#define D_TILT1_L               (54)
-#define D_TILT2_H               (56)
-#define D_TILT2_L               (58)
-#define D_TILT3_H               (60)
-#define D_TILT3_L               (62)
-
-#define DMP_CODE_SIZE           (3062)
-
-static const unsigned char dmp_memory[DMP_CODE_SIZE] = {
-    /* bank # 0 */
-    0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x00, 0x00,
-    0x00, 0x65, 0x00, 0x54, 0xff, 0xef, 0x00, 0x00, 0xfa, 0x80, 0x00, 0x0b, 0x12, 0x82, 0x00, 0x01,
-    0x03, 0x0c, 0x30, 0xc3, 0x0e, 0x8c, 0x8c, 0xe9, 0x14, 0xd5, 0x40, 0x02, 0x13, 0x71, 0x0f, 0x8e,
-    0x38, 0x83, 0xf8, 0x83, 0x30, 0x00, 0xf8, 0x83, 0x25, 0x8e, 0xf8, 0x83, 0x30, 0x00, 0xf8, 0x83,
-    0xff, 0xff, 0xff, 0xff, 0x0f, 0xfe, 0xa9, 0xd6, 0x24, 0x00, 0x04, 0x00, 0x1a, 0x82, 0x79, 0xa1,
-    0x00, 0x00, 0x00, 0x3c, 0xff, 0xff, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x38, 0x83, 0x6f, 0xa2,
-    0x00, 0x3e, 0x03, 0x30, 0x40, 0x00, 0x00, 0x00, 0x02, 0xca, 0xe3, 0x09, 0x3e, 0x80, 0x00, 0x00,
-    0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
-    0x00, 0x0c, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x6e, 0x00, 0x00, 0x06, 0x92, 0x0a, 0x16, 0xc0, 0xdf,
-    0xff, 0xff, 0x02, 0x56, 0xfd, 0x8c, 0xd3, 0x77, 0xff, 0xe1, 0xc4, 0x96, 0xe0, 0xc5, 0xbe, 0xaa,
-    0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0b, 0x2b, 0x00, 0x00, 0x16, 0x57, 0x00, 0x00, 0x03, 0x59,
-    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0xfa, 0x00, 0x02, 0x6c, 0x1d, 0x00, 0x00, 0x00, 0x00,
-    0x3f, 0xff, 0xdf, 0xeb, 0x00, 0x3e, 0xb3, 0xb6, 0x00, 0x0d, 0x22, 0x78, 0x00, 0x00, 0x2f, 0x3c,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x42, 0xb5, 0x00, 0x00, 0x39, 0xa2, 0x00, 0x00, 0xb3, 0x65,
-    0xd9, 0x0e, 0x9f, 0xc9, 0x1d, 0xcf, 0x4c, 0x34, 0x30, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00,
-    0x3b, 0xb6, 0x7a, 0xe8, 0x00, 0x64, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    /* bank # 1 */
-    0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0xfa, 0x92, 0x10, 0x00, 0x22, 0x5e, 0x00, 0x0d, 0x22, 0x9f,
-    0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0xff, 0x46, 0x00, 0x00, 0x63, 0xd4, 0x00, 0x00,
-    0x10, 0x00, 0x00, 0x00, 0x04, 0xd6, 0x00, 0x00, 0x04, 0xcc, 0x00, 0x00, 0x04, 0xcc, 0x00, 0x00,
-    0x00, 0x00, 0x10, 0x72, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x06, 0x00, 0x02, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x64, 0x00, 0x20, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, 0x00,
-    0x00, 0x00, 0x00, 0x32, 0xf8, 0x98, 0x00, 0x00, 0xff, 0x65, 0x00, 0x00, 0x83, 0x0f, 0x00, 0x00,
-    0xff, 0x9b, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
-    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0xb2, 0x6a, 0x00, 0x02, 0x00, 0x00,
-    0x00, 0x01, 0xfb, 0x83, 0x00, 0x68, 0x00, 0x00, 0x00, 0xd9, 0xfc, 0x00, 0x7c, 0xf1, 0xff, 0x83,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x64, 0x03, 0xe8, 0x00, 0x64, 0x00, 0x28,
-    0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x16, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
-    0x00, 0x00, 0x10, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x01, 0xf4, 0x00, 0x00, 0x10, 0x00,
-    /* bank # 2 */
-    0x00, 0x28, 0x00, 0x00, 0xff, 0xff, 0x45, 0x81, 0xff, 0xff, 0xfa, 0x72, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x05, 0x00, 0x05, 0xba, 0xc6, 0x00, 0x47, 0x78, 0xa2,
-    0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x14,
-    0x00, 0x00, 0x25, 0x4d, 0x00, 0x2f, 0x70, 0x6d, 0x00, 0x00, 0x05, 0xae, 0x00, 0x0c, 0x02, 0xd0,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x64, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x0e,
-    0x00, 0x00, 0x0a, 0xc7, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0xff, 0xff, 0xff, 0x9c,
-    0x00, 0x00, 0x0b, 0x2b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x64,
-    0xff, 0xe5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    /* bank # 3 */
-    0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x24, 0x26, 0xd3,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x96, 0x00, 0x3c,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x0c, 0x0a, 0x4e, 0x68, 0xcd, 0xcf, 0x77, 0x09, 0x50, 0x16, 0x67, 0x59, 0xc6, 0x19, 0xce, 0x82,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xd7, 0x84, 0x00, 0x03, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc7, 0x93, 0x8f, 0x9d, 0x1e, 0x1b, 0x1c, 0x19,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x18, 0x85, 0x00, 0x00, 0x40, 0x00,
-    0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x67, 0x7d, 0xdf, 0x7e, 0x72, 0x90, 0x2e, 0x55, 0x4c, 0xf6, 0xe6, 0x88,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-
-    /* bank # 4 */
-    0xd8, 0xdc, 0xb4, 0xb8, 0xb0, 0xd8, 0xb9, 0xab, 0xf3, 0xf8, 0xfa, 0xb3, 0xb7, 0xbb, 0x8e, 0x9e,
-    0xae, 0xf1, 0x32, 0xf5, 0x1b, 0xf1, 0xb4, 0xb8, 0xb0, 0x80, 0x97, 0xf1, 0xa9, 0xdf, 0xdf, 0xdf,
-    0xaa, 0xdf, 0xdf, 0xdf, 0xf2, 0xaa, 0xc5, 0xcd, 0xc7, 0xa9, 0x0c, 0xc9, 0x2c, 0x97, 0xf1, 0xa9,
-    0x89, 0x26, 0x46, 0x66, 0xb2, 0x89, 0x99, 0xa9, 0x2d, 0x55, 0x7d, 0xb0, 0xb0, 0x8a, 0xa8, 0x96,
-    0x36, 0x56, 0x76, 0xf1, 0xba, 0xa3, 0xb4, 0xb2, 0x80, 0xc0, 0xb8, 0xa8, 0x97, 0x11, 0xb2, 0x83,
-    0x98, 0xba, 0xa3, 0xf0, 0x24, 0x08, 0x44, 0x10, 0x64, 0x18, 0xb2, 0xb9, 0xb4, 0x98, 0x83, 0xf1,
-    0xa3, 0x29, 0x55, 0x7d, 0xba, 0xb5, 0xb1, 0xa3, 0x83, 0x93, 0xf0, 0x00, 0x28, 0x50, 0xf5, 0xb2,
-    0xb6, 0xaa, 0x83, 0x93, 0x28, 0x54, 0x7c, 0xf1, 0xb9, 0xa3, 0x82, 0x93, 0x61, 0xba, 0xa2, 0xda,
-    0xde, 0xdf, 0xdb, 0x81, 0x9a, 0xb9, 0xae, 0xf5, 0x60, 0x68, 0x70, 0xf1, 0xda, 0xba, 0xa2, 0xdf,
-    0xd9, 0xba, 0xa2, 0xfa, 0xb9, 0xa3, 0x82, 0x92, 0xdb, 0x31, 0xba, 0xa2, 0xd9, 0xba, 0xa2, 0xf8,
-    0xdf, 0x85, 0xa4, 0xd0, 0xc1, 0xbb, 0xad, 0x83, 0xc2, 0xc5, 0xc7, 0xb8, 0xa2, 0xdf, 0xdf, 0xdf,
-    0xba, 0xa0, 0xdf, 0xdf, 0xdf, 0xd8, 0xd8, 0xf1, 0xb8, 0xaa, 0xb3, 0x8d, 0xb4, 0x98, 0x0d, 0x35,
-    0x5d, 0xb2, 0xb6, 0xba, 0xaf, 0x8c, 0x96, 0x19, 0x8f, 0x9f, 0xa7, 0x0e, 0x16, 0x1e, 0xb4, 0x9a,
-    0xb8, 0xaa, 0x87, 0x2c, 0x54, 0x7c, 0xba, 0xa4, 0xb0, 0x8a, 0xb6, 0x91, 0x32, 0x56, 0x76, 0xb2,
-    0x84, 0x94, 0xa4, 0xc8, 0x08, 0xcd, 0xd8, 0xb8, 0xb4, 0xb0, 0xf1, 0x99, 0x82, 0xa8, 0x2d, 0x55,
-    0x7d, 0x98, 0xa8, 0x0e, 0x16, 0x1e, 0xa2, 0x2c, 0x54, 0x7c, 0x92, 0xa4, 0xf0, 0x2c, 0x50, 0x78,
-    /* bank # 5 */
-    0xf1, 0x84, 0xa8, 0x98, 0xc4, 0xcd, 0xfc, 0xd8, 0x0d, 0xdb, 0xa8, 0xfc, 0x2d, 0xf3, 0xd9, 0xba,
-    0xa6, 0xf8, 0xda, 0xba, 0xa6, 0xde, 0xd8, 0xba, 0xb2, 0xb6, 0x86, 0x96, 0xa6, 0xd0, 0xf3, 0xc8,
-    0x41, 0xda, 0xa6, 0xc8, 0xf8, 0xd8, 0xb0, 0xb4, 0xb8, 0x82, 0xa8, 0x92, 0xf5, 0x2c, 0x54, 0x88,
-    0x98, 0xf1, 0x35, 0xd9, 0xf4, 0x18, 0xd8, 0xf1, 0xa2, 0xd0, 0xf8, 0xf9, 0xa8, 0x84, 0xd9, 0xc7,
-    0xdf, 0xf8, 0xf8, 0x83, 0xc5, 0xda, 0xdf, 0x69, 0xdf, 0x83, 0xc1, 0xd8, 0xf4, 0x01, 0x14, 0xf1,
-    0xa8, 0x82, 0x4e, 0xa8, 0x84, 0xf3, 0x11, 0xd1, 0x82, 0xf5, 0xd9, 0x92, 0x28, 0x97, 0x88, 0xf1,
-    0x09, 0xf4, 0x1c, 0x1c, 0xd8, 0x84, 0xa8, 0xf3, 0xc0, 0xf9, 0xd1, 0xd9, 0x97, 0x82, 0xf1, 0x29,
-    0xf4, 0x0d, 0xd8, 0xf3, 0xf9, 0xf9, 0xd1, 0xd9, 0x82, 0xf4, 0xc2, 0x03, 0xd8, 0xde, 0xdf, 0x1a,
-    0xd8, 0xf1, 0xa2, 0xfa, 0xf9, 0xa8, 0x84, 0x98, 0xd9, 0xc7, 0xdf, 0xf8, 0xf8, 0xf8, 0x83, 0xc7,
-    0xda, 0xdf, 0x69, 0xdf, 0xf8, 0x83, 0xc3, 0xd8, 0xf4, 0x01, 0x14, 0xf1, 0x98, 0xa8, 0x82, 0x2e,
-    0xa8, 0x84, 0xf3, 0x11, 0xd1, 0x82, 0xf5, 0xd9, 0x92, 0x50, 0x97, 0x88, 0xf1, 0x09, 0xf4, 0x1c,
-    0xd8, 0x84, 0xa8, 0xf3, 0xc0, 0xf8, 0xf9, 0xd1, 0xd9, 0x97, 0x82, 0xf1, 0x49, 0xf4, 0x0d, 0xd8,
-    0xf3, 0xf9, 0xf9, 0xd1, 0xd9, 0x82, 0xf4, 0xc4, 0x03, 0xd8, 0xde, 0xdf, 0xd8, 0xf1, 0xad, 0x88,
-    0x98, 0xcc, 0xa8, 0x09, 0xf9, 0xd9, 0x82, 0x92, 0xa8, 0xf5, 0x7c, 0xf1, 0x88, 0x3a, 0xcf, 0x94,
-    0x4a, 0x6e, 0x98, 0xdb, 0x69, 0x31, 0xda, 0xad, 0xf2, 0xde, 0xf9, 0xd8, 0x87, 0x95, 0xa8, 0xf2,
-    0x21, 0xd1, 0xda, 0xa5, 0xf9, 0xf4, 0x17, 0xd9, 0xf1, 0xae, 0x8e, 0xd0, 0xc0, 0xc3, 0xae, 0x82,
-    /* bank # 6 */
-    0xc6, 0x84, 0xc3, 0xa8, 0x85, 0x95, 0xc8, 0xa5, 0x88, 0xf2, 0xc0, 0xf1, 0xf4, 0x01, 0x0e, 0xf1,
-    0x8e, 0x9e, 0xa8, 0xc6, 0x3e, 0x56, 0xf5, 0x54, 0xf1, 0x88, 0x72, 0xf4, 0x01, 0x15, 0xf1, 0x98,
-    0x45, 0x85, 0x6e, 0xf5, 0x8e, 0x9e, 0x04, 0x88, 0xf1, 0x42, 0x98, 0x5a, 0x8e, 0x9e, 0x06, 0x88,
-    0x69, 0xf4, 0x01, 0x1c, 0xf1, 0x98, 0x1e, 0x11, 0x08, 0xd0, 0xf5, 0x04, 0xf1, 0x1e, 0x97, 0x02,
-    0x02, 0x98, 0x36, 0x25, 0xdb, 0xf9, 0xd9, 0x85, 0xa5, 0xf3, 0xc1, 0xda, 0x85, 0xa5, 0xf3, 0xdf,
-    0xd8, 0x85, 0x95, 0xa8, 0xf3, 0x09, 0xda, 0xa5, 0xfa, 0xd8, 0x82, 0x92, 0xa8, 0xf5, 0x78, 0xf1,
-    0x88, 0x1a, 0x84, 0x9f, 0x26, 0x88, 0x98, 0x21, 0xda, 0xf4, 0x1d, 0xf3, 0xd8, 0x87, 0x9f, 0x39,
-    0xd1, 0xaf, 0xd9, 0xdf, 0xdf, 0xfb, 0xf9, 0xf4, 0x0c, 0xf3, 0xd8, 0xfa, 0xd0, 0xf8, 0xda, 0xf9,
-    0xf9, 0xd0, 0xdf, 0xd9, 0xf9, 0xd8, 0xf4, 0x0b, 0xd8, 0xf3, 0x87, 0x9f, 0x39, 0xd1, 0xaf, 0xd9,
-    0xdf, 0xdf, 0xf4, 0x1d, 0xf3, 0xd8, 0xfa, 0xfc, 0xa8, 0x69, 0xf9, 0xf9, 0xaf, 0xd0, 0xda, 0xde,
-    0xfa, 0xd9, 0xf8, 0x8f, 0x9f, 0xa8, 0xf1, 0xcc, 0xf3, 0x98, 0xdb, 0x45, 0xd9, 0xaf, 0xdf, 0xd0,
-    0xf8, 0xd8, 0xf1, 0x8f, 0x9f, 0xa8, 0xca, 0xf3, 0x88, 0x09, 0xda, 0xaf, 0x8f, 0xcb, 0xf8, 0xd8,
-    0xf2, 0xad, 0x97, 0x8d, 0x0c, 0xd9, 0xa5, 0xdf, 0xf9, 0xba, 0xa6, 0xf3, 0xfa, 0xf4, 0x12, 0xf2,
-    0xd8, 0x95, 0x0d, 0xd1, 0xd9, 0xba, 0xa6, 0xf3, 0xfa, 0xda, 0xa5, 0xf2, 0xc1, 0xba, 0xa6, 0xf3,
-    0xdf, 0xd8, 0xf1, 0xba, 0xb2, 0xb6, 0x86, 0x96, 0xa6, 0xd0, 0xca, 0xf3, 0x49, 0xda, 0xa6, 0xcb,
-    0xf8, 0xd8, 0xb0, 0xb4, 0xb8, 0xd8, 0xad, 0x84, 0xf2, 0xc0, 0xdf, 0xf1, 0x8f, 0xcb, 0xc3, 0xa8,
-    /* bank # 7 */
-    0xb2, 0xb6, 0x86, 0x96, 0xc8, 0xc1, 0xcb, 0xc3, 0xf3, 0xb0, 0xb4, 0x88, 0x98, 0xa8, 0x21, 0xdb,
-    0x71, 0x8d, 0x9d, 0x71, 0x85, 0x95, 0x21, 0xd9, 0xad, 0xf2, 0xfa, 0xd8, 0x85, 0x97, 0xa8, 0x28,
-    0xd9, 0xf4, 0x08, 0xd8, 0xf2, 0x8d, 0x29, 0xda, 0xf4, 0x05, 0xd9, 0xf2, 0x85, 0xa4, 0xc2, 0xf2,
-    0xd8, 0xa8, 0x8d, 0x94, 0x01, 0xd1, 0xd9, 0xf4, 0x11, 0xf2, 0xd8, 0x87, 0x21, 0xd8, 0xf4, 0x0a,
-    0xd8, 0xf2, 0x84, 0x98, 0xa8, 0xc8, 0x01, 0xd1, 0xd9, 0xf4, 0x11, 0xd8, 0xf3, 0xa4, 0xc8, 0xbb,
-    0xaf, 0xd0, 0xf2, 0xde, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xd8, 0xf1, 0xb8, 0xf6,
-    0xb5, 0xb9, 0xb0, 0x8a, 0x95, 0xa3, 0xde, 0x3c, 0xa3, 0xd9, 0xf8, 0xd8, 0x5c, 0xa3, 0xd9, 0xf8,
-    0xd8, 0x7c, 0xa3, 0xd9, 0xf8, 0xd8, 0xf8, 0xf9, 0xd1, 0xa5, 0xd9, 0xdf, 0xda, 0xfa, 0xd8, 0xb1,
-    0x85, 0x30, 0xf7, 0xd9, 0xde, 0xd8, 0xf8, 0x30, 0xad, 0xda, 0xde, 0xd8, 0xf2, 0xb4, 0x8c, 0x99,
-    0xa3, 0x2d, 0x55, 0x7d, 0xa0, 0x83, 0xdf, 0xdf, 0xdf, 0xb5, 0x91, 0xa0, 0xf6, 0x29, 0xd9, 0xfb,
-    0xd8, 0xa0, 0xfc, 0x29, 0xd9, 0xfa, 0xd8, 0xa0, 0xd0, 0x51, 0xd9, 0xf8, 0xd8, 0xfc, 0x51, 0xd9,
-    0xf9, 0xd8, 0x79, 0xd9, 0xfb, 0xd8, 0xa0, 0xd0, 0xfc, 0x79, 0xd9, 0xfa, 0xd8, 0xa1, 0xf9, 0xf9,
-    0xf9, 0xf9, 0xf9, 0xa0, 0xda, 0xdf, 0xdf, 0xdf, 0xd8, 0xa1, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xac,
-    0xde, 0xf8, 0xad, 0xde, 0x83, 0x93, 0xac, 0x2c, 0x54, 0x7c, 0xf1, 0xa8, 0xdf, 0xdf, 0xdf, 0xf6,
-    0x9d, 0x2c, 0xda, 0xa0, 0xdf, 0xd9, 0xfa, 0xdb, 0x2d, 0xf8, 0xd8, 0xa8, 0x50, 0xda, 0xa0, 0xd0,
-    0xde, 0xd9, 0xd0, 0xf8, 0xf8, 0xf8, 0xdb, 0x55, 0xf8, 0xd8, 0xa8, 0x78, 0xda, 0xa0, 0xd0, 0xdf,
-    /* bank # 8 */
-    0xd9, 0xd0, 0xfa, 0xf8, 0xf8, 0xf8, 0xf8, 0xdb, 0x7d, 0xf8, 0xd8, 0x9c, 0xa8, 0x8c, 0xf5, 0x30,
-    0xdb, 0x38, 0xd9, 0xd0, 0xde, 0xdf, 0xa0, 0xd0, 0xde, 0xdf, 0xd8, 0xa8, 0x48, 0xdb, 0x58, 0xd9,
-    0xdf, 0xd0, 0xde, 0xa0, 0xdf, 0xd0, 0xde, 0xd8, 0xa8, 0x68, 0xdb, 0x70, 0xd9, 0xdf, 0xdf, 0xa0,
-    0xdf, 0xdf, 0xd8, 0xf1, 0xa8, 0x88, 0x90, 0x2c, 0x54, 0x7c, 0x98, 0xa8, 0xd0, 0x5c, 0x38, 0xd1,
-    0xda, 0xf2, 0xae, 0x8c, 0xdf, 0xf9, 0xd8, 0xb0, 0x87, 0xa8, 0xc1, 0xc1, 0xb1, 0x88, 0xa8, 0xc6,
-    0xf9, 0xf9, 0xda, 0x36, 0xd8, 0xa8, 0xf9, 0xda, 0x36, 0xd8, 0xa8, 0xf9, 0xda, 0x36, 0xd8, 0xa8,
-    0xf9, 0xda, 0x36, 0xd8, 0xa8, 0xf9, 0xda, 0x36, 0xd8, 0xf7, 0x8d, 0x9d, 0xad, 0xf8, 0x18, 0xda,
-    0xf2, 0xae, 0xdf, 0xd8, 0xf7, 0xad, 0xfa, 0x30, 0xd9, 0xa4, 0xde, 0xf9, 0xd8, 0xf2, 0xae, 0xde,
-    0xfa, 0xf9, 0x83, 0xa7, 0xd9, 0xc3, 0xc5, 0xc7, 0xf1, 0x88, 0x9b, 0xa7, 0x7a, 0xad, 0xf7, 0xde,
-    0xdf, 0xa4, 0xf8, 0x84, 0x94, 0x08, 0xa7, 0x97, 0xf3, 0x00, 0xae, 0xf2, 0x98, 0x19, 0xa4, 0x88,
-    0xc6, 0xa3, 0x94, 0x88, 0xf6, 0x32, 0xdf, 0xf2, 0x83, 0x93, 0xdb, 0x09, 0xd9, 0xf2, 0xaa, 0xdf,
-    0xd8, 0xd8, 0xae, 0xf8, 0xf9, 0xd1, 0xda, 0xf3, 0xa4, 0xde, 0xa7, 0xf1, 0x88, 0x9b, 0x7a, 0xd8,
-    0xf3, 0x84, 0x94, 0xae, 0x19, 0xf9, 0xda, 0xaa, 0xf1, 0xdf, 0xd8, 0xa8, 0x81, 0xc0, 0xc3, 0xc5,
-    0xc7, 0xa3, 0x92, 0x83, 0xf6, 0x28, 0xad, 0xde, 0xd9, 0xf8, 0xd8, 0xa3, 0x50, 0xad, 0xd9, 0xf8,
-    0xd8, 0xa3, 0x78, 0xad, 0xd9, 0xf8, 0xd8, 0xf8, 0xf9, 0xd1, 0xa1, 0xda, 0xde, 0xc3, 0xc5, 0xc7,
-    0xd8, 0xa1, 0x81, 0x94, 0xf8, 0x18, 0xf2, 0xb0, 0x89, 0xac, 0xc3, 0xc5, 0xc7, 0xf1, 0xd8, 0xb8,
-    /* bank # 9 */
-    0xb4, 0xb0, 0x97, 0x86, 0xa8, 0x31, 0x9b, 0x06, 0x99, 0x07, 0xab, 0x97, 0x28, 0x88, 0x9b, 0xf0,
-    0x0c, 0x20, 0x14, 0x40, 0xb0, 0xb4, 0xb8, 0xf0, 0xa8, 0x8a, 0x9a, 0x28, 0x50, 0x78, 0xb7, 0x9b,
-    0xa8, 0x29, 0x51, 0x79, 0x24, 0x70, 0x59, 0x44, 0x69, 0x38, 0x64, 0x48, 0x31, 0xf1, 0xbb, 0xab,
-    0x88, 0x00, 0x2c, 0x54, 0x7c, 0xf0, 0xb3, 0x8b, 0xb8, 0xa8, 0x04, 0x28, 0x50, 0x78, 0xf1, 0xb0,
-    0x88, 0xb4, 0x97, 0x26, 0xa8, 0x59, 0x98, 0xbb, 0xab, 0xb3, 0x8b, 0x02, 0x26, 0x46, 0x66, 0xb0,
-    0xb8, 0xf0, 0x8a, 0x9c, 0xa8, 0x29, 0x51, 0x79, 0x8b, 0x29, 0x51, 0x79, 0x8a, 0x24, 0x70, 0x59,
-    0x8b, 0x20, 0x58, 0x71, 0x8a, 0x44, 0x69, 0x38, 0x8b, 0x39, 0x40, 0x68, 0x8a, 0x64, 0x48, 0x31,
-    0x8b, 0x30, 0x49, 0x60, 0x88, 0xf1, 0xac, 0x00, 0x2c, 0x54, 0x7c, 0xf0, 0x8c, 0xa8, 0x04, 0x28,
-    0x50, 0x78, 0xf1, 0x88, 0x97, 0x26, 0xa8, 0x59, 0x98, 0xac, 0x8c, 0x02, 0x26, 0x46, 0x66, 0xf0,
-    0x89, 0x9c, 0xa8, 0x29, 0x51, 0x79, 0x24, 0x70, 0x59, 0x44, 0x69, 0x38, 0x64, 0x48, 0x31, 0xa9,
-    0x88, 0x09, 0x20, 0x59, 0x70, 0xab, 0x11, 0x38, 0x40, 0x69, 0xa8, 0x19, 0x31, 0x48, 0x60, 0x8c,
-    0xa8, 0x3c, 0x41, 0x5c, 0x20, 0x7c, 0x00, 0xf1, 0x87, 0x98, 0x19, 0x86, 0xa8, 0x6e, 0x76, 0x7e,
-    0xa9, 0x99, 0x88, 0x2d, 0x55, 0x7d, 0xd8, 0xb1, 0xb5, 0xb9, 0xa3, 0xdf, 0xdf, 0xdf, 0xae, 0xd0,
-    0xdf, 0xaa, 0xd0, 0xde, 0xf2, 0xab, 0xf8, 0xf9, 0xd9, 0xb0, 0x87, 0xc4, 0xaa, 0xf1, 0xdf, 0xdf,
-    0xbb, 0xaf, 0xdf, 0xdf, 0xb9, 0xd8, 0xb1, 0xf1, 0xa3, 0x97, 0x8e, 0x60, 0xdf, 0xb0, 0x84, 0xf2,
-    0xc8, 0xf8, 0xf9, 0xd9, 0xde, 0xd8, 0x93, 0x85, 0xf1, 0x4a, 0xb1, 0x83, 0xa3, 0x08, 0xb5, 0x83,
-    /* bank # 10 */
-    0x9a, 0x08, 0x10, 0xb7, 0x9f, 0x10, 0xd8, 0xf1, 0xb0, 0xba, 0xae, 0xb0, 0x8a, 0xc2, 0xb2, 0xb6,
-    0x8e, 0x9e, 0xf1, 0xfb, 0xd9, 0xf4, 0x1d, 0xd8, 0xf9, 0xd9, 0x0c, 0xf1, 0xd8, 0xf8, 0xf8, 0xad,
-    0x61, 0xd9, 0xae, 0xfb, 0xd8, 0xf4, 0x0c, 0xf1, 0xd8, 0xf8, 0xf8, 0xad, 0x19, 0xd9, 0xae, 0xfb,
-    0xdf, 0xd8, 0xf4, 0x16, 0xf1, 0xd8, 0xf8, 0xad, 0x8d, 0x61, 0xd9, 0xf4, 0xf4, 0xac, 0xf5, 0x9c,
-    0x9c, 0x8d, 0xdf, 0x2b, 0xba, 0xb6, 0xae, 0xfa, 0xf8, 0xf4, 0x0b, 0xd8, 0xf1, 0xae, 0xd0, 0xf8,
-    0xad, 0x51, 0xda, 0xae, 0xfa, 0xf8, 0xf1, 0xd8, 0xb9, 0xb1, 0xb6, 0xa3, 0x83, 0x9c, 0x08, 0xb9,
-    0xb1, 0x83, 0x9a, 0xb5, 0xaa, 0xc0, 0xfd, 0x30, 0x83, 0xb7, 0x9f, 0x10, 0xb5, 0x8b, 0x93, 0xf2,
-    0x02, 0x02, 0xd1, 0xab, 0xda, 0xde, 0xd8, 0xf1, 0xb0, 0x80, 0xba, 0xab, 0xc0, 0xc3, 0xb2, 0x84,
-    0xc1, 0xc3, 0xd8, 0xb1, 0xb9, 0xf3, 0x8b, 0xa3, 0x91, 0xb6, 0x09, 0xb4, 0xd9, 0xab, 0xde, 0xb0,
-    0x87, 0x9c, 0xb9, 0xa3, 0xdd, 0xf1, 0xb3, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0xb0, 0x87, 0xa3, 0xa3,
-    0xa3, 0xa3, 0xb2, 0x8b, 0xb6, 0x9b, 0xf2, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3,
-    0xa3, 0xf1, 0xb0, 0x87, 0xb5, 0x9a, 0xa3, 0xf3, 0x9b, 0xa3, 0xa3, 0xdc, 0xba, 0xac, 0xdf, 0xb9,
-    0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3,
-    0xd8, 0xd8, 0xd8, 0xbb, 0xb3, 0xb7, 0xf1, 0xaa, 0xf9, 0xda, 0xff, 0xd9, 0x80, 0x9a, 0xaa, 0x28,
-    0xb4, 0x80, 0x98, 0xa7, 0x20, 0xb7, 0x97, 0x87, 0xa8, 0x66, 0x88, 0xf0, 0x79, 0x51, 0xf1, 0x90,
-    0x2c, 0x87, 0x0c, 0xa7, 0x81, 0x97, 0x62, 0x93, 0xf0, 0x71, 0x71, 0x60, 0x85, 0x94, 0x01, 0x29,
-    /* bank # 11 */
-    0x51, 0x79, 0x90, 0xa5, 0xf1, 0x28, 0x4c, 0x6c, 0x87, 0x0c, 0x95, 0x18, 0x85, 0x78, 0xa3, 0x83,
-    0x90, 0x28, 0x4c, 0x6c, 0x88, 0x6c, 0xd8, 0xf3, 0xa2, 0x82, 0x00, 0xf2, 0x10, 0xa8, 0x92, 0x19,
-    0x80, 0xa2, 0xf2, 0xd9, 0x26, 0xd8, 0xf1, 0x88, 0xa8, 0x4d, 0xd9, 0x48, 0xd8, 0x96, 0xa8, 0x39,
-    0x80, 0xd9, 0x3c, 0xd8, 0x95, 0x80, 0xa8, 0x39, 0xa6, 0x86, 0x98, 0xd9, 0x2c, 0xda, 0x87, 0xa7,
-    0x2c, 0xd8, 0xa8, 0x89, 0x95, 0x19, 0xa9, 0x80, 0xd9, 0x38, 0xd8, 0xa8, 0x89, 0x39, 0xa9, 0x80,
-    0xda, 0x3c, 0xd8, 0xa8, 0x2e, 0xa8, 0x39, 0x90, 0xd9, 0x0c, 0xd8, 0xa8, 0x95, 0x31, 0x98, 0xd9,
-    0x0c, 0xd8, 0xa8, 0x09, 0xd9, 0xff, 0xd8, 0x01, 0xda, 0xff, 0xd8, 0x95, 0x39, 0xa9, 0xda, 0x26,
-    0xff, 0xd8, 0x90, 0xa8, 0x0d, 0x89, 0x99, 0xa8, 0x10, 0x80, 0x98, 0x21, 0xda, 0x2e, 0xd8, 0x89,
-    0x99, 0xa8, 0x31, 0x80, 0xda, 0x2e, 0xd8, 0xa8, 0x86, 0x96, 0x31, 0x80, 0xda, 0x2e, 0xd8, 0xa8,
-    0x87, 0x31, 0x80, 0xda, 0x2e, 0xd8, 0xa8, 0x82, 0x92, 0xf3, 0x41, 0x80, 0xf1, 0xd9, 0x2e, 0xd8,
-    0xa8, 0x82, 0xf3, 0x19, 0x80, 0xf1, 0xd9, 0x2e, 0xd8, 0x82, 0xac, 0xf3, 0xc0, 0xa2, 0x80, 0x22,
-    0xf1, 0xa6, 0x2e, 0xa7, 0x2e, 0xa9, 0x22, 0x98, 0xa8, 0x29, 0xda, 0xac, 0xde, 0xff, 0xd8, 0xa2,
-    0xf2, 0x2a, 0xf1, 0xa9, 0x2e, 0x82, 0x92, 0xa8, 0xf2, 0x31, 0x80, 0xa6, 0x96, 0xf1, 0xd9, 0x00,
-    0xac, 0x8c, 0x9c, 0x0c, 0x30, 0xac, 0xde, 0xd0, 0xde, 0xff, 0xd8, 0x8c, 0x9c, 0xac, 0xd0, 0x10,
-    0xac, 0xde, 0x80, 0x92, 0xa2, 0xf2, 0x4c, 0x82, 0xa8, 0xf1, 0xca, 0xf2, 0x35, 0xf1, 0x96, 0x88,
-    0xa6, 0xd9, 0x00, 0xd8, 0xf1, 0xff
-};
-
-static const unsigned short sStartAddress = 0x0400;
-
-/* END OF SECTION COPIED FROM dmpDefaultMPU6050.c */
-
-#define INT_SRC_TAP             (0x01)
-#define INT_SRC_ANDROID_ORIENT  (0x08)
-
-#define DMP_FEATURE_SEND_ANY_GYRO   (DMP_FEATURE_SEND_RAW_GYRO | \
-                                     DMP_FEATURE_SEND_CAL_GYRO)
-
-#define MAX_PACKET_LENGTH   (32)
-
-#define DMP_SAMPLE_RATE     (200)
-#define GYRO_SF             (46850825LL * 200 / DMP_SAMPLE_RATE)
-
-#define FIFO_CORRUPTION_CHECK
-#ifdef FIFO_CORRUPTION_CHECK
-#define QUAT_ERROR_THRESH       (1L<<24)
-#define QUAT_MAG_SQ_NORMALIZED  (1L<<28)
-#define QUAT_MAG_SQ_MIN         (QUAT_MAG_SQ_NORMALIZED - QUAT_ERROR_THRESH)
-#define QUAT_MAG_SQ_MAX         (QUAT_MAG_SQ_NORMALIZED + QUAT_ERROR_THRESH)
-#endif
-
-struct dmp_s {
-    void (*tap_cb)(unsigned char count, unsigned char direction);
-    void (*android_orient_cb)(unsigned char orientation);
-    unsigned short orient;
-    unsigned short feature_mask;
-    unsigned short fifo_rate;
-    unsigned char packet_length;
-};
-
-static struct dmp_s dmp = {
-    .tap_cb = NULL,
-    .android_orient_cb = NULL,
-    .orient = 0,
-    .feature_mask = 0,
-    .fifo_rate = 0,
-    .packet_length = 0
-};
-
-/**
- *  @brief  Load the DMP with this image.
- *  @return 0 if successful.
- */
-int dmp_load_motion_driver_firmware(void)
-{
-    return mpu_load_firmware(DMP_CODE_SIZE, dmp_memory, sStartAddress,
-        DMP_SAMPLE_RATE);
-}
-
-/**
- *  @brief      Push gyro and accel orientation to the DMP.
- *  The orientation is represented here as the output of
- *  @e inv_orientation_matrix_to_scalar.
- *  @param[in]  orient  Gyro and accel orientation in body frame.
- *  @return     0 if successful.
- */
-int dmp_set_orientation(unsigned short orient)
-{
-    unsigned char gyro_regs[3], accel_regs[3];
-    const unsigned char gyro_axes[3] = {DINA4C, DINACD, DINA6C};
-    const unsigned char accel_axes[3] = {DINA0C, DINAC9, DINA2C};
-    const unsigned char gyro_sign[3] = {DINA36, DINA56, DINA76};
-    const unsigned char accel_sign[3] = {DINA26, DINA46, DINA66};
-
-    gyro_regs[0] = gyro_axes[orient & 3];
-    gyro_regs[1] = gyro_axes[(orient >> 3) & 3];
-    gyro_regs[2] = gyro_axes[(orient >> 6) & 3];
-    accel_regs[0] = accel_axes[orient & 3];
-    accel_regs[1] = accel_axes[(orient >> 3) & 3];
-    accel_regs[2] = accel_axes[(orient >> 6) & 3];
-
-    /* Chip-to-body, axes only. */
-    if (mpu_write_mem(FCFG_1, 3, gyro_regs))
-        return -1;
-    if (mpu_write_mem(FCFG_2, 3, accel_regs))
-        return -1;
-
-    memcpy(gyro_regs, gyro_sign, 3);
-    memcpy(accel_regs, accel_sign, 3);
-    if (orient & 4) {
-        gyro_regs[0] |= 1;
-        accel_regs[0] |= 1;
-    }
-    if (orient & 0x20) {
-        gyro_regs[1] |= 1;
-        accel_regs[1] |= 1;
-    }
-    if (orient & 0x100) {
-        gyro_regs[2] |= 1;
-        accel_regs[2] |= 1;
-    }
-
-    /* Chip-to-body, sign only. */
-    if (mpu_write_mem(FCFG_3, 3, gyro_regs))
-        return -1;
-    if (mpu_write_mem(FCFG_7, 3, accel_regs))
-        return -1;
-    dmp.orient = orient;
-    return 0;
-}
-
-/**
- *  @brief      Push gyro biases to the DMP.
- *  Because the gyro integration is handled in the DMP, any gyro biases
- *  calculated by the MPL should be pushed down to DMP memory to remove
- *  3-axis quaternion drift.
- *  \n NOTE: If the DMP-based gyro calibration is enabled, the DMP will
- *  overwrite the biases written to this location once a new one is computed.
- *  @param[in]  bias    Gyro biases in q16.
- *  @return     0 if successful.
- */
-int dmp_set_gyro_bias(long *bias)
-{
-    long gyro_bias_body[3];
-    unsigned char regs[4];
-
-    gyro_bias_body[0] = bias[dmp.orient & 3];
-    if (dmp.orient & 4)
-        gyro_bias_body[0] *= -1;
-    gyro_bias_body[1] = bias[(dmp.orient >> 3) & 3];
-    if (dmp.orient & 0x20)
-        gyro_bias_body[1] *= -1;
-    gyro_bias_body[2] = bias[(dmp.orient >> 6) & 3];
-    if (dmp.orient & 0x100)
-        gyro_bias_body[2] *= -1;
-
-#ifdef EMPL_NO_64BIT
-    gyro_bias_body[0] = (long)(((float)gyro_bias_body[0] * GYRO_SF) / 1073741824.f);
-    gyro_bias_body[1] = (long)(((float)gyro_bias_body[1] * GYRO_SF) / 1073741824.f);
-    gyro_bias_body[2] = (long)(((float)gyro_bias_body[2] * GYRO_SF) / 1073741824.f);
-#else
-    gyro_bias_body[0] = (long)(((long long)gyro_bias_body[0] * GYRO_SF) >> 30);
-    gyro_bias_body[1] = (long)(((long long)gyro_bias_body[1] * GYRO_SF) >> 30);
-    gyro_bias_body[2] = (long)(((long long)gyro_bias_body[2] * GYRO_SF) >> 30);
-#endif
-
-    regs[0] = (unsigned char)((gyro_bias_body[0] >> 24) & 0xFF);
-    regs[1] = (unsigned char)((gyro_bias_body[0] >> 16) & 0xFF);
-    regs[2] = (unsigned char)((gyro_bias_body[0] >> 8) & 0xFF);
-    regs[3] = (unsigned char)(gyro_bias_body[0] & 0xFF);
-    if (mpu_write_mem(D_EXT_GYRO_BIAS_X, 4, regs))
-        return -1;
-
-    regs[0] = (unsigned char)((gyro_bias_body[1] >> 24) & 0xFF);
-    regs[1] = (unsigned char)((gyro_bias_body[1] >> 16) & 0xFF);
-    regs[2] = (unsigned char)((gyro_bias_body[1] >> 8) & 0xFF);
-    regs[3] = (unsigned char)(gyro_bias_body[1] & 0xFF);
-    if (mpu_write_mem(D_EXT_GYRO_BIAS_Y, 4, regs))
-        return -1;
-
-    regs[0] = (unsigned char)((gyro_bias_body[2] >> 24) & 0xFF);
-    regs[1] = (unsigned char)((gyro_bias_body[2] >> 16) & 0xFF);
-    regs[2] = (unsigned char)((gyro_bias_body[2] >> 8) & 0xFF);
-    regs[3] = (unsigned char)(gyro_bias_body[2] & 0xFF);
-    return mpu_write_mem(D_EXT_GYRO_BIAS_Z, 4, regs);
-}
-
-/**
- *  @brief      Push accel biases to the DMP.
- *  These biases will be removed from the DMP 6-axis quaternion.
- *  @param[in]  bias    Accel biases in q16.
- *  @return     0 if successful.
- */
-int dmp_set_accel_bias(long *bias)
-{
-    long accel_bias_body[3];
-    unsigned char regs[12];
-    long long accel_sf;
-    unsigned short accel_sens;
-
-    mpu_get_accel_sens(&accel_sens);
-    accel_sf = (long long)accel_sens << 15;
-//    __no_operation();
-    __NOP();
-
-    accel_bias_body[0] = bias[dmp.orient & 3];
-    if (dmp.orient & 4)
-        accel_bias_body[0] *= -1;
-    accel_bias_body[1] = bias[(dmp.orient >> 3) & 3];
-    if (dmp.orient & 0x20)
-        accel_bias_body[1] *= -1;
-    accel_bias_body[2] = bias[(dmp.orient >> 6) & 3];
-    if (dmp.orient & 0x100)
-        accel_bias_body[2] *= -1;
-
-#ifdef EMPL_NO_64BIT
-    accel_bias_body[0] = (long)(((float)accel_bias_body[0] * accel_sf) / 1073741824.f);
-    accel_bias_body[1] = (long)(((float)accel_bias_body[1] * accel_sf) / 1073741824.f);
-    accel_bias_body[2] = (long)(((float)accel_bias_body[2] * accel_sf) / 1073741824.f);
-#else
-    accel_bias_body[0] = (long)(((long long)accel_bias_body[0] * accel_sf) >> 30);
-    accel_bias_body[1] = (long)(((long long)accel_bias_body[1] * accel_sf) >> 30);
-    accel_bias_body[2] = (long)(((long long)accel_bias_body[2] * accel_sf) >> 30);
-#endif
-
-    regs[0] = (unsigned char)((accel_bias_body[0] >> 24) & 0xFF);
-    regs[1] = (unsigned char)((accel_bias_body[0] >> 16) & 0xFF);
-    regs[2] = (unsigned char)((accel_bias_body[0] >> 8) & 0xFF);
-    regs[3] = (unsigned char)(accel_bias_body[0] & 0xFF);
-    regs[4] = (unsigned char)((accel_bias_body[1] >> 24) & 0xFF);
-    regs[5] = (unsigned char)((accel_bias_body[1] >> 16) & 0xFF);
-    regs[6] = (unsigned char)((accel_bias_body[1] >> 8) & 0xFF);
-    regs[7] = (unsigned char)(accel_bias_body[1] & 0xFF);
-    regs[8] = (unsigned char)((accel_bias_body[2] >> 24) & 0xFF);
-    regs[9] = (unsigned char)((accel_bias_body[2] >> 16) & 0xFF);
-    regs[10] = (unsigned char)((accel_bias_body[2] >> 8) & 0xFF);
-    regs[11] = (unsigned char)(accel_bias_body[2] & 0xFF);
-    return mpu_write_mem(D_ACCEL_BIAS, 12, regs);
-}
-
-/**
- *  @brief      Set DMP output rate.
- *  Only used when DMP is on.
- *  @param[in]  rate    Desired fifo rate (Hz).
- *  @return     0 if successful.
- */
-int dmp_set_fifo_rate(unsigned short rate)
-{
-    const unsigned char regs_end[12] = {DINAFE, DINAF2, DINAAB,
-        0xc4, DINAAA, DINAF1, DINADF, DINADF, 0xBB, 0xAF, DINADF, DINADF};
-    unsigned short div;
-    unsigned char tmp[8];
-
-    if (rate > DMP_SAMPLE_RATE)
-        return -1;
-    div = DMP_SAMPLE_RATE / rate - 1;
-    tmp[0] = (unsigned char)((div >> 8) & 0xFF);
-    tmp[1] = (unsigned char)(div & 0xFF);
-    if (mpu_write_mem(D_0_22, 2, tmp))
-        return -1;
-    if (mpu_write_mem(CFG_6, 12, (unsigned char*)regs_end))
-        return -1;
-
-    dmp.fifo_rate = rate;
-    return 0;
-}
-
-/**
- *  @brief      Get DMP output rate.
- *  @param[out] rate    Current fifo rate (Hz).
- *  @return     0 if successful.
- */
-int dmp_get_fifo_rate(unsigned short *rate)
-{
-    rate[0] = dmp.fifo_rate;
-    return 0;
-}
-
-/**
- *  @brief      Set tap threshold for a specific axis.
- *  @param[in]  axis    1, 2, and 4 for XYZ accel, respectively.
- *  @param[in]  thresh  Tap threshold, in mg/ms.
- *  @return     0 if successful.
- */
-int dmp_set_tap_thresh(unsigned char axis, unsigned short thresh)
-{
-    unsigned char tmp[4], accel_fsr;
-    float scaled_thresh;
-    unsigned short dmp_thresh, dmp_thresh_2;
-    if (!(axis & TAP_XYZ) || thresh > 1600)
-        return -1;
-
-    scaled_thresh = (float)thresh / DMP_SAMPLE_RATE;
-
-    mpu_get_accel_fsr(&accel_fsr);
-    switch (accel_fsr) {
-    case 2:
-        dmp_thresh = (unsigned short)(scaled_thresh * 16384);
-        /* dmp_thresh * 0.75 */
-        dmp_thresh_2 = (unsigned short)(scaled_thresh * 12288);
-        break;
-    case 4:
-        dmp_thresh = (unsigned short)(scaled_thresh * 8192);
-        /* dmp_thresh * 0.75 */
-        dmp_thresh_2 = (unsigned short)(scaled_thresh * 6144);
-        break;
-    case 8:
-        dmp_thresh = (unsigned short)(scaled_thresh * 4096);
-        /* dmp_thresh * 0.75 */
-        dmp_thresh_2 = (unsigned short)(scaled_thresh * 3072);
-        break;
-    case 16:
-        dmp_thresh = (unsigned short)(scaled_thresh * 2048);
-        /* dmp_thresh * 0.75 */
-        dmp_thresh_2 = (unsigned short)(scaled_thresh * 1536);
-        break;
-    default:
-        return -1;
-    }
-    tmp[0] = (unsigned char)(dmp_thresh >> 8);
-    tmp[1] = (unsigned char)(dmp_thresh & 0xFF);
-    tmp[2] = (unsigned char)(dmp_thresh_2 >> 8);
-    tmp[3] = (unsigned char)(dmp_thresh_2 & 0xFF);
-
-    if (axis & TAP_X) {
-        if (mpu_write_mem(DMP_TAP_THX, 2, tmp))
-            return -1;
-        if (mpu_write_mem(D_1_36, 2, tmp+2))
-            return -1;
-    }
-    if (axis & TAP_Y) {
-        if (mpu_write_mem(DMP_TAP_THY, 2, tmp))
-            return -1;
-        if (mpu_write_mem(D_1_40, 2, tmp+2))
-            return -1;
-    }
-    if (axis & TAP_Z) {
-        if (mpu_write_mem(DMP_TAP_THZ, 2, tmp))
-            return -1;
-        if (mpu_write_mem(D_1_44, 2, tmp+2))
-            return -1;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Set which axes will register a tap.
- *  @param[in]  axis    1, 2, and 4 for XYZ, respectively.
- *  @return     0 if successful.
- */
-int dmp_set_tap_axes(unsigned char axis)
-{
-    unsigned char tmp = 0;
-
-    if (axis & TAP_X)
-        tmp |= 0x30;
-    if (axis & TAP_Y)
-        tmp |= 0x0C;
-    if (axis & TAP_Z)
-        tmp |= 0x03;
-    return mpu_write_mem(D_1_72, 1, &tmp);
-}
-
-/**
- *  @brief      Set minimum number of taps needed for an interrupt.
- *  @param[in]  min_taps    Minimum consecutive taps (1-4).
- *  @return     0 if successful.
- */
-int dmp_set_tap_count(unsigned char min_taps)
-{
-    unsigned char tmp;
-
-    if (min_taps < 1)
-        min_taps = 1;
-    else if (min_taps > 4)
-        min_taps = 4;
-
-    tmp = min_taps - 1;
-    return mpu_write_mem(D_1_79, 1, &tmp);
-}
-
-/**
- *  @brief      Set length between valid taps.
- *  @param[in]  time    Milliseconds between taps.
- *  @return     0 if successful.
- */
-int dmp_set_tap_time(unsigned short time)
-{
-    unsigned short dmp_time;
-    unsigned char tmp[2];
-
-    dmp_time = time / (1000 / DMP_SAMPLE_RATE);
-    tmp[0] = (unsigned char)(dmp_time >> 8);
-    tmp[1] = (unsigned char)(dmp_time & 0xFF);
-    return mpu_write_mem(DMP_TAPW_MIN, 2, tmp);
-}
-
-/**
- *  @brief      Set max time between taps to register as a multi-tap.
- *  @param[in]  time    Max milliseconds between taps.
- *  @return     0 if successful.
- */
-int dmp_set_tap_time_multi(unsigned short time)
-{
-    unsigned short dmp_time;
-    unsigned char tmp[2];
-
-    dmp_time = time / (1000 / DMP_SAMPLE_RATE);
-    tmp[0] = (unsigned char)(dmp_time >> 8);
-    tmp[1] = (unsigned char)(dmp_time & 0xFF);
-    return mpu_write_mem(D_1_218, 2, tmp);
-}
-
-/**
- *  @brief      Set shake rejection threshold.
- *  If the DMP detects a gyro sample larger than @e thresh, taps are rejected.
- *  @param[in]  sf      Gyro scale factor.
- *  @param[in]  thresh  Gyro threshold in dps.
- *  @return     0 if successful.
- */
-int dmp_set_shake_reject_thresh(long sf, unsigned short thresh)
-{
-    unsigned char tmp[4];
-    long thresh_scaled = sf / 1000 * thresh;
-    tmp[0] = (unsigned char)(((long)thresh_scaled >> 24) & 0xFF);
-    tmp[1] = (unsigned char)(((long)thresh_scaled >> 16) & 0xFF);
-    tmp[2] = (unsigned char)(((long)thresh_scaled >> 8) & 0xFF);
-    tmp[3] = (unsigned char)((long)thresh_scaled & 0xFF);
-    return mpu_write_mem(D_1_92, 4, tmp);
-}
-
-/**
- *  @brief      Set shake rejection time.
- *  Sets the length of time that the gyro must be outside of the threshold set
- *  by @e gyro_set_shake_reject_thresh before taps are rejected. A mandatory
- *  60 ms is added to this parameter.
- *  @param[in]  time    Time in milliseconds.
- *  @return     0 if successful.
- */
-int dmp_set_shake_reject_time(unsigned short time)
-{
-    unsigned char tmp[2];
-
-    time /= (1000 / DMP_SAMPLE_RATE);
-    tmp[0] = time >> 8;
-    tmp[1] = time & 0xFF;
-    return mpu_write_mem(D_1_90,2,tmp);
-}
-
-/**
- *  @brief      Set shake rejection timeout.
- *  Sets the length of time after a shake rejection that the gyro must stay
- *  inside of the threshold before taps can be detected again. A mandatory
- *  60 ms is added to this parameter.
- *  @param[in]  time    Time in milliseconds.
- *  @return     0 if successful.
- */
-int dmp_set_shake_reject_timeout(unsigned short time)
-{
-    unsigned char tmp[2];
-
-    time /= (1000 / DMP_SAMPLE_RATE);
-    tmp[0] = time >> 8;
-    tmp[1] = time & 0xFF;
-    return mpu_write_mem(D_1_88,2,tmp);
-}
-
-/**
- *  @brief      Get current step count.
- *  @param[out] count   Number of steps detected.
- *  @return     0 if successful.
- */
-int dmp_get_pedometer_step_count(unsigned long *count)
-{
-    unsigned char tmp[4];
-    if (!count)
-        return -1;
-
-    if (mpu_read_mem(D_PEDSTD_STEPCTR, 4, tmp))
-        return -1;
-
-    count[0] = ((unsigned long)tmp[0] << 24) | ((unsigned long)tmp[1] << 16) |
-        ((unsigned long)tmp[2] << 8) | tmp[3];
-    return 0;
-}
-
-/**
- *  @brief      Overwrite current step count.
- *  WARNING: This function writes to DMP memory and could potentially encounter
- *  a race condition if called while the pedometer is enabled.
- *  @param[in]  count   New step count.
- *  @return     0 if successful.
- */
-int dmp_set_pedometer_step_count(unsigned long count)
-{
-    unsigned char tmp[4];
-
-    tmp[0] = (unsigned char)((count >> 24) & 0xFF);
-    tmp[1] = (unsigned char)((count >> 16) & 0xFF);
-    tmp[2] = (unsigned char)((count >> 8) & 0xFF);
-    tmp[3] = (unsigned char)(count & 0xFF);
-    return mpu_write_mem(D_PEDSTD_STEPCTR, 4, tmp);
-}
-
-/**
- *  @brief      Get duration of walking time.
- *  @param[in]  time    Walk time in milliseconds.
- *  @return     0 if successful.
- */
-int dmp_get_pedometer_walk_time(unsigned long *time)
-{
-    unsigned char tmp[4];
-    if (!time)
-        return -1;
-
-    if (mpu_read_mem(D_PEDSTD_TIMECTR, 4, tmp))
-        return -1;
-
-    time[0] = (((unsigned long)tmp[0] << 24) | ((unsigned long)tmp[1] << 16) |
-        ((unsigned long)tmp[2] << 8) | tmp[3]) * 20;
-    return 0;
-}
-
-/**
- *  @brief      Overwrite current walk time.
- *  WARNING: This function writes to DMP memory and could potentially encounter
- *  a race condition if called while the pedometer is enabled.
- *  @param[in]  time    New walk time in milliseconds.
- */
-int dmp_set_pedometer_walk_time(unsigned long time)
-{
-    unsigned char tmp[4];
-
-    time /= 20;
-
-    tmp[0] = (unsigned char)((time >> 24) & 0xFF);
-    tmp[1] = (unsigned char)((time >> 16) & 0xFF);
-    tmp[2] = (unsigned char)((time >> 8) & 0xFF);
-    tmp[3] = (unsigned char)(time & 0xFF);
-    return mpu_write_mem(D_PEDSTD_TIMECTR, 4, tmp);
-}
-
-/**
- *  @brief      Enable DMP features.
- *  The following \#define's are used in the input mask:
- *  \n DMP_FEATURE_TAP
- *  \n DMP_FEATURE_ANDROID_ORIENT
- *  \n DMP_FEATURE_LP_QUAT
- *  \n DMP_FEATURE_6X_LP_QUAT
- *  \n DMP_FEATURE_GYRO_CAL
- *  \n DMP_FEATURE_SEND_RAW_ACCEL
- *  \n DMP_FEATURE_SEND_RAW_GYRO
- *  \n NOTE: DMP_FEATURE_LP_QUAT and DMP_FEATURE_6X_LP_QUAT are mutually
- *  exclusive.
- *  \n NOTE: DMP_FEATURE_SEND_RAW_GYRO and DMP_FEATURE_SEND_CAL_GYRO are also
- *  mutually exclusive.
- *  @param[in]  mask    Mask of features to enable.
- *  @return     0 if successful.
- */
-int dmp_enable_feature(unsigned short mask)
-{
-    unsigned char tmp[10];
-
-    /* TODO: All of these settings can probably be integrated into the default
-     * DMP image.
-     */
-    /* Set integration scale factor. */
-    tmp[0] = (unsigned char)((GYRO_SF >> 24) & 0xFF);
-    tmp[1] = (unsigned char)((GYRO_SF >> 16) & 0xFF);
-    tmp[2] = (unsigned char)((GYRO_SF >> 8) & 0xFF);
-    tmp[3] = (unsigned char)(GYRO_SF & 0xFF);
-    mpu_write_mem(D_0_104, 4, tmp);
-
-    /* Send sensor data to the FIFO. */
-    tmp[0] = 0xA3;
-    if (mask & DMP_FEATURE_SEND_RAW_ACCEL) {
-        tmp[1] = 0xC0;
-        tmp[2] = 0xC8;
-        tmp[3] = 0xC2;
-    } else {
-        tmp[1] = 0xA3;
-        tmp[2] = 0xA3;
-        tmp[3] = 0xA3;
-    }
-    if (mask & DMP_FEATURE_SEND_ANY_GYRO) {
-        tmp[4] = 0xC4;
-        tmp[5] = 0xCC;
-        tmp[6] = 0xC6;
-    } else {
-        tmp[4] = 0xA3;
-        tmp[5] = 0xA3;
-        tmp[6] = 0xA3;
-    }
-    tmp[7] = 0xA3;
-    tmp[8] = 0xA3;
-    tmp[9] = 0xA3;
-    mpu_write_mem(CFG_15,10,tmp);
-
-    /* Send gesture data to the FIFO. */
-    if (mask & (DMP_FEATURE_TAP | DMP_FEATURE_ANDROID_ORIENT))
-        tmp[0] = DINA20;
-    else
-        tmp[0] = 0xD8;
-    mpu_write_mem(CFG_27,1,tmp);
-
-    if (mask & DMP_FEATURE_GYRO_CAL)
-        dmp_enable_gyro_cal(1);
-    else
-        dmp_enable_gyro_cal(0);
-
-    if (mask & DMP_FEATURE_SEND_ANY_GYRO) {
-        if (mask & DMP_FEATURE_SEND_CAL_GYRO) {
-            tmp[0] = 0xB2;
-            tmp[1] = 0x8B;
-            tmp[2] = 0xB6;
-            tmp[3] = 0x9B;
-        } else {
-            tmp[0] = DINAC0;
-            tmp[1] = DINA80;
-            tmp[2] = DINAC2;
-            tmp[3] = DINA90;
-        }
-        mpu_write_mem(CFG_GYRO_RAW_DATA, 4, tmp);
-    }
-
-    if (mask & DMP_FEATURE_TAP) {
-        /* Enable tap. */
-        tmp[0] = 0xF8;
-        mpu_write_mem(CFG_20, 1, tmp);
-        dmp_set_tap_thresh(TAP_XYZ, 250);
-        dmp_set_tap_axes(TAP_XYZ);
-        dmp_set_tap_count(1);
-        dmp_set_tap_time(100);
-        dmp_set_tap_time_multi(500);
-
-        dmp_set_shake_reject_thresh(GYRO_SF, 200);
-        dmp_set_shake_reject_time(40);
-        dmp_set_shake_reject_timeout(10);
-    } else {
-        tmp[0] = 0xD8;
-        mpu_write_mem(CFG_20, 1, tmp);
-    }
-
-    if (mask & DMP_FEATURE_ANDROID_ORIENT) {
-        tmp[0] = 0xD9;
-    } else
-        tmp[0] = 0xD8;
-    mpu_write_mem(CFG_ANDROID_ORIENT_INT, 1, tmp);
-
-    if (mask & DMP_FEATURE_LP_QUAT)
-        dmp_enable_lp_quat(1);
-    else
-        dmp_enable_lp_quat(0);
-
-    if (mask & DMP_FEATURE_6X_LP_QUAT)
-        dmp_enable_6x_lp_quat(1);
-    else
-        dmp_enable_6x_lp_quat(0);
-
-    /* Pedometer is always enabled. */
-    dmp.feature_mask = mask | DMP_FEATURE_PEDOMETER;
-    mpu_reset_fifo();
-
-    dmp.packet_length = 0;
-    if (mask & DMP_FEATURE_SEND_RAW_ACCEL)
-        dmp.packet_length += 6;
-    if (mask & DMP_FEATURE_SEND_ANY_GYRO)
-        dmp.packet_length += 6;
-    if (mask & (DMP_FEATURE_LP_QUAT | DMP_FEATURE_6X_LP_QUAT))
-        dmp.packet_length += 16;
-    if (mask & (DMP_FEATURE_TAP | DMP_FEATURE_ANDROID_ORIENT))
-        dmp.packet_length += 4;
-
-    return 0;
-}
-
-/**
- *  @brief      Get list of currently enabled DMP features.
- *  @param[out] Mask of enabled features.
- *  @return     0 if successful.
- */
-int dmp_get_enabled_features(unsigned short *mask)
-{
-    mask[0] = dmp.feature_mask;
-    return 0;
-}
-
-/**
- *  @brief      Calibrate the gyro data in the DMP.
- *  After eight seconds of no motion, the DMP will compute gyro biases and
- *  subtract them from the quaternion output. If @e dmp_enable_feature is
- *  called with @e DMP_FEATURE_SEND_CAL_GYRO, the biases will also be
- *  subtracted from the gyro output.
- *  @param[in]  enable  1 to enable gyro calibration.
- *  @return     0 if successful.
- */
-int dmp_enable_gyro_cal(unsigned char enable)
-{
-    if (enable) {
-        unsigned char regs[9] = {0xb8, 0xaa, 0xb3, 0x8d, 0xb4, 0x98, 0x0d, 0x35, 0x5d};
-        return mpu_write_mem(CFG_MOTION_BIAS, 9, regs);
-    } else {
-        unsigned char regs[9] = {0xb8, 0xaa, 0xaa, 0xaa, 0xb0, 0x88, 0xc3, 0xc5, 0xc7};
-        return mpu_write_mem(CFG_MOTION_BIAS, 9, regs);
-    }
-}
-
-/**
- *  @brief      Generate 3-axis quaternions from the DMP.
- *  In this driver, the 3-axis and 6-axis DMP quaternion features are mutually
- *  exclusive.
- *  @param[in]  enable  1 to enable 3-axis quaternion.
- *  @return     0 if successful.
- */
-int dmp_enable_lp_quat(unsigned char enable)
-{
-    unsigned char regs[4];
-    if (enable) {
-        regs[0] = DINBC0;
-        regs[1] = DINBC2;
-        regs[2] = DINBC4;
-        regs[3] = DINBC6;
-    }
-    else
-        memset(regs, 0x8B, 4);
-
-    mpu_write_mem(CFG_LP_QUAT, 4, regs);
-
-    return mpu_reset_fifo();
-}
-
-/**
- *  @brief       Generate 6-axis quaternions from the DMP.
- *  In this driver, the 3-axis and 6-axis DMP quaternion features are mutually
- *  exclusive.
- *  @param[in]   enable  1 to enable 6-axis quaternion.
- *  @return      0 if successful.
- */
-int dmp_enable_6x_lp_quat(unsigned char enable)
-{
-    unsigned char regs[4];
-    if (enable) {
-        regs[0] = DINA20;
-        regs[1] = DINA28;
-        regs[2] = DINA30;
-        regs[3] = DINA38;
-    } else
-        memset(regs, 0xA3, 4);
-
-    mpu_write_mem(CFG_8, 4, regs);
-
-    return mpu_reset_fifo();
-}
-
-/**
- *  @brief      Decode the four-byte gesture data and execute any callbacks.
- *  @param[in]  gesture Gesture data from DMP packet.
- *  @return     0 if successful.
- */
-static int decode_gesture(unsigned char *gesture)
-{
-    unsigned char tap, android_orient;
-
-    android_orient = gesture[3] & 0xC0;
-    tap = 0x3F & gesture[3];
-
-    if (gesture[1] & INT_SRC_TAP) {
-        unsigned char direction, count;
-        direction = tap >> 3;
-        count = (tap % 8) + 1;
-        if (dmp.tap_cb)
-            dmp.tap_cb(direction, count);
-    }
-
-    if (gesture[1] & INT_SRC_ANDROID_ORIENT) {
-        if (dmp.android_orient_cb)
-            dmp.android_orient_cb(android_orient >> 6);
-    }
-
-    return 0;
-}
-
-/**
- *  @brief      Specify when a DMP interrupt should occur.
- *  A DMP interrupt can be configured to trigger on either of the two
- *  conditions below:
- *  \n a. One FIFO period has elapsed (set by @e mpu_set_sample_rate).
- *  \n b. A tap event has been detected.
- *  @param[in]  mode    DMP_INT_GESTURE or DMP_INT_CONTINUOUS.
- *  @return     0 if successful.
- */
-int dmp_set_interrupt_mode(unsigned char mode)
-{
-    const unsigned char regs_continuous[11] =
-        {0xd8, 0xb1, 0xb9, 0xf3, 0x8b, 0xa3, 0x91, 0xb6, 0x09, 0xb4, 0xd9};
-    const unsigned char regs_gesture[11] =
-        {0xda, 0xb1, 0xb9, 0xf3, 0x8b, 0xa3, 0x91, 0xb6, 0xda, 0xb4, 0xda};
-
-    switch (mode) {
-    case DMP_INT_CONTINUOUS:
-        return mpu_write_mem(CFG_FIFO_ON_EVENT, 11,
-            (unsigned char*)regs_continuous);
-    case DMP_INT_GESTURE:
-        return mpu_write_mem(CFG_FIFO_ON_EVENT, 11,
-            (unsigned char*)regs_gesture);
-    default:
-        return -1;
-    }
-}
-
-/**
- *  @brief      Get one packet from the FIFO.
- *  If @e sensors does not contain a particular sensor, disregard the data
- *  returned to that pointer.
- *  \n @e sensors can contain a combination of the following flags:
- *  \n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
- *  \n INV_XYZ_GYRO
- *  \n INV_XYZ_ACCEL
- *  \n INV_WXYZ_QUAT
- *  \n If the FIFO has no new data, @e sensors will be zero.
- *  \n If the FIFO is disabled, @e sensors will be zero and this function will
- *  return a non-zero error code.
- *  @param[out] gyro        Gyro data in hardware units.
- *  @param[out] accel       Accel data in hardware units.
- *  @param[out] quat        3-axis quaternion data in hardware units.
- *  @param[out] timestamp   Timestamp in milliseconds.
- *  @param[out] sensors     Mask of sensors read from FIFO.
- *  @param[out] more        Number of remaining packets.
- *  @return     0 if successful.
- */
-int dmp_read_fifo(short *gyro, short *accel, long *quat,
-    unsigned long *timestamp, short *sensors, unsigned char *more)
-{
-    unsigned char fifo_data[MAX_PACKET_LENGTH];
-    unsigned char ii = 0;
-
-    /* TODO: sensors[0] only changes when dmp_enable_feature is called. We can
-     * cache this value and save some cycles.
-     */
-    sensors[0] = 0;
-
-    /* Get a packet. */
-    if (mpu_read_fifo_stream(dmp.packet_length, fifo_data, more))
-        return -1;
-
-    /* Parse DMP packet. */
-    if (dmp.feature_mask & (DMP_FEATURE_LP_QUAT | DMP_FEATURE_6X_LP_QUAT)) {
-#ifdef FIFO_CORRUPTION_CHECK
-        long quat_q14[4], quat_mag_sq;
-#endif
-        quat[0] = ((long)fifo_data[0] << 24) | ((long)fifo_data[1] << 16) |
-            ((long)fifo_data[2] << 8) | fifo_data[3];
-        quat[1] = ((long)fifo_data[4] << 24) | ((long)fifo_data[5] << 16) |
-            ((long)fifo_data[6] << 8) | fifo_data[7];
-        quat[2] = ((long)fifo_data[8] << 24) | ((long)fifo_data[9] << 16) |
-            ((long)fifo_data[10] << 8) | fifo_data[11];
-        quat[3] = ((long)fifo_data[12] << 24) | ((long)fifo_data[13] << 16) |
-            ((long)fifo_data[14] << 8) | fifo_data[15];
-        ii += 16;
-#ifdef FIFO_CORRUPTION_CHECK
-        /* We can detect a corrupted FIFO by monitoring the quaternion data and
-         * ensuring that the magnitude is always normalized to one. This
-         * shouldn't happen in normal operation, but if an I2C error occurs,
-         * the FIFO reads might become misaligned.
-         *
-         * Let's start by scaling down the quaternion data to avoid long long
-         * math.
-         */
-        quat_q14[0] = quat[0] >> 16;
-        quat_q14[1] = quat[1] >> 16;
-        quat_q14[2] = quat[2] >> 16;
-        quat_q14[3] = quat[3] >> 16;
-        quat_mag_sq = quat_q14[0] * quat_q14[0] + quat_q14[1] * quat_q14[1] +
-            quat_q14[2] * quat_q14[2] + quat_q14[3] * quat_q14[3];
-        if ((quat_mag_sq < QUAT_MAG_SQ_MIN) ||
-            (quat_mag_sq > QUAT_MAG_SQ_MAX)) {
-            /* Quaternion is outside of the acceptable threshold. */
-            mpu_reset_fifo();
-            sensors[0] = 0;
-            return -1;
-        }
-        sensors[0] |= INV_WXYZ_QUAT;
-#endif
-    }
-
-    if (dmp.feature_mask & DMP_FEATURE_SEND_RAW_ACCEL) {
-        accel[0] = ((short)fifo_data[ii+0] << 8) | fifo_data[ii+1];
-        accel[1] = ((short)fifo_data[ii+2] << 8) | fifo_data[ii+3];
-        accel[2] = ((short)fifo_data[ii+4] << 8) | fifo_data[ii+5];
-        ii += 6;
-        sensors[0] |= INV_XYZ_ACCEL;
-    }
-
-    if (dmp.feature_mask & DMP_FEATURE_SEND_ANY_GYRO) {
-        gyro[0] = ((short)fifo_data[ii+0] << 8) | fifo_data[ii+1];
-        gyro[1] = ((short)fifo_data[ii+2] << 8) | fifo_data[ii+3];
-        gyro[2] = ((short)fifo_data[ii+4] << 8) | fifo_data[ii+5];
-        ii += 6;
-        sensors[0] |= INV_XYZ_GYRO;
-    }
-
-    /* Gesture data is at the end of the DMP packet. Parse it and call
-     * the gesture callbacks (if registered).
-     */
-    if (dmp.feature_mask & (DMP_FEATURE_TAP | DMP_FEATURE_ANDROID_ORIENT))
-        decode_gesture(fifo_data + ii);
-
-    get_ms(timestamp);
-    return 0;
-}
-
-/**
- *  @brief      Register a function to be executed on a tap event.
- *  The tap direction is represented by one of the following:
- *  \n TAP_X_UP
- *  \n TAP_X_DOWN
- *  \n TAP_Y_UP
- *  \n TAP_Y_DOWN
- *  \n TAP_Z_UP
- *  \n TAP_Z_DOWN
- *  @param[in]  func    Callback function.
- *  @return     0 if successful.
- */
-int dmp_register_tap_cb(void (*func)(unsigned char, unsigned char))
-{
-    dmp.tap_cb = func;
-    return 0;
-}
-
-/**
- *  @brief      Register a function to be executed on a android orientation event.
- *  @param[in]  func    Callback function.
- *  @return     0 if successful.
- */
-int dmp_register_android_orient_cb(void (*func)(unsigned char))
-{
-    dmp.android_orient_cb = func;
-    return 0;
-}
-
-/**
- *  @}
- */
-

+ 0 - 97
Core备份3/imu2/inv_mpu_dmp_motion_driver2.h

@@ -1,97 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011-2012 InvenSense Corporation, All Rights Reserved.
-    See included License.txt for License information.
- $
- */
-/**
- *  @addtogroup  DRIVERS Sensor Driver Layer
- *  @brief       Hardware drivers to communicate with sensors via I2C.
- *
- *  @{
- *      @file       inv_mpu_dmp_motion_driver.h
- *      @brief      DMP image and interface functions.
- *      @details    All functions are preceded by the dmp_ prefix to
- *                  differentiate among MPL and general driver function calls.
- */
-#ifndef _INV_MPU_DMP_MOTION_DRIVER_H_
-#define _INV_MPU_DMP_MOTION_DRIVER_H_
-
-#define TAP_X               (0x01)
-#define TAP_Y               (0x02)
-#define TAP_Z               (0x04)
-#define TAP_XYZ             (0x07)
-
-#define TAP_X_UP            (0x01)
-#define TAP_X_DOWN          (0x02)
-#define TAP_Y_UP            (0x03)
-#define TAP_Y_DOWN          (0x04)
-#define TAP_Z_UP            (0x05)
-#define TAP_Z_DOWN          (0x06)
-
-#define ANDROID_ORIENT_PORTRAIT             (0x00)
-#define ANDROID_ORIENT_LANDSCAPE            (0x01)
-#define ANDROID_ORIENT_REVERSE_PORTRAIT     (0x02)
-#define ANDROID_ORIENT_REVERSE_LANDSCAPE    (0x03)
-
-#define DMP_INT_GESTURE     (0x01)
-#define DMP_INT_CONTINUOUS  (0x02)
-
-#define DMP_FEATURE_TAP             (0x001)
-#define DMP_FEATURE_ANDROID_ORIENT  (0x002)
-#define DMP_FEATURE_LP_QUAT         (0x004)
-#define DMP_FEATURE_PEDOMETER       (0x008)
-#define DMP_FEATURE_6X_LP_QUAT      (0x010)
-#define DMP_FEATURE_GYRO_CAL        (0x020)
-#define DMP_FEATURE_SEND_RAW_ACCEL  (0x040)
-#define DMP_FEATURE_SEND_RAW_GYRO   (0x080)
-#define DMP_FEATURE_SEND_CAL_GYRO   (0x100)
-
-#define INV_WXYZ_QUAT       (0x100)
-
-/* Set up functions. */
-int dmp_load_motion_driver_firmware(void);
-int dmp_set_fifo_rate(unsigned short rate);
-int dmp_get_fifo_rate(unsigned short *rate);
-int dmp_enable_feature(unsigned short mask);
-int dmp_get_enabled_features(unsigned short *mask);
-int dmp_set_interrupt_mode(unsigned char mode);
-int dmp_set_orientation(unsigned short orient);
-int dmp_set_gyro_bias(long *bias);
-int dmp_set_accel_bias(long *bias);
-
-/* Tap functions. */
-int dmp_register_tap_cb(void (*func)(unsigned char, unsigned char));
-int dmp_set_tap_thresh(unsigned char axis, unsigned short thresh);
-int dmp_set_tap_axes(unsigned char axis);
-int dmp_set_tap_count(unsigned char min_taps);
-int dmp_set_tap_time(unsigned short time);
-int dmp_set_tap_time_multi(unsigned short time);
-int dmp_set_shake_reject_thresh(long sf, unsigned short thresh);
-int dmp_set_shake_reject_time(unsigned short time);
-int dmp_set_shake_reject_timeout(unsigned short time);
-
-/* Android orientation functions. */
-int dmp_register_android_orient_cb(void (*func)(unsigned char));
-
-/* LP quaternion functions. */
-int dmp_enable_lp_quat(unsigned char enable);
-int dmp_enable_6x_lp_quat(unsigned char enable);
-
-/* Pedometer functions. */
-int dmp_get_pedometer_step_count(unsigned long *count);
-int dmp_set_pedometer_step_count(unsigned long count);
-int dmp_get_pedometer_walk_time(unsigned long *time);
-int dmp_set_pedometer_walk_time(unsigned long time);
-
-/* DMP gyro calibration functions. */
-int dmp_enable_gyro_cal(unsigned char enable);
-
-/* Read function. This function should be called whenever the MPU interrupt is
- * detected.
- */
-int dmp_read_fifo(short *gyro, short *accel, long *quat,
-    unsigned long *timestamp, short *sensors, unsigned char *more);
-
-#endif  /* #ifndef _INV_MPU_DMP_MOTION_DRIVER_H_ */
-

+ 0 - 542
Core备份3/imu3/MPU60503.c

@@ -1,542 +0,0 @@
-/*
- * MPU6050.c
- *
- *  Created on: Oct 26, 2021
- *      Author: Administrator
- */
-
-#include "MPU60503.h"
-
-#include <stdio.h>
-
- u8 IIC_Write_Byte(u8 reg, u8 value)
- {
-	 return IIC_Write_Len(MPU_ADDR, reg, 1, &value);
- }
-
- u8 IIC_Read_Byte(u8 reg)
- {
-	 u8 value = 0;
-
-	 IIC_Read_Len(MPU_ADDR, reg, 1, &value);
-
-	 return value;
- }
-
- //IIC连续写
- u8 IIC_Write_Len(u8 addr,u8 reg, u8 len, u8 *buf)
- {
-	 addr = (addr << 1) | 0;
-
-	 u8 data[10] = {0};
-	 data[0] = reg;
-	 for(int i = 0; i < len; i++)
-	 {
-		 data[1 + i] = buf[i];
-	 }
-
-	 if(HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)addr, (uint8_t*)data, len + 1, 10000)!= HAL_OK)
-	 {
-		 printf("++write len byte fail\r\n");
-		 return 1;
-	 }
-
-	 return 0;
- }
-
- //IIC连续读
- u8 IIC_Read_Len(u8 addr,u8 reg,u8 len,u8 *buf)
- {
-	 u8 tmp  = (addr << 1) | 0;
-	 if(HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)tmp, (uint8_t*)&reg, 1, 10000)!= HAL_OK)
-	 {
-		 printf("++write byte fail\r\n");
-		 return 1;
-	 }
-
-	 tmp  = (addr << 1) | 1;
-	 if(HAL_I2C_Master_Receive(&hi2c1, (uint16_t)tmp, (uint8_t *)buf, len, 10000) != HAL_OK)
-	 {
-		 printf("--read byte fail\r\n");
-	 }
-
- }
-
-
-//初始化MPU6050
-//返回值: 0,成功
-//        其他,错误代码
-u8 MPU_Init(void)
-{
-    u8 res = 0;
-
-    IIC_Write_Byte(MPU_PWR_MGMT1_REG,0X80);//复位MPU6050
-
-    HAL_Delay(100);
-
-    IIC_Write_Byte(MPU_PWR_MGMT1_REG,0X00);//唤醒MPU6050
-
-    MPU_Set_Gyro_Fsr(3); //陀螺仪传感器,±2000dps
-    MPU_Set_Accel_Fsr(0); //加速度传感器 ±2g
-    MPU_Set_Rate(50); //设置采样率50HZ
-    IIC_Write_Byte(MPU_INT_EN_REG,0X00); //关闭所有中断
-    IIC_Write_Byte(MPU_USER_CTRL_REG,0X00);//I2C主模式关闭
-    IIC_Write_Byte(MPU_FIFO_EN_REG,0X00);//关闭FIFO
-    IIC_Write_Byte(MPU_INTBP_CFG_REG,0X80);//INT引脚低电平有效
-
-    res=IIC_Read_Byte(MPU_DEVICE_ID_REG);
-
-    printf("the addr is:%d\r\n", res);
-
-    if(res==MPU_ADDR)//器件ID正确
-    {
-        IIC_Write_Byte(MPU_PWR_MGMT1_REG,0X01);//设置CLKSEL,PLL X 轴为参考
-        IIC_Write_Byte(MPU_PWR_MGMT2_REG,0X00);//加速度陀螺仪都工作
-        MPU_Set_Rate(50); //设置采样率为50HZ
-    }
-    else
-    {
-    	return 1;
-    }
-
-    return 0;
-}
-
-//设置MPU6050陀螺仪传感器满量程范围
-//fsr:0,±250dps;1,±500dps;2,±1000dps;3,±2000dps
-//返回值:0,设置成功
-//    其他,设置失败
-u8 MPU_Set_Gyro_Fsr(u8 fsr)
-{
-    return IIC_Write_Byte(MPU_GYRO_CFG_REG, fsr<<3);//设置陀螺仪满量程范围
-}
-
-//设置MPU6050加速度传感器满量程范围
-//fsr:0,±2g;1,±4g;2,±8g;3,±16g
-//返回值:0,设置成功
-//    其他,设置失败
-u8 MPU_Set_Accel_Fsr(u8 fsr)
-{
-    return IIC_Write_Byte(MPU_ACCEL_CFG_REG, fsr<<3);//设置加速度传感器满量程范围
-}
-
-//设置MPU6050的数字低通滤波器
-//lpf:数字低通滤波频率(Hz)
-//返回值:0,设置成功
-//    其他,设置失败
-u8 MPU_Set_LPF(u16 lpf)
-{
-    u8 data=0;
-    if(lpf>=188) data=1;
-    else if(lpf>=98) data=2;
-    else if(lpf>=42) data=2;
-    else if(lpf>=42) data=3;
-    else if(lpf>=20) data=4;
-    else if(lpf>=10) data=5;
-    else data=6;
-    return IIC_Write_Byte(MPU_CFG_REG,data);//设置数字低通滤波器
-}
-
-//设置MPU6050的采样率(假定Fs=1KHz)
-//rate:4~1000(Hz)
-//返回值:0,设置成功
-//    其他,设置失败
-u8 MPU_Set_Rate(u16 rate)
-{
-    u8 data;
-    if(rate>1000)rate=1000;
-    if(rate<4)rate=4;
-    data=1000/rate-1;
-    data=IIC_Write_Byte(MPU_SAMPLE_RATE_REG, data);  //设置数字低通滤波器
-    return MPU_Set_LPF(rate/2); //自动设置LPF为采样率的一半
-}
-
-//得到温度值
-//返回值:温度值(扩大了100倍)
-short MPU_Get_Temperature(void)
-{
-    u8 buf[2];
-    short raw;
-    float temp;
-    IIC_Read_Len(MPU_ADDR, MPU_TEMP_OUTH_REG, 2, buf);
-    raw=((u16)buf[0]<<8)|buf[1];
-    temp=36.53+((double)raw)/340;
-
-    return temp*100;;
-}
-
-//得到陀螺仪值(原始值)
-//gx,gy,gz:陀螺仪x,y,z轴的原始读数(带符号)
-//返回值:0,成功
-// 其他,错误代码
-u8 MPU_Get_Gyroscope(short *gx,short *gy,short *gz)
-{
-    u8 buf[6],res;
-    res=IIC_Read_Len(MPU_ADDR,MPU_GYRO_XOUTH_REG,6,buf);
-    if(res==0)
-    {
-        *gx=((u16)buf[0]<<8)|buf[1];
-        *gy=((u16)buf[2]<<8)|buf[3];
-        *gz=((u16)buf[4]<<8)|buf[5];
-    }
-    return res;
-}
-
-//得到加速度值(原始值)
-//ax,ay,az:陀螺仪x,y,z轴的原始读数(带符号)
-//返回值:0,成功
-//    其他,错误代码
-u8 MPU_Get_Accelerometer(short *ax,short *ay,short *az)
-{
-    u8 buf[6],res;
-    res=IIC_Read_Len(MPU_ADDR,MPU_ACCEL_XOUTH_REG,6,buf);
-    if(res==0)
-    {
-        *ax=((u16)buf[0]<<8)|buf[1];
-        *ay=((u16)buf[2]<<8)|buf[3];
-        *az=((u16)buf[4]<<8)|buf[5];
-    }
-    return res;;
-}
-
-/*--------------------以下为使用板载固件DMP的相关代码,这个融合得到的姿态角效果很好*/
-
-
-/**
-  * @brief  获取当前毫秒值
-  * @param  存储最新毫秒值的变量
-  * @retval 无
-  */
-int get_tick_count(unsigned long *count)
-{
-   count[0] = HAL_GetTick();
-	return 0;
-}
-
-
-#include "inv_mpu3.h"
-#include "inv_mpu_dmp_motion_driver3.h"
-
-/* Data requested by client. */
-#define PRINT_ACCEL     (0x01)
-#define PRINT_GYRO      (0x02)
-#define PRINT_QUAT      (0x04)
-
-#define ACCEL_ON        (0x01)
-#define GYRO_ON         (0x02)
-
-#define MOTION          (0)
-#define NO_MOTION       (1)
-
-/* Starting sampling rate. */ //100
-#define DEFAULT_MPU_HZ  (50)
-
-struct rx_s {
-    unsigned char header[3];
-    unsigned char cmd;
-};
-struct hal_s {
-    unsigned char sensors;
-    unsigned char dmp_on;
-    unsigned char wait_for_tap;
-    volatile unsigned char new_gyro;
-    unsigned short report;
-    unsigned short dmp_features;
-    unsigned char motion_int_mode;
-    struct rx_s rx;
-};
-static struct hal_s hal = {0};
-
-/* USB RX binary semaphore. Actually, it's just a flag. Not included in struct
- * because it's declared extern elsewhere.
- */
-volatile unsigned char rx_new;
-
-/* The sensors can be mounted onto the board in any orientation. The mounting
- * matrix seen below tells the MPL how to rotate the raw data from thei
- * driver(s).
- * TODO: The following matrices refer to the configuration on an internal test
- * board at Invensense. If needed, please modify the matrices to match the
- * chip-to-body matrix for your particular set up.
- */
-static signed char gyro_orientation[9] = {-1, 0, 0,
-                                           0,-1, 0,
-                                           0, 0, 1};
-
-/* Every time new gyro data is available, this function is called in an
- * ISR context. In this example, it sets a flag protecting the FIFO read
- * function.
- */
-static void gyro_data_ready_cb(void)
-{
-    hal.new_gyro = 1;
-}
-
-enum packet_type_e {
-    PACKET_TYPE_ACCEL,
-    PACKET_TYPE_GYRO,
-    PACKET_TYPE_QUAT,
-    PACKET_TYPE_TAP,
-    PACKET_TYPE_ANDROID_ORIENT,
-    PACKET_TYPE_PEDO,
-    PACKET_TYPE_MISC
-};
-
-#define BYTE u_char
-/* Send data to the Python client application.
- * Data is formatted as follows:
- * packet[0]    = $
- * packet[1]    = packet type (see packet_type_e)
- * packet[2+]   = data
- */
-void send_packet(char packet_type, void *data)
-{
-
-	#define MAX_BUF_LENGTH  (18)
-    char buf[MAX_BUF_LENGTH], length;
-
-    memset(buf, 0, MAX_BUF_LENGTH);
-    buf[0] = '$';
-    buf[1] = packet_type;
-
-    if (packet_type == PACKET_TYPE_ACCEL || packet_type == PACKET_TYPE_GYRO) {
-        short *sdata = (short*)data;
-        buf[2] = (char)(sdata[0] >> 8);
-        buf[3] = (char)sdata[0];
-        buf[4] = (char)(sdata[1] >> 8);
-        buf[5] = (char)sdata[1];
-        buf[6] = (char)(sdata[2] >> 8);
-        buf[7] = (char)sdata[2];
-        length = 8;
-    } else if (packet_type == PACKET_TYPE_QUAT) {
-        long *ldata = (long*)data;
-        buf[2] = (char)(ldata[0] >> 24);
-        buf[3] = (char)(ldata[0] >> 16);
-        buf[4] = (char)(ldata[0] >> 8);
-        buf[5] = (char)ldata[0];
-        buf[6] = (char)(ldata[1] >> 24);
-        buf[7] = (char)(ldata[1] >> 16);
-        buf[8] = (char)(ldata[1] >> 8);
-        buf[9] = (char)ldata[1];
-        buf[10] = (char)(ldata[2] >> 24);
-        buf[11] = (char)(ldata[2] >> 16);
-        buf[12] = (char)(ldata[2] >> 8);
-        buf[13] = (char)ldata[2];
-        buf[14] = (char)(ldata[3] >> 24);
-        buf[15] = (char)(ldata[3] >> 16);
-        buf[16] = (char)(ldata[3] >> 8);
-        buf[17] = (char)ldata[3];
-        length = 18;
-    } else if (packet_type == PACKET_TYPE_TAP) {
-        buf[2] = ((char*)data)[0];
-        buf[3] = ((char*)data)[1];
-        length = 4;
-    } else if (packet_type == PACKET_TYPE_ANDROID_ORIENT) {
-        buf[2] = ((char*)data)[0];
-        length = 3;
-    } else if (packet_type == PACKET_TYPE_PEDO) {
-        long *ldata = (long*)data;
-        buf[2] = (char)(ldata[0] >> 24);
-        buf[3] = (char)(ldata[0] >> 16);
-        buf[4] = (char)(ldata[0] >> 8);
-        buf[5] = (char)ldata[0];
-        buf[6] = (char)(ldata[1] >> 24);
-        buf[7] = (char)(ldata[1] >> 16);
-        buf[8] = (char)(ldata[1] >> 8);
-        buf[9] = (char)ldata[1];
-        length = 10;
-    } else if (packet_type == PACKET_TYPE_MISC) {
-        buf[2] = ((char*)data)[0];
-        buf[3] = ((char*)data)[1];
-        buf[4] = ((char*)data)[2];
-        buf[5] = ((char*)data)[3];
-        length = 6;
-    }
-
-//    cdcSendDataWaitTilDone((BYTE*)buf, length, CDC0_INTFNUM, 100);
-}
-
-/* These next two functions converts the orientation matrix (see
- * gyro_orientation) to a scalar representation for use by the DMP.
- * NOTE: These functions are borrowed from Invensense's MPL.
- */
-static inline unsigned short inv_row_2_scale(const signed char *row)
-{
-    unsigned short b;
-
-    if (row[0] > 0)
-        b = 0;
-    else if (row[0] < 0)
-        b = 4;
-    else if (row[1] > 0)
-        b = 1;
-    else if (row[1] < 0)
-        b = 5;
-    else if (row[2] > 0)
-        b = 2;
-    else if (row[2] < 0)
-        b = 6;
-    else
-        b = 7;      // error
-    return b;
-}
-static inline unsigned short inv_orientation_matrix_to_scalar(
-    const signed char *mtx)
-{
-    unsigned short scalar;
-
-    /*
-       XYZ  010_001_000 Identity Matrix
-       XZY  001_010_000
-       YXZ  010_000_001
-       YZX  000_010_001
-       ZXY  001_000_010
-       ZYX  000_001_010
-     */
-
-    scalar = inv_row_2_scale(mtx);
-    scalar |= inv_row_2_scale(mtx + 3) << 3;
-    scalar |= inv_row_2_scale(mtx + 6) << 6;
-
-
-    return scalar;
-}
-
-static inline void run_self_test(void)
-{
-    int result;
-    char test_packet[4] = {0};
-    long gyro[3], accel[3];
-
-    result = mpu_run_self_test(gyro, accel);
-    if (result == 0x7) {
-        /* Test passed. We can trust the gyro data here, so let's push it down
-         * to the DMP.
-         */
-        float sens;
-        unsigned short accel_sens;
-        mpu_get_gyro_sens(&sens);
-        gyro[0] = (long)(gyro[0] * sens);
-        gyro[1] = (long)(gyro[1] * sens);
-        gyro[2] = (long)(gyro[2] * sens);
-        dmp_set_gyro_bias(gyro);
-        mpu_get_accel_sens(&accel_sens);
-        accel[0] *= accel_sens;
-        accel[1] *= accel_sens;
-        accel[2] *= accel_sens;
-        dmp_set_accel_bias(accel);
-    }
-
-    /* Report results. */
-    test_packet[0] = 't';
-    test_packet[1] = result;
-    send_packet(PACKET_TYPE_MISC, test_packet);
-}
-
-
-#define INT_EXIT_LPM0 12
-
-void DMP_Init(void)
-{
-    struct int_param_s int_param;
-
-	/* Set up gyro.
-	 * Every function preceded by mpu_ is a driver function and can be found
-	 * in inv_mpu.h.
-	 */
-	int_param.cb = gyro_data_ready_cb;
-	int_param.pin = 16;
-	int_param.lp_exit = INT_EXIT_LPM0;
-	int_param.active_low = 1;
-
-	int result = mpu_init(&int_param);
-
-	printf("mpu_init, %d\r\n", result);
-
-	if(result == 0)     //mpu初始化
-	{
-		if(!mpu_set_sensors(INV_XYZ_GYRO | INV_XYZ_ACCEL))    //设置需要的传感器
-			printf("mpu_set_sensor complete ......\r\n");
-
-		if(!mpu_configure_fifo(INV_XYZ_GYRO | INV_XYZ_ACCEL)) //设置fifo
-			printf("mpu_configure_fifo complete ......\r\n");
-
-		if(!mpu_set_sample_rate(DEFAULT_MPU_HZ))              //设置采集样率
-			printf("mpu_set_sample_rate complete ......\r\n");
-
-
-		unsigned short gyro_rate = 0, gyro_fsr = 0;
-		unsigned char accel_fsr = 0;
-
-	    mpu_get_sample_rate(&gyro_rate);
-	    mpu_get_gyro_fsr(&gyro_fsr);
-	    mpu_get_accel_fsr(&accel_fsr);
-
-	    printf("gyro_rate %d, gyro_fsr %d, accel_fsr %d\r\n", gyro_rate, gyro_fsr, accel_fsr);
-
-
-
-		if(!dmp_load_motion_driver_firmware())                //加载dmp固件
-			printf("dmp_load_motion_driver_firmware complete ......\r\n");
-
-		if(!dmp_set_orientation(inv_orientation_matrix_to_scalar(gyro_orientation)))
-			printf("dmp_set_orientation complete ......\r\n"); //设置陀螺仪方向
-
-		if(!dmp_enable_feature(DMP_FEATURE_6X_LP_QUAT | DMP_FEATURE_TAP |
-				DMP_FEATURE_ANDROID_ORIENT | DMP_FEATURE_SEND_RAW_ACCEL | DMP_FEATURE_SEND_CAL_GYRO |
-				DMP_FEATURE_GYRO_CAL))
-			printf("dmp_enable_feature complete ......\r\n");
-
-		if(!dmp_set_fifo_rate(DEFAULT_MPU_HZ))    //设置速率
-			printf("dmp_set_fifo_rate complete ......\r\n");
-
-		run_self_test();                          //自检(非必要)
-
-		if(!mpu_set_dmp_state(1))                 //使能
-			printf("mpu_set_dmp_state complete ......\r\n");
-	}
-
-}
-
-#define q30 1073741824.0
-
-uint8_t Read_DMP(float* Pitch,float* Roll,float* Yaw)
-{
-	short gyro[3], accel[3], sensors;
-	float q0=1.0f,q1=0.0f,q2=0.0f,q3=0.0f;
-	unsigned long sensor_timestamp;
-	unsigned char more;
-	long quat[4];
-
-	int ret = dmp_read_fifo(gyro, accel, quat, &sensor_timestamp, &sensors, &more);
-
-//	printf("dmp_read_fifo, %d\r\n", ret);
-
-	if(ret)
-	{
-		return 1;
-	}
-
-	if (sensors & INV_WXYZ_QUAT)
-	{
-		q0=quat[0] / q30;
-		q1=quat[1] / q30;
-		q2=quat[2] / q30;
-		q3=quat[3] / q30;
-		*Pitch = (float)asin(-2 * q1 * q3 + 2 * q0* q2)* 57.3;
-		*Roll =  (float)atan2(2 * q2 * q3 + 2 * q0 * q1, -2 * q1 * q1 - 2 * q2* q2 + 1)* 57.3; // roll
-		*Yaw =   (float)atan2(2*(q1*q2 + q0*q3),q0*q0+q1*q1-q2*q2-q3*q3) * 57.3;
-		return 0;
-	}
-	else
-	{
-		return 2;
-	}
-
-}
-
-
-
-
-
-

+ 0 - 117
Core备份3/imu3/MPU60503.h

@@ -1,117 +0,0 @@
-/*
- * MPU6050.h
- *
- *  Created on: Oct 26, 2021
- *      Author: Administrator
- */
-
-#ifndef INC_MPU6050_H_
-#define INC_MPU6050_H_
-
-#include "i2c.h"
-#include "inv_mpu3.h"
-
-//#define MPU_ACCEL_OFFS_REG		0X06	//accel_offs寄存器,可读取版本号,寄存器手册未提到
-//#define MPU_PROD_ID_REG			0X0C	//prod id寄存器,在寄存器手册未提到
-#define MPU_SELF_TESTX_REG		0X0D	//自检寄存器X
-#define MPU_SELF_TESTY_REG		0X0E	//自检寄存器Y
-#define MPU_SELF_TESTZ_REG		0X0F	//自检寄存器Z
-#define MPU_SELF_TESTA_REG		0X10	//自检寄存器A
-#define MPU_SAMPLE_RATE_REG		0X19	//采样频率分频器
-#define MPU_CFG_REG				0X1A	//配置寄存器
-#define MPU_GYRO_CFG_REG		0X1B	//陀螺仪配置寄存器
-#define MPU_ACCEL_CFG_REG		0X1C	//加速度计配置寄存器
-#define MPU_MOTION_DET_REG		0X1F	//运动检测阀值设置寄存器
-#define MPU_FIFO_EN_REG			0X23	//FIFO使能寄存器
-#define MPU_I2CMST_CTRL_REG		0X24	//IIC主机控制寄存器
-#define MPU_I2CSLV0_ADDR_REG	0X25	//IIC从机0器件地址寄存器
-#define MPU_I2CSLV0_REG			0X26	//IIC从机0数据地址寄存器
-#define MPU_I2CSLV0_CTRL_REG	0X27	//IIC从机0控制寄存器
-#define MPU_I2CSLV1_ADDR_REG	0X28	//IIC从机1器件地址寄存器
-#define MPU_I2CSLV1_REG			0X29	//IIC从机1数据地址寄存器
-#define MPU_I2CSLV1_CTRL_REG	0X2A	//IIC从机1控制寄存器
-#define MPU_I2CSLV2_ADDR_REG	0X2B	//IIC从机2器件地址寄存器
-#define MPU_I2CSLV2_REG			0X2C	//IIC从机2数据地址寄存器
-#define MPU_I2CSLV2_CTRL_REG	0X2D	//IIC从机2控制寄存器
-#define MPU_I2CSLV3_ADDR_REG	0X2E	//IIC从机3器件地址寄存器
-#define MPU_I2CSLV3_REG			0X2F	//IIC从机3数据地址寄存器
-#define MPU_I2CSLV3_CTRL_REG	0X30	//IIC从机3控制寄存器
-#define MPU_I2CSLV4_ADDR_REG	0X31	//IIC从机4器件地址寄存器
-#define MPU_I2CSLV4_REG			0X32	//IIC从机4数据地址寄存器
-#define MPU_I2CSLV4_DO_REG		0X33	//IIC从机4写数据寄存器
-#define MPU_I2CSLV4_CTRL_REG	0X34	//IIC从机4控制寄存器
-#define MPU_I2CSLV4_DI_REG		0X35	//IIC从机4读数据寄存器
-
-#define MPU_I2CMST_STA_REG		0X36	//IIC主机状态寄存器
-#define MPU_INTBP_CFG_REG		0X37	//中断/旁路设置寄存器
-#define MPU_INT_EN_REG			0X38	//中断使能寄存器
-#define MPU_INT_STA_REG			0X3A	//中断状态寄存器
-
-#define MPU_ACCEL_XOUTH_REG		0X3B	//加速度值,X轴高8位寄存器
-#define MPU_ACCEL_XOUTL_REG		0X3C	//加速度值,X轴低8位寄存器
-#define MPU_ACCEL_YOUTH_REG		0X3D	//加速度值,Y轴高8位寄存器
-#define MPU_ACCEL_YOUTL_REG		0X3E	//加速度值,Y轴低8位寄存器
-#define MPU_ACCEL_ZOUTH_REG		0X3F	//加速度值,Z轴高8位寄存器
-#define MPU_ACCEL_ZOUTL_REG		0X40	//加速度值,Z轴低8位寄存器
-
-#define MPU_TEMP_OUTH_REG		0X41	//温度值高八位寄存器
-#define MPU_TEMP_OUTL_REG		0X42	//温度值低8位寄存器
-
-#define MPU_GYRO_XOUTH_REG		0X43	//陀螺仪值,X轴高8位寄存器
-#define MPU_GYRO_XOUTL_REG		0X44	//陀螺仪值,X轴低8位寄存器
-#define MPU_GYRO_YOUTH_REG		0X45	//陀螺仪值,Y轴高8位寄存器
-#define MPU_GYRO_YOUTL_REG		0X46	//陀螺仪值,Y轴低8位寄存器
-#define MPU_GYRO_ZOUTH_REG		0X47	//陀螺仪值,Z轴高8位寄存器
-#define MPU_GYRO_ZOUTL_REG		0X48	//陀螺仪值,Z轴低8位寄存器
-
-#define MPU_I2CSLV0_DO_REG		0X63	//IIC从机0数据寄存器
-#define MPU_I2CSLV1_DO_REG		0X64	//IIC从机1数据寄存器
-#define MPU_I2CSLV2_DO_REG		0X65	//IIC从机2数据寄存器
-#define MPU_I2CSLV3_DO_REG		0X66	//IIC从机3数据寄存器
-
-#define MPU_I2CMST_DELAY_REG	0X67	//IIC主机延时管理寄存器
-#define MPU_SIGPATH_RST_REG		0X68	//信号通道复位寄存器
-#define MPU_MDETECT_CTRL_REG	0X69	//运动检测控制寄存器
-#define MPU_USER_CTRL_REG		0X6A	//用户控制寄存器
-#define MPU_PWR_MGMT1_REG		0X6B	//电源管理寄存器1
-#define MPU_PWR_MGMT2_REG		0X6C	//电源管理寄存器2
-#define MPU_FIFO_CNTH_REG		0X72	//FIFO计数寄存器高八位
-#define MPU_FIFO_CNTL_REG		0X73	//FIFO计数寄存器低八位
-#define MPU_FIFO_RW_REG			0X74	//FIFO读写寄存器
-#define MPU_DEVICE_ID_REG		0X75	//器件ID寄存器
-
-//如果AD0脚接地,IIC地址为0X68(不包含最低位).
-//如果接V3.3,则IIC地址为0X69(不包含最低位).
-#define MPU_ADDR				0X68
-
-
-//因为模块AD0默认接GND,所以转为读写地址后,为0XD1和0XD0(如果接VCC,则为0XD3和0XD2)
-#define MPU_READ    0XD1
-#define MPU_WRITE   0XD0
-
-#define u8 uint8_t
-#define u16 uint16_t
-
-u8 MPU_Init(void); 								//初始化MPU6050
-u8 IIC_Write_Len(u8 addr,u8 reg,u8 len,u8 *buf);//IIC连续写
-u8 IIC_Read_Len(u8 addr,u8 reg,u8 len,u8 *buf); //IIC连续读
-u8 IIC_Write_Byte(u8 reg,u8 data);				//IIC写一个字节
-u8 IIC_Read_Byte(u8 reg);						//IIC读一个字节
-
-u8 MPU_Set_Gyro_Fsr(u8 fsr);
-u8 MPU_Set_Accel_Fsr(u8 fsr);
-u8 MPU_Set_LPF(u16 lpf);
-u8 MPU_Set_Rate(u16 rate);
-u8 MPU_Set_Fifo(u8 sens);
-
-
-short MPU_Get_Temperature(void);
-u8 MPU_Get_Gyroscope(short *gx,short *gy,short *gz);
-u8 MPU_Get_Accelerometer(short *ax,short *ay,short *az);
-
-//----------------------DMP-------------------------------
-void DMP_Init(void);
-uint8_t Read_DMP(float* Pitch,float* Roll,float* Yaw);
-int get_tick_count(unsigned long *count);
-
-#endif /* INC_MPU6050_H_ */

+ 0 - 494
Core备份3/imu3/dmpKey3.h

@@ -1,494 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011 InvenSense Corporation, All Rights Reserved.
- $
- */
-#ifndef DMPKEY_H__
-#define DMPKEY_H__
-
-#define KEY_CFG_25                  (0)
-#define KEY_CFG_24                  (KEY_CFG_25 + 1)
-#define KEY_CFG_26                  (KEY_CFG_24 + 1)
-#define KEY_CFG_27                  (KEY_CFG_26 + 1)
-#define KEY_CFG_21                  (KEY_CFG_27 + 1)
-#define KEY_CFG_20                  (KEY_CFG_21 + 1)
-#define KEY_CFG_TAP4                (KEY_CFG_20 + 1)
-#define KEY_CFG_TAP5                (KEY_CFG_TAP4 + 1)
-#define KEY_CFG_TAP6                (KEY_CFG_TAP5 + 1)
-#define KEY_CFG_TAP7                (KEY_CFG_TAP6 + 1)
-#define KEY_CFG_TAP0                (KEY_CFG_TAP7 + 1)
-#define KEY_CFG_TAP1                (KEY_CFG_TAP0 + 1)
-#define KEY_CFG_TAP2                (KEY_CFG_TAP1 + 1)
-#define KEY_CFG_TAP3                (KEY_CFG_TAP2 + 1)
-#define KEY_CFG_TAP_QUANTIZE        (KEY_CFG_TAP3 + 1)
-#define KEY_CFG_TAP_JERK            (KEY_CFG_TAP_QUANTIZE + 1)
-#define KEY_CFG_DR_INT              (KEY_CFG_TAP_JERK + 1)
-#define KEY_CFG_AUTH                (KEY_CFG_DR_INT + 1)
-#define KEY_CFG_TAP_SAVE_ACCB       (KEY_CFG_AUTH + 1)
-#define KEY_CFG_TAP_CLEAR_STICKY    (KEY_CFG_TAP_SAVE_ACCB + 1)
-#define KEY_CFG_FIFO_ON_EVENT       (KEY_CFG_TAP_CLEAR_STICKY + 1)
-#define KEY_FCFG_ACCEL_INPUT        (KEY_CFG_FIFO_ON_EVENT + 1)
-#define KEY_FCFG_ACCEL_INIT         (KEY_FCFG_ACCEL_INPUT + 1)
-#define KEY_CFG_23                  (KEY_FCFG_ACCEL_INIT + 1)
-#define KEY_FCFG_1                  (KEY_CFG_23 + 1)
-#define KEY_FCFG_3                  (KEY_FCFG_1 + 1)
-#define KEY_FCFG_2                  (KEY_FCFG_3 + 1)
-#define KEY_CFG_3D                  (KEY_FCFG_2 + 1)
-#define KEY_CFG_3B                  (KEY_CFG_3D + 1)
-#define KEY_CFG_3C                  (KEY_CFG_3B + 1)
-#define KEY_FCFG_5                  (KEY_CFG_3C + 1)
-#define KEY_FCFG_4                  (KEY_FCFG_5 + 1)
-#define KEY_FCFG_7                  (KEY_FCFG_4 + 1)
-#define KEY_FCFG_FSCALE             (KEY_FCFG_7 + 1)
-#define KEY_FCFG_AZ                 (KEY_FCFG_FSCALE + 1)
-#define KEY_FCFG_6                  (KEY_FCFG_AZ + 1)
-#define KEY_FCFG_LSB4               (KEY_FCFG_6 + 1)
-#define KEY_CFG_12                  (KEY_FCFG_LSB4 + 1)
-#define KEY_CFG_14                  (KEY_CFG_12 + 1)
-#define KEY_CFG_15                  (KEY_CFG_14 + 1)
-#define KEY_CFG_16                  (KEY_CFG_15 + 1)
-#define KEY_CFG_18                  (KEY_CFG_16 + 1)
-#define KEY_CFG_6                   (KEY_CFG_18 + 1)
-#define KEY_CFG_7                   (KEY_CFG_6 + 1)
-#define KEY_CFG_4                   (KEY_CFG_7 + 1)
-#define KEY_CFG_5                   (KEY_CFG_4 + 1)
-#define KEY_CFG_2                   (KEY_CFG_5 + 1)
-#define KEY_CFG_3                   (KEY_CFG_2 + 1)
-#define KEY_CFG_1                   (KEY_CFG_3 + 1)
-#define KEY_CFG_EXTERNAL            (KEY_CFG_1 + 1)
-#define KEY_CFG_8                   (KEY_CFG_EXTERNAL + 1)
-#define KEY_CFG_9                   (KEY_CFG_8 + 1)
-#define KEY_CFG_ORIENT_3            (KEY_CFG_9 + 1)
-#define KEY_CFG_ORIENT_2            (KEY_CFG_ORIENT_3 + 1)
-#define KEY_CFG_ORIENT_1            (KEY_CFG_ORIENT_2 + 1)
-#define KEY_CFG_GYRO_SOURCE         (KEY_CFG_ORIENT_1 + 1)
-#define KEY_CFG_ORIENT_IRQ_1        (KEY_CFG_GYRO_SOURCE + 1)
-#define KEY_CFG_ORIENT_IRQ_2        (KEY_CFG_ORIENT_IRQ_1 + 1)
-#define KEY_CFG_ORIENT_IRQ_3        (KEY_CFG_ORIENT_IRQ_2 + 1)
-#define KEY_FCFG_MAG_VAL            (KEY_CFG_ORIENT_IRQ_3 + 1)
-#define KEY_FCFG_MAG_MOV            (KEY_FCFG_MAG_VAL + 1)
-#define KEY_CFG_LP_QUAT             (KEY_FCFG_MAG_MOV + 1)
-
-/* MPU6050 keys */
-#define KEY_CFG_ACCEL_FILTER        (KEY_CFG_LP_QUAT + 1)
-#define KEY_CFG_MOTION_BIAS         (KEY_CFG_ACCEL_FILTER + 1)
-#define KEY_TEMPLABEL               (KEY_CFG_MOTION_BIAS + 1)
-
-#define KEY_D_0_22                  (KEY_TEMPLABEL + 1)
-#define KEY_D_0_24                  (KEY_D_0_22 + 1)
-#define KEY_D_0_36                  (KEY_D_0_24 + 1)
-#define KEY_D_0_52                  (KEY_D_0_36 + 1)
-#define KEY_D_0_96                  (KEY_D_0_52 + 1)
-#define KEY_D_0_104                 (KEY_D_0_96 + 1)
-#define KEY_D_0_108                 (KEY_D_0_104 + 1)
-#define KEY_D_0_163                 (KEY_D_0_108 + 1)
-#define KEY_D_0_188                 (KEY_D_0_163 + 1)
-#define KEY_D_0_192                 (KEY_D_0_188 + 1)
-#define KEY_D_0_224                 (KEY_D_0_192 + 1)
-#define KEY_D_0_228                 (KEY_D_0_224 + 1)
-#define KEY_D_0_232                 (KEY_D_0_228 + 1)
-#define KEY_D_0_236                 (KEY_D_0_232 + 1)
-
-#define KEY_DMP_PREVPTAT            (KEY_D_0_236 + 1)
-#define KEY_D_1_2                   (KEY_DMP_PREVPTAT + 1)
-#define KEY_D_1_4                   (KEY_D_1_2 + 1)
-#define KEY_D_1_8                   (KEY_D_1_4 + 1)
-#define KEY_D_1_10                  (KEY_D_1_8 + 1)
-#define KEY_D_1_24                  (KEY_D_1_10 + 1)
-#define KEY_D_1_28                  (KEY_D_1_24 + 1)
-#define KEY_D_1_36                  (KEY_D_1_28 + 1)
-#define KEY_D_1_40                  (KEY_D_1_36 + 1)
-#define KEY_D_1_44                  (KEY_D_1_40 + 1)
-#define KEY_D_1_72                  (KEY_D_1_44 + 1)
-#define KEY_D_1_74                  (KEY_D_1_72 + 1)
-#define KEY_D_1_79                  (KEY_D_1_74 + 1)
-#define KEY_D_1_88                  (KEY_D_1_79 + 1)
-#define KEY_D_1_90                  (KEY_D_1_88 + 1)
-#define KEY_D_1_92                  (KEY_D_1_90 + 1)
-#define KEY_D_1_96                  (KEY_D_1_92 + 1)
-#define KEY_D_1_98                  (KEY_D_1_96 + 1)
-#define KEY_D_1_100                 (KEY_D_1_98 + 1)
-#define KEY_D_1_106                 (KEY_D_1_100 + 1)
-#define KEY_D_1_108                 (KEY_D_1_106 + 1)
-#define KEY_D_1_112                 (KEY_D_1_108 + 1)
-#define KEY_D_1_128                 (KEY_D_1_112 + 1)
-#define KEY_D_1_152                 (KEY_D_1_128 + 1)
-#define KEY_D_1_160                 (KEY_D_1_152 + 1)
-#define KEY_D_1_168                 (KEY_D_1_160 + 1)
-#define KEY_D_1_175                 (KEY_D_1_168 + 1)
-#define KEY_D_1_176                 (KEY_D_1_175 + 1)
-#define KEY_D_1_178                 (KEY_D_1_176 + 1)
-#define KEY_D_1_179                 (KEY_D_1_178 + 1)
-#define KEY_D_1_218                 (KEY_D_1_179 + 1)
-#define KEY_D_1_232                 (KEY_D_1_218 + 1)
-#define KEY_D_1_236                 (KEY_D_1_232 + 1)
-#define KEY_D_1_240                 (KEY_D_1_236 + 1)
-#define KEY_D_1_244                 (KEY_D_1_240 + 1)
-#define KEY_D_1_250                 (KEY_D_1_244 + 1)
-#define KEY_D_1_252                 (KEY_D_1_250 + 1)
-#define KEY_D_2_12                  (KEY_D_1_252 + 1)
-#define KEY_D_2_96                  (KEY_D_2_12 + 1)
-#define KEY_D_2_108                 (KEY_D_2_96 + 1)
-#define KEY_D_2_208                 (KEY_D_2_108 + 1)
-#define KEY_FLICK_MSG               (KEY_D_2_208 + 1)
-#define KEY_FLICK_COUNTER           (KEY_FLICK_MSG + 1)
-#define KEY_FLICK_LOWER             (KEY_FLICK_COUNTER + 1)
-#define KEY_CFG_FLICK_IN            (KEY_FLICK_LOWER + 1)
-#define KEY_FLICK_UPPER             (KEY_CFG_FLICK_IN + 1)
-#define KEY_CGNOTICE_INTR           (KEY_FLICK_UPPER + 1)
-#define KEY_D_2_224                 (KEY_CGNOTICE_INTR + 1)
-#define KEY_D_2_244                 (KEY_D_2_224 + 1)
-#define KEY_D_2_248                 (KEY_D_2_244 + 1)
-#define KEY_D_2_252                 (KEY_D_2_248 + 1)
-
-#define KEY_D_GYRO_BIAS_X               (KEY_D_2_252 + 1)
-#define KEY_D_GYRO_BIAS_Y               (KEY_D_GYRO_BIAS_X + 1)
-#define KEY_D_GYRO_BIAS_Z               (KEY_D_GYRO_BIAS_Y + 1)
-#define KEY_D_ACC_BIAS_X                (KEY_D_GYRO_BIAS_Z + 1)
-#define KEY_D_ACC_BIAS_Y                (KEY_D_ACC_BIAS_X + 1)
-#define KEY_D_ACC_BIAS_Z                (KEY_D_ACC_BIAS_Y + 1)
-#define KEY_D_GYRO_ENABLE               (KEY_D_ACC_BIAS_Z + 1)
-#define KEY_D_ACCEL_ENABLE              (KEY_D_GYRO_ENABLE + 1)
-#define KEY_D_QUAT_ENABLE               (KEY_D_ACCEL_ENABLE +1)
-#define KEY_D_OUTPUT_ENABLE             (KEY_D_QUAT_ENABLE + 1)
-#define KEY_D_CR_TIME_G                 (KEY_D_OUTPUT_ENABLE + 1)
-#define KEY_D_CR_TIME_A                 (KEY_D_CR_TIME_G + 1)
-#define KEY_D_CR_TIME_Q                 (KEY_D_CR_TIME_A + 1)
-#define KEY_D_CS_TAX                    (KEY_D_CR_TIME_Q + 1)
-#define KEY_D_CS_TAY                    (KEY_D_CS_TAX + 1)
-#define KEY_D_CS_TAZ                    (KEY_D_CS_TAY + 1)
-#define KEY_D_CS_TGX                    (KEY_D_CS_TAZ + 1)
-#define KEY_D_CS_TGY                    (KEY_D_CS_TGX + 1)
-#define KEY_D_CS_TGZ                    (KEY_D_CS_TGY + 1)
-#define KEY_D_CS_TQ0                    (KEY_D_CS_TGZ + 1)
-#define KEY_D_CS_TQ1                    (KEY_D_CS_TQ0 + 1)
-#define KEY_D_CS_TQ2                    (KEY_D_CS_TQ1 + 1)
-#define KEY_D_CS_TQ3                    (KEY_D_CS_TQ2 + 1)
-
-/* Compass keys */
-#define KEY_CPASS_BIAS_X            (KEY_D_CS_TQ3 + 1)
-#define KEY_CPASS_BIAS_Y            (KEY_CPASS_BIAS_X + 1)
-#define KEY_CPASS_BIAS_Z            (KEY_CPASS_BIAS_Y + 1)
-#define KEY_CPASS_MTX_00            (KEY_CPASS_BIAS_Z + 1)
-#define KEY_CPASS_MTX_01            (KEY_CPASS_MTX_00 + 1)
-#define KEY_CPASS_MTX_02            (KEY_CPASS_MTX_01 + 1)
-#define KEY_CPASS_MTX_10            (KEY_CPASS_MTX_02 + 1)
-#define KEY_CPASS_MTX_11            (KEY_CPASS_MTX_10 + 1)
-#define KEY_CPASS_MTX_12            (KEY_CPASS_MTX_11 + 1)
-#define KEY_CPASS_MTX_20            (KEY_CPASS_MTX_12 + 1)
-#define KEY_CPASS_MTX_21            (KEY_CPASS_MTX_20 + 1)
-#define KEY_CPASS_MTX_22            (KEY_CPASS_MTX_21 + 1)
-
-/* Gesture Keys */
-#define KEY_DMP_TAPW_MIN            (KEY_CPASS_MTX_22 + 1)
-#define KEY_DMP_TAP_THR_X           (KEY_DMP_TAPW_MIN + 1)
-#define KEY_DMP_TAP_THR_Y           (KEY_DMP_TAP_THR_X + 1)
-#define KEY_DMP_TAP_THR_Z           (KEY_DMP_TAP_THR_Y + 1)
-#define KEY_DMP_SH_TH_Y             (KEY_DMP_TAP_THR_Z + 1)
-#define KEY_DMP_SH_TH_X             (KEY_DMP_SH_TH_Y + 1)
-#define KEY_DMP_SH_TH_Z             (KEY_DMP_SH_TH_X + 1)
-#define KEY_DMP_ORIENT              (KEY_DMP_SH_TH_Z + 1)
-#define KEY_D_ACT0                  (KEY_DMP_ORIENT + 1)
-#define KEY_D_ACSX                  (KEY_D_ACT0 + 1)
-#define KEY_D_ACSY                  (KEY_D_ACSX + 1)
-#define KEY_D_ACSZ                  (KEY_D_ACSY + 1)
-
-#define KEY_X_GRT_Y_TMP             (KEY_D_ACSZ + 1)
-#define KEY_SKIP_X_GRT_Y_TMP        (KEY_X_GRT_Y_TMP + 1)
-#define KEY_SKIP_END_COMPARE        (KEY_SKIP_X_GRT_Y_TMP + 1)
-#define KEY_END_COMPARE_Y_X_TMP2    (KEY_SKIP_END_COMPARE + 1)       
-#define KEY_CFG_ANDROID_ORIENT_INT  (KEY_END_COMPARE_Y_X_TMP2 + 1)
-#define KEY_NO_ORIENT_INTERRUPT     (KEY_CFG_ANDROID_ORIENT_INT + 1)
-#define KEY_END_COMPARE_Y_X_TMP     (KEY_NO_ORIENT_INTERRUPT + 1)
-#define KEY_END_ORIENT_1            (KEY_END_COMPARE_Y_X_TMP + 1)
-#define KEY_END_COMPARE_Y_X         (KEY_END_ORIENT_1 + 1) 
-#define KEY_END_ORIENT              (KEY_END_COMPARE_Y_X + 1)
-#define KEY_X_GRT_Y                 (KEY_END_ORIENT + 1)
-#define KEY_NOT_TIME_MINUS_1        (KEY_X_GRT_Y + 1)       
-#define KEY_END_COMPARE_Y_X_TMP3    (KEY_NOT_TIME_MINUS_1 + 1) 
-#define KEY_X_GRT_Y_TMP2            (KEY_END_COMPARE_Y_X_TMP3 + 1)
-
-/* Authenticate Keys */
-#define KEY_D_AUTH_OUT              (KEY_X_GRT_Y_TMP2 + 1)
-#define KEY_D_AUTH_IN               (KEY_D_AUTH_OUT + 1)
-#define KEY_D_AUTH_A                (KEY_D_AUTH_IN + 1)
-#define KEY_D_AUTH_B                (KEY_D_AUTH_A + 1)
-
-/* Pedometer standalone only keys */
-#define KEY_D_PEDSTD_BP_B           (KEY_D_AUTH_B + 1)
-#define KEY_D_PEDSTD_HP_A           (KEY_D_PEDSTD_BP_B + 1)
-#define KEY_D_PEDSTD_HP_B           (KEY_D_PEDSTD_HP_A + 1)
-#define KEY_D_PEDSTD_BP_A4          (KEY_D_PEDSTD_HP_B + 1)
-#define KEY_D_PEDSTD_BP_A3          (KEY_D_PEDSTD_BP_A4 + 1)
-#define KEY_D_PEDSTD_BP_A2          (KEY_D_PEDSTD_BP_A3 + 1)
-#define KEY_D_PEDSTD_BP_A1          (KEY_D_PEDSTD_BP_A2 + 1)
-#define KEY_D_PEDSTD_INT_THRSH      (KEY_D_PEDSTD_BP_A1 + 1)
-#define KEY_D_PEDSTD_CLIP           (KEY_D_PEDSTD_INT_THRSH + 1)
-#define KEY_D_PEDSTD_SB             (KEY_D_PEDSTD_CLIP + 1)
-#define KEY_D_PEDSTD_SB_TIME        (KEY_D_PEDSTD_SB + 1)
-#define KEY_D_PEDSTD_PEAKTHRSH      (KEY_D_PEDSTD_SB_TIME + 1)
-#define KEY_D_PEDSTD_TIML           (KEY_D_PEDSTD_PEAKTHRSH + 1)
-#define KEY_D_PEDSTD_TIMH           (KEY_D_PEDSTD_TIML + 1)
-#define KEY_D_PEDSTD_PEAK           (KEY_D_PEDSTD_TIMH + 1)
-#define KEY_D_PEDSTD_TIMECTR        (KEY_D_PEDSTD_PEAK + 1)
-#define KEY_D_PEDSTD_STEPCTR        (KEY_D_PEDSTD_TIMECTR + 1)
-#define KEY_D_PEDSTD_WALKTIME       (KEY_D_PEDSTD_STEPCTR + 1)
-#define KEY_D_PEDSTD_DECI           (KEY_D_PEDSTD_WALKTIME + 1)
-
-/*Host Based No Motion*/
-#define KEY_D_HOST_NO_MOT           (KEY_D_PEDSTD_DECI + 1)
-
-/* EIS keys */
-#define KEY_P_EIS_FIFO_FOOTER       (KEY_D_HOST_NO_MOT + 1)
-#define KEY_P_EIS_FIFO_YSHIFT       (KEY_P_EIS_FIFO_FOOTER + 1)
-#define KEY_P_EIS_DATA_RATE         (KEY_P_EIS_FIFO_YSHIFT + 1)
-#define KEY_P_EIS_FIFO_XSHIFT       (KEY_P_EIS_DATA_RATE + 1)
-#define KEY_P_EIS_FIFO_SYNC         (KEY_P_EIS_FIFO_XSHIFT + 1)
-#define KEY_P_EIS_FIFO_ZSHIFT       (KEY_P_EIS_FIFO_SYNC + 1)
-#define KEY_P_EIS_FIFO_READY        (KEY_P_EIS_FIFO_ZSHIFT + 1)
-#define KEY_DMP_FOOTER              (KEY_P_EIS_FIFO_READY + 1)
-#define KEY_DMP_INTX_HC             (KEY_DMP_FOOTER + 1)
-#define KEY_DMP_INTX_PH             (KEY_DMP_INTX_HC + 1)
-#define KEY_DMP_INTX_SH             (KEY_DMP_INTX_PH + 1)
-#define KEY_DMP_AINV_SH             (KEY_DMP_INTX_SH + 1)
-#define KEY_DMP_A_INV_XH            (KEY_DMP_AINV_SH + 1)
-#define KEY_DMP_AINV_PH             (KEY_DMP_A_INV_XH + 1)
-#define KEY_DMP_CTHX_H              (KEY_DMP_AINV_PH + 1)
-#define KEY_DMP_CTHY_H              (KEY_DMP_CTHX_H + 1)
-#define KEY_DMP_CTHZ_H              (KEY_DMP_CTHY_H + 1)
-#define KEY_DMP_NCTHX_H             (KEY_DMP_CTHZ_H + 1)
-#define KEY_DMP_NCTHY_H             (KEY_DMP_NCTHX_H + 1)
-#define KEY_DMP_NCTHZ_H             (KEY_DMP_NCTHY_H + 1)
-#define KEY_DMP_CTSQ_XH             (KEY_DMP_NCTHZ_H + 1)
-#define KEY_DMP_CTSQ_YH             (KEY_DMP_CTSQ_XH + 1)
-#define KEY_DMP_CTSQ_ZH             (KEY_DMP_CTSQ_YH + 1)
-#define KEY_DMP_INTX_H              (KEY_DMP_CTSQ_ZH + 1)
-#define KEY_DMP_INTY_H              (KEY_DMP_INTX_H + 1)
-#define KEY_DMP_INTZ_H              (KEY_DMP_INTY_H + 1)
-//#define KEY_DMP_HPX_H               (KEY_DMP_INTZ_H + 1)
-//#define KEY_DMP_HPY_H               (KEY_DMP_HPX_H + 1)
-//#define KEY_DMP_HPZ_H               (KEY_DMP_HPY_H + 1)
-
-/* Stream keys */
-#define KEY_STREAM_P_GYRO_Z         (KEY_DMP_INTZ_H + 1)
-#define KEY_STREAM_P_GYRO_Y         (KEY_STREAM_P_GYRO_Z + 1)
-#define KEY_STREAM_P_GYRO_X         (KEY_STREAM_P_GYRO_Y + 1)
-#define KEY_STREAM_P_TEMP           (KEY_STREAM_P_GYRO_X + 1)
-#define KEY_STREAM_P_AUX_Y          (KEY_STREAM_P_TEMP + 1)
-#define KEY_STREAM_P_AUX_X          (KEY_STREAM_P_AUX_Y + 1)
-#define KEY_STREAM_P_AUX_Z          (KEY_STREAM_P_AUX_X + 1)
-#define KEY_STREAM_P_ACCEL_Y        (KEY_STREAM_P_AUX_Z + 1)
-#define KEY_STREAM_P_ACCEL_X        (KEY_STREAM_P_ACCEL_Y + 1)
-#define KEY_STREAM_P_FOOTER         (KEY_STREAM_P_ACCEL_X + 1)
-#define KEY_STREAM_P_ACCEL_Z        (KEY_STREAM_P_FOOTER + 1)
-
-#define NUM_KEYS                    (KEY_STREAM_P_ACCEL_Z + 1)
-
-typedef struct {
-    unsigned short key;
-    unsigned short addr;
-} tKeyLabel;
-
-#define DINA0A 0x0a
-#define DINA22 0x22
-#define DINA42 0x42
-#define DINA5A 0x5a
-
-#define DINA06 0x06
-#define DINA0E 0x0e
-#define DINA16 0x16
-#define DINA1E 0x1e
-#define DINA26 0x26
-#define DINA2E 0x2e
-#define DINA36 0x36
-#define DINA3E 0x3e
-#define DINA46 0x46
-#define DINA4E 0x4e
-#define DINA56 0x56
-#define DINA5E 0x5e
-#define DINA66 0x66
-#define DINA6E 0x6e
-#define DINA76 0x76
-#define DINA7E 0x7e
-
-#define DINA00 0x00
-#define DINA08 0x08
-#define DINA10 0x10
-#define DINA18 0x18
-#define DINA20 0x20
-#define DINA28 0x28
-#define DINA30 0x30
-#define DINA38 0x38
-#define DINA40 0x40
-#define DINA48 0x48
-#define DINA50 0x50
-#define DINA58 0x58
-#define DINA60 0x60
-#define DINA68 0x68
-#define DINA70 0x70
-#define DINA78 0x78
-
-#define DINA04 0x04
-#define DINA0C 0x0c
-#define DINA14 0x14
-#define DINA1C 0x1C
-#define DINA24 0x24
-#define DINA2C 0x2c
-#define DINA34 0x34
-#define DINA3C 0x3c
-#define DINA44 0x44
-#define DINA4C 0x4c
-#define DINA54 0x54
-#define DINA5C 0x5c
-#define DINA64 0x64
-#define DINA6C 0x6c
-#define DINA74 0x74
-#define DINA7C 0x7c
-
-#define DINA01 0x01
-#define DINA09 0x09
-#define DINA11 0x11
-#define DINA19 0x19
-#define DINA21 0x21
-#define DINA29 0x29
-#define DINA31 0x31
-#define DINA39 0x39
-#define DINA41 0x41
-#define DINA49 0x49
-#define DINA51 0x51
-#define DINA59 0x59
-#define DINA61 0x61
-#define DINA69 0x69
-#define DINA71 0x71
-#define DINA79 0x79
-
-#define DINA25 0x25
-#define DINA2D 0x2d
-#define DINA35 0x35
-#define DINA3D 0x3d
-#define DINA4D 0x4d
-#define DINA55 0x55
-#define DINA5D 0x5D
-#define DINA6D 0x6d
-#define DINA75 0x75
-#define DINA7D 0x7d
-
-#define DINADC 0xdc
-#define DINAF2 0xf2
-#define DINAAB 0xab
-#define DINAAA 0xaa
-#define DINAF1 0xf1
-#define DINADF 0xdf
-#define DINADA 0xda
-#define DINAB1 0xb1
-#define DINAB9 0xb9
-#define DINAF3 0xf3
-#define DINA8B 0x8b
-#define DINAA3 0xa3
-#define DINA91 0x91
-#define DINAB6 0xb6
-#define DINAB4 0xb4
-
-
-#define DINC00 0x00
-#define DINC01 0x01
-#define DINC02 0x02
-#define DINC03 0x03
-#define DINC08 0x08
-#define DINC09 0x09
-#define DINC0A 0x0a
-#define DINC0B 0x0b
-#define DINC10 0x10
-#define DINC11 0x11
-#define DINC12 0x12
-#define DINC13 0x13
-#define DINC18 0x18
-#define DINC19 0x19
-#define DINC1A 0x1a
-#define DINC1B 0x1b
-
-#define DINC20 0x20
-#define DINC21 0x21
-#define DINC22 0x22
-#define DINC23 0x23
-#define DINC28 0x28
-#define DINC29 0x29
-#define DINC2A 0x2a
-#define DINC2B 0x2b
-#define DINC30 0x30
-#define DINC31 0x31
-#define DINC32 0x32
-#define DINC33 0x33
-#define DINC38 0x38
-#define DINC39 0x39
-#define DINC3A 0x3a
-#define DINC3B 0x3b
-
-#define DINC40 0x40
-#define DINC41 0x41
-#define DINC42 0x42
-#define DINC43 0x43
-#define DINC48 0x48
-#define DINC49 0x49
-#define DINC4A 0x4a
-#define DINC4B 0x4b
-#define DINC50 0x50
-#define DINC51 0x51
-#define DINC52 0x52
-#define DINC53 0x53
-#define DINC58 0x58
-#define DINC59 0x59
-#define DINC5A 0x5a
-#define DINC5B 0x5b
-
-#define DINC60 0x60
-#define DINC61 0x61
-#define DINC62 0x62
-#define DINC63 0x63
-#define DINC68 0x68
-#define DINC69 0x69
-#define DINC6A 0x6a
-#define DINC6B 0x6b
-#define DINC70 0x70
-#define DINC71 0x71
-#define DINC72 0x72
-#define DINC73 0x73
-#define DINC78 0x78
-#define DINC79 0x79
-#define DINC7A 0x7a
-#define DINC7B 0x7b
-
-#define DIND40 0x40
-
-
-#define DINA80 0x80
-#define DINA90 0x90
-#define DINAA0 0xa0
-#define DINAC9 0xc9
-#define DINACB 0xcb
-#define DINACD 0xcd
-#define DINACF 0xcf
-#define DINAC8 0xc8
-#define DINACA 0xca
-#define DINACC 0xcc
-#define DINACE 0xce
-#define DINAD8 0xd8
-#define DINADD 0xdd
-#define DINAF8 0xf0
-#define DINAFE 0xfe
-
-#define DINBF8 0xf8
-#define DINAC0 0xb0
-#define DINAC1 0xb1
-#define DINAC2 0xb4
-#define DINAC3 0xb5
-#define DINAC4 0xb8
-#define DINAC5 0xb9
-#define DINBC0 0xc0
-#define DINBC2 0xc2
-#define DINBC4 0xc4
-#define DINBC6 0xc6
-
-
-
-#endif // DMPKEY_H__

+ 0 - 264
Core备份3/imu3/dmpmap3.h

@@ -1,264 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011 InvenSense Corporation, All Rights Reserved.
- $
- */
-#ifndef DMPMAP_H
-#define DMPMAP_H
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#define DMP_PTAT    0
-#define DMP_XGYR    2
-#define DMP_YGYR    4
-#define DMP_ZGYR    6
-#define DMP_XACC    8
-#define DMP_YACC    10
-#define DMP_ZACC    12
-#define DMP_ADC1    14
-#define DMP_ADC2    16
-#define DMP_ADC3    18
-#define DMP_BIASUNC    20
-#define DMP_FIFORT    22
-#define DMP_INVGSFH    24
-#define DMP_INVGSFL    26
-#define DMP_1H    28
-#define DMP_1L    30
-#define DMP_BLPFSTCH    32
-#define DMP_BLPFSTCL    34
-#define DMP_BLPFSXH    36
-#define DMP_BLPFSXL    38
-#define DMP_BLPFSYH    40
-#define DMP_BLPFSYL    42
-#define DMP_BLPFSZH    44
-#define DMP_BLPFSZL    46
-#define DMP_BLPFMTC    48
-#define DMP_SMC    50
-#define DMP_BLPFMXH    52
-#define DMP_BLPFMXL    54
-#define DMP_BLPFMYH    56
-#define DMP_BLPFMYL    58
-#define DMP_BLPFMZH    60
-#define DMP_BLPFMZL    62
-#define DMP_BLPFC    64
-#define DMP_SMCTH    66
-#define DMP_0H2    68
-#define DMP_0L2    70
-#define DMP_BERR2H    72
-#define DMP_BERR2L    74
-#define DMP_BERR2NH    76
-#define DMP_SMCINC    78
-#define DMP_ANGVBXH    80
-#define DMP_ANGVBXL    82
-#define DMP_ANGVBYH    84
-#define DMP_ANGVBYL    86
-#define DMP_ANGVBZH    88
-#define DMP_ANGVBZL    90
-#define DMP_BERR1H    92
-#define DMP_BERR1L    94
-#define DMP_ATCH    96
-#define DMP_BIASUNCSF    98
-#define DMP_ACT2H    100
-#define DMP_ACT2L    102
-#define DMP_GSFH    104
-#define DMP_GSFL    106
-#define DMP_GH    108
-#define DMP_GL    110
-#define DMP_0_5H    112
-#define DMP_0_5L    114
-#define DMP_0_0H    116
-#define DMP_0_0L    118
-#define DMP_1_0H    120
-#define DMP_1_0L    122
-#define DMP_1_5H    124
-#define DMP_1_5L    126
-#define DMP_TMP1AH    128
-#define DMP_TMP1AL    130
-#define DMP_TMP2AH    132
-#define DMP_TMP2AL    134
-#define DMP_TMP3AH    136
-#define DMP_TMP3AL    138
-#define DMP_TMP4AH    140
-#define DMP_TMP4AL    142
-#define DMP_XACCW    144
-#define DMP_TMP5    146
-#define DMP_XACCB    148
-#define DMP_TMP8    150
-#define DMP_YACCB    152
-#define DMP_TMP9    154
-#define DMP_ZACCB    156
-#define DMP_TMP10    158
-#define DMP_DZH    160
-#define DMP_DZL    162
-#define DMP_XGCH    164
-#define DMP_XGCL    166
-#define DMP_YGCH    168
-#define DMP_YGCL    170
-#define DMP_ZGCH    172
-#define DMP_ZGCL    174
-#define DMP_YACCW    176
-#define DMP_TMP7    178
-#define DMP_AFB1H    180
-#define DMP_AFB1L    182
-#define DMP_AFB2H    184
-#define DMP_AFB2L    186
-#define DMP_MAGFBH    188
-#define DMP_MAGFBL    190
-#define DMP_QT1H    192
-#define DMP_QT1L    194
-#define DMP_QT2H    196
-#define DMP_QT2L    198
-#define DMP_QT3H    200
-#define DMP_QT3L    202
-#define DMP_QT4H    204
-#define DMP_QT4L    206
-#define DMP_CTRL1H    208
-#define DMP_CTRL1L    210
-#define DMP_CTRL2H    212
-#define DMP_CTRL2L    214
-#define DMP_CTRL3H    216
-#define DMP_CTRL3L    218
-#define DMP_CTRL4H    220
-#define DMP_CTRL4L    222
-#define DMP_CTRLS1    224
-#define DMP_CTRLSF1    226
-#define DMP_CTRLS2    228
-#define DMP_CTRLSF2    230
-#define DMP_CTRLS3    232
-#define DMP_CTRLSFNLL    234
-#define DMP_CTRLS4    236
-#define DMP_CTRLSFNL2    238
-#define DMP_CTRLSFNL    240
-#define DMP_TMP30    242
-#define DMP_CTRLSFJT    244
-#define DMP_TMP31    246
-#define DMP_TMP11    248
-#define DMP_CTRLSF2_2    250
-#define DMP_TMP12    252
-#define DMP_CTRLSF1_2    254
-#define DMP_PREVPTAT    256
-#define DMP_ACCZB    258
-#define DMP_ACCXB    264
-#define DMP_ACCYB    266
-#define DMP_1HB    272
-#define DMP_1LB    274
-#define DMP_0H    276
-#define DMP_0L    278
-#define DMP_ASR22H    280
-#define DMP_ASR22L    282
-#define DMP_ASR6H    284
-#define DMP_ASR6L    286
-#define DMP_TMP13    288
-#define DMP_TMP14    290
-#define DMP_FINTXH    292
-#define DMP_FINTXL    294
-#define DMP_FINTYH    296
-#define DMP_FINTYL    298
-#define DMP_FINTZH    300
-#define DMP_FINTZL    302
-#define DMP_TMP1BH    304
-#define DMP_TMP1BL    306
-#define DMP_TMP2BH    308
-#define DMP_TMP2BL    310
-#define DMP_TMP3BH    312
-#define DMP_TMP3BL    314
-#define DMP_TMP4BH    316
-#define DMP_TMP4BL    318
-#define DMP_STXG    320
-#define DMP_ZCTXG    322
-#define DMP_STYG    324
-#define DMP_ZCTYG    326
-#define DMP_STZG    328
-#define DMP_ZCTZG    330
-#define DMP_CTRLSFJT2    332
-#define DMP_CTRLSFJTCNT    334
-#define DMP_PVXG    336
-#define DMP_TMP15    338
-#define DMP_PVYG    340
-#define DMP_TMP16    342
-#define DMP_PVZG    344
-#define DMP_TMP17    346
-#define DMP_MNMFLAGH    352
-#define DMP_MNMFLAGL    354
-#define DMP_MNMTMH    356
-#define DMP_MNMTML    358
-#define DMP_MNMTMTHRH    360
-#define DMP_MNMTMTHRL    362
-#define DMP_MNMTHRH    364
-#define DMP_MNMTHRL    366
-#define DMP_ACCQD4H    368
-#define DMP_ACCQD4L    370
-#define DMP_ACCQD5H    372
-#define DMP_ACCQD5L    374
-#define DMP_ACCQD6H    376
-#define DMP_ACCQD6L    378
-#define DMP_ACCQD7H    380
-#define DMP_ACCQD7L    382
-#define DMP_ACCQD0H    384
-#define DMP_ACCQD0L    386
-#define DMP_ACCQD1H    388
-#define DMP_ACCQD1L    390
-#define DMP_ACCQD2H    392
-#define DMP_ACCQD2L    394
-#define DMP_ACCQD3H    396
-#define DMP_ACCQD3L    398
-#define DMP_XN2H    400
-#define DMP_XN2L    402
-#define DMP_XN1H    404
-#define DMP_XN1L    406
-#define DMP_YN2H    408
-#define DMP_YN2L    410
-#define DMP_YN1H    412
-#define DMP_YN1L    414
-#define DMP_YH    416
-#define DMP_YL    418
-#define DMP_B0H    420
-#define DMP_B0L    422
-#define DMP_A1H    424
-#define DMP_A1L    426
-#define DMP_A2H    428
-#define DMP_A2L    430
-#define DMP_SEM1    432
-#define DMP_FIFOCNT    434
-#define DMP_SH_TH_X    436
-#define DMP_PACKET    438
-#define DMP_SH_TH_Y    440
-#define DMP_FOOTER    442
-#define DMP_SH_TH_Z    444
-#define DMP_TEMP29    448
-#define DMP_TEMP30    450
-#define DMP_XACCB_PRE    452
-#define DMP_XACCB_PREL    454
-#define DMP_YACCB_PRE    456
-#define DMP_YACCB_PREL    458
-#define DMP_ZACCB_PRE    460
-#define DMP_ZACCB_PREL    462
-#define DMP_TMP22    464
-#define DMP_TAP_TIMER    466
-#define DMP_TAP_THX    468
-#define DMP_TAP_THY    472
-#define DMP_TAP_THZ    476
-#define DMP_TAPW_MIN    478
-#define DMP_TMP25    480
-#define DMP_TMP26    482
-#define DMP_TMP27    484
-#define DMP_TMP28    486
-#define DMP_ORIENT    488
-#define DMP_THRSH    490
-#define DMP_ENDIANH    492
-#define DMP_ENDIANL    494
-#define DMP_BLPFNMTCH    496
-#define DMP_BLPFNMTCL    498
-#define DMP_BLPFNMXH    500
-#define DMP_BLPFNMXL    502
-#define DMP_BLPFNMYH    504
-#define DMP_BLPFNMYL    506
-#define DMP_BLPFNMZH    508
-#define DMP_BLPFNMZL    510
-#ifdef __cplusplus
-}
-#endif
-#endif // DMPMAP_H

+ 0 - 2774
Core备份3/imu3/inv_mpu3.c

@@ -1,2774 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011-2012 InvenSense Corporation, All Rights Reserved.
-    See included License.txt for License information.
- $
- */
-/**
- *  @addtogroup  DRIVERS Sensor Driver Layer
- *  @brief       Hardware drivers to communicate with sensors via I2C.
- *
- *  @{
- *      @file       inv_mpu.c
- *      @brief      An I2C-based driver for Invensense gyroscopes.
- *      @details    This driver currently works for the following devices:
- *                  MPU6050
- *                  MPU6500
- *                  MPU9150 (or MPU6050 w/ AK8975 on the auxiliary bus)
- *                  MPU9250 (or MPU6500 w/ AK8963 on the auxiliary bus)
- */
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include "inv_mpu3.h"
-
-#include "MPU60503.h"
-
-
-/* The following functions must be defined for this platform:
- * i2c_write(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char const *data)
- * i2c_read(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char *data)
- * delay_ms(unsigned long num_ms)
- * get_ms(unsigned long *count)
- * reg_int_cb(void (*cb)(void), unsigned char port, unsigned char pin)
- * labs(long x)
- * fabsf(float x)
- * min(int a, int b)
- */
-#if defined MOTION_DRIVER_TARGET_MSP430
-#include "msp430.h"
-#include "msp430_i2c.h"
-#include "msp430_clock.h"
-#include "msp430_interrupt.h"
-#define i2c_write   msp430_i2c_write
-#define i2c_read    msp430_i2c_read
-#define delay_ms    msp430_delay_ms
-#define get_ms      msp430_get_clock_ms
-static inline int reg_int_cb(struct int_param_s *int_param)
-{
-    return msp430_reg_int_cb(int_param->cb, int_param->pin, int_param->lp_exit,
-        int_param->active_low);
-}
-#define log_i(...)     do {} while (0)
-#define log_e(...)     do {} while (0)
-/* labs is already defined by TI's toolchain. */
-/* fabs is for doubles. fabsf is for floats. */
-#define fabs        fabsf
-#define min(a,b) ((a<b)?a:b)
-#elif defined EMPL_TARGET_MSP430
-#include "msp430.h"
-#include "msp430_i2c.h"
-#include "msp430_clock.h"
-#include "msp430_interrupt.h"
-#include "log.h"
-#define i2c_write   msp430_i2c_write
-#define i2c_read    msp430_i2c_read
-#define delay_ms    msp430_delay_ms
-#define get_ms      msp430_get_clock_ms
-static inline int reg_int_cb(struct int_param_s *int_param)
-{
-    return msp430_reg_int_cb(int_param->cb, int_param->pin, int_param->lp_exit,
-        int_param->active_low);
-}
-#define log_i       MPL_LOGI
-#define log_e       MPL_LOGE
-/* labs is already defined by TI's toolchain. */
-/* fabs is for doubles. fabsf is for floats. */
-#define fabs        fabsf
-#define min(a,b) ((a<b)?a:b)
-#elif defined EMPL_TARGET_UC3L0
-/* Instead of using the standard TWI driver from the ASF library, we're using
- * a TWI driver that follows the slave address + register address convention.
- */
-#include "twi.h"
-#include "delay.h"
-#include "sysclk.h"
-#include "log.h"
-#include "sensors_xplained.h"
-#include "uc3l0_clock.h"
-#define i2c_write(a, b, c, d)   twi_write(a, b, d, c)
-#define i2c_read(a, b, c, d)    twi_read(a, b, d, c)
-/* delay_ms is a function already defined in ASF. */
-#define get_ms  uc3l0_get_clock_ms
-static inline int reg_int_cb(struct int_param_s *int_param)
-{
-    sensor_board_irq_connect(int_param->pin, int_param->cb, int_param->arg);
-    return 0;
-}
-#define log_i       MPL_LOGI
-#define log_e       MPL_LOGE
-/* UC3 is a 32-bit processor, so abs and labs are equivalent. */
-#define labs        abs
-#define fabs(x)     (((x)>0)?(x):-(x))
-#elif defined MOTION_DRIVER_TARGET_STM32
-
-/* The following functions must be defined for this platform:
- * i2c_write(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char const *data)
- * i2c_read(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char *data)
- * delay_ms(unsigned long num_ms)
- * get_ms(unsigned long *count)
- * reg_int_cb(void (*cb)(void), unsigned char port, unsigned char pin)
- * labs(long x)
- * fabsf(float x)
- * min(int a, int b)
- */
-
-#define i2c_write   IIC_Write_Len
-#define i2c_read    IIC_Read_Len
-#define delay_ms    HAL_Delay
-#define get_ms      get_tick_count
-//static inline int reg_int_cb(struct int_param_s *int_param)
-//{
-////    return msp430_reg_int_cb(int_param->cb, int_param->pin, int_param->lp_exit,
-////        int_param->active_low);
-//}
-//#define log_i(...)     do {} while (0)
-//#define log_e(...)     do {} while (0)
-
-#define log_i     printf
-#define log_e     printf
-
-/* labs is already defined by TI's toolchain. */
-/* fabs is for doubles. fabsf is for floats. */
-#define fabs        fabsf
-#define min(a,b) ((a<b)?a:b)
-
-#else
-#error  Gyro driver is missing the system layer implementations.
-#endif
-
-#if !defined MPU6050 && !defined MPU9150 && !defined MPU6500 && !defined MPU9250
-#error  Which gyro are you using? Define MPUxxxx in your compiler options.
-#endif
-
-/* Time for some messy macro work. =]
- * #define MPU9150
- * is equivalent to..
- * #define MPU6050
- * #define AK8975_SECONDARY
- *
- * #define MPU9250
- * is equivalent to..
- * #define MPU6500
- * #define AK8963_SECONDARY
- */
-#if defined MPU9150
-#ifndef MPU6050
-#define MPU6050
-#endif                          /* #ifndef MPU6050 */
-#if defined AK8963_SECONDARY
-#error "MPU9150 and AK8963_SECONDARY cannot both be defined."
-#elif !defined AK8975_SECONDARY /* #if defined AK8963_SECONDARY */
-#define AK8975_SECONDARY
-#endif                          /* #if defined AK8963_SECONDARY */
-#elif defined MPU9250           /* #if defined MPU9150 */
-#ifndef MPU6500
-#define MPU6500
-#endif                          /* #ifndef MPU6500 */
-#if defined AK8975_SECONDARY
-#error "MPU9250 and AK8975_SECONDARY cannot both be defined."
-#elif !defined AK8963_SECONDARY /* #if defined AK8975_SECONDARY */
-#define AK8963_SECONDARY
-#endif                          /* #if defined AK8975_SECONDARY */
-#endif                          /* #if defined MPU9150 */
-
-#if defined AK8975_SECONDARY || defined AK8963_SECONDARY
-#define AK89xx_SECONDARY
-#else
-/* #warning "No compass = less profit for Invensense. Lame." */
-#endif
-
-static int set_int_enable(unsigned char enable);
-
-/* Hardware registers needed by driver. */
-struct gyro_reg_s {
-    unsigned char who_am_i;
-    unsigned char rate_div;
-    unsigned char lpf;
-    unsigned char prod_id;
-    unsigned char user_ctrl;
-    unsigned char fifo_en;
-    unsigned char gyro_cfg;
-    unsigned char accel_cfg;
-    unsigned char accel_cfg2;
-    unsigned char lp_accel_odr;
-    unsigned char motion_thr;
-    unsigned char motion_dur;
-    unsigned char fifo_count_h;
-    unsigned char fifo_r_w;
-    unsigned char raw_gyro;
-    unsigned char raw_accel;
-    unsigned char temp;
-    unsigned char int_enable;
-    unsigned char dmp_int_status;
-    unsigned char int_status;
-    unsigned char accel_intel;
-    unsigned char pwr_mgmt_1;
-    unsigned char pwr_mgmt_2;
-    unsigned char int_pin_cfg;
-    unsigned char mem_r_w;
-    unsigned char accel_offs;
-    unsigned char i2c_mst;
-    unsigned char bank_sel;
-    unsigned char mem_start_addr;
-    unsigned char prgm_start_h;
-#if defined AK89xx_SECONDARY
-    unsigned char s0_addr;
-    unsigned char s0_reg;
-    unsigned char s0_ctrl;
-    unsigned char s1_addr;
-    unsigned char s1_reg;
-    unsigned char s1_ctrl;
-    unsigned char s4_ctrl;
-    unsigned char s0_do;
-    unsigned char s1_do;
-    unsigned char i2c_delay_ctrl;
-    unsigned char raw_compass;
-    /* The I2C_MST_VDDIO bit is in this register. */
-    unsigned char yg_offs_tc;
-#endif
-};
-
-/* Information specific to a particular device. */
-struct hw_s {
-    unsigned char addr;
-    unsigned short max_fifo;
-    unsigned char num_reg;
-    unsigned short temp_sens;
-    short temp_offset;
-    unsigned short bank_size;
-#if defined AK89xx_SECONDARY
-    unsigned short compass_fsr;
-#endif
-};
-
-/* When entering motion interrupt mode, the driver keeps track of the
- * previous state so that it can be restored at a later time.
- * TODO: This is tacky. Fix it.
- */
-struct motion_int_cache_s {
-    unsigned short gyro_fsr;
-    unsigned char accel_fsr;
-    unsigned short lpf;
-    unsigned short sample_rate;
-    unsigned char sensors_on;
-    unsigned char fifo_sensors;
-    unsigned char dmp_on;
-};
-
-/* Cached chip configuration data.
- * TODO: A lot of these can be handled with a bitmask.
- */
-struct chip_cfg_s {
-    /* Matches gyro_cfg >> 3 & 0x03 */
-    unsigned char gyro_fsr;
-    /* Matches accel_cfg >> 3 & 0x03 */
-    unsigned char accel_fsr;
-    /* Enabled sensors. Uses same masks as fifo_en, NOT pwr_mgmt_2. */
-    unsigned char sensors;
-    /* Matches config register. */
-    unsigned char lpf;
-    unsigned char clk_src;
-    /* Sample rate, NOT rate divider. */
-    unsigned short sample_rate;
-    /* Matches fifo_en register. */
-    unsigned char fifo_enable;
-    /* Matches int enable register. */
-    unsigned char int_enable;
-    /* 1 if devices on auxiliary I2C bus appear on the primary. */
-    unsigned char bypass_mode;
-    /* 1 if half-sensitivity.
-     * NOTE: This doesn't belong here, but everything else in hw_s is const,
-     * and this allows us to save some precious RAM.
-     */
-    unsigned char accel_half;
-    /* 1 if device in low-power accel-only mode. */
-    unsigned char lp_accel_mode;
-    /* 1 if interrupts are only triggered on motion events. */
-    unsigned char int_motion_only;
-    struct motion_int_cache_s cache;
-    /* 1 for active low interrupts. */
-    unsigned char active_low_int;
-    /* 1 for latched interrupts. */
-    unsigned char latched_int;
-    /* 1 if DMP is enabled. */
-    unsigned char dmp_on;
-    /* Ensures that DMP will only be loaded once. */
-    unsigned char dmp_loaded;
-    /* Sampling rate used when DMP is enabled. */
-    unsigned short dmp_sample_rate;
-#ifdef AK89xx_SECONDARY
-    /* Compass sample rate. */
-    unsigned short compass_sample_rate;
-    unsigned char compass_addr;
-    short mag_sens_adj[3];
-#endif
-};
-
-/* Information for self-test. */
-struct test_s {
-    unsigned long gyro_sens;
-    unsigned long accel_sens;
-    unsigned char reg_rate_div;
-    unsigned char reg_lpf;
-    unsigned char reg_gyro_fsr;
-    unsigned char reg_accel_fsr;
-    unsigned short wait_ms;
-    unsigned char packet_thresh;
-    float min_dps;
-    float max_dps;
-    float max_gyro_var;
-    float min_g;
-    float max_g;
-    float max_accel_var;
-};
-
-/* Gyro driver state variables. */
-struct gyro_state_s {
-    const struct gyro_reg_s *reg;
-    const struct hw_s *hw;
-    struct chip_cfg_s chip_cfg;
-    const struct test_s *test;
-};
-
-/* Filter configurations. */
-enum lpf_e {
-    INV_FILTER_256HZ_NOLPF2 = 0,
-    INV_FILTER_188HZ,
-    INV_FILTER_98HZ,
-    INV_FILTER_42HZ,
-    INV_FILTER_20HZ,
-    INV_FILTER_10HZ,
-    INV_FILTER_5HZ,
-    INV_FILTER_2100HZ_NOLPF,
-    NUM_FILTER
-};
-
-/* Full scale ranges. */
-enum gyro_fsr_e {
-    INV_FSR_250DPS = 0,
-    INV_FSR_500DPS,
-    INV_FSR_1000DPS,
-    INV_FSR_2000DPS,
-    NUM_GYRO_FSR
-};
-
-/* Full scale ranges. */
-enum accel_fsr_e {
-    INV_FSR_2G = 0,
-    INV_FSR_4G,
-    INV_FSR_8G,
-    INV_FSR_16G,
-    NUM_ACCEL_FSR
-};
-
-/* Clock sources. */
-enum clock_sel_e {
-    INV_CLK_INTERNAL = 0,
-    INV_CLK_PLL,
-    NUM_CLK
-};
-
-/* Low-power accel wakeup rates. */
-enum lp_accel_rate_e {
-#if defined MPU6050
-    INV_LPA_1_25HZ,
-    INV_LPA_5HZ,
-    INV_LPA_20HZ,
-    INV_LPA_40HZ
-#elif defined MPU6500
-    INV_LPA_0_3125HZ,
-    INV_LPA_0_625HZ,
-    INV_LPA_1_25HZ,
-    INV_LPA_2_5HZ,
-    INV_LPA_5HZ,
-    INV_LPA_10HZ,
-    INV_LPA_20HZ,
-    INV_LPA_40HZ,
-    INV_LPA_80HZ,
-    INV_LPA_160HZ,
-    INV_LPA_320HZ,
-    INV_LPA_640HZ
-#endif
-};
-
-#define BIT_I2C_MST_VDDIO   (0x80)
-#define BIT_FIFO_EN         (0x40)
-#define BIT_DMP_EN          (0x80)
-#define BIT_FIFO_RST        (0x04)
-#define BIT_DMP_RST         (0x08)
-#define BIT_FIFO_OVERFLOW   (0x10)
-#define BIT_DATA_RDY_EN     (0x01)
-#define BIT_DMP_INT_EN      (0x02)
-#define BIT_MOT_INT_EN      (0x40)
-#define BITS_FSR            (0x18)
-#define BITS_LPF            (0x07)
-#define BITS_HPF            (0x07)
-#define BITS_CLK            (0x07)
-#define BIT_FIFO_SIZE_1024  (0x40)
-#define BIT_FIFO_SIZE_2048  (0x80)
-#define BIT_FIFO_SIZE_4096  (0xC0)
-#define BIT_RESET           (0x80)
-#define BIT_SLEEP           (0x40)
-#define BIT_S0_DELAY_EN     (0x01)
-#define BIT_S2_DELAY_EN     (0x04)
-#define BITS_SLAVE_LENGTH   (0x0F)
-#define BIT_SLAVE_BYTE_SW   (0x40)
-#define BIT_SLAVE_GROUP     (0x10)
-#define BIT_SLAVE_EN        (0x80)
-#define BIT_I2C_READ        (0x80)
-#define BITS_I2C_MASTER_DLY (0x1F)
-#define BIT_AUX_IF_EN       (0x20)
-#define BIT_ACTL            (0x80)
-#define BIT_LATCH_EN        (0x20)
-#define BIT_ANY_RD_CLR      (0x10)
-#define BIT_BYPASS_EN       (0x02)
-#define BITS_WOM_EN         (0xC0)
-#define BIT_LPA_CYCLE       (0x20)
-#define BIT_STBY_XA         (0x20)
-#define BIT_STBY_YA         (0x10)
-#define BIT_STBY_ZA         (0x08)
-#define BIT_STBY_XG         (0x04)
-#define BIT_STBY_YG         (0x02)
-#define BIT_STBY_ZG         (0x01)
-#define BIT_STBY_XYZA       (BIT_STBY_XA | BIT_STBY_YA | BIT_STBY_ZA)
-#define BIT_STBY_XYZG       (BIT_STBY_XG | BIT_STBY_YG | BIT_STBY_ZG)
-
-#if defined AK8975_SECONDARY
-#define SUPPORTS_AK89xx_HIGH_SENS   (0x00)
-#define AK89xx_FSR                  (9830)
-#elif defined AK8963_SECONDARY
-#define SUPPORTS_AK89xx_HIGH_SENS   (0x10)
-#define AK89xx_FSR                  (4915)
-#endif
-
-#ifdef AK89xx_SECONDARY
-#define AKM_REG_WHOAMI      (0x00)
-
-#define AKM_REG_ST1         (0x02)
-#define AKM_REG_HXL         (0x03)
-#define AKM_REG_ST2         (0x09)
-
-#define AKM_REG_CNTL        (0x0A)
-#define AKM_REG_ASTC        (0x0C)
-#define AKM_REG_ASAX        (0x10)
-#define AKM_REG_ASAY        (0x11)
-#define AKM_REG_ASAZ        (0x12)
-
-#define AKM_DATA_READY      (0x01)
-#define AKM_DATA_OVERRUN    (0x02)
-#define AKM_OVERFLOW        (0x80)
-#define AKM_DATA_ERROR      (0x40)
-
-#define AKM_BIT_SELF_TEST   (0x40)
-
-#define AKM_POWER_DOWN          (0x00 | SUPPORTS_AK89xx_HIGH_SENS)
-#define AKM_SINGLE_MEASUREMENT  (0x01 | SUPPORTS_AK89xx_HIGH_SENS)
-#define AKM_FUSE_ROM_ACCESS     (0x0F | SUPPORTS_AK89xx_HIGH_SENS)
-#define AKM_MODE_SELF_TEST      (0x08 | SUPPORTS_AK89xx_HIGH_SENS)
-
-#define AKM_WHOAMI      (0x48)
-#endif
-
-#if defined MPU6050
-const struct gyro_reg_s reg = {
-    .who_am_i       = 0x75,
-    .rate_div       = 0x19,
-    .lpf            = 0x1A,
-    .prod_id        = 0x0C,
-    .user_ctrl      = 0x6A,
-    .fifo_en        = 0x23,
-    .gyro_cfg       = 0x1B,
-    .accel_cfg      = 0x1C,
-    .motion_thr     = 0x1F,
-    .motion_dur     = 0x20,
-    .fifo_count_h   = 0x72,
-    .fifo_r_w       = 0x74,
-    .raw_gyro       = 0x43,
-    .raw_accel      = 0x3B,
-    .temp           = 0x41,
-    .int_enable     = 0x38,
-    .dmp_int_status = 0x39,
-    .int_status     = 0x3A,
-    .pwr_mgmt_1     = 0x6B,
-    .pwr_mgmt_2     = 0x6C,
-    .int_pin_cfg    = 0x37,
-    .mem_r_w        = 0x6F,
-    .accel_offs     = 0x06,
-    .i2c_mst        = 0x24,
-    .bank_sel       = 0x6D,
-    .mem_start_addr = 0x6E,
-    .prgm_start_h   = 0x70
-#ifdef AK89xx_SECONDARY
-    ,.raw_compass   = 0x49,
-    .yg_offs_tc     = 0x01,
-    .s0_addr        = 0x25,
-    .s0_reg         = 0x26,
-    .s0_ctrl        = 0x27,
-    .s1_addr        = 0x28,
-    .s1_reg         = 0x29,
-    .s1_ctrl        = 0x2A,
-    .s4_ctrl        = 0x34,
-    .s0_do          = 0x63,
-    .s1_do          = 0x64,
-    .i2c_delay_ctrl = 0x67
-#endif
-};
-const struct hw_s hw = {
-    .addr           = 0x68,
-    .max_fifo       = 1024,
-    .num_reg        = 118,
-    .temp_sens      = 340,
-    .temp_offset    = -521,
-    .bank_size      = 256
-#if defined AK89xx_SECONDARY
-    ,.compass_fsr    = AK89xx_FSR
-#endif
-};
-
-const struct test_s test = {
-    .gyro_sens      = 32768/250,
-    .accel_sens     = 32768/16,
-    .reg_rate_div   = 0,    /* 1kHz. */
-    .reg_lpf        = 1,    /* 188Hz. */
-    .reg_gyro_fsr   = 0,    /* 250dps. */
-    .reg_accel_fsr  = 0x18, /* 16g. */
-    .wait_ms        = 50,
-    .packet_thresh  = 5,    /* 5% */
-    .min_dps        = 10.f,
-    .max_dps        = 105.f,
-    .max_gyro_var   = 0.14f,
-    .min_g          = 0.3f,
-    .max_g          = 0.95f,
-    .max_accel_var  = 0.14f
-};
-
-static struct gyro_state_s st = {
-    .reg = &reg,
-    .hw = &hw,
-    .test = &test
-};
-#elif defined MPU6500
-const struct gyro_reg_s reg = {
-    .who_am_i       = 0x75,
-    .rate_div       = 0x19,
-    .lpf            = 0x1A,
-    .prod_id        = 0x0C,
-    .user_ctrl      = 0x6A,
-    .fifo_en        = 0x23,
-    .gyro_cfg       = 0x1B,
-    .accel_cfg      = 0x1C,
-    .accel_cfg2     = 0x1D,
-    .lp_accel_odr   = 0x1E,
-    .motion_thr     = 0x1F,
-    .motion_dur     = 0x20,
-    .fifo_count_h   = 0x72,
-    .fifo_r_w       = 0x74,
-    .raw_gyro       = 0x43,
-    .raw_accel      = 0x3B,
-    .temp           = 0x41,
-    .int_enable     = 0x38,
-    .dmp_int_status = 0x39,
-    .int_status     = 0x3A,
-    .accel_intel    = 0x69,
-    .pwr_mgmt_1     = 0x6B,
-    .pwr_mgmt_2     = 0x6C,
-    .int_pin_cfg    = 0x37,
-    .mem_r_w        = 0x6F,
-    .accel_offs     = 0x77,
-    .i2c_mst        = 0x24,
-    .bank_sel       = 0x6D,
-    .mem_start_addr = 0x6E,
-    .prgm_start_h   = 0x70
-#ifdef AK89xx_SECONDARY
-    ,.raw_compass   = 0x49,
-    .s0_addr        = 0x25,
-    .s0_reg         = 0x26,
-    .s0_ctrl        = 0x27,
-    .s1_addr        = 0x28,
-    .s1_reg         = 0x29,
-    .s1_ctrl        = 0x2A,
-    .s4_ctrl        = 0x34,
-    .s0_do          = 0x63,
-    .s1_do          = 0x64,
-    .i2c_delay_ctrl = 0x67
-#endif
-};
-const struct hw_s hw = {
-    .addr           = 0x68,
-    .max_fifo       = 1024,
-    .num_reg        = 128,
-    .temp_sens      = 321,
-    .temp_offset    = 0,
-    .bank_size      = 256
-#if defined AK89xx_SECONDARY
-    ,.compass_fsr    = AK89xx_FSR
-#endif
-};
-
-const struct test_s test = {
-    .gyro_sens      = 32768/250,
-    .accel_sens     = 32768/16,
-    .reg_rate_div   = 0,    /* 1kHz. */
-    .reg_lpf        = 1,    /* 188Hz. */
-    .reg_gyro_fsr   = 0,    /* 250dps. */
-    .reg_accel_fsr  = 0x18, /* 16g. */
-    .wait_ms        = 50,
-    .packet_thresh  = 5,    /* 5% */
-    .min_dps        = 10.f,
-    .max_dps        = 105.f,
-    .max_gyro_var   = 0.14f,
-    .min_g          = 0.3f,
-    .max_g          = 0.95f,
-    .max_accel_var  = 0.14f
-};
-
-static struct gyro_state_s st = {
-    .reg = &reg,
-    .hw = &hw,
-    .test = &test
-};
-#endif
-
-#define MAX_PACKET_LENGTH (12)
-
-#ifdef AK89xx_SECONDARY
-static int setup_compass(void);
-#define MAX_COMPASS_SAMPLE_RATE (100)
-#endif
-
-/**
- *  @brief      Enable/disable data ready interrupt.
- *  If the DMP is on, the DMP interrupt is enabled. Otherwise, the data ready
- *  interrupt is used.
- *  @param[in]  enable      1 to enable interrupt.
- *  @return     0 if successful.
- */
-static int set_int_enable(unsigned char enable)
-{
-    unsigned char tmp;
-
-    if (st.chip_cfg.dmp_on) {
-        if (enable)
-            tmp = BIT_DMP_INT_EN;
-        else
-            tmp = 0x00;
-        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &tmp))
-            return -1;
-        st.chip_cfg.int_enable = tmp;
-    } else {
-        if (!st.chip_cfg.sensors)
-            return -1;
-        if (enable && st.chip_cfg.int_enable)
-            return 0;
-        if (enable)
-            tmp = BIT_DATA_RDY_EN;
-        else
-            tmp = 0x00;
-        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &tmp))
-            return -1;
-        st.chip_cfg.int_enable = tmp;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Register dump for testing.
- *  @return     0 if successful.
- */
-int mpu_reg_dump(void)
-{
-    unsigned char ii;
-    unsigned char data;
-
-    for (ii = 0; ii < st.hw->num_reg; ii++) {
-        if (ii == st.reg->fifo_r_w || ii == st.reg->mem_r_w)
-            continue;
-        if (i2c_read(st.hw->addr, ii, 1, &data))
-            return -1;
-        log_i("%#5x: %#5x\r\n", ii, data);
-    }
-    return 0;
-}
-
-/**
- *  @brief      Read from a single register.
- *  NOTE: The memory and FIFO read/write registers cannot be accessed.
- *  @param[in]  reg     Register address.
- *  @param[out] data    Register data.
- *  @return     0 if successful.
- */
-int mpu_read_reg(unsigned char reg, unsigned char *data)
-{
-    if (reg == st.reg->fifo_r_w || reg == st.reg->mem_r_w)
-        return -1;
-    if (reg >= st.hw->num_reg)
-        return -1;
-    return i2c_read(st.hw->addr, reg, 1, data);
-}
-
-/**
- *  @brief      Initialize hardware.
- *  Initial configuration:\n
- *  Gyro FSR: +/- 2000DPS\n
- *  Accel FSR +/- 2G\n
- *  DLPF: 42Hz\n
- *  FIFO rate: 50Hz\n
- *  Clock source: Gyro PLL\n
- *  FIFO: Disabled.\n
- *  Data ready interrupt: Disabled, active low, unlatched.
- *  @param[in]  int_param   Platform-specific parameters to interrupt API.
- *  @return     0 if successful.
- */
-int mpu_init(struct int_param_s *int_param)
-{
-    unsigned char data[6], rev;
-
-    /* Reset device. */
-    data[0] = BIT_RESET;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, data))
-        return -1;
-    delay_ms(100);
-
-    /* Wake up chip. */
-    data[0] = 0x00;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, data))
-        return -1;
-
-#if defined MPU6050
-    /* Check product revision. */
-    if (i2c_read(st.hw->addr, st.reg->accel_offs, 6, data))
-        return -1;
-    rev = ((data[5] & 0x01) << 2) | ((data[3] & 0x01) << 1) |
-        (data[1] & 0x01);
-
-    if (rev) {
-        /* Congrats, these parts are better. */
-        if (rev == 1)
-            st.chip_cfg.accel_half = 1;
-        else if (rev == 2)
-            st.chip_cfg.accel_half = 0;
-        else {
-            log_e("Unsupported software product rev %d.\n", rev);
-            return -1;
-        }
-    } else {
-        if (i2c_read(st.hw->addr, st.reg->prod_id, 1, data))
-            return -1;
-        rev = data[0] & 0x0F;
-        if (!rev) {
-            log_e("Product ID read as 0 indicates device is either "
-                "incompatible or an MPU3050.\n");
-            return -1;
-        } else if (rev == 4) {
-            log_i("Half sensitivity part found.\n");
-            st.chip_cfg.accel_half = 1;
-        } else
-            st.chip_cfg.accel_half = 0;
-    }
-#elif defined MPU6500
-#define MPU6500_MEM_REV_ADDR    (0x17)
-    if (mpu_read_mem(MPU6500_MEM_REV_ADDR, 1, &rev))
-        return -1;
-    if (rev == 0x1)
-        st.chip_cfg.accel_half = 0;
-    else {
-        log_e("Unsupported software product rev %d.\n", rev);
-        return -1;
-    }
-
-    /* MPU6500 shares 4kB of memory between the DMP and the FIFO. Since the
-     * first 3kB are needed by the DMP, we'll use the last 1kB for the FIFO.
-     */
-    data[0] = BIT_FIFO_SIZE_1024 | 0x8;
-    if (i2c_write(st.hw->addr, st.reg->accel_cfg2, 1, data))
-        return -1;
-#endif
-
-    /* Set to invalid values to ensure no I2C writes are skipped. */
-    st.chip_cfg.sensors = 0xFF;
-    st.chip_cfg.gyro_fsr = 0xFF;
-    st.chip_cfg.accel_fsr = 0xFF;
-    st.chip_cfg.lpf = 0xFF;
-    st.chip_cfg.sample_rate = 0xFFFF;
-    st.chip_cfg.fifo_enable = 0xFF;
-    st.chip_cfg.bypass_mode = 0xFF;
-#ifdef AK89xx_SECONDARY
-    st.chip_cfg.compass_sample_rate = 0xFFFF;
-#endif
-    /* mpu_set_sensors always preserves this setting. */
-    st.chip_cfg.clk_src = INV_CLK_PLL;
-    /* Handled in next call to mpu_set_bypass. */
-    st.chip_cfg.active_low_int = 1;
-    st.chip_cfg.latched_int = 0;
-    st.chip_cfg.int_motion_only = 0;
-    st.chip_cfg.lp_accel_mode = 0;
-    memset(&st.chip_cfg.cache, 0, sizeof(st.chip_cfg.cache));
-    st.chip_cfg.dmp_on = 0;
-    st.chip_cfg.dmp_loaded = 0;
-    st.chip_cfg.dmp_sample_rate = 0;
-
-    if (mpu_set_gyro_fsr(2000))
-        return -1;
-    if (mpu_set_accel_fsr(2))
-        return -1;
-    if (mpu_set_lpf(42))
-        return -1;
-    if (mpu_set_sample_rate(50))
-        return -1;
-    if (mpu_configure_fifo(0))
-        return -1;
-
-#ifndef MOTION_DRIVER_TARGET_STM32
-    if (int_param)
-        reg_int_cb(int_param);
-#endif
-
-#ifdef AK89xx_SECONDARY
-    setup_compass();
-    if (mpu_set_compass_sample_rate(10))
-        return -1;
-#else
-    /* Already disabled by setup_compass. */
-    if (mpu_set_bypass(0))
-        return -1;
-#endif
-
-    mpu_set_sensors(0);
-    return 0;
-}
-
-/**
- *  @brief      Enter low-power accel-only mode.
- *  In low-power accel mode, the chip goes to sleep and only wakes up to sample
- *  the accelerometer at one of the following frequencies:
- *  \n MPU6050: 1.25Hz, 5Hz, 20Hz, 40Hz
- *  \n MPU6500: 1.25Hz, 2.5Hz, 5Hz, 10Hz, 20Hz, 40Hz, 80Hz, 160Hz, 320Hz, 640Hz
- *  \n If the requested rate is not one listed above, the device will be set to
- *  the next highest rate. Requesting a rate above the maximum supported
- *  frequency will result in an error.
- *  \n To select a fractional wake-up frequency, round down the value passed to
- *  @e rate.
- *  @param[in]  rate        Minimum sampling rate, or zero to disable LP
- *                          accel mode.
- *  @return     0 if successful.
- */
-int mpu_lp_accel_mode(unsigned char rate)
-{
-    unsigned char tmp[2];
-
-    if (rate > 40)
-        return -1;
-
-    if (!rate) {
-        mpu_set_int_latched(0);
-        tmp[0] = 0;
-        tmp[1] = BIT_STBY_XYZG;
-        if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 2, tmp))
-            return -1;
-        st.chip_cfg.lp_accel_mode = 0;
-        return 0;
-    }
-    /* For LP accel, we automatically configure the hardware to produce latched
-     * interrupts. In LP accel mode, the hardware cycles into sleep mode before
-     * it gets a chance to deassert the interrupt pin; therefore, we shift this
-     * responsibility over to the MCU.
-     *
-     * Any register read will clear the interrupt.
-     */
-    mpu_set_int_latched(1);
-#if defined MPU6050
-    tmp[0] = BIT_LPA_CYCLE;
-    if (rate == 1) {
-        tmp[1] = INV_LPA_1_25HZ;
-        mpu_set_lpf(5);
-    } else if (rate <= 5) {
-        tmp[1] = INV_LPA_5HZ;
-        mpu_set_lpf(5);
-    } else if (rate <= 20) {
-        tmp[1] = INV_LPA_20HZ;
-        mpu_set_lpf(10);
-    } else {
-        tmp[1] = INV_LPA_40HZ;
-        mpu_set_lpf(20);
-    }
-    tmp[1] = (tmp[1] << 6) | BIT_STBY_XYZG;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 2, tmp))
-        return -1;
-#elif defined MPU6500
-    /* Set wake frequency. */
-    if (rate == 1)
-        tmp[0] = INV_LPA_1_25HZ;
-    else if (rate == 2)
-        tmp[0] = INV_LPA_2_5HZ;
-    else if (rate <= 5)
-        tmp[0] = INV_LPA_5HZ;
-    else if (rate <= 10)
-        tmp[0] = INV_LPA_10HZ;
-    else if (rate <= 20)
-        tmp[0] = INV_LPA_20HZ;
-    else if (rate <= 40)
-        tmp[0] = INV_LPA_40HZ;
-    else if (rate <= 80)
-        tmp[0] = INV_LPA_80HZ;
-    else if (rate <= 160)
-        tmp[0] = INV_LPA_160HZ;
-    else if (rate <= 320)
-        tmp[0] = INV_LPA_320HZ;
-    else
-        tmp[0] = INV_LPA_640HZ;
-    if (i2c_write(st.hw->addr, st.reg->lp_accel_odr, 1, tmp))
-        return -1;
-    tmp[0] = BIT_LPA_CYCLE;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, tmp))
-        return -1;
-#endif
-    st.chip_cfg.sensors = INV_XYZ_ACCEL;
-    st.chip_cfg.clk_src = 0;
-    st.chip_cfg.lp_accel_mode = 1;
-    mpu_configure_fifo(0);
-
-    return 0;
-}
-
-/**
- *  @brief      Read raw gyro data directly from the registers.
- *  @param[out] data        Raw data in hardware units.
- *  @param[out] timestamp   Timestamp in milliseconds. Null if not needed.
- *  @return     0 if successful.
- */
-int mpu_get_gyro_reg(short *data, unsigned long *timestamp)
-{
-    unsigned char tmp[6];
-
-    if (!(st.chip_cfg.sensors & INV_XYZ_GYRO))
-        return -1;
-
-    if (i2c_read(st.hw->addr, st.reg->raw_gyro, 6, tmp))
-        return -1;
-    data[0] = (tmp[0] << 8) | tmp[1];
-    data[1] = (tmp[2] << 8) | tmp[3];
-    data[2] = (tmp[4] << 8) | tmp[5];
-    if (timestamp)
-        get_ms(timestamp);
-    return 0;
-}
-
-/**
- *  @brief      Read raw accel data directly from the registers.
- *  @param[out] data        Raw data in hardware units.
- *  @param[out] timestamp   Timestamp in milliseconds. Null if not needed.
- *  @return     0 if successful.
- */
-int mpu_get_accel_reg(short *data, unsigned long *timestamp)
-{
-    unsigned char tmp[6];
-
-    if (!(st.chip_cfg.sensors & INV_XYZ_ACCEL))
-        return -1;
-
-    if (i2c_read(st.hw->addr, st.reg->raw_accel, 6, tmp))
-        return -1;
-    data[0] = (tmp[0] << 8) | tmp[1];
-    data[1] = (tmp[2] << 8) | tmp[3];
-    data[2] = (tmp[4] << 8) | tmp[5];
-    if (timestamp)
-        get_ms(timestamp);
-    return 0;
-}
-
-/**
- *  @brief      Read temperature data directly from the registers.
- *  @param[out] data        Data in q16 format.
- *  @param[out] timestamp   Timestamp in milliseconds. Null if not needed.
- *  @return     0 if successful.
- */
-int mpu_get_temperature(long *data, unsigned long *timestamp)
-{
-    unsigned char tmp[2];
-    short raw;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    if (i2c_read(st.hw->addr, st.reg->temp, 2, tmp))
-        return -1;
-    raw = (tmp[0] << 8) | tmp[1];
-    if (timestamp)
-        get_ms(timestamp);
-
-    data[0] = (long)((35 + ((raw - (float)st.hw->temp_offset) / st.hw->temp_sens)) * 65536L);
-    return 0;
-}
-
-/**
- *  @brief      Push biases to the accel bias registers.
- *  This function expects biases relative to the current sensor output, and
- *  these biases will be added to the factory-supplied values.
- *  @param[in]  accel_bias  New biases.
- *  @return     0 if successful.
- */
-int mpu_set_accel_bias(const long *accel_bias)
-{
-    unsigned char data[6];
-    short accel_hw[3];
-    short got_accel[3];
-    short fg[3];
-
-    if (!accel_bias)
-        return -1;
-    if (!accel_bias[0] && !accel_bias[1] && !accel_bias[2])
-        return 0;
-
-    if (i2c_read(st.hw->addr, 3, 3, data))
-        return -1;
-    fg[0] = ((data[0] >> 4) + 8) & 0xf;
-    fg[1] = ((data[1] >> 4) + 8) & 0xf;
-    fg[2] = ((data[2] >> 4) + 8) & 0xf;
-
-    accel_hw[0] = (short)(accel_bias[0] * 2 / (64 + fg[0]));
-    accel_hw[1] = (short)(accel_bias[1] * 2 / (64 + fg[1]));
-    accel_hw[2] = (short)(accel_bias[2] * 2 / (64 + fg[2]));
-
-    if (i2c_read(st.hw->addr, 0x06, 6, data))
-        return -1;
-
-    got_accel[0] = ((short)data[0] << 8) | data[1];
-    got_accel[1] = ((short)data[2] << 8) | data[3];
-    got_accel[2] = ((short)data[4] << 8) | data[5];
-
-    accel_hw[0] += got_accel[0];
-    accel_hw[1] += got_accel[1];
-    accel_hw[2] += got_accel[2];
-
-    data[0] = (accel_hw[0] >> 8) & 0xff;
-    data[1] = (accel_hw[0]) & 0xff;
-    data[2] = (accel_hw[1] >> 8) & 0xff;
-    data[3] = (accel_hw[1]) & 0xff;
-    data[4] = (accel_hw[2] >> 8) & 0xff;
-    data[5] = (accel_hw[2]) & 0xff;
-
-    if (i2c_write(st.hw->addr, 0x06, 6, data))
-        return -1;
-    return 0;
-}
-
-/**
- *  @brief  Reset FIFO read/write pointers.
- *  @return 0 if successful.
- */
-int mpu_reset_fifo(void)
-{
-    unsigned char data;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    data = 0;
-    if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, &data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
-        return -1;
-
-    if (st.chip_cfg.dmp_on) {
-        data = BIT_FIFO_RST | BIT_DMP_RST;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
-            return -1;
-        delay_ms(50);
-        data = BIT_DMP_EN | BIT_FIFO_EN;
-        if (st.chip_cfg.sensors & INV_XYZ_COMPASS)
-            data |= BIT_AUX_IF_EN;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
-            return -1;
-        if (st.chip_cfg.int_enable)
-            data = BIT_DMP_INT_EN;
-        else
-            data = 0;
-        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &data))
-            return -1;
-        data = 0;
-        if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, &data))
-            return -1;
-    } else {
-        data = BIT_FIFO_RST;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
-            return -1;
-        if (st.chip_cfg.bypass_mode || !(st.chip_cfg.sensors & INV_XYZ_COMPASS))
-            data = BIT_FIFO_EN;
-        else
-            data = BIT_FIFO_EN | BIT_AUX_IF_EN;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
-            return -1;
-        delay_ms(50);
-        if (st.chip_cfg.int_enable)
-            data = BIT_DATA_RDY_EN;
-        else
-            data = 0;
-        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &data))
-            return -1;
-        if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, &st.chip_cfg.fifo_enable))
-            return -1;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Get the gyro full-scale range.
- *  @param[out] fsr Current full-scale range.
- *  @return     0 if successful.
- */
-int mpu_get_gyro_fsr(unsigned short *fsr)
-{
-    switch (st.chip_cfg.gyro_fsr) {
-    case INV_FSR_250DPS:
-        fsr[0] = 250;
-        break;
-    case INV_FSR_500DPS:
-        fsr[0] = 500;
-        break;
-    case INV_FSR_1000DPS:
-        fsr[0] = 1000;
-        break;
-    case INV_FSR_2000DPS:
-        fsr[0] = 2000;
-        break;
-    default:
-        fsr[0] = 0;
-        break;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Set the gyro full-scale range.
- *  @param[in]  fsr Desired full-scale range.
- *  @return     0 if successful.
- */
-int mpu_set_gyro_fsr(unsigned short fsr)
-{
-    unsigned char data;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    switch (fsr) {
-    case 250:
-        data = INV_FSR_250DPS << 3;
-        break;
-    case 500:
-        data = INV_FSR_500DPS << 3;
-        break;
-    case 1000:
-        data = INV_FSR_1000DPS << 3;
-        break;
-    case 2000:
-        data = INV_FSR_2000DPS << 3;
-        break;
-    default:
-        return -1;
-    }
-
-    if (st.chip_cfg.gyro_fsr == (data >> 3))
-        return 0;
-    if (i2c_write(st.hw->addr, st.reg->gyro_cfg, 1, &data))
-        return -1;
-    st.chip_cfg.gyro_fsr = data >> 3;
-    return 0;
-}
-
-/**
- *  @brief      Get the accel full-scale range.
- *  @param[out] fsr Current full-scale range.
- *  @return     0 if successful.
- */
-int mpu_get_accel_fsr(unsigned char *fsr)
-{
-    switch (st.chip_cfg.accel_fsr) {
-    case INV_FSR_2G:
-        fsr[0] = 2;
-        break;
-    case INV_FSR_4G:
-        fsr[0] = 4;
-        break;
-    case INV_FSR_8G:
-        fsr[0] = 8;
-        break;
-    case INV_FSR_16G:
-        fsr[0] = 16;
-        break;
-    default:
-        return -1;
-    }
-    if (st.chip_cfg.accel_half)
-        fsr[0] <<= 1;
-    return 0;
-}
-
-/**
- *  @brief      Set the accel full-scale range.
- *  @param[in]  fsr Desired full-scale range.
- *  @return     0 if successful.
- */
-int mpu_set_accel_fsr(unsigned char fsr)
-{
-    unsigned char data;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    switch (fsr) {
-    case 2:
-        data = INV_FSR_2G << 3;
-        break;
-    case 4:
-        data = INV_FSR_4G << 3;
-        break;
-    case 8:
-        data = INV_FSR_8G << 3;
-        break;
-    case 16:
-        data = INV_FSR_16G << 3;
-        break;
-    default:
-        return -1;
-    }
-
-    if (st.chip_cfg.accel_fsr == (data >> 3))
-        return 0;
-    if (i2c_write(st.hw->addr, st.reg->accel_cfg, 1, &data))
-        return -1;
-    st.chip_cfg.accel_fsr = data >> 3;
-    return 0;
-}
-
-/**
- *  @brief      Get the current DLPF setting.
- *  @param[out] lpf Current LPF setting.
- *  0 if successful.
- */
-int mpu_get_lpf(unsigned short *lpf)
-{
-    switch (st.chip_cfg.lpf) {
-    case INV_FILTER_188HZ:
-        lpf[0] = 188;
-        break;
-    case INV_FILTER_98HZ:
-        lpf[0] = 98;
-        break;
-    case INV_FILTER_42HZ:
-        lpf[0] = 42;
-        break;
-    case INV_FILTER_20HZ:
-        lpf[0] = 20;
-        break;
-    case INV_FILTER_10HZ:
-        lpf[0] = 10;
-        break;
-    case INV_FILTER_5HZ:
-        lpf[0] = 5;
-        break;
-    case INV_FILTER_256HZ_NOLPF2:
-    case INV_FILTER_2100HZ_NOLPF:
-    default:
-        lpf[0] = 0;
-        break;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Set digital low pass filter.
- *  The following LPF settings are supported: 188, 98, 42, 20, 10, 5.
- *  @param[in]  lpf Desired LPF setting.
- *  @return     0 if successful.
- */
-int mpu_set_lpf(unsigned short lpf)
-{
-    unsigned char data;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    if (lpf >= 188)
-        data = INV_FILTER_188HZ;
-    else if (lpf >= 98)
-        data = INV_FILTER_98HZ;
-    else if (lpf >= 42)
-        data = INV_FILTER_42HZ;
-    else if (lpf >= 20)
-        data = INV_FILTER_20HZ;
-    else if (lpf >= 10)
-        data = INV_FILTER_10HZ;
-    else
-        data = INV_FILTER_5HZ;
-
-    if (st.chip_cfg.lpf == data)
-        return 0;
-    if (i2c_write(st.hw->addr, st.reg->lpf, 1, &data))
-        return -1;
-    st.chip_cfg.lpf = data;
-    return 0;
-}
-
-/**
- *  @brief      Get sampling rate.
- *  @param[out] rate    Current sampling rate (Hz).
- *  @return     0 if successful.
- */
-int mpu_get_sample_rate(unsigned short *rate)
-{
-    if (st.chip_cfg.dmp_on)
-        return -1;
-    else
-        rate[0] = st.chip_cfg.sample_rate;
-
-    return 0;
-}
-
-/**
- *  @brief      Set sampling rate.
- *  Sampling rate must be between 4Hz and 1kHz.
- *  @param[in]  rate    Desired sampling rate (Hz).
- *  @return     0 if successful.
- */
-int mpu_set_sample_rate(unsigned short rate)
-{
-    unsigned char data;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    if (st.chip_cfg.dmp_on)
-        return -1;
-    else {
-        if (st.chip_cfg.lp_accel_mode) {
-            if (rate && (rate <= 40)) {
-                /* Just stay in low-power accel mode. */
-                mpu_lp_accel_mode(rate);
-                return 0;
-            }
-            /* Requested rate exceeds the allowed frequencies in LP accel mode,
-             * switch back to full-power mode.
-             */
-            mpu_lp_accel_mode(0);
-        }
-        if (rate < 4)
-            rate = 4;
-        else if (rate > 1000)
-            rate = 1000;
-
-        data = 1000 / rate - 1;
-        if (i2c_write(st.hw->addr, st.reg->rate_div, 1, &data))
-            return -1;
-
-        st.chip_cfg.sample_rate = 1000 / (1 + data);
-
-#ifdef AK89xx_SECONDARY
-        mpu_set_compass_sample_rate(min(st.chip_cfg.compass_sample_rate, MAX_COMPASS_SAMPLE_RATE));
-#endif
-
-        /* Automatically set LPF to 1/2 sampling rate. */
-        mpu_set_lpf(st.chip_cfg.sample_rate >> 1);
-        return 0;
-    }
-}
-
-/**
- *  @brief      Get compass sampling rate.
- *  @param[out] rate    Current compass sampling rate (Hz).
- *  @return     0 if successful.
- */
-int mpu_get_compass_sample_rate(unsigned short *rate)
-{
-#ifdef AK89xx_SECONDARY
-    rate[0] = st.chip_cfg.compass_sample_rate;
-    return 0;
-#else
-    rate[0] = 0;
-    return -1;
-#endif
-}
-
-/**
- *  @brief      Set compass sampling rate.
- *  The compass on the auxiliary I2C bus is read by the MPU hardware at a
- *  maximum of 100Hz. The actual rate can be set to a fraction of the gyro
- *  sampling rate.
- *
- *  \n WARNING: The new rate may be different than what was requested. Call
- *  mpu_get_compass_sample_rate to check the actual setting.
- *  @param[in]  rate    Desired compass sampling rate (Hz).
- *  @return     0 if successful.
- */
-int mpu_set_compass_sample_rate(unsigned short rate)
-{
-#ifdef AK89xx_SECONDARY
-    unsigned char div;
-    if (!rate || rate > st.chip_cfg.sample_rate || rate > MAX_COMPASS_SAMPLE_RATE)
-        return -1;
-
-    div = st.chip_cfg.sample_rate / rate - 1;
-    if (i2c_write(st.hw->addr, st.reg->s4_ctrl, 1, &div))
-        return -1;
-    st.chip_cfg.compass_sample_rate = st.chip_cfg.sample_rate / (div + 1);
-    return 0;
-#else
-    return -1;
-#endif
-}
-
-/**
- *  @brief      Get gyro sensitivity scale factor.
- *  @param[out] sens    Conversion from hardware units to dps.
- *  @return     0 if successful.
- */
-int mpu_get_gyro_sens(float *sens)
-{
-    switch (st.chip_cfg.gyro_fsr) {
-    case INV_FSR_250DPS:
-        sens[0] = 131.f;
-        break;
-    case INV_FSR_500DPS:
-        sens[0] = 65.5f;
-        break;
-    case INV_FSR_1000DPS:
-        sens[0] = 32.8f;
-        break;
-    case INV_FSR_2000DPS:
-        sens[0] = 16.4f;
-        break;
-    default:
-        return -1;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Get accel sensitivity scale factor.
- *  @param[out] sens    Conversion from hardware units to g's.
- *  @return     0 if successful.
- */
-int mpu_get_accel_sens(unsigned short *sens)
-{
-    switch (st.chip_cfg.accel_fsr) {
-    case INV_FSR_2G:
-        sens[0] = 16384;
-        break;
-    case INV_FSR_4G:
-        sens[0] = 8092;
-        break;
-    case INV_FSR_8G:
-        sens[0] = 4096;
-        break;
-    case INV_FSR_16G:
-        sens[0] = 2048;
-        break;
-    default:
-        return -1;
-    }
-    if (st.chip_cfg.accel_half)
-        sens[0] >>= 1;
-    return 0;
-}
-
-/**
- *  @brief      Get current FIFO configuration.
- *  @e sensors can contain a combination of the following flags:
- *  \n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
- *  \n INV_XYZ_GYRO
- *  \n INV_XYZ_ACCEL
- *  @param[out] sensors Mask of sensors in FIFO.
- *  @return     0 if successful.
- */
-int mpu_get_fifo_config(unsigned char *sensors)
-{
-    sensors[0] = st.chip_cfg.fifo_enable;
-    return 0;
-}
-
-/**
- *  @brief      Select which sensors are pushed to FIFO.
- *  @e sensors can contain a combination of the following flags:
- *  \n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
- *  \n INV_XYZ_GYRO
- *  \n INV_XYZ_ACCEL
- *  @param[in]  sensors Mask of sensors to push to FIFO.
- *  @return     0 if successful.
- */
-int mpu_configure_fifo(unsigned char sensors)
-{
-    unsigned char prev;
-    int result = 0;
-
-    /* Compass data isn't going into the FIFO. Stop trying. */
-    sensors &= ~INV_XYZ_COMPASS;
-
-    if (st.chip_cfg.dmp_on)
-        return 0;
-    else {
-        if (!(st.chip_cfg.sensors))
-            return -1;
-        prev = st.chip_cfg.fifo_enable;
-        st.chip_cfg.fifo_enable = sensors & st.chip_cfg.sensors;
-        if (st.chip_cfg.fifo_enable != sensors)
-            /* You're not getting what you asked for. Some sensors are
-             * asleep.
-             */
-            result = -1;
-        else
-            result = 0;
-        if (sensors || st.chip_cfg.lp_accel_mode)
-            set_int_enable(1);
-        else
-            set_int_enable(0);
-        if (sensors) {
-            if (mpu_reset_fifo()) {
-                st.chip_cfg.fifo_enable = prev;
-                return -1;
-            }
-        }
-    }
-
-    return result;
-}
-
-/**
- *  @brief      Get current power state.
- *  @param[in]  power_on    1 if turned on, 0 if suspended.
- *  @return     0 if successful.
- */
-int mpu_get_power_state(unsigned char *power_on)
-{
-    if (st.chip_cfg.sensors)
-        power_on[0] = 1;
-    else
-        power_on[0] = 0;
-    return 0;
-}
-
-/**
- *  @brief      Turn specific sensors on/off.
- *  @e sensors can contain a combination of the following flags:
- *  \n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
- *  \n INV_XYZ_GYRO
- *  \n INV_XYZ_ACCEL
- *  \n INV_XYZ_COMPASS
- *  @param[in]  sensors    Mask of sensors to wake.
- *  @return     0 if successful.
- */
-int mpu_set_sensors(unsigned char sensors)
-{
-    unsigned char data;
-#ifdef AK89xx_SECONDARY
-    unsigned char user_ctrl;
-#endif
-
-    if (sensors & INV_XYZ_GYRO)
-        data = INV_CLK_PLL;
-    else if (sensors)
-        data = 0;
-    else
-        data = BIT_SLEEP;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, &data)) {
-        st.chip_cfg.sensors = 0;
-        return -1;
-    }
-    st.chip_cfg.clk_src = data & ~BIT_SLEEP;
-
-    data = 0;
-    if (!(sensors & INV_X_GYRO))
-        data |= BIT_STBY_XG;
-    if (!(sensors & INV_Y_GYRO))
-        data |= BIT_STBY_YG;
-    if (!(sensors & INV_Z_GYRO))
-        data |= BIT_STBY_ZG;
-    if (!(sensors & INV_XYZ_ACCEL))
-        data |= BIT_STBY_XYZA;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_2, 1, &data)) {
-        st.chip_cfg.sensors = 0;
-        return -1;
-    }
-
-    if (sensors && (sensors != INV_XYZ_ACCEL))
-        /* Latched interrupts only used in LP accel mode. */
-        mpu_set_int_latched(0);
-
-#ifdef AK89xx_SECONDARY
-#ifdef AK89xx_BYPASS
-    if (sensors & INV_XYZ_COMPASS)
-        mpu_set_bypass(1);
-    else
-        mpu_set_bypass(0);
-#else
-    if (i2c_read(st.hw->addr, st.reg->user_ctrl, 1, &user_ctrl))
-        return -1;
-    /* Handle AKM power management. */
-    if (sensors & INV_XYZ_COMPASS) {
-        data = AKM_SINGLE_MEASUREMENT;
-        user_ctrl |= BIT_AUX_IF_EN;
-    } else {
-        data = AKM_POWER_DOWN;
-        user_ctrl &= ~BIT_AUX_IF_EN;
-    }
-    if (st.chip_cfg.dmp_on)
-        user_ctrl |= BIT_DMP_EN;
-    else
-        user_ctrl &= ~BIT_DMP_EN;
-    if (i2c_write(st.hw->addr, st.reg->s1_do, 1, &data))
-        return -1;
-    /* Enable/disable I2C master mode. */
-    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &user_ctrl))
-        return -1;
-#endif
-#endif
-
-    st.chip_cfg.sensors = sensors;
-    st.chip_cfg.lp_accel_mode = 0;
-    delay_ms(50);
-    return 0;
-}
-
-/**
- *  @brief      Read the MPU interrupt status registers.
- *  @param[out] status  Mask of interrupt bits.
- *  @return     0 if successful.
- */
-int mpu_get_int_status(short *status)
-{
-    unsigned char tmp[2];
-    if (!st.chip_cfg.sensors)
-        return -1;
-    if (i2c_read(st.hw->addr, st.reg->dmp_int_status, 2, tmp))
-        return -1;
-    status[0] = (tmp[0] << 8) | tmp[1];
-    return 0;
-}
-
-/**
- *  @brief      Get one packet from the FIFO.
- *  If @e sensors does not contain a particular sensor, disregard the data
- *  returned to that pointer.
- *  \n @e sensors can contain a combination of the following flags:
- *  \n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
- *  \n INV_XYZ_GYRO
- *  \n INV_XYZ_ACCEL
- *  \n If the FIFO has no new data, @e sensors will be zero.
- *  \n If the FIFO is disabled, @e sensors will be zero and this function will
- *  return a non-zero error code.
- *  @param[out] gyro        Gyro data in hardware units.
- *  @param[out] accel       Accel data in hardware units.
- *  @param[out] timestamp   Timestamp in milliseconds.
- *  @param[out] sensors     Mask of sensors read from FIFO.
- *  @param[out] more        Number of remaining packets.
- *  @return     0 if successful.
- */
-int mpu_read_fifo(short *gyro, short *accel, unsigned long *timestamp,
-        unsigned char *sensors, unsigned char *more)
-{
-    /* Assumes maximum packet size is gyro (6) + accel (6). */
-    unsigned char data[MAX_PACKET_LENGTH];
-    unsigned char packet_size = 0;
-    unsigned short fifo_count, index = 0;
-
-    if (st.chip_cfg.dmp_on)
-        return -1;
-
-    sensors[0] = 0;
-    if (!st.chip_cfg.sensors)
-        return -1;
-    if (!st.chip_cfg.fifo_enable)
-        return -1;
-
-    if (st.chip_cfg.fifo_enable & INV_X_GYRO)
-        packet_size += 2;
-    if (st.chip_cfg.fifo_enable & INV_Y_GYRO)
-        packet_size += 2;
-    if (st.chip_cfg.fifo_enable & INV_Z_GYRO)
-        packet_size += 2;
-    if (st.chip_cfg.fifo_enable & INV_XYZ_ACCEL)
-        packet_size += 6;
-
-    if (i2c_read(st.hw->addr, st.reg->fifo_count_h, 2, data))
-        return -1;
-    fifo_count = (data[0] << 8) | data[1];
-    if (fifo_count < packet_size)
-        return 0;
-//    log_i("FIFO count: %hd\n", fifo_count);
-    if (fifo_count > (st.hw->max_fifo >> 1)) {
-        /* FIFO is 50% full, better check overflow bit. */
-        if (i2c_read(st.hw->addr, st.reg->int_status, 1, data))
-            return -1;
-        if (data[0] & BIT_FIFO_OVERFLOW) {
-            mpu_reset_fifo();
-            return -2;
-        }
-    }
-    get_ms((unsigned long*)timestamp);
-
-    if (i2c_read(st.hw->addr, st.reg->fifo_r_w, packet_size, data))
-        return -1;
-    more[0] = fifo_count / packet_size - 1;
-    sensors[0] = 0;
-
-    if ((index != packet_size) && st.chip_cfg.fifo_enable & INV_XYZ_ACCEL) {
-        accel[0] = (data[index+0] << 8) | data[index+1];
-        accel[1] = (data[index+2] << 8) | data[index+3];
-        accel[2] = (data[index+4] << 8) | data[index+5];
-        sensors[0] |= INV_XYZ_ACCEL;
-        index += 6;
-    }
-    if ((index != packet_size) && st.chip_cfg.fifo_enable & INV_X_GYRO) {
-        gyro[0] = (data[index+0] << 8) | data[index+1];
-        sensors[0] |= INV_X_GYRO;
-        index += 2;
-    }
-    if ((index != packet_size) && st.chip_cfg.fifo_enable & INV_Y_GYRO) {
-        gyro[1] = (data[index+0] << 8) | data[index+1];
-        sensors[0] |= INV_Y_GYRO;
-        index += 2;
-    }
-    if ((index != packet_size) && st.chip_cfg.fifo_enable & INV_Z_GYRO) {
-        gyro[2] = (data[index+0] << 8) | data[index+1];
-        sensors[0] |= INV_Z_GYRO;
-        index += 2;
-    }
-
-    return 0;
-}
-
-/**
- *  @brief      Get one unparsed packet from the FIFO.
- *  This function should be used if the packet is to be parsed elsewhere.
- *  @param[in]  length  Length of one FIFO packet.
- *  @param[in]  data    FIFO packet.
- *  @param[in]  more    Number of remaining packets.
- */
-int mpu_read_fifo_stream(unsigned short length, unsigned char *data,
-    unsigned char *more)
-{
-    unsigned char tmp[2];
-    unsigned short fifo_count;
-
-//    printf("addr %d, dmp_on %d, sensors %d\r\n", st.hw->addr, st.chip_cfg.dmp_on, st.chip_cfg.sensors);
-
-    if (!st.chip_cfg.dmp_on)
-        return -1;
-    if (!st.chip_cfg.sensors)
-        return -1;
-
-//    printf("----1\r\n");
-
-    if (i2c_read(st.hw->addr, st.reg->fifo_count_h, 2, tmp))
-        return -1;
-
-//    printf("----2\r\n");
-
-    fifo_count = (tmp[0] << 8) | tmp[1];
-    if (fifo_count < length) {
-        more[0] = 0;
-        return -1;
-    }
-
-//    printf("----3\r\n");
-    if (fifo_count > (st.hw->max_fifo >> 1)) {
-
-//        printf("----3.1\r\n");
-        /* FIFO is 50% full, better check overflow bit. */
-        if (i2c_read(st.hw->addr, st.reg->int_status, 1, tmp))
-            return -1;
-
-//        printf("----3.2\r\n");
-        if (tmp[0] & BIT_FIFO_OVERFLOW) {
-            mpu_reset_fifo();
-            return -2;
-        }
-    }
-
-//    printf("----4\r\n");
-    if (i2c_read(st.hw->addr, st.reg->fifo_r_w, length, data))
-        return -1;
-
-    more[0] = fifo_count / length - 1;
-    return 0;
-}
-
-/**
- *  @brief      Set device to bypass mode.
- *  @param[in]  bypass_on   1 to enable bypass mode.
- *  @return     0 if successful.
- */
-int mpu_set_bypass(unsigned char bypass_on)
-{
-    unsigned char tmp;
-
-    if (st.chip_cfg.bypass_mode == bypass_on)
-        return 0;
-
-    if (bypass_on) {
-        if (i2c_read(st.hw->addr, st.reg->user_ctrl, 1, &tmp))
-            return -1;
-        tmp &= ~BIT_AUX_IF_EN;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &tmp))
-            return -1;
-        delay_ms(3);
-        tmp = BIT_BYPASS_EN;
-        if (st.chip_cfg.active_low_int)
-            tmp |= BIT_ACTL;
-        if (st.chip_cfg.latched_int)
-            tmp |= BIT_LATCH_EN | BIT_ANY_RD_CLR;
-        if (i2c_write(st.hw->addr, st.reg->int_pin_cfg, 1, &tmp))
-            return -1;
-    } else {
-        /* Enable I2C master mode if compass is being used. */
-        if (i2c_read(st.hw->addr, st.reg->user_ctrl, 1, &tmp))
-            return -1;
-        if (st.chip_cfg.sensors & INV_XYZ_COMPASS)
-            tmp |= BIT_AUX_IF_EN;
-        else
-            tmp &= ~BIT_AUX_IF_EN;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &tmp))
-            return -1;
-        delay_ms(3);
-        if (st.chip_cfg.active_low_int)
-            tmp = BIT_ACTL;
-        else
-            tmp = 0;
-        if (st.chip_cfg.latched_int)
-            tmp |= BIT_LATCH_EN | BIT_ANY_RD_CLR;
-        if (i2c_write(st.hw->addr, st.reg->int_pin_cfg, 1, &tmp))
-            return -1;
-    }
-    st.chip_cfg.bypass_mode = bypass_on;
-    return 0;
-}
-
-/**
- *  @brief      Set interrupt level.
- *  @param[in]  active_low  1 for active low, 0 for active high.
- *  @return     0 if successful.
- */
-int mpu_set_int_level(unsigned char active_low)
-{
-    st.chip_cfg.active_low_int = active_low;
-    return 0;
-}
-
-/**
- *  @brief      Enable latched interrupts.
- *  Any MPU register will clear the interrupt.
- *  @param[in]  enable  1 to enable, 0 to disable.
- *  @return     0 if successful.
- */
-int mpu_set_int_latched(unsigned char enable)
-{
-    unsigned char tmp;
-    if (st.chip_cfg.latched_int == enable)
-        return 0;
-
-    if (enable)
-        tmp = BIT_LATCH_EN | BIT_ANY_RD_CLR;
-    else
-        tmp = 0;
-    if (st.chip_cfg.bypass_mode)
-        tmp |= BIT_BYPASS_EN;
-    if (st.chip_cfg.active_low_int)
-        tmp |= BIT_ACTL;
-    if (i2c_write(st.hw->addr, st.reg->int_pin_cfg, 1, &tmp))
-        return -1;
-    st.chip_cfg.latched_int = enable;
-    return 0;
-}
-
-#ifdef MPU6050
-static int get_accel_prod_shift(float *st_shift)
-{
-    unsigned char tmp[4], shift_code[3], ii;
-
-    if (i2c_read(st.hw->addr, 0x0D, 4, tmp))
-        return 0x07;
-
-    shift_code[0] = ((tmp[0] & 0xE0) >> 3) | ((tmp[3] & 0x30) >> 4);
-    shift_code[1] = ((tmp[1] & 0xE0) >> 3) | ((tmp[3] & 0x0C) >> 2);
-    shift_code[2] = ((tmp[2] & 0xE0) >> 3) | (tmp[3] & 0x03);
-    for (ii = 0; ii < 3; ii++) {
-        if (!shift_code[ii]) {
-            st_shift[ii] = 0.f;
-            continue;
-        }
-        /* Equivalent to..
-         * st_shift[ii] = 0.34f * powf(0.92f/0.34f, (shift_code[ii]-1) / 30.f)
-         */
-        st_shift[ii] = 0.34f;
-        while (--shift_code[ii])
-            st_shift[ii] *= 1.034f;
-    }
-    return 0;
-}
-
-static int accel_self_test(long *bias_regular, long *bias_st)
-{
-    int jj, result = 0;
-    float st_shift[3], st_shift_cust, st_shift_var;
-
-    get_accel_prod_shift(st_shift);
-    for(jj = 0; jj < 3; jj++) {
-        st_shift_cust = labs(bias_regular[jj] - bias_st[jj]) / 65536.f;
-        if (st_shift[jj]) {
-            st_shift_var = st_shift_cust / st_shift[jj] - 1.f;
-            if (fabs(st_shift_var) > test.max_accel_var)
-                result |= 1 << jj;
-        } else if ((st_shift_cust < test.min_g) ||
-            (st_shift_cust > test.max_g))
-            result |= 1 << jj;
-    }
-
-    return result;
-}
-
-static int gyro_self_test(long *bias_regular, long *bias_st)
-{
-    int jj, result = 0;
-    unsigned char tmp[3];
-    float st_shift, st_shift_cust, st_shift_var;
-
-    if (i2c_read(st.hw->addr, 0x0D, 3, tmp))
-        return 0x07;
-
-    tmp[0] &= 0x1F;
-    tmp[1] &= 0x1F;
-    tmp[2] &= 0x1F;
-
-    for (jj = 0; jj < 3; jj++) {
-        st_shift_cust = labs(bias_regular[jj] - bias_st[jj]) / 65536.f;
-        if (tmp[jj]) {
-            st_shift = 3275.f / test.gyro_sens;
-            while (--tmp[jj])
-                st_shift *= 1.046f;
-            st_shift_var = st_shift_cust / st_shift - 1.f;
-            if (fabs(st_shift_var) > test.max_gyro_var)
-                result |= 1 << jj;
-        } else if ((st_shift_cust < test.min_dps) ||
-            (st_shift_cust > test.max_dps))
-            result |= 1 << jj;
-    }
-    return result;
-}
-
-#ifdef AK89xx_SECONDARY
-static int compass_self_test(void)
-{
-    unsigned char tmp[6];
-    unsigned char tries = 10;
-    int result = 0x07;
-    short data;
-
-    mpu_set_bypass(1);
-
-    tmp[0] = AKM_POWER_DOWN;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, tmp))
-        return 0x07;
-    tmp[0] = AKM_BIT_SELF_TEST;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_ASTC, 1, tmp))
-        goto AKM_restore;
-    tmp[0] = AKM_MODE_SELF_TEST;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, tmp))
-        goto AKM_restore;
-
-    do {
-        delay_ms(10);
-        if (i2c_read(st.chip_cfg.compass_addr, AKM_REG_ST1, 1, tmp))
-            goto AKM_restore;
-        if (tmp[0] & AKM_DATA_READY)
-            break;
-    } while (tries--);
-    if (!(tmp[0] & AKM_DATA_READY))
-        goto AKM_restore;
-
-    if (i2c_read(st.chip_cfg.compass_addr, AKM_REG_HXL, 6, tmp))
-        goto AKM_restore;
-
-    result = 0;
-    data = (short)(tmp[1] << 8) | tmp[0];
-    if ((data > 100) || (data < -100))
-        result |= 0x01;
-    data = (short)(tmp[3] << 8) | tmp[2];
-    if ((data > 100) || (data < -100))
-        result |= 0x02;
-    data = (short)(tmp[5] << 8) | tmp[4];
-    if ((data > -300) || (data < -1000))
-        result |= 0x04;
-
-AKM_restore:
-    tmp[0] = 0 | SUPPORTS_AK89xx_HIGH_SENS;
-    i2c_write(st.chip_cfg.compass_addr, AKM_REG_ASTC, 1, tmp);
-    tmp[0] = SUPPORTS_AK89xx_HIGH_SENS;
-    i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, tmp);
-    mpu_set_bypass(0);
-    return result;
-}
-#endif
-#endif
-
-static int get_st_biases(long *gyro, long *accel, unsigned char hw_test)
-{
-    unsigned char data[MAX_PACKET_LENGTH];
-    unsigned char packet_count, ii;
-    unsigned short fifo_count;
-
-    data[0] = 0x01;
-    data[1] = 0;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 2, data))
-        return -1;
-    delay_ms(200);
-    data[0] = 0;
-    if (i2c_write(st.hw->addr, st.reg->int_enable, 1, data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->i2c_mst, 1, data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, data))
-        return -1;
-    data[0] = BIT_FIFO_RST | BIT_DMP_RST;
-    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, data))
-        return -1;
-    delay_ms(15);
-    data[0] = st.test->reg_lpf;
-    if (i2c_write(st.hw->addr, st.reg->lpf, 1, data))
-        return -1;
-    data[0] = st.test->reg_rate_div;
-    if (i2c_write(st.hw->addr, st.reg->rate_div, 1, data))
-        return -1;
-    if (hw_test)
-        data[0] = st.test->reg_gyro_fsr | 0xE0;
-    else
-        data[0] = st.test->reg_gyro_fsr;
-    if (i2c_write(st.hw->addr, st.reg->gyro_cfg, 1, data))
-        return -1;
-
-    if (hw_test)
-        data[0] = st.test->reg_accel_fsr | 0xE0;
-    else
-        data[0] = test.reg_accel_fsr;
-    if (i2c_write(st.hw->addr, st.reg->accel_cfg, 1, data))
-        return -1;
-    if (hw_test)
-        delay_ms(200);
-
-    /* Fill FIFO for test.wait_ms milliseconds. */
-    data[0] = BIT_FIFO_EN;
-    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, data))
-        return -1;
-
-    data[0] = INV_XYZ_GYRO | INV_XYZ_ACCEL;
-    if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, data))
-        return -1;
-    delay_ms(test.wait_ms);
-    data[0] = 0;
-    if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, data))
-        return -1;
-
-    if (i2c_read(st.hw->addr, st.reg->fifo_count_h, 2, data))
-        return -1;
-
-    fifo_count = (data[0] << 8) | data[1];
-    packet_count = fifo_count / MAX_PACKET_LENGTH;
-    gyro[0] = gyro[1] = gyro[2] = 0;
-    accel[0] = accel[1] = accel[2] = 0;
-
-    for (ii = 0; ii < packet_count; ii++) {
-        short accel_cur[3], gyro_cur[3];
-        if (i2c_read(st.hw->addr, st.reg->fifo_r_w, MAX_PACKET_LENGTH, data))
-            return -1;
-        accel_cur[0] = ((short)data[0] << 8) | data[1];
-        accel_cur[1] = ((short)data[2] << 8) | data[3];
-        accel_cur[2] = ((short)data[4] << 8) | data[5];
-        accel[0] += (long)accel_cur[0];
-        accel[1] += (long)accel_cur[1];
-        accel[2] += (long)accel_cur[2];
-        gyro_cur[0] = (((short)data[6] << 8) | data[7]);
-        gyro_cur[1] = (((short)data[8] << 8) | data[9]);
-        gyro_cur[2] = (((short)data[10] << 8) | data[11]);
-        gyro[0] += (long)gyro_cur[0];
-        gyro[1] += (long)gyro_cur[1];
-        gyro[2] += (long)gyro_cur[2];
-    }
-#ifdef EMPL_NO_64BIT
-    gyro[0] = (long)(((float)gyro[0]*65536.f) / test.gyro_sens / packet_count);
-    gyro[1] = (long)(((float)gyro[1]*65536.f) / test.gyro_sens / packet_count);
-    gyro[2] = (long)(((float)gyro[2]*65536.f) / test.gyro_sens / packet_count);
-    if (has_accel) {
-        accel[0] = (long)(((float)accel[0]*65536.f) / test.accel_sens /
-            packet_count);
-        accel[1] = (long)(((float)accel[1]*65536.f) / test.accel_sens /
-            packet_count);
-        accel[2] = (long)(((float)accel[2]*65536.f) / test.accel_sens /
-            packet_count);
-        /* Don't remove gravity! */
-        accel[2] -= 65536L;
-    }
-#else
-    gyro[0] = (long)(((long long)gyro[0]<<16) / test.gyro_sens / packet_count);
-    gyro[1] = (long)(((long long)gyro[1]<<16) / test.gyro_sens / packet_count);
-    gyro[2] = (long)(((long long)gyro[2]<<16) / test.gyro_sens / packet_count);
-    accel[0] = (long)(((long long)accel[0]<<16) / test.accel_sens /
-        packet_count);
-    accel[1] = (long)(((long long)accel[1]<<16) / test.accel_sens /
-        packet_count);
-    accel[2] = (long)(((long long)accel[2]<<16) / test.accel_sens /
-        packet_count);
-    /* Don't remove gravity! */
-    if (accel[2] > 0L)
-        accel[2] -= 65536L;
-    else
-        accel[2] += 65536L;
-#endif
-
-    return 0;
-}
-
-/**
- *  @brief      Trigger gyro/accel/compass self-test.
- *  On success/error, the self-test returns a mask representing the sensor(s)
- *  that failed. For each bit, a one (1) represents a "pass" case; conversely,
- *  a zero (0) indicates a failure.
- *
- *  \n The mask is defined as follows:
- *  \n Bit 0:   Gyro.
- *  \n Bit 1:   Accel.
- *  \n Bit 2:   Compass.
- *
- *  \n Currently, the hardware self-test is unsupported for MPU6500. However,
- *  this function can still be used to obtain the accel and gyro biases.
- *
- *  \n This function must be called with the device either face-up or face-down
- *  (z-axis is parallel to gravity).
- *  @param[out] gyro        Gyro biases in q16 format.
- *  @param[out] accel       Accel biases (if applicable) in q16 format.
- *  @return     Result mask (see above).
- */
-int mpu_run_self_test(long *gyro, long *accel)
-{
-#ifdef MPU6050
-    const unsigned char tries = 2;
-    long gyro_st[3], accel_st[3];
-    unsigned char accel_result, gyro_result;
-#ifdef AK89xx_SECONDARY
-    unsigned char compass_result;
-#endif
-    int ii;
-#endif
-    int result;
-    unsigned char accel_fsr, fifo_sensors, sensors_on;
-    unsigned short gyro_fsr, sample_rate, lpf;
-    unsigned char dmp_was_on;
-
-    if (st.chip_cfg.dmp_on) {
-        mpu_set_dmp_state(0);
-        dmp_was_on = 1;
-    } else
-        dmp_was_on = 0;
-
-    /* Get initial settings. */
-    mpu_get_gyro_fsr(&gyro_fsr);
-    mpu_get_accel_fsr(&accel_fsr);
-    mpu_get_lpf(&lpf);
-    mpu_get_sample_rate(&sample_rate);
-    sensors_on = st.chip_cfg.sensors;
-    mpu_get_fifo_config(&fifo_sensors);
-
-    /* For older chips, the self-test will be different. */
-#if defined MPU6050
-    for (ii = 0; ii < tries; ii++)
-        if (!get_st_biases(gyro, accel, 0))
-            break;
-    if (ii == tries) {
-        /* If we reach this point, we most likely encountered an I2C error.
-         * We'll just report an error for all three sensors.
-         */
-        result = 0;
-        goto restore;
-    }
-    for (ii = 0; ii < tries; ii++)
-        if (!get_st_biases(gyro_st, accel_st, 1))
-            break;
-    if (ii == tries) {
-        /* Again, probably an I2C error. */
-        result = 0;
-        goto restore;
-    }
-    accel_result = accel_self_test(accel, accel_st);
-    gyro_result = gyro_self_test(gyro, gyro_st);
-
-    result = 0;
-    if (!gyro_result)
-        result |= 0x01;
-    if (!accel_result)
-        result |= 0x02;
-
-#ifdef AK89xx_SECONDARY
-    compass_result = compass_self_test();
-    if (!compass_result)
-        result |= 0x04;
-#endif
-restore:
-#elif defined MPU6500
-    /* For now, this function will return a "pass" result for all three sensors
-     * for compatibility with current test applications.
-     */
-    get_st_biases(gyro, accel, 0);
-    result = 0x7;
-#endif
-    /* Set to invalid values to ensure no I2C writes are skipped. */
-    st.chip_cfg.gyro_fsr = 0xFF;
-    st.chip_cfg.accel_fsr = 0xFF;
-    st.chip_cfg.lpf = 0xFF;
-    st.chip_cfg.sample_rate = 0xFFFF;
-    st.chip_cfg.sensors = 0xFF;
-    st.chip_cfg.fifo_enable = 0xFF;
-    st.chip_cfg.clk_src = INV_CLK_PLL;
-    mpu_set_gyro_fsr(gyro_fsr);
-    mpu_set_accel_fsr(accel_fsr);
-    mpu_set_lpf(lpf);
-    mpu_set_sample_rate(sample_rate);
-    mpu_set_sensors(sensors_on);
-    mpu_configure_fifo(fifo_sensors);
-
-    if (dmp_was_on)
-        mpu_set_dmp_state(1);
-
-    return result;
-}
-
-/**
- *  @brief      Write to the DMP memory.
- *  This function prevents I2C writes past the bank boundaries. The DMP memory
- *  is only accessible when the chip is awake.
- *  @param[in]  mem_addr    Memory location (bank << 8 | start address)
- *  @param[in]  length      Number of bytes to write.
- *  @param[in]  data        Bytes to write to memory.
- *  @return     0 if successful.
- */
-int mpu_write_mem(unsigned short mem_addr, unsigned short length,
-        unsigned char *data)
-{
-    unsigned char tmp[2];
-
-    if (!data)
-        return -1;
-    if (!st.chip_cfg.sensors)
-        return -1;
-
-    tmp[0] = (unsigned char)(mem_addr >> 8);
-    tmp[1] = (unsigned char)(mem_addr & 0xFF);
-
-    /* Check bank boundaries. */
-    if (tmp[1] + length > st.hw->bank_size)
-        return -1;
-
-    if (i2c_write(st.hw->addr, st.reg->bank_sel, 2, tmp))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->mem_r_w, length, data))
-        return -1;
-    return 0;
-}
-
-/**
- *  @brief      Read from the DMP memory.
- *  This function prevents I2C reads past the bank boundaries. The DMP memory
- *  is only accessible when the chip is awake.
- *  @param[in]  mem_addr    Memory location (bank << 8 | start address)
- *  @param[in]  length      Number of bytes to read.
- *  @param[out] data        Bytes read from memory.
- *  @return     0 if successful.
- */
-int mpu_read_mem(unsigned short mem_addr, unsigned short length,
-        unsigned char *data)
-{
-    unsigned char tmp[2];
-
-    if (!data)
-        return -1;
-    if (!st.chip_cfg.sensors)
-        return -1;
-
-    tmp[0] = (unsigned char)(mem_addr >> 8);
-    tmp[1] = (unsigned char)(mem_addr & 0xFF);
-
-    /* Check bank boundaries. */
-    if (tmp[1] + length > st.hw->bank_size)
-        return -1;
-
-    if (i2c_write(st.hw->addr, st.reg->bank_sel, 2, tmp))
-        return -1;
-    if (i2c_read(st.hw->addr, st.reg->mem_r_w, length, data))
-        return -1;
-    return 0;
-}
-
-/**
- *  @brief      Load and verify DMP image.
- *  @param[in]  length      Length of DMP image.
- *  @param[in]  firmware    DMP code.
- *  @param[in]  start_addr  Starting address of DMP code memory.
- *  @param[in]  sample_rate Fixed sampling rate used when DMP is enabled.
- *  @return     0 if successful.
- */
-int mpu_load_firmware(unsigned short length, const unsigned char *firmware,
-    unsigned short start_addr, unsigned short sample_rate)
-{
-    unsigned short ii;
-    unsigned short this_write;
-    /* Must divide evenly into st.hw->bank_size to avoid bank crossings. */
-#define LOAD_CHUNK  (16)
-    unsigned char cur[LOAD_CHUNK], tmp[2];
-
-    if (st.chip_cfg.dmp_loaded)
-        /* DMP should only be loaded once. */
-        return -1;
-
-    if (!firmware)
-        return -1;
-    for (ii = 0; ii < length; ii += this_write) {
-        this_write = min(LOAD_CHUNK, length - ii);
-        if (mpu_write_mem(ii, this_write, (unsigned char*)&firmware[ii]))
-            return -1;
-        if (mpu_read_mem(ii, this_write, cur))
-            return -1;
-        if (memcmp(firmware+ii, cur, this_write))
-            return -2;
-    }
-
-    /* Set program start address. */
-    tmp[0] = start_addr >> 8;
-    tmp[1] = start_addr & 0xFF;
-    if (i2c_write(st.hw->addr, st.reg->prgm_start_h, 2, tmp))
-        return -1;
-
-    st.chip_cfg.dmp_loaded = 1;
-    st.chip_cfg.dmp_sample_rate = sample_rate;
-    return 0;
-}
-
-/**
- *  @brief      Enable/disable DMP support.
- *  @param[in]  enable  1 to turn on the DMP.
- *  @return     0 if successful.
- */
-int mpu_set_dmp_state(unsigned char enable)
-{
-    unsigned char tmp;
-    if (st.chip_cfg.dmp_on == enable)
-        return 0;
-
-    if (enable) {
-        if (!st.chip_cfg.dmp_loaded)
-            return -1;
-        /* Disable data ready interrupt. */
-        set_int_enable(0);
-        /* Disable bypass mode. */
-        mpu_set_bypass(0);
-        /* Keep constant sample rate, FIFO rate controlled by DMP. */
-        mpu_set_sample_rate(st.chip_cfg.dmp_sample_rate);
-        /* Remove FIFO elements. */
-        tmp = 0;
-        i2c_write(st.hw->addr, 0x23, 1, &tmp);
-        st.chip_cfg.dmp_on = 1;
-        /* Enable DMP interrupt. */
-        set_int_enable(1);
-        mpu_reset_fifo();
-    } else {
-        /* Disable DMP interrupt. */
-        set_int_enable(0);
-        /* Restore FIFO settings. */
-        tmp = st.chip_cfg.fifo_enable;
-        i2c_write(st.hw->addr, 0x23, 1, &tmp);
-        st.chip_cfg.dmp_on = 0;
-        mpu_reset_fifo();
-    }
-    return 0;
-}
-
-/**
- *  @brief      Get DMP state.
- *  @param[out] enabled 1 if enabled.
- *  @return     0 if successful.
- */
-int mpu_get_dmp_state(unsigned char *enabled)
-{
-    enabled[0] = st.chip_cfg.dmp_on;
-    return 0;
-}
-
-
-/* This initialization is similar to the one in ak8975.c. */
-static int setup_compass(void)
-{
-#ifdef AK89xx_SECONDARY
-    unsigned char data[4], akm_addr;
-
-    mpu_set_bypass(1);
-
-    /* Find compass. Possible addresses range from 0x0C to 0x0F. */
-    for (akm_addr = 0x0C; akm_addr <= 0x0F; akm_addr++) {
-        int result;
-        result = i2c_read(akm_addr, AKM_REG_WHOAMI, 1, data);
-        if (!result && (data[0] == AKM_WHOAMI))
-            break;
-    }
-
-    if (akm_addr > 0x0F) {
-        /* TODO: Handle this case in all compass-related functions. */
-        log_e("Compass not found.\n");
-        return -1;
-    }
-
-    st.chip_cfg.compass_addr = akm_addr;
-
-    data[0] = AKM_POWER_DOWN;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, data))
-        return -1;
-    delay_ms(1);
-
-    data[0] = AKM_FUSE_ROM_ACCESS;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, data))
-        return -1;
-    delay_ms(1);
-
-    /* Get sensitivity adjustment data from fuse ROM. */
-    if (i2c_read(st.chip_cfg.compass_addr, AKM_REG_ASAX, 3, data))
-        return -1;
-    st.chip_cfg.mag_sens_adj[0] = (long)data[0] + 128;
-    st.chip_cfg.mag_sens_adj[1] = (long)data[1] + 128;
-    st.chip_cfg.mag_sens_adj[2] = (long)data[2] + 128;
-
-    data[0] = AKM_POWER_DOWN;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, data))
-        return -1;
-    delay_ms(1);
-
-    mpu_set_bypass(0);
-
-    /* Set up master mode, master clock, and ES bit. */
-    data[0] = 0x40;
-    if (i2c_write(st.hw->addr, st.reg->i2c_mst, 1, data))
-        return -1;
-
-    /* Slave 0 reads from AKM data registers. */
-    data[0] = BIT_I2C_READ | st.chip_cfg.compass_addr;
-    if (i2c_write(st.hw->addr, st.reg->s0_addr, 1, data))
-        return -1;
-
-    /* Compass reads start at this register. */
-    data[0] = AKM_REG_ST1;
-    if (i2c_write(st.hw->addr, st.reg->s0_reg, 1, data))
-        return -1;
-
-    /* Enable slave 0, 8-byte reads. */
-    data[0] = BIT_SLAVE_EN | 8;
-    if (i2c_write(st.hw->addr, st.reg->s0_ctrl, 1, data))
-        return -1;
-
-    /* Slave 1 changes AKM measurement mode. */
-    data[0] = st.chip_cfg.compass_addr;
-    if (i2c_write(st.hw->addr, st.reg->s1_addr, 1, data))
-        return -1;
-
-    /* AKM measurement mode register. */
-    data[0] = AKM_REG_CNTL;
-    if (i2c_write(st.hw->addr, st.reg->s1_reg, 1, data))
-        return -1;
-
-    /* Enable slave 1, 1-byte writes. */
-    data[0] = BIT_SLAVE_EN | 1;
-    if (i2c_write(st.hw->addr, st.reg->s1_ctrl, 1, data))
-        return -1;
-
-    /* Set slave 1 data. */
-    data[0] = AKM_SINGLE_MEASUREMENT;
-    if (i2c_write(st.hw->addr, st.reg->s1_do, 1, data))
-        return -1;
-
-    /* Trigger slave 0 and slave 1 actions at each sample. */
-    data[0] = 0x03;
-    if (i2c_write(st.hw->addr, st.reg->i2c_delay_ctrl, 1, data))
-        return -1;
-
-#ifdef MPU9150
-    /* For the MPU9150, the auxiliary I2C bus needs to be set to VDD. */
-    data[0] = BIT_I2C_MST_VDDIO;
-    if (i2c_write(st.hw->addr, st.reg->yg_offs_tc, 1, data))
-        return -1;
-#endif
-
-    return 0;
-#else
-    return -1;
-#endif
-}
-
-/**
- *  @brief      Read raw compass data.
- *  @param[out] data        Raw data in hardware units.
- *  @param[out] timestamp   Timestamp in milliseconds. Null if not needed.
- *  @return     0 if successful.
- */
-int mpu_get_compass_reg(short *data, unsigned long *timestamp)
-{
-#ifdef AK89xx_SECONDARY
-    unsigned char tmp[9];
-
-    if (!(st.chip_cfg.sensors & INV_XYZ_COMPASS))
-        return -1;
-
-#ifdef AK89xx_BYPASS
-    if (i2c_read(st.chip_cfg.compass_addr, AKM_REG_ST1, 8, tmp))
-        return -1;
-    tmp[8] = AKM_SINGLE_MEASUREMENT;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, tmp+8))
-        return -1;
-#else
-    if (i2c_read(st.hw->addr, st.reg->raw_compass, 8, tmp))
-        return -1;
-#endif
-
-#if defined AK8975_SECONDARY
-    /* AK8975 doesn't have the overrun error bit. */
-    if (!(tmp[0] & AKM_DATA_READY))
-        return -2;
-    if ((tmp[7] & AKM_OVERFLOW) || (tmp[7] & AKM_DATA_ERROR))
-        return -3;
-#elif defined AK8963_SECONDARY
-    /* AK8963 doesn't have the data read error bit. */
-    if (!(tmp[0] & AKM_DATA_READY) || (tmp[0] & AKM_DATA_OVERRUN))
-        return -2;
-    if (tmp[7] & AKM_OVERFLOW)
-        return -3;
-#endif
-    data[0] = (tmp[2] << 8) | tmp[1];
-    data[1] = (tmp[4] << 8) | tmp[3];
-    data[2] = (tmp[6] << 8) | tmp[5];
-
-    data[0] = ((long)data[0] * st.chip_cfg.mag_sens_adj[0]) >> 8;
-    data[1] = ((long)data[1] * st.chip_cfg.mag_sens_adj[1]) >> 8;
-    data[2] = ((long)data[2] * st.chip_cfg.mag_sens_adj[2]) >> 8;
-
-    if (timestamp)
-        get_ms(timestamp);
-    return 0;
-#else
-    return -1;
-#endif
-}
-
-/**
- *  @brief      Get the compass full-scale range.
- *  @param[out] fsr Current full-scale range.
- *  @return     0 if successful.
- */
-int mpu_get_compass_fsr(unsigned short *fsr)
-{
-#ifdef AK89xx_SECONDARY
-    fsr[0] = st.hw->compass_fsr;
-    return 0;
-#else
-    return -1;
-#endif
-}
-
-/**
- *  @brief      Enters LP accel motion interrupt mode.
- *  The behaviour of this feature is very different between the MPU6050 and the
- *  MPU6500. Each chip's version of this feature is explained below.
- *
- *  \n The hardware motion threshold can be between 32mg and 8160mg in 32mg
- *  increments.
- *
- *  \n Low-power accel mode supports the following frequencies:
- *  \n 1.25Hz, 5Hz, 20Hz, 40Hz
- *
- *  \n MPU6500:
- *  \n Unlike the MPU6050 version, the hardware does not "lock in" a reference
- *  sample. The hardware monitors the accel data and detects any large change
- *  over a short period of time.
- *
- *  \n The hardware motion threshold can be between 4mg and 1020mg in 4mg
- *  increments.
- *
- *  \n MPU6500 Low-power accel mode supports the following frequencies:
- *  \n 1.25Hz, 2.5Hz, 5Hz, 10Hz, 20Hz, 40Hz, 80Hz, 160Hz, 320Hz, 640Hz
- *
- *  \n\n NOTES:
- *  \n The driver will round down @e thresh to the nearest supported value if
- *  an unsupported threshold is selected.
- *  \n To select a fractional wake-up frequency, round down the value passed to
- *  @e lpa_freq.
- *  \n The MPU6500 does not support a delay parameter. If this function is used
- *  for the MPU6500, the value passed to @e time will be ignored.
- *  \n To disable this mode, set @e lpa_freq to zero. The driver will restore
- *  the previous configuration.
- *
- *  @param[in]  thresh      Motion threshold in mg.
- *  @param[in]  time        Duration in milliseconds that the accel data must
- *                          exceed @e thresh before motion is reported.
- *  @param[in]  lpa_freq    Minimum sampling rate, or zero to disable.
- *  @return     0 if successful.
- */
-int mpu_lp_motion_interrupt(unsigned short thresh, unsigned char time,
-    unsigned char lpa_freq)
-{
-    unsigned char data[3];
-
-    if (lpa_freq) {
-        unsigned char thresh_hw;
-
-#if defined MPU6500
-        /* 1LSb = 4mg. */
-        if (thresh > 1020)
-            thresh_hw = 255;
-        else if (thresh < 4)
-            thresh_hw = 1;
-        else
-            thresh_hw = thresh >> 2;
-#endif
-
-        if (!time)
-            /* Minimum duration must be 1ms. */
-            time = 1;
-
-#if defined MPU6500
-        if (lpa_freq > 640)
-#endif
-            /* At this point, the chip has not been re-configured, so the
-             * function can safely exit.
-             */
-            return -1;
-
-        if (!st.chip_cfg.int_motion_only) {
-            /* Store current settings for later. */
-            if (st.chip_cfg.dmp_on) {
-                mpu_set_dmp_state(0);
-                st.chip_cfg.cache.dmp_on = 1;
-            } else
-                st.chip_cfg.cache.dmp_on = 0;
-            mpu_get_gyro_fsr(&st.chip_cfg.cache.gyro_fsr);
-            mpu_get_accel_fsr(&st.chip_cfg.cache.accel_fsr);
-            mpu_get_lpf(&st.chip_cfg.cache.lpf);
-            mpu_get_sample_rate(&st.chip_cfg.cache.sample_rate);
-            st.chip_cfg.cache.sensors_on = st.chip_cfg.sensors;
-            mpu_get_fifo_config(&st.chip_cfg.cache.fifo_sensors);
-        }
-
-#if defined MPU6500
-        /* Disable hardware interrupts. */
-        set_int_enable(0);
-
-        /* Enter full-power accel-only mode, no FIFO/DMP. */
-        data[0] = 0;
-        data[1] = 0;
-        data[2] = BIT_STBY_XYZG;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 3, data))
-            goto lp_int_restore;
-
-        /* Set motion threshold. */
-        data[0] = thresh_hw;
-        if (i2c_write(st.hw->addr, st.reg->motion_thr, 1, data))
-            goto lp_int_restore;
-
-        /* Set wake frequency. */
-        if (lpa_freq == 1)
-            data[0] = INV_LPA_1_25HZ;
-        else if (lpa_freq == 2)
-            data[0] = INV_LPA_2_5HZ;
-        else if (lpa_freq <= 5)
-            data[0] = INV_LPA_5HZ;
-        else if (lpa_freq <= 10)
-            data[0] = INV_LPA_10HZ;
-        else if (lpa_freq <= 20)
-            data[0] = INV_LPA_20HZ;
-        else if (lpa_freq <= 40)
-            data[0] = INV_LPA_40HZ;
-        else if (lpa_freq <= 80)
-            data[0] = INV_LPA_80HZ;
-        else if (lpa_freq <= 160)
-            data[0] = INV_LPA_160HZ;
-        else if (lpa_freq <= 320)
-            data[0] = INV_LPA_320HZ;
-        else
-            data[0] = INV_LPA_640HZ;
-        if (i2c_write(st.hw->addr, st.reg->lp_accel_odr, 1, data))
-            goto lp_int_restore;
-
-        /* Enable motion interrupt (MPU6500 version). */
-        data[0] = BITS_WOM_EN;
-        if (i2c_write(st.hw->addr, st.reg->accel_intel, 1, data))
-            goto lp_int_restore;
-
-        /* Enable cycle mode. */
-        data[0] = BIT_LPA_CYCLE;
-        if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, data))
-            goto lp_int_restore;
-
-        /* Enable interrupt. */
-        data[0] = BIT_MOT_INT_EN;
-        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, data))
-            goto lp_int_restore;
-
-        st.chip_cfg.int_motion_only = 1;
-        return 0;
-#endif
-    } else {
-        /* Don't "restore" the previous state if no state has been saved. */
-        int ii;
-        char *cache_ptr = (char*)&st.chip_cfg.cache;
-        for (ii = 0; ii < sizeof(st.chip_cfg.cache); ii++) {
-            if (cache_ptr[ii] != 0)
-                goto lp_int_restore;
-        }
-        /* If we reach this point, motion interrupt mode hasn't been used yet. */
-        return -1;
-    }
-lp_int_restore:
-    /* Set to invalid values to ensure no I2C writes are skipped. */
-    st.chip_cfg.gyro_fsr = 0xFF;
-    st.chip_cfg.accel_fsr = 0xFF;
-    st.chip_cfg.lpf = 0xFF;
-    st.chip_cfg.sample_rate = 0xFFFF;
-    st.chip_cfg.sensors = 0xFF;
-    st.chip_cfg.fifo_enable = 0xFF;
-    st.chip_cfg.clk_src = INV_CLK_PLL;
-    mpu_set_sensors(st.chip_cfg.cache.sensors_on);
-    mpu_set_gyro_fsr(st.chip_cfg.cache.gyro_fsr);
-    mpu_set_accel_fsr(st.chip_cfg.cache.accel_fsr);
-    mpu_set_lpf(st.chip_cfg.cache.lpf);
-    mpu_set_sample_rate(st.chip_cfg.cache.sample_rate);
-    mpu_configure_fifo(st.chip_cfg.cache.fifo_sensors);
-
-    if (st.chip_cfg.cache.dmp_on)
-        mpu_set_dmp_state(1);
-
-#ifdef MPU6500
-    /* Disable motion interrupt (MPU6500 version). */
-    data[0] = 0;
-    if (i2c_write(st.hw->addr, st.reg->accel_intel, 1, data))
-        goto lp_int_restore;
-#endif
-
-    st.chip_cfg.int_motion_only = 0;
-    return 0;
-}
-
-/**
- *  @}
- */
-

+ 0 - 132
Core备份3/imu3/inv_mpu3.h

@@ -1,132 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011-2012 InvenSense Corporation, All Rights Reserved.
-    See included License.txt for License information.
- $
- */
-/**
- *  @addtogroup  DRIVERS Sensor Driver Layer
- *  @brief       Hardware drivers to communicate with sensors via I2C.
- *
- *  @{
- *      @file       inv_mpu.h
- *      @brief      An I2C-based driver for Invensense gyroscopes.
- *      @details    This driver currently works for the following devices:
- *                  MPU6050
- *                  MPU6500
- *                  MPU9150 (or MPU6050 w/ AK8975 on the auxiliary bus)
- *                  MPU9250 (or MPU6500 w/ AK8963 on the auxiliary bus)
- */
-
-#ifndef _INV_MPU_H_
-#define _INV_MPU_H_
-
-#define MOTION_DRIVER_TARGET_STM32
-#define MPU6050
-//#define EMPL
-//#define USE_DMP
-
-#define INV_X_GYRO      (0x40)
-#define INV_Y_GYRO      (0x20)
-#define INV_Z_GYRO      (0x10)
-#define INV_XYZ_GYRO    (INV_X_GYRO | INV_Y_GYRO | INV_Z_GYRO)
-#define INV_XYZ_ACCEL   (0x08)
-#define INV_XYZ_COMPASS (0x01)
-
-struct int_param_s {
-#if defined EMPL_TARGET_MSP430 || defined MOTION_DRIVER_TARGET_MSP430 || defined MOTION_DRIVER_TARGET_STM32
-    void (*cb)(void);
-    unsigned short pin;
-    unsigned char lp_exit;
-    unsigned char active_low;
-#elif defined EMPL_TARGET_UC3L0
-    unsigned long pin;
-    void (*cb)(volatile void*);
-    void *arg;
-#endif
-};
-
-#define MPU_INT_STATUS_DATA_READY       (0x0001)
-#define MPU_INT_STATUS_DMP              (0x0002)
-#define MPU_INT_STATUS_PLL_READY        (0x0004)
-#define MPU_INT_STATUS_I2C_MST          (0x0008)
-#define MPU_INT_STATUS_FIFO_OVERFLOW    (0x0010)
-#define MPU_INT_STATUS_ZMOT             (0x0020)
-#define MPU_INT_STATUS_MOT              (0x0040)
-#define MPU_INT_STATUS_FREE_FALL        (0x0080)
-#define MPU_INT_STATUS_DMP_0            (0x0100)
-#define MPU_INT_STATUS_DMP_1            (0x0200)
-#define MPU_INT_STATUS_DMP_2            (0x0400)
-#define MPU_INT_STATUS_DMP_3            (0x0800)
-#define MPU_INT_STATUS_DMP_4            (0x1000)
-#define MPU_INT_STATUS_DMP_5            (0x2000)
-
-/* Set up APIs */
-int mpu_init(struct int_param_s *int_param);
-int mpu_init_slave(void);
-int mpu_set_bypass(unsigned char bypass_on);
-
-/* Configuration APIs */
-int mpu_lp_accel_mode(unsigned char rate);
-int mpu_lp_motion_interrupt(unsigned short thresh, unsigned char time,
-    unsigned char lpa_freq);
-int mpu_set_int_level(unsigned char active_low);
-int mpu_set_int_latched(unsigned char enable);
-
-int mpu_set_dmp_state(unsigned char enable);
-int mpu_get_dmp_state(unsigned char *enabled);
-
-int mpu_get_lpf(unsigned short *lpf);
-int mpu_set_lpf(unsigned short lpf);
-
-int mpu_get_gyro_fsr(unsigned short *fsr);
-int mpu_set_gyro_fsr(unsigned short fsr);
-
-int mpu_get_accel_fsr(unsigned char *fsr);
-int mpu_set_accel_fsr(unsigned char fsr);
-
-int mpu_get_compass_fsr(unsigned short *fsr);
-
-int mpu_get_gyro_sens(float *sens);
-int mpu_get_accel_sens(unsigned short *sens);
-
-int mpu_get_sample_rate(unsigned short *rate);
-int mpu_set_sample_rate(unsigned short rate);
-int mpu_get_compass_sample_rate(unsigned short *rate);
-int mpu_set_compass_sample_rate(unsigned short rate);
-
-int mpu_get_fifo_config(unsigned char *sensors);
-int mpu_configure_fifo(unsigned char sensors);
-
-int mpu_get_power_state(unsigned char *power_on);
-int mpu_set_sensors(unsigned char sensors);
-
-int mpu_set_accel_bias(const long *accel_bias);
-
-/* Data getter/setter APIs */
-int mpu_get_gyro_reg(short *data, unsigned long *timestamp);
-int mpu_get_accel_reg(short *data, unsigned long *timestamp);
-int mpu_get_compass_reg(short *data, unsigned long *timestamp);
-int mpu_get_temperature(long *data, unsigned long *timestamp);
-
-int mpu_get_int_status(short *status);
-int mpu_read_fifo(short *gyro, short *accel, unsigned long *timestamp,
-    unsigned char *sensors, unsigned char *more);
-int mpu_read_fifo_stream(unsigned short length, unsigned char *data,
-    unsigned char *more);
-int mpu_reset_fifo(void);
-
-int mpu_write_mem(unsigned short mem_addr, unsigned short length,
-    unsigned char *data);
-int mpu_read_mem(unsigned short mem_addr, unsigned short length,
-    unsigned char *data);
-int mpu_load_firmware(unsigned short length, const unsigned char *firmware,
-    unsigned short start_addr, unsigned short sample_rate);
-
-int mpu_reg_dump(void);
-int mpu_read_reg(unsigned char reg, unsigned char *data);
-int mpu_run_self_test(long *gyro, long *accel);
-int mpu_register_tap_cb(void (*func)(unsigned char, unsigned char));
-
-#endif  /* #ifndef _INV_MPU_H_ */
-

+ 0 - 1380
Core备份3/imu3/inv_mpu_dmp_motion_driver3.c

@@ -1,1380 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011-2012 InvenSense Corporation, All Rights Reserved.
-    See included License.txt for License information.
- $
- */
-/**
- *  @addtogroup  DRIVERS Sensor Driver Layer
- *  @brief       Hardware drivers to communicate with sensors via I2C.
- *
- *  @{
- *      @file       inv_mpu_dmp_motion_driver.c
- *      @brief      DMP image and interface functions.
- *      @details    All functions are preceded by the dmp_ prefix to
- *                  differentiate among MPL and general driver function calls.
- */
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include "inv_mpu3.h"
-#include "inv_mpu_dmp_motion_driver3.h"
-#include "dmpKey3.h"
-#include "dmpmap3.h"
-
-#include "MPU60503.h"
-
-/* The following functions must be defined for this platform:
- * i2c_write(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char const *data)
- * i2c_read(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char *data)
- * delay_ms(unsigned long num_ms)
- * get_ms(unsigned long *count)
- */
-#if defined MOTION_DRIVER_TARGET_MSP430
-#include "msp430.h"
-#include "msp430_clock.h"
-#define delay_ms    msp430_delay_ms
-#define get_ms      msp430_get_clock_ms
-#define log_i(...)     do {} while (0)
-#define log_e(...)     do {} while (0)
-
-#elif defined EMPL_TARGET_MSP430
-#include "msp430.h"
-#include "msp430_clock.h"
-#include "log.h"
-#define delay_ms    msp430_delay_ms
-#define get_ms      msp430_get_clock_ms
-#define log_i       MPL_LOGI
-#define log_e       MPL_LOGE
-
-#elif defined EMPL_TARGET_UC3L0
-/* Instead of using the standard TWI driver from the ASF library, we're using
- * a TWI driver that follows the slave address + register address convention.
- */
-#include "delay.h"
-#include "sysclk.h"
-#include "log.h"
-#include "uc3l0_clock.h"
-/* delay_ms is a function already defined in ASF. */
-#define get_ms  uc3l0_get_clock_ms
-#define log_i       MPL_LOGI
-#define log_e       MPL_LOGE
-
-#elif defined MOTION_DRIVER_TARGET_STM32
-
-#define delay_ms    HAL_Delay
-#define get_ms      get_tick_count
-
-#define log_i(...)     do {} while (0)
-#define log_e(...)     do {} while (0)
-
-#else
-#error  Gyro driver is missing the system layer implementations.
-#endif
-
-/* These defines are copied from dmpDefaultMPU6050.c in the general MPL
- * releases. These defines may change for each DMP image, so be sure to modify
- * these values when switching to a new image.
- */
-#define CFG_LP_QUAT             (2712)
-#define END_ORIENT_TEMP         (1866)
-#define CFG_27                  (2742)
-#define CFG_20                  (2224)
-#define CFG_23                  (2745)
-#define CFG_FIFO_ON_EVENT       (2690)
-#define END_PREDICTION_UPDATE   (1761)
-#define CGNOTICE_INTR           (2620)
-#define X_GRT_Y_TMP             (1358)
-#define CFG_DR_INT              (1029)
-#define CFG_AUTH                (1035)
-#define UPDATE_PROP_ROT         (1835)
-#define END_COMPARE_Y_X_TMP2    (1455)
-#define SKIP_X_GRT_Y_TMP        (1359)
-#define SKIP_END_COMPARE        (1435)
-#define FCFG_3                  (1088)
-#define FCFG_2                  (1066)
-#define FCFG_1                  (1062)
-#define END_COMPARE_Y_X_TMP3    (1434)
-#define FCFG_7                  (1073)
-#define FCFG_6                  (1106)
-#define FLAT_STATE_END          (1713)
-#define SWING_END_4             (1616)
-#define SWING_END_2             (1565)
-#define SWING_END_3             (1587)
-#define SWING_END_1             (1550)
-#define CFG_8                   (2718)
-#define CFG_15                  (2727)
-#define CFG_16                  (2746)
-#define CFG_EXT_GYRO_BIAS       (1189)
-#define END_COMPARE_Y_X_TMP     (1407)
-#define DO_NOT_UPDATE_PROP_ROT  (1839)
-#define CFG_7                   (1205)
-#define FLAT_STATE_END_TEMP     (1683)
-#define END_COMPARE_Y_X         (1484)
-#define SKIP_SWING_END_1        (1551)
-#define SKIP_SWING_END_3        (1588)
-#define SKIP_SWING_END_2        (1566)
-#define TILTG75_START           (1672)
-#define CFG_6                   (2753)
-#define TILTL75_END             (1669)
-#define END_ORIENT              (1884)
-#define CFG_FLICK_IN            (2573)
-#define TILTL75_START           (1643)
-#define CFG_MOTION_BIAS         (1208)
-#define X_GRT_Y                 (1408)
-#define TEMPLABEL               (2324)
-#define CFG_ANDROID_ORIENT_INT  (1853)
-#define CFG_GYRO_RAW_DATA       (2722)
-#define X_GRT_Y_TMP2            (1379)
-
-#define D_0_22                  (22+512)
-#define D_0_24                  (24+512)
-
-#define D_0_36                  (36)
-#define D_0_52                  (52)
-#define D_0_96                  (96)
-#define D_0_104                 (104)
-#define D_0_108                 (108)
-#define D_0_163                 (163)
-#define D_0_188                 (188)
-#define D_0_192                 (192)
-#define D_0_224                 (224)
-#define D_0_228                 (228)
-#define D_0_232                 (232)
-#define D_0_236                 (236)
-
-#define D_1_2                   (256 + 2)
-#define D_1_4                   (256 + 4)
-#define D_1_8                   (256 + 8)
-#define D_1_10                  (256 + 10)
-#define D_1_24                  (256 + 24)
-#define D_1_28                  (256 + 28)
-#define D_1_36                  (256 + 36)
-#define D_1_40                  (256 + 40)
-#define D_1_44                  (256 + 44)
-#define D_1_72                  (256 + 72)
-#define D_1_74                  (256 + 74)
-#define D_1_79                  (256 + 79)
-#define D_1_88                  (256 + 88)
-#define D_1_90                  (256 + 90)
-#define D_1_92                  (256 + 92)
-#define D_1_96                  (256 + 96)
-#define D_1_98                  (256 + 98)
-#define D_1_106                 (256 + 106)
-#define D_1_108                 (256 + 108)
-#define D_1_112                 (256 + 112)
-#define D_1_128                 (256 + 144)
-#define D_1_152                 (256 + 12)
-#define D_1_160                 (256 + 160)
-#define D_1_176                 (256 + 176)
-#define D_1_178                 (256 + 178)
-#define D_1_218                 (256 + 218)
-#define D_1_232                 (256 + 232)
-#define D_1_236                 (256 + 236)
-#define D_1_240                 (256 + 240)
-#define D_1_244                 (256 + 244)
-#define D_1_250                 (256 + 250)
-#define D_1_252                 (256 + 252)
-#define D_2_12                  (512 + 12)
-#define D_2_96                  (512 + 96)
-#define D_2_108                 (512 + 108)
-#define D_2_208                 (512 + 208)
-#define D_2_224                 (512 + 224)
-#define D_2_236                 (512 + 236)
-#define D_2_244                 (512 + 244)
-#define D_2_248                 (512 + 248)
-#define D_2_252                 (512 + 252)
-
-#define CPASS_BIAS_X            (35 * 16 + 4)
-#define CPASS_BIAS_Y            (35 * 16 + 8)
-#define CPASS_BIAS_Z            (35 * 16 + 12)
-#define CPASS_MTX_00            (36 * 16)
-#define CPASS_MTX_01            (36 * 16 + 4)
-#define CPASS_MTX_02            (36 * 16 + 8)
-#define CPASS_MTX_10            (36 * 16 + 12)
-#define CPASS_MTX_11            (37 * 16)
-#define CPASS_MTX_12            (37 * 16 + 4)
-#define CPASS_MTX_20            (37 * 16 + 8)
-#define CPASS_MTX_21            (37 * 16 + 12)
-#define CPASS_MTX_22            (43 * 16 + 12)
-#define D_EXT_GYRO_BIAS_X       (61 * 16)
-#define D_EXT_GYRO_BIAS_Y       (61 * 16) + 4
-#define D_EXT_GYRO_BIAS_Z       (61 * 16) + 8
-#define D_ACT0                  (40 * 16)
-#define D_ACSX                  (40 * 16 + 4)
-#define D_ACSY                  (40 * 16 + 8)
-#define D_ACSZ                  (40 * 16 + 12)
-
-#define FLICK_MSG               (45 * 16 + 4)
-#define FLICK_COUNTER           (45 * 16 + 8)
-#define FLICK_LOWER             (45 * 16 + 12)
-#define FLICK_UPPER             (46 * 16 + 12)
-
-#define D_AUTH_OUT              (992)
-#define D_AUTH_IN               (996)
-#define D_AUTH_A                (1000)
-#define D_AUTH_B                (1004)
-
-#define D_PEDSTD_BP_B           (768 + 0x1C)
-#define D_PEDSTD_HP_A           (768 + 0x78)
-#define D_PEDSTD_HP_B           (768 + 0x7C)
-#define D_PEDSTD_BP_A4          (768 + 0x40)
-#define D_PEDSTD_BP_A3          (768 + 0x44)
-#define D_PEDSTD_BP_A2          (768 + 0x48)
-#define D_PEDSTD_BP_A1          (768 + 0x4C)
-#define D_PEDSTD_INT_THRSH      (768 + 0x68)
-#define D_PEDSTD_CLIP           (768 + 0x6C)
-#define D_PEDSTD_SB             (768 + 0x28)
-#define D_PEDSTD_SB_TIME        (768 + 0x2C)
-#define D_PEDSTD_PEAKTHRSH      (768 + 0x98)
-#define D_PEDSTD_TIML           (768 + 0x2A)
-#define D_PEDSTD_TIMH           (768 + 0x2E)
-#define D_PEDSTD_PEAK           (768 + 0X94)
-#define D_PEDSTD_STEPCTR        (768 + 0x60)
-#define D_PEDSTD_TIMECTR        (964)
-#define D_PEDSTD_DECI           (768 + 0xA0)
-
-#define D_HOST_NO_MOT           (976)
-#define D_ACCEL_BIAS            (660)
-
-#define D_ORIENT_GAP            (76)
-
-#define D_TILT0_H               (48)
-#define D_TILT0_L               (50)
-#define D_TILT1_H               (52)
-#define D_TILT1_L               (54)
-#define D_TILT2_H               (56)
-#define D_TILT2_L               (58)
-#define D_TILT3_H               (60)
-#define D_TILT3_L               (62)
-
-#define DMP_CODE_SIZE           (3062)
-
-static const unsigned char dmp_memory[DMP_CODE_SIZE] = {
-    /* bank # 0 */
-    0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x00, 0x00,
-    0x00, 0x65, 0x00, 0x54, 0xff, 0xef, 0x00, 0x00, 0xfa, 0x80, 0x00, 0x0b, 0x12, 0x82, 0x00, 0x01,
-    0x03, 0x0c, 0x30, 0xc3, 0x0e, 0x8c, 0x8c, 0xe9, 0x14, 0xd5, 0x40, 0x02, 0x13, 0x71, 0x0f, 0x8e,
-    0x38, 0x83, 0xf8, 0x83, 0x30, 0x00, 0xf8, 0x83, 0x25, 0x8e, 0xf8, 0x83, 0x30, 0x00, 0xf8, 0x83,
-    0xff, 0xff, 0xff, 0xff, 0x0f, 0xfe, 0xa9, 0xd6, 0x24, 0x00, 0x04, 0x00, 0x1a, 0x82, 0x79, 0xa1,
-    0x00, 0x00, 0x00, 0x3c, 0xff, 0xff, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x38, 0x83, 0x6f, 0xa2,
-    0x00, 0x3e, 0x03, 0x30, 0x40, 0x00, 0x00, 0x00, 0x02, 0xca, 0xe3, 0x09, 0x3e, 0x80, 0x00, 0x00,
-    0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
-    0x00, 0x0c, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x6e, 0x00, 0x00, 0x06, 0x92, 0x0a, 0x16, 0xc0, 0xdf,
-    0xff, 0xff, 0x02, 0x56, 0xfd, 0x8c, 0xd3, 0x77, 0xff, 0xe1, 0xc4, 0x96, 0xe0, 0xc5, 0xbe, 0xaa,
-    0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0b, 0x2b, 0x00, 0x00, 0x16, 0x57, 0x00, 0x00, 0x03, 0x59,
-    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0xfa, 0x00, 0x02, 0x6c, 0x1d, 0x00, 0x00, 0x00, 0x00,
-    0x3f, 0xff, 0xdf, 0xeb, 0x00, 0x3e, 0xb3, 0xb6, 0x00, 0x0d, 0x22, 0x78, 0x00, 0x00, 0x2f, 0x3c,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x42, 0xb5, 0x00, 0x00, 0x39, 0xa2, 0x00, 0x00, 0xb3, 0x65,
-    0xd9, 0x0e, 0x9f, 0xc9, 0x1d, 0xcf, 0x4c, 0x34, 0x30, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00,
-    0x3b, 0xb6, 0x7a, 0xe8, 0x00, 0x64, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    /* bank # 1 */
-    0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0xfa, 0x92, 0x10, 0x00, 0x22, 0x5e, 0x00, 0x0d, 0x22, 0x9f,
-    0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0xff, 0x46, 0x00, 0x00, 0x63, 0xd4, 0x00, 0x00,
-    0x10, 0x00, 0x00, 0x00, 0x04, 0xd6, 0x00, 0x00, 0x04, 0xcc, 0x00, 0x00, 0x04, 0xcc, 0x00, 0x00,
-    0x00, 0x00, 0x10, 0x72, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x06, 0x00, 0x02, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x64, 0x00, 0x20, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, 0x00,
-    0x00, 0x00, 0x00, 0x32, 0xf8, 0x98, 0x00, 0x00, 0xff, 0x65, 0x00, 0x00, 0x83, 0x0f, 0x00, 0x00,
-    0xff, 0x9b, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
-    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0xb2, 0x6a, 0x00, 0x02, 0x00, 0x00,
-    0x00, 0x01, 0xfb, 0x83, 0x00, 0x68, 0x00, 0x00, 0x00, 0xd9, 0xfc, 0x00, 0x7c, 0xf1, 0xff, 0x83,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x64, 0x03, 0xe8, 0x00, 0x64, 0x00, 0x28,
-    0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x16, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
-    0x00, 0x00, 0x10, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x01, 0xf4, 0x00, 0x00, 0x10, 0x00,
-    /* bank # 2 */
-    0x00, 0x28, 0x00, 0x00, 0xff, 0xff, 0x45, 0x81, 0xff, 0xff, 0xfa, 0x72, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x05, 0x00, 0x05, 0xba, 0xc6, 0x00, 0x47, 0x78, 0xa2,
-    0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x14,
-    0x00, 0x00, 0x25, 0x4d, 0x00, 0x2f, 0x70, 0x6d, 0x00, 0x00, 0x05, 0xae, 0x00, 0x0c, 0x02, 0xd0,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x64, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x0e,
-    0x00, 0x00, 0x0a, 0xc7, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0xff, 0xff, 0xff, 0x9c,
-    0x00, 0x00, 0x0b, 0x2b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x64,
-    0xff, 0xe5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    /* bank # 3 */
-    0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x24, 0x26, 0xd3,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x96, 0x00, 0x3c,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x0c, 0x0a, 0x4e, 0x68, 0xcd, 0xcf, 0x77, 0x09, 0x50, 0x16, 0x67, 0x59, 0xc6, 0x19, 0xce, 0x82,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xd7, 0x84, 0x00, 0x03, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc7, 0x93, 0x8f, 0x9d, 0x1e, 0x1b, 0x1c, 0x19,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x18, 0x85, 0x00, 0x00, 0x40, 0x00,
-    0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x67, 0x7d, 0xdf, 0x7e, 0x72, 0x90, 0x2e, 0x55, 0x4c, 0xf6, 0xe6, 0x88,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-
-    /* bank # 4 */
-    0xd8, 0xdc, 0xb4, 0xb8, 0xb0, 0xd8, 0xb9, 0xab, 0xf3, 0xf8, 0xfa, 0xb3, 0xb7, 0xbb, 0x8e, 0x9e,
-    0xae, 0xf1, 0x32, 0xf5, 0x1b, 0xf1, 0xb4, 0xb8, 0xb0, 0x80, 0x97, 0xf1, 0xa9, 0xdf, 0xdf, 0xdf,
-    0xaa, 0xdf, 0xdf, 0xdf, 0xf2, 0xaa, 0xc5, 0xcd, 0xc7, 0xa9, 0x0c, 0xc9, 0x2c, 0x97, 0xf1, 0xa9,
-    0x89, 0x26, 0x46, 0x66, 0xb2, 0x89, 0x99, 0xa9, 0x2d, 0x55, 0x7d, 0xb0, 0xb0, 0x8a, 0xa8, 0x96,
-    0x36, 0x56, 0x76, 0xf1, 0xba, 0xa3, 0xb4, 0xb2, 0x80, 0xc0, 0xb8, 0xa8, 0x97, 0x11, 0xb2, 0x83,
-    0x98, 0xba, 0xa3, 0xf0, 0x24, 0x08, 0x44, 0x10, 0x64, 0x18, 0xb2, 0xb9, 0xb4, 0x98, 0x83, 0xf1,
-    0xa3, 0x29, 0x55, 0x7d, 0xba, 0xb5, 0xb1, 0xa3, 0x83, 0x93, 0xf0, 0x00, 0x28, 0x50, 0xf5, 0xb2,
-    0xb6, 0xaa, 0x83, 0x93, 0x28, 0x54, 0x7c, 0xf1, 0xb9, 0xa3, 0x82, 0x93, 0x61, 0xba, 0xa2, 0xda,
-    0xde, 0xdf, 0xdb, 0x81, 0x9a, 0xb9, 0xae, 0xf5, 0x60, 0x68, 0x70, 0xf1, 0xda, 0xba, 0xa2, 0xdf,
-    0xd9, 0xba, 0xa2, 0xfa, 0xb9, 0xa3, 0x82, 0x92, 0xdb, 0x31, 0xba, 0xa2, 0xd9, 0xba, 0xa2, 0xf8,
-    0xdf, 0x85, 0xa4, 0xd0, 0xc1, 0xbb, 0xad, 0x83, 0xc2, 0xc5, 0xc7, 0xb8, 0xa2, 0xdf, 0xdf, 0xdf,
-    0xba, 0xa0, 0xdf, 0xdf, 0xdf, 0xd8, 0xd8, 0xf1, 0xb8, 0xaa, 0xb3, 0x8d, 0xb4, 0x98, 0x0d, 0x35,
-    0x5d, 0xb2, 0xb6, 0xba, 0xaf, 0x8c, 0x96, 0x19, 0x8f, 0x9f, 0xa7, 0x0e, 0x16, 0x1e, 0xb4, 0x9a,
-    0xb8, 0xaa, 0x87, 0x2c, 0x54, 0x7c, 0xba, 0xa4, 0xb0, 0x8a, 0xb6, 0x91, 0x32, 0x56, 0x76, 0xb2,
-    0x84, 0x94, 0xa4, 0xc8, 0x08, 0xcd, 0xd8, 0xb8, 0xb4, 0xb0, 0xf1, 0x99, 0x82, 0xa8, 0x2d, 0x55,
-    0x7d, 0x98, 0xa8, 0x0e, 0x16, 0x1e, 0xa2, 0x2c, 0x54, 0x7c, 0x92, 0xa4, 0xf0, 0x2c, 0x50, 0x78,
-    /* bank # 5 */
-    0xf1, 0x84, 0xa8, 0x98, 0xc4, 0xcd, 0xfc, 0xd8, 0x0d, 0xdb, 0xa8, 0xfc, 0x2d, 0xf3, 0xd9, 0xba,
-    0xa6, 0xf8, 0xda, 0xba, 0xa6, 0xde, 0xd8, 0xba, 0xb2, 0xb6, 0x86, 0x96, 0xa6, 0xd0, 0xf3, 0xc8,
-    0x41, 0xda, 0xa6, 0xc8, 0xf8, 0xd8, 0xb0, 0xb4, 0xb8, 0x82, 0xa8, 0x92, 0xf5, 0x2c, 0x54, 0x88,
-    0x98, 0xf1, 0x35, 0xd9, 0xf4, 0x18, 0xd8, 0xf1, 0xa2, 0xd0, 0xf8, 0xf9, 0xa8, 0x84, 0xd9, 0xc7,
-    0xdf, 0xf8, 0xf8, 0x83, 0xc5, 0xda, 0xdf, 0x69, 0xdf, 0x83, 0xc1, 0xd8, 0xf4, 0x01, 0x14, 0xf1,
-    0xa8, 0x82, 0x4e, 0xa8, 0x84, 0xf3, 0x11, 0xd1, 0x82, 0xf5, 0xd9, 0x92, 0x28, 0x97, 0x88, 0xf1,
-    0x09, 0xf4, 0x1c, 0x1c, 0xd8, 0x84, 0xa8, 0xf3, 0xc0, 0xf9, 0xd1, 0xd9, 0x97, 0x82, 0xf1, 0x29,
-    0xf4, 0x0d, 0xd8, 0xf3, 0xf9, 0xf9, 0xd1, 0xd9, 0x82, 0xf4, 0xc2, 0x03, 0xd8, 0xde, 0xdf, 0x1a,
-    0xd8, 0xf1, 0xa2, 0xfa, 0xf9, 0xa8, 0x84, 0x98, 0xd9, 0xc7, 0xdf, 0xf8, 0xf8, 0xf8, 0x83, 0xc7,
-    0xda, 0xdf, 0x69, 0xdf, 0xf8, 0x83, 0xc3, 0xd8, 0xf4, 0x01, 0x14, 0xf1, 0x98, 0xa8, 0x82, 0x2e,
-    0xa8, 0x84, 0xf3, 0x11, 0xd1, 0x82, 0xf5, 0xd9, 0x92, 0x50, 0x97, 0x88, 0xf1, 0x09, 0xf4, 0x1c,
-    0xd8, 0x84, 0xa8, 0xf3, 0xc0, 0xf8, 0xf9, 0xd1, 0xd9, 0x97, 0x82, 0xf1, 0x49, 0xf4, 0x0d, 0xd8,
-    0xf3, 0xf9, 0xf9, 0xd1, 0xd9, 0x82, 0xf4, 0xc4, 0x03, 0xd8, 0xde, 0xdf, 0xd8, 0xf1, 0xad, 0x88,
-    0x98, 0xcc, 0xa8, 0x09, 0xf9, 0xd9, 0x82, 0x92, 0xa8, 0xf5, 0x7c, 0xf1, 0x88, 0x3a, 0xcf, 0x94,
-    0x4a, 0x6e, 0x98, 0xdb, 0x69, 0x31, 0xda, 0xad, 0xf2, 0xde, 0xf9, 0xd8, 0x87, 0x95, 0xa8, 0xf2,
-    0x21, 0xd1, 0xda, 0xa5, 0xf9, 0xf4, 0x17, 0xd9, 0xf1, 0xae, 0x8e, 0xd0, 0xc0, 0xc3, 0xae, 0x82,
-    /* bank # 6 */
-    0xc6, 0x84, 0xc3, 0xa8, 0x85, 0x95, 0xc8, 0xa5, 0x88, 0xf2, 0xc0, 0xf1, 0xf4, 0x01, 0x0e, 0xf1,
-    0x8e, 0x9e, 0xa8, 0xc6, 0x3e, 0x56, 0xf5, 0x54, 0xf1, 0x88, 0x72, 0xf4, 0x01, 0x15, 0xf1, 0x98,
-    0x45, 0x85, 0x6e, 0xf5, 0x8e, 0x9e, 0x04, 0x88, 0xf1, 0x42, 0x98, 0x5a, 0x8e, 0x9e, 0x06, 0x88,
-    0x69, 0xf4, 0x01, 0x1c, 0xf1, 0x98, 0x1e, 0x11, 0x08, 0xd0, 0xf5, 0x04, 0xf1, 0x1e, 0x97, 0x02,
-    0x02, 0x98, 0x36, 0x25, 0xdb, 0xf9, 0xd9, 0x85, 0xa5, 0xf3, 0xc1, 0xda, 0x85, 0xa5, 0xf3, 0xdf,
-    0xd8, 0x85, 0x95, 0xa8, 0xf3, 0x09, 0xda, 0xa5, 0xfa, 0xd8, 0x82, 0x92, 0xa8, 0xf5, 0x78, 0xf1,
-    0x88, 0x1a, 0x84, 0x9f, 0x26, 0x88, 0x98, 0x21, 0xda, 0xf4, 0x1d, 0xf3, 0xd8, 0x87, 0x9f, 0x39,
-    0xd1, 0xaf, 0xd9, 0xdf, 0xdf, 0xfb, 0xf9, 0xf4, 0x0c, 0xf3, 0xd8, 0xfa, 0xd0, 0xf8, 0xda, 0xf9,
-    0xf9, 0xd0, 0xdf, 0xd9, 0xf9, 0xd8, 0xf4, 0x0b, 0xd8, 0xf3, 0x87, 0x9f, 0x39, 0xd1, 0xaf, 0xd9,
-    0xdf, 0xdf, 0xf4, 0x1d, 0xf3, 0xd8, 0xfa, 0xfc, 0xa8, 0x69, 0xf9, 0xf9, 0xaf, 0xd0, 0xda, 0xde,
-    0xfa, 0xd9, 0xf8, 0x8f, 0x9f, 0xa8, 0xf1, 0xcc, 0xf3, 0x98, 0xdb, 0x45, 0xd9, 0xaf, 0xdf, 0xd0,
-    0xf8, 0xd8, 0xf1, 0x8f, 0x9f, 0xa8, 0xca, 0xf3, 0x88, 0x09, 0xda, 0xaf, 0x8f, 0xcb, 0xf8, 0xd8,
-    0xf2, 0xad, 0x97, 0x8d, 0x0c, 0xd9, 0xa5, 0xdf, 0xf9, 0xba, 0xa6, 0xf3, 0xfa, 0xf4, 0x12, 0xf2,
-    0xd8, 0x95, 0x0d, 0xd1, 0xd9, 0xba, 0xa6, 0xf3, 0xfa, 0xda, 0xa5, 0xf2, 0xc1, 0xba, 0xa6, 0xf3,
-    0xdf, 0xd8, 0xf1, 0xba, 0xb2, 0xb6, 0x86, 0x96, 0xa6, 0xd0, 0xca, 0xf3, 0x49, 0xda, 0xa6, 0xcb,
-    0xf8, 0xd8, 0xb0, 0xb4, 0xb8, 0xd8, 0xad, 0x84, 0xf2, 0xc0, 0xdf, 0xf1, 0x8f, 0xcb, 0xc3, 0xa8,
-    /* bank # 7 */
-    0xb2, 0xb6, 0x86, 0x96, 0xc8, 0xc1, 0xcb, 0xc3, 0xf3, 0xb0, 0xb4, 0x88, 0x98, 0xa8, 0x21, 0xdb,
-    0x71, 0x8d, 0x9d, 0x71, 0x85, 0x95, 0x21, 0xd9, 0xad, 0xf2, 0xfa, 0xd8, 0x85, 0x97, 0xa8, 0x28,
-    0xd9, 0xf4, 0x08, 0xd8, 0xf2, 0x8d, 0x29, 0xda, 0xf4, 0x05, 0xd9, 0xf2, 0x85, 0xa4, 0xc2, 0xf2,
-    0xd8, 0xa8, 0x8d, 0x94, 0x01, 0xd1, 0xd9, 0xf4, 0x11, 0xf2, 0xd8, 0x87, 0x21, 0xd8, 0xf4, 0x0a,
-    0xd8, 0xf2, 0x84, 0x98, 0xa8, 0xc8, 0x01, 0xd1, 0xd9, 0xf4, 0x11, 0xd8, 0xf3, 0xa4, 0xc8, 0xbb,
-    0xaf, 0xd0, 0xf2, 0xde, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xd8, 0xf1, 0xb8, 0xf6,
-    0xb5, 0xb9, 0xb0, 0x8a, 0x95, 0xa3, 0xde, 0x3c, 0xa3, 0xd9, 0xf8, 0xd8, 0x5c, 0xa3, 0xd9, 0xf8,
-    0xd8, 0x7c, 0xa3, 0xd9, 0xf8, 0xd8, 0xf8, 0xf9, 0xd1, 0xa5, 0xd9, 0xdf, 0xda, 0xfa, 0xd8, 0xb1,
-    0x85, 0x30, 0xf7, 0xd9, 0xde, 0xd8, 0xf8, 0x30, 0xad, 0xda, 0xde, 0xd8, 0xf2, 0xb4, 0x8c, 0x99,
-    0xa3, 0x2d, 0x55, 0x7d, 0xa0, 0x83, 0xdf, 0xdf, 0xdf, 0xb5, 0x91, 0xa0, 0xf6, 0x29, 0xd9, 0xfb,
-    0xd8, 0xa0, 0xfc, 0x29, 0xd9, 0xfa, 0xd8, 0xa0, 0xd0, 0x51, 0xd9, 0xf8, 0xd8, 0xfc, 0x51, 0xd9,
-    0xf9, 0xd8, 0x79, 0xd9, 0xfb, 0xd8, 0xa0, 0xd0, 0xfc, 0x79, 0xd9, 0xfa, 0xd8, 0xa1, 0xf9, 0xf9,
-    0xf9, 0xf9, 0xf9, 0xa0, 0xda, 0xdf, 0xdf, 0xdf, 0xd8, 0xa1, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xac,
-    0xde, 0xf8, 0xad, 0xde, 0x83, 0x93, 0xac, 0x2c, 0x54, 0x7c, 0xf1, 0xa8, 0xdf, 0xdf, 0xdf, 0xf6,
-    0x9d, 0x2c, 0xda, 0xa0, 0xdf, 0xd9, 0xfa, 0xdb, 0x2d, 0xf8, 0xd8, 0xa8, 0x50, 0xda, 0xa0, 0xd0,
-    0xde, 0xd9, 0xd0, 0xf8, 0xf8, 0xf8, 0xdb, 0x55, 0xf8, 0xd8, 0xa8, 0x78, 0xda, 0xa0, 0xd0, 0xdf,
-    /* bank # 8 */
-    0xd9, 0xd0, 0xfa, 0xf8, 0xf8, 0xf8, 0xf8, 0xdb, 0x7d, 0xf8, 0xd8, 0x9c, 0xa8, 0x8c, 0xf5, 0x30,
-    0xdb, 0x38, 0xd9, 0xd0, 0xde, 0xdf, 0xa0, 0xd0, 0xde, 0xdf, 0xd8, 0xa8, 0x48, 0xdb, 0x58, 0xd9,
-    0xdf, 0xd0, 0xde, 0xa0, 0xdf, 0xd0, 0xde, 0xd8, 0xa8, 0x68, 0xdb, 0x70, 0xd9, 0xdf, 0xdf, 0xa0,
-    0xdf, 0xdf, 0xd8, 0xf1, 0xa8, 0x88, 0x90, 0x2c, 0x54, 0x7c, 0x98, 0xa8, 0xd0, 0x5c, 0x38, 0xd1,
-    0xda, 0xf2, 0xae, 0x8c, 0xdf, 0xf9, 0xd8, 0xb0, 0x87, 0xa8, 0xc1, 0xc1, 0xb1, 0x88, 0xa8, 0xc6,
-    0xf9, 0xf9, 0xda, 0x36, 0xd8, 0xa8, 0xf9, 0xda, 0x36, 0xd8, 0xa8, 0xf9, 0xda, 0x36, 0xd8, 0xa8,
-    0xf9, 0xda, 0x36, 0xd8, 0xa8, 0xf9, 0xda, 0x36, 0xd8, 0xf7, 0x8d, 0x9d, 0xad, 0xf8, 0x18, 0xda,
-    0xf2, 0xae, 0xdf, 0xd8, 0xf7, 0xad, 0xfa, 0x30, 0xd9, 0xa4, 0xde, 0xf9, 0xd8, 0xf2, 0xae, 0xde,
-    0xfa, 0xf9, 0x83, 0xa7, 0xd9, 0xc3, 0xc5, 0xc7, 0xf1, 0x88, 0x9b, 0xa7, 0x7a, 0xad, 0xf7, 0xde,
-    0xdf, 0xa4, 0xf8, 0x84, 0x94, 0x08, 0xa7, 0x97, 0xf3, 0x00, 0xae, 0xf2, 0x98, 0x19, 0xa4, 0x88,
-    0xc6, 0xa3, 0x94, 0x88, 0xf6, 0x32, 0xdf, 0xf2, 0x83, 0x93, 0xdb, 0x09, 0xd9, 0xf2, 0xaa, 0xdf,
-    0xd8, 0xd8, 0xae, 0xf8, 0xf9, 0xd1, 0xda, 0xf3, 0xa4, 0xde, 0xa7, 0xf1, 0x88, 0x9b, 0x7a, 0xd8,
-    0xf3, 0x84, 0x94, 0xae, 0x19, 0xf9, 0xda, 0xaa, 0xf1, 0xdf, 0xd8, 0xa8, 0x81, 0xc0, 0xc3, 0xc5,
-    0xc7, 0xa3, 0x92, 0x83, 0xf6, 0x28, 0xad, 0xde, 0xd9, 0xf8, 0xd8, 0xa3, 0x50, 0xad, 0xd9, 0xf8,
-    0xd8, 0xa3, 0x78, 0xad, 0xd9, 0xf8, 0xd8, 0xf8, 0xf9, 0xd1, 0xa1, 0xda, 0xde, 0xc3, 0xc5, 0xc7,
-    0xd8, 0xa1, 0x81, 0x94, 0xf8, 0x18, 0xf2, 0xb0, 0x89, 0xac, 0xc3, 0xc5, 0xc7, 0xf1, 0xd8, 0xb8,
-    /* bank # 9 */
-    0xb4, 0xb0, 0x97, 0x86, 0xa8, 0x31, 0x9b, 0x06, 0x99, 0x07, 0xab, 0x97, 0x28, 0x88, 0x9b, 0xf0,
-    0x0c, 0x20, 0x14, 0x40, 0xb0, 0xb4, 0xb8, 0xf0, 0xa8, 0x8a, 0x9a, 0x28, 0x50, 0x78, 0xb7, 0x9b,
-    0xa8, 0x29, 0x51, 0x79, 0x24, 0x70, 0x59, 0x44, 0x69, 0x38, 0x64, 0x48, 0x31, 0xf1, 0xbb, 0xab,
-    0x88, 0x00, 0x2c, 0x54, 0x7c, 0xf0, 0xb3, 0x8b, 0xb8, 0xa8, 0x04, 0x28, 0x50, 0x78, 0xf1, 0xb0,
-    0x88, 0xb4, 0x97, 0x26, 0xa8, 0x59, 0x98, 0xbb, 0xab, 0xb3, 0x8b, 0x02, 0x26, 0x46, 0x66, 0xb0,
-    0xb8, 0xf0, 0x8a, 0x9c, 0xa8, 0x29, 0x51, 0x79, 0x8b, 0x29, 0x51, 0x79, 0x8a, 0x24, 0x70, 0x59,
-    0x8b, 0x20, 0x58, 0x71, 0x8a, 0x44, 0x69, 0x38, 0x8b, 0x39, 0x40, 0x68, 0x8a, 0x64, 0x48, 0x31,
-    0x8b, 0x30, 0x49, 0x60, 0x88, 0xf1, 0xac, 0x00, 0x2c, 0x54, 0x7c, 0xf0, 0x8c, 0xa8, 0x04, 0x28,
-    0x50, 0x78, 0xf1, 0x88, 0x97, 0x26, 0xa8, 0x59, 0x98, 0xac, 0x8c, 0x02, 0x26, 0x46, 0x66, 0xf0,
-    0x89, 0x9c, 0xa8, 0x29, 0x51, 0x79, 0x24, 0x70, 0x59, 0x44, 0x69, 0x38, 0x64, 0x48, 0x31, 0xa9,
-    0x88, 0x09, 0x20, 0x59, 0x70, 0xab, 0x11, 0x38, 0x40, 0x69, 0xa8, 0x19, 0x31, 0x48, 0x60, 0x8c,
-    0xa8, 0x3c, 0x41, 0x5c, 0x20, 0x7c, 0x00, 0xf1, 0x87, 0x98, 0x19, 0x86, 0xa8, 0x6e, 0x76, 0x7e,
-    0xa9, 0x99, 0x88, 0x2d, 0x55, 0x7d, 0xd8, 0xb1, 0xb5, 0xb9, 0xa3, 0xdf, 0xdf, 0xdf, 0xae, 0xd0,
-    0xdf, 0xaa, 0xd0, 0xde, 0xf2, 0xab, 0xf8, 0xf9, 0xd9, 0xb0, 0x87, 0xc4, 0xaa, 0xf1, 0xdf, 0xdf,
-    0xbb, 0xaf, 0xdf, 0xdf, 0xb9, 0xd8, 0xb1, 0xf1, 0xa3, 0x97, 0x8e, 0x60, 0xdf, 0xb0, 0x84, 0xf2,
-    0xc8, 0xf8, 0xf9, 0xd9, 0xde, 0xd8, 0x93, 0x85, 0xf1, 0x4a, 0xb1, 0x83, 0xa3, 0x08, 0xb5, 0x83,
-    /* bank # 10 */
-    0x9a, 0x08, 0x10, 0xb7, 0x9f, 0x10, 0xd8, 0xf1, 0xb0, 0xba, 0xae, 0xb0, 0x8a, 0xc2, 0xb2, 0xb6,
-    0x8e, 0x9e, 0xf1, 0xfb, 0xd9, 0xf4, 0x1d, 0xd8, 0xf9, 0xd9, 0x0c, 0xf1, 0xd8, 0xf8, 0xf8, 0xad,
-    0x61, 0xd9, 0xae, 0xfb, 0xd8, 0xf4, 0x0c, 0xf1, 0xd8, 0xf8, 0xf8, 0xad, 0x19, 0xd9, 0xae, 0xfb,
-    0xdf, 0xd8, 0xf4, 0x16, 0xf1, 0xd8, 0xf8, 0xad, 0x8d, 0x61, 0xd9, 0xf4, 0xf4, 0xac, 0xf5, 0x9c,
-    0x9c, 0x8d, 0xdf, 0x2b, 0xba, 0xb6, 0xae, 0xfa, 0xf8, 0xf4, 0x0b, 0xd8, 0xf1, 0xae, 0xd0, 0xf8,
-    0xad, 0x51, 0xda, 0xae, 0xfa, 0xf8, 0xf1, 0xd8, 0xb9, 0xb1, 0xb6, 0xa3, 0x83, 0x9c, 0x08, 0xb9,
-    0xb1, 0x83, 0x9a, 0xb5, 0xaa, 0xc0, 0xfd, 0x30, 0x83, 0xb7, 0x9f, 0x10, 0xb5, 0x8b, 0x93, 0xf2,
-    0x02, 0x02, 0xd1, 0xab, 0xda, 0xde, 0xd8, 0xf1, 0xb0, 0x80, 0xba, 0xab, 0xc0, 0xc3, 0xb2, 0x84,
-    0xc1, 0xc3, 0xd8, 0xb1, 0xb9, 0xf3, 0x8b, 0xa3, 0x91, 0xb6, 0x09, 0xb4, 0xd9, 0xab, 0xde, 0xb0,
-    0x87, 0x9c, 0xb9, 0xa3, 0xdd, 0xf1, 0xb3, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0xb0, 0x87, 0xa3, 0xa3,
-    0xa3, 0xa3, 0xb2, 0x8b, 0xb6, 0x9b, 0xf2, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3,
-    0xa3, 0xf1, 0xb0, 0x87, 0xb5, 0x9a, 0xa3, 0xf3, 0x9b, 0xa3, 0xa3, 0xdc, 0xba, 0xac, 0xdf, 0xb9,
-    0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3,
-    0xd8, 0xd8, 0xd8, 0xbb, 0xb3, 0xb7, 0xf1, 0xaa, 0xf9, 0xda, 0xff, 0xd9, 0x80, 0x9a, 0xaa, 0x28,
-    0xb4, 0x80, 0x98, 0xa7, 0x20, 0xb7, 0x97, 0x87, 0xa8, 0x66, 0x88, 0xf0, 0x79, 0x51, 0xf1, 0x90,
-    0x2c, 0x87, 0x0c, 0xa7, 0x81, 0x97, 0x62, 0x93, 0xf0, 0x71, 0x71, 0x60, 0x85, 0x94, 0x01, 0x29,
-    /* bank # 11 */
-    0x51, 0x79, 0x90, 0xa5, 0xf1, 0x28, 0x4c, 0x6c, 0x87, 0x0c, 0x95, 0x18, 0x85, 0x78, 0xa3, 0x83,
-    0x90, 0x28, 0x4c, 0x6c, 0x88, 0x6c, 0xd8, 0xf3, 0xa2, 0x82, 0x00, 0xf2, 0x10, 0xa8, 0x92, 0x19,
-    0x80, 0xa2, 0xf2, 0xd9, 0x26, 0xd8, 0xf1, 0x88, 0xa8, 0x4d, 0xd9, 0x48, 0xd8, 0x96, 0xa8, 0x39,
-    0x80, 0xd9, 0x3c, 0xd8, 0x95, 0x80, 0xa8, 0x39, 0xa6, 0x86, 0x98, 0xd9, 0x2c, 0xda, 0x87, 0xa7,
-    0x2c, 0xd8, 0xa8, 0x89, 0x95, 0x19, 0xa9, 0x80, 0xd9, 0x38, 0xd8, 0xa8, 0x89, 0x39, 0xa9, 0x80,
-    0xda, 0x3c, 0xd8, 0xa8, 0x2e, 0xa8, 0x39, 0x90, 0xd9, 0x0c, 0xd8, 0xa8, 0x95, 0x31, 0x98, 0xd9,
-    0x0c, 0xd8, 0xa8, 0x09, 0xd9, 0xff, 0xd8, 0x01, 0xda, 0xff, 0xd8, 0x95, 0x39, 0xa9, 0xda, 0x26,
-    0xff, 0xd8, 0x90, 0xa8, 0x0d, 0x89, 0x99, 0xa8, 0x10, 0x80, 0x98, 0x21, 0xda, 0x2e, 0xd8, 0x89,
-    0x99, 0xa8, 0x31, 0x80, 0xda, 0x2e, 0xd8, 0xa8, 0x86, 0x96, 0x31, 0x80, 0xda, 0x2e, 0xd8, 0xa8,
-    0x87, 0x31, 0x80, 0xda, 0x2e, 0xd8, 0xa8, 0x82, 0x92, 0xf3, 0x41, 0x80, 0xf1, 0xd9, 0x2e, 0xd8,
-    0xa8, 0x82, 0xf3, 0x19, 0x80, 0xf1, 0xd9, 0x2e, 0xd8, 0x82, 0xac, 0xf3, 0xc0, 0xa2, 0x80, 0x22,
-    0xf1, 0xa6, 0x2e, 0xa7, 0x2e, 0xa9, 0x22, 0x98, 0xa8, 0x29, 0xda, 0xac, 0xde, 0xff, 0xd8, 0xa2,
-    0xf2, 0x2a, 0xf1, 0xa9, 0x2e, 0x82, 0x92, 0xa8, 0xf2, 0x31, 0x80, 0xa6, 0x96, 0xf1, 0xd9, 0x00,
-    0xac, 0x8c, 0x9c, 0x0c, 0x30, 0xac, 0xde, 0xd0, 0xde, 0xff, 0xd8, 0x8c, 0x9c, 0xac, 0xd0, 0x10,
-    0xac, 0xde, 0x80, 0x92, 0xa2, 0xf2, 0x4c, 0x82, 0xa8, 0xf1, 0xca, 0xf2, 0x35, 0xf1, 0x96, 0x88,
-    0xa6, 0xd9, 0x00, 0xd8, 0xf1, 0xff
-};
-
-static const unsigned short sStartAddress = 0x0400;
-
-/* END OF SECTION COPIED FROM dmpDefaultMPU6050.c */
-
-#define INT_SRC_TAP             (0x01)
-#define INT_SRC_ANDROID_ORIENT  (0x08)
-
-#define DMP_FEATURE_SEND_ANY_GYRO   (DMP_FEATURE_SEND_RAW_GYRO | \
-                                     DMP_FEATURE_SEND_CAL_GYRO)
-
-#define MAX_PACKET_LENGTH   (32)
-
-#define DMP_SAMPLE_RATE     (200)
-#define GYRO_SF             (46850825LL * 200 / DMP_SAMPLE_RATE)
-
-#define FIFO_CORRUPTION_CHECK
-#ifdef FIFO_CORRUPTION_CHECK
-#define QUAT_ERROR_THRESH       (1L<<24)
-#define QUAT_MAG_SQ_NORMALIZED  (1L<<28)
-#define QUAT_MAG_SQ_MIN         (QUAT_MAG_SQ_NORMALIZED - QUAT_ERROR_THRESH)
-#define QUAT_MAG_SQ_MAX         (QUAT_MAG_SQ_NORMALIZED + QUAT_ERROR_THRESH)
-#endif
-
-struct dmp_s {
-    void (*tap_cb)(unsigned char count, unsigned char direction);
-    void (*android_orient_cb)(unsigned char orientation);
-    unsigned short orient;
-    unsigned short feature_mask;
-    unsigned short fifo_rate;
-    unsigned char packet_length;
-};
-
-static struct dmp_s dmp = {
-    .tap_cb = NULL,
-    .android_orient_cb = NULL,
-    .orient = 0,
-    .feature_mask = 0,
-    .fifo_rate = 0,
-    .packet_length = 0
-};
-
-/**
- *  @brief  Load the DMP with this image.
- *  @return 0 if successful.
- */
-int dmp_load_motion_driver_firmware(void)
-{
-    return mpu_load_firmware(DMP_CODE_SIZE, dmp_memory, sStartAddress,
-        DMP_SAMPLE_RATE);
-}
-
-/**
- *  @brief      Push gyro and accel orientation to the DMP.
- *  The orientation is represented here as the output of
- *  @e inv_orientation_matrix_to_scalar.
- *  @param[in]  orient  Gyro and accel orientation in body frame.
- *  @return     0 if successful.
- */
-int dmp_set_orientation(unsigned short orient)
-{
-    unsigned char gyro_regs[3], accel_regs[3];
-    const unsigned char gyro_axes[3] = {DINA4C, DINACD, DINA6C};
-    const unsigned char accel_axes[3] = {DINA0C, DINAC9, DINA2C};
-    const unsigned char gyro_sign[3] = {DINA36, DINA56, DINA76};
-    const unsigned char accel_sign[3] = {DINA26, DINA46, DINA66};
-
-    gyro_regs[0] = gyro_axes[orient & 3];
-    gyro_regs[1] = gyro_axes[(orient >> 3) & 3];
-    gyro_regs[2] = gyro_axes[(orient >> 6) & 3];
-    accel_regs[0] = accel_axes[orient & 3];
-    accel_regs[1] = accel_axes[(orient >> 3) & 3];
-    accel_regs[2] = accel_axes[(orient >> 6) & 3];
-
-    /* Chip-to-body, axes only. */
-    if (mpu_write_mem(FCFG_1, 3, gyro_regs))
-        return -1;
-    if (mpu_write_mem(FCFG_2, 3, accel_regs))
-        return -1;
-
-    memcpy(gyro_regs, gyro_sign, 3);
-    memcpy(accel_regs, accel_sign, 3);
-    if (orient & 4) {
-        gyro_regs[0] |= 1;
-        accel_regs[0] |= 1;
-    }
-    if (orient & 0x20) {
-        gyro_regs[1] |= 1;
-        accel_regs[1] |= 1;
-    }
-    if (orient & 0x100) {
-        gyro_regs[2] |= 1;
-        accel_regs[2] |= 1;
-    }
-
-    /* Chip-to-body, sign only. */
-    if (mpu_write_mem(FCFG_3, 3, gyro_regs))
-        return -1;
-    if (mpu_write_mem(FCFG_7, 3, accel_regs))
-        return -1;
-    dmp.orient = orient;
-    return 0;
-}
-
-/**
- *  @brief      Push gyro biases to the DMP.
- *  Because the gyro integration is handled in the DMP, any gyro biases
- *  calculated by the MPL should be pushed down to DMP memory to remove
- *  3-axis quaternion drift.
- *  \n NOTE: If the DMP-based gyro calibration is enabled, the DMP will
- *  overwrite the biases written to this location once a new one is computed.
- *  @param[in]  bias    Gyro biases in q16.
- *  @return     0 if successful.
- */
-int dmp_set_gyro_bias(long *bias)
-{
-    long gyro_bias_body[3];
-    unsigned char regs[4];
-
-    gyro_bias_body[0] = bias[dmp.orient & 3];
-    if (dmp.orient & 4)
-        gyro_bias_body[0] *= -1;
-    gyro_bias_body[1] = bias[(dmp.orient >> 3) & 3];
-    if (dmp.orient & 0x20)
-        gyro_bias_body[1] *= -1;
-    gyro_bias_body[2] = bias[(dmp.orient >> 6) & 3];
-    if (dmp.orient & 0x100)
-        gyro_bias_body[2] *= -1;
-
-#ifdef EMPL_NO_64BIT
-    gyro_bias_body[0] = (long)(((float)gyro_bias_body[0] * GYRO_SF) / 1073741824.f);
-    gyro_bias_body[1] = (long)(((float)gyro_bias_body[1] * GYRO_SF) / 1073741824.f);
-    gyro_bias_body[2] = (long)(((float)gyro_bias_body[2] * GYRO_SF) / 1073741824.f);
-#else
-    gyro_bias_body[0] = (long)(((long long)gyro_bias_body[0] * GYRO_SF) >> 30);
-    gyro_bias_body[1] = (long)(((long long)gyro_bias_body[1] * GYRO_SF) >> 30);
-    gyro_bias_body[2] = (long)(((long long)gyro_bias_body[2] * GYRO_SF) >> 30);
-#endif
-
-    regs[0] = (unsigned char)((gyro_bias_body[0] >> 24) & 0xFF);
-    regs[1] = (unsigned char)((gyro_bias_body[0] >> 16) & 0xFF);
-    regs[2] = (unsigned char)((gyro_bias_body[0] >> 8) & 0xFF);
-    regs[3] = (unsigned char)(gyro_bias_body[0] & 0xFF);
-    if (mpu_write_mem(D_EXT_GYRO_BIAS_X, 4, regs))
-        return -1;
-
-    regs[0] = (unsigned char)((gyro_bias_body[1] >> 24) & 0xFF);
-    regs[1] = (unsigned char)((gyro_bias_body[1] >> 16) & 0xFF);
-    regs[2] = (unsigned char)((gyro_bias_body[1] >> 8) & 0xFF);
-    regs[3] = (unsigned char)(gyro_bias_body[1] & 0xFF);
-    if (mpu_write_mem(D_EXT_GYRO_BIAS_Y, 4, regs))
-        return -1;
-
-    regs[0] = (unsigned char)((gyro_bias_body[2] >> 24) & 0xFF);
-    regs[1] = (unsigned char)((gyro_bias_body[2] >> 16) & 0xFF);
-    regs[2] = (unsigned char)((gyro_bias_body[2] >> 8) & 0xFF);
-    regs[3] = (unsigned char)(gyro_bias_body[2] & 0xFF);
-    return mpu_write_mem(D_EXT_GYRO_BIAS_Z, 4, regs);
-}
-
-/**
- *  @brief      Push accel biases to the DMP.
- *  These biases will be removed from the DMP 6-axis quaternion.
- *  @param[in]  bias    Accel biases in q16.
- *  @return     0 if successful.
- */
-int dmp_set_accel_bias(long *bias)
-{
-    long accel_bias_body[3];
-    unsigned char regs[12];
-    long long accel_sf;
-    unsigned short accel_sens;
-
-    mpu_get_accel_sens(&accel_sens);
-    accel_sf = (long long)accel_sens << 15;
-//    __no_operation();
-    __NOP();
-
-    accel_bias_body[0] = bias[dmp.orient & 3];
-    if (dmp.orient & 4)
-        accel_bias_body[0] *= -1;
-    accel_bias_body[1] = bias[(dmp.orient >> 3) & 3];
-    if (dmp.orient & 0x20)
-        accel_bias_body[1] *= -1;
-    accel_bias_body[2] = bias[(dmp.orient >> 6) & 3];
-    if (dmp.orient & 0x100)
-        accel_bias_body[2] *= -1;
-
-#ifdef EMPL_NO_64BIT
-    accel_bias_body[0] = (long)(((float)accel_bias_body[0] * accel_sf) / 1073741824.f);
-    accel_bias_body[1] = (long)(((float)accel_bias_body[1] * accel_sf) / 1073741824.f);
-    accel_bias_body[2] = (long)(((float)accel_bias_body[2] * accel_sf) / 1073741824.f);
-#else
-    accel_bias_body[0] = (long)(((long long)accel_bias_body[0] * accel_sf) >> 30);
-    accel_bias_body[1] = (long)(((long long)accel_bias_body[1] * accel_sf) >> 30);
-    accel_bias_body[2] = (long)(((long long)accel_bias_body[2] * accel_sf) >> 30);
-#endif
-
-    regs[0] = (unsigned char)((accel_bias_body[0] >> 24) & 0xFF);
-    regs[1] = (unsigned char)((accel_bias_body[0] >> 16) & 0xFF);
-    regs[2] = (unsigned char)((accel_bias_body[0] >> 8) & 0xFF);
-    regs[3] = (unsigned char)(accel_bias_body[0] & 0xFF);
-    regs[4] = (unsigned char)((accel_bias_body[1] >> 24) & 0xFF);
-    regs[5] = (unsigned char)((accel_bias_body[1] >> 16) & 0xFF);
-    regs[6] = (unsigned char)((accel_bias_body[1] >> 8) & 0xFF);
-    regs[7] = (unsigned char)(accel_bias_body[1] & 0xFF);
-    regs[8] = (unsigned char)((accel_bias_body[2] >> 24) & 0xFF);
-    regs[9] = (unsigned char)((accel_bias_body[2] >> 16) & 0xFF);
-    regs[10] = (unsigned char)((accel_bias_body[2] >> 8) & 0xFF);
-    regs[11] = (unsigned char)(accel_bias_body[2] & 0xFF);
-    return mpu_write_mem(D_ACCEL_BIAS, 12, regs);
-}
-
-/**
- *  @brief      Set DMP output rate.
- *  Only used when DMP is on.
- *  @param[in]  rate    Desired fifo rate (Hz).
- *  @return     0 if successful.
- */
-int dmp_set_fifo_rate(unsigned short rate)
-{
-    const unsigned char regs_end[12] = {DINAFE, DINAF2, DINAAB,
-        0xc4, DINAAA, DINAF1, DINADF, DINADF, 0xBB, 0xAF, DINADF, DINADF};
-    unsigned short div;
-    unsigned char tmp[8];
-
-    if (rate > DMP_SAMPLE_RATE)
-        return -1;
-    div = DMP_SAMPLE_RATE / rate - 1;
-    tmp[0] = (unsigned char)((div >> 8) & 0xFF);
-    tmp[1] = (unsigned char)(div & 0xFF);
-    if (mpu_write_mem(D_0_22, 2, tmp))
-        return -1;
-    if (mpu_write_mem(CFG_6, 12, (unsigned char*)regs_end))
-        return -1;
-
-    dmp.fifo_rate = rate;
-    return 0;
-}
-
-/**
- *  @brief      Get DMP output rate.
- *  @param[out] rate    Current fifo rate (Hz).
- *  @return     0 if successful.
- */
-int dmp_get_fifo_rate(unsigned short *rate)
-{
-    rate[0] = dmp.fifo_rate;
-    return 0;
-}
-
-/**
- *  @brief      Set tap threshold for a specific axis.
- *  @param[in]  axis    1, 2, and 4 for XYZ accel, respectively.
- *  @param[in]  thresh  Tap threshold, in mg/ms.
- *  @return     0 if successful.
- */
-int dmp_set_tap_thresh(unsigned char axis, unsigned short thresh)
-{
-    unsigned char tmp[4], accel_fsr;
-    float scaled_thresh;
-    unsigned short dmp_thresh, dmp_thresh_2;
-    if (!(axis & TAP_XYZ) || thresh > 1600)
-        return -1;
-
-    scaled_thresh = (float)thresh / DMP_SAMPLE_RATE;
-
-    mpu_get_accel_fsr(&accel_fsr);
-    switch (accel_fsr) {
-    case 2:
-        dmp_thresh = (unsigned short)(scaled_thresh * 16384);
-        /* dmp_thresh * 0.75 */
-        dmp_thresh_2 = (unsigned short)(scaled_thresh * 12288);
-        break;
-    case 4:
-        dmp_thresh = (unsigned short)(scaled_thresh * 8192);
-        /* dmp_thresh * 0.75 */
-        dmp_thresh_2 = (unsigned short)(scaled_thresh * 6144);
-        break;
-    case 8:
-        dmp_thresh = (unsigned short)(scaled_thresh * 4096);
-        /* dmp_thresh * 0.75 */
-        dmp_thresh_2 = (unsigned short)(scaled_thresh * 3072);
-        break;
-    case 16:
-        dmp_thresh = (unsigned short)(scaled_thresh * 2048);
-        /* dmp_thresh * 0.75 */
-        dmp_thresh_2 = (unsigned short)(scaled_thresh * 1536);
-        break;
-    default:
-        return -1;
-    }
-    tmp[0] = (unsigned char)(dmp_thresh >> 8);
-    tmp[1] = (unsigned char)(dmp_thresh & 0xFF);
-    tmp[2] = (unsigned char)(dmp_thresh_2 >> 8);
-    tmp[3] = (unsigned char)(dmp_thresh_2 & 0xFF);
-
-    if (axis & TAP_X) {
-        if (mpu_write_mem(DMP_TAP_THX, 2, tmp))
-            return -1;
-        if (mpu_write_mem(D_1_36, 2, tmp+2))
-            return -1;
-    }
-    if (axis & TAP_Y) {
-        if (mpu_write_mem(DMP_TAP_THY, 2, tmp))
-            return -1;
-        if (mpu_write_mem(D_1_40, 2, tmp+2))
-            return -1;
-    }
-    if (axis & TAP_Z) {
-        if (mpu_write_mem(DMP_TAP_THZ, 2, tmp))
-            return -1;
-        if (mpu_write_mem(D_1_44, 2, tmp+2))
-            return -1;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Set which axes will register a tap.
- *  @param[in]  axis    1, 2, and 4 for XYZ, respectively.
- *  @return     0 if successful.
- */
-int dmp_set_tap_axes(unsigned char axis)
-{
-    unsigned char tmp = 0;
-
-    if (axis & TAP_X)
-        tmp |= 0x30;
-    if (axis & TAP_Y)
-        tmp |= 0x0C;
-    if (axis & TAP_Z)
-        tmp |= 0x03;
-    return mpu_write_mem(D_1_72, 1, &tmp);
-}
-
-/**
- *  @brief      Set minimum number of taps needed for an interrupt.
- *  @param[in]  min_taps    Minimum consecutive taps (1-4).
- *  @return     0 if successful.
- */
-int dmp_set_tap_count(unsigned char min_taps)
-{
-    unsigned char tmp;
-
-    if (min_taps < 1)
-        min_taps = 1;
-    else if (min_taps > 4)
-        min_taps = 4;
-
-    tmp = min_taps - 1;
-    return mpu_write_mem(D_1_79, 1, &tmp);
-}
-
-/**
- *  @brief      Set length between valid taps.
- *  @param[in]  time    Milliseconds between taps.
- *  @return     0 if successful.
- */
-int dmp_set_tap_time(unsigned short time)
-{
-    unsigned short dmp_time;
-    unsigned char tmp[2];
-
-    dmp_time = time / (1000 / DMP_SAMPLE_RATE);
-    tmp[0] = (unsigned char)(dmp_time >> 8);
-    tmp[1] = (unsigned char)(dmp_time & 0xFF);
-    return mpu_write_mem(DMP_TAPW_MIN, 2, tmp);
-}
-
-/**
- *  @brief      Set max time between taps to register as a multi-tap.
- *  @param[in]  time    Max milliseconds between taps.
- *  @return     0 if successful.
- */
-int dmp_set_tap_time_multi(unsigned short time)
-{
-    unsigned short dmp_time;
-    unsigned char tmp[2];
-
-    dmp_time = time / (1000 / DMP_SAMPLE_RATE);
-    tmp[0] = (unsigned char)(dmp_time >> 8);
-    tmp[1] = (unsigned char)(dmp_time & 0xFF);
-    return mpu_write_mem(D_1_218, 2, tmp);
-}
-
-/**
- *  @brief      Set shake rejection threshold.
- *  If the DMP detects a gyro sample larger than @e thresh, taps are rejected.
- *  @param[in]  sf      Gyro scale factor.
- *  @param[in]  thresh  Gyro threshold in dps.
- *  @return     0 if successful.
- */
-int dmp_set_shake_reject_thresh(long sf, unsigned short thresh)
-{
-    unsigned char tmp[4];
-    long thresh_scaled = sf / 1000 * thresh;
-    tmp[0] = (unsigned char)(((long)thresh_scaled >> 24) & 0xFF);
-    tmp[1] = (unsigned char)(((long)thresh_scaled >> 16) & 0xFF);
-    tmp[2] = (unsigned char)(((long)thresh_scaled >> 8) & 0xFF);
-    tmp[3] = (unsigned char)((long)thresh_scaled & 0xFF);
-    return mpu_write_mem(D_1_92, 4, tmp);
-}
-
-/**
- *  @brief      Set shake rejection time.
- *  Sets the length of time that the gyro must be outside of the threshold set
- *  by @e gyro_set_shake_reject_thresh before taps are rejected. A mandatory
- *  60 ms is added to this parameter.
- *  @param[in]  time    Time in milliseconds.
- *  @return     0 if successful.
- */
-int dmp_set_shake_reject_time(unsigned short time)
-{
-    unsigned char tmp[2];
-
-    time /= (1000 / DMP_SAMPLE_RATE);
-    tmp[0] = time >> 8;
-    tmp[1] = time & 0xFF;
-    return mpu_write_mem(D_1_90,2,tmp);
-}
-
-/**
- *  @brief      Set shake rejection timeout.
- *  Sets the length of time after a shake rejection that the gyro must stay
- *  inside of the threshold before taps can be detected again. A mandatory
- *  60 ms is added to this parameter.
- *  @param[in]  time    Time in milliseconds.
- *  @return     0 if successful.
- */
-int dmp_set_shake_reject_timeout(unsigned short time)
-{
-    unsigned char tmp[2];
-
-    time /= (1000 / DMP_SAMPLE_RATE);
-    tmp[0] = time >> 8;
-    tmp[1] = time & 0xFF;
-    return mpu_write_mem(D_1_88,2,tmp);
-}
-
-/**
- *  @brief      Get current step count.
- *  @param[out] count   Number of steps detected.
- *  @return     0 if successful.
- */
-int dmp_get_pedometer_step_count(unsigned long *count)
-{
-    unsigned char tmp[4];
-    if (!count)
-        return -1;
-
-    if (mpu_read_mem(D_PEDSTD_STEPCTR, 4, tmp))
-        return -1;
-
-    count[0] = ((unsigned long)tmp[0] << 24) | ((unsigned long)tmp[1] << 16) |
-        ((unsigned long)tmp[2] << 8) | tmp[3];
-    return 0;
-}
-
-/**
- *  @brief      Overwrite current step count.
- *  WARNING: This function writes to DMP memory and could potentially encounter
- *  a race condition if called while the pedometer is enabled.
- *  @param[in]  count   New step count.
- *  @return     0 if successful.
- */
-int dmp_set_pedometer_step_count(unsigned long count)
-{
-    unsigned char tmp[4];
-
-    tmp[0] = (unsigned char)((count >> 24) & 0xFF);
-    tmp[1] = (unsigned char)((count >> 16) & 0xFF);
-    tmp[2] = (unsigned char)((count >> 8) & 0xFF);
-    tmp[3] = (unsigned char)(count & 0xFF);
-    return mpu_write_mem(D_PEDSTD_STEPCTR, 4, tmp);
-}
-
-/**
- *  @brief      Get duration of walking time.
- *  @param[in]  time    Walk time in milliseconds.
- *  @return     0 if successful.
- */
-int dmp_get_pedometer_walk_time(unsigned long *time)
-{
-    unsigned char tmp[4];
-    if (!time)
-        return -1;
-
-    if (mpu_read_mem(D_PEDSTD_TIMECTR, 4, tmp))
-        return -1;
-
-    time[0] = (((unsigned long)tmp[0] << 24) | ((unsigned long)tmp[1] << 16) |
-        ((unsigned long)tmp[2] << 8) | tmp[3]) * 20;
-    return 0;
-}
-
-/**
- *  @brief      Overwrite current walk time.
- *  WARNING: This function writes to DMP memory and could potentially encounter
- *  a race condition if called while the pedometer is enabled.
- *  @param[in]  time    New walk time in milliseconds.
- */
-int dmp_set_pedometer_walk_time(unsigned long time)
-{
-    unsigned char tmp[4];
-
-    time /= 20;
-
-    tmp[0] = (unsigned char)((time >> 24) & 0xFF);
-    tmp[1] = (unsigned char)((time >> 16) & 0xFF);
-    tmp[2] = (unsigned char)((time >> 8) & 0xFF);
-    tmp[3] = (unsigned char)(time & 0xFF);
-    return mpu_write_mem(D_PEDSTD_TIMECTR, 4, tmp);
-}
-
-/**
- *  @brief      Enable DMP features.
- *  The following \#define's are used in the input mask:
- *  \n DMP_FEATURE_TAP
- *  \n DMP_FEATURE_ANDROID_ORIENT
- *  \n DMP_FEATURE_LP_QUAT
- *  \n DMP_FEATURE_6X_LP_QUAT
- *  \n DMP_FEATURE_GYRO_CAL
- *  \n DMP_FEATURE_SEND_RAW_ACCEL
- *  \n DMP_FEATURE_SEND_RAW_GYRO
- *  \n NOTE: DMP_FEATURE_LP_QUAT and DMP_FEATURE_6X_LP_QUAT are mutually
- *  exclusive.
- *  \n NOTE: DMP_FEATURE_SEND_RAW_GYRO and DMP_FEATURE_SEND_CAL_GYRO are also
- *  mutually exclusive.
- *  @param[in]  mask    Mask of features to enable.
- *  @return     0 if successful.
- */
-int dmp_enable_feature(unsigned short mask)
-{
-    unsigned char tmp[10];
-
-    /* TODO: All of these settings can probably be integrated into the default
-     * DMP image.
-     */
-    /* Set integration scale factor. */
-    tmp[0] = (unsigned char)((GYRO_SF >> 24) & 0xFF);
-    tmp[1] = (unsigned char)((GYRO_SF >> 16) & 0xFF);
-    tmp[2] = (unsigned char)((GYRO_SF >> 8) & 0xFF);
-    tmp[3] = (unsigned char)(GYRO_SF & 0xFF);
-    mpu_write_mem(D_0_104, 4, tmp);
-
-    /* Send sensor data to the FIFO. */
-    tmp[0] = 0xA3;
-    if (mask & DMP_FEATURE_SEND_RAW_ACCEL) {
-        tmp[1] = 0xC0;
-        tmp[2] = 0xC8;
-        tmp[3] = 0xC2;
-    } else {
-        tmp[1] = 0xA3;
-        tmp[2] = 0xA3;
-        tmp[3] = 0xA3;
-    }
-    if (mask & DMP_FEATURE_SEND_ANY_GYRO) {
-        tmp[4] = 0xC4;
-        tmp[5] = 0xCC;
-        tmp[6] = 0xC6;
-    } else {
-        tmp[4] = 0xA3;
-        tmp[5] = 0xA3;
-        tmp[6] = 0xA3;
-    }
-    tmp[7] = 0xA3;
-    tmp[8] = 0xA3;
-    tmp[9] = 0xA3;
-    mpu_write_mem(CFG_15,10,tmp);
-
-    /* Send gesture data to the FIFO. */
-    if (mask & (DMP_FEATURE_TAP | DMP_FEATURE_ANDROID_ORIENT))
-        tmp[0] = DINA20;
-    else
-        tmp[0] = 0xD8;
-    mpu_write_mem(CFG_27,1,tmp);
-
-    if (mask & DMP_FEATURE_GYRO_CAL)
-        dmp_enable_gyro_cal(1);
-    else
-        dmp_enable_gyro_cal(0);
-
-    if (mask & DMP_FEATURE_SEND_ANY_GYRO) {
-        if (mask & DMP_FEATURE_SEND_CAL_GYRO) {
-            tmp[0] = 0xB2;
-            tmp[1] = 0x8B;
-            tmp[2] = 0xB6;
-            tmp[3] = 0x9B;
-        } else {
-            tmp[0] = DINAC0;
-            tmp[1] = DINA80;
-            tmp[2] = DINAC2;
-            tmp[3] = DINA90;
-        }
-        mpu_write_mem(CFG_GYRO_RAW_DATA, 4, tmp);
-    }
-
-    if (mask & DMP_FEATURE_TAP) {
-        /* Enable tap. */
-        tmp[0] = 0xF8;
-        mpu_write_mem(CFG_20, 1, tmp);
-        dmp_set_tap_thresh(TAP_XYZ, 250);
-        dmp_set_tap_axes(TAP_XYZ);
-        dmp_set_tap_count(1);
-        dmp_set_tap_time(100);
-        dmp_set_tap_time_multi(500);
-
-        dmp_set_shake_reject_thresh(GYRO_SF, 200);
-        dmp_set_shake_reject_time(40);
-        dmp_set_shake_reject_timeout(10);
-    } else {
-        tmp[0] = 0xD8;
-        mpu_write_mem(CFG_20, 1, tmp);
-    }
-
-    if (mask & DMP_FEATURE_ANDROID_ORIENT) {
-        tmp[0] = 0xD9;
-    } else
-        tmp[0] = 0xD8;
-    mpu_write_mem(CFG_ANDROID_ORIENT_INT, 1, tmp);
-
-    if (mask & DMP_FEATURE_LP_QUAT)
-        dmp_enable_lp_quat(1);
-    else
-        dmp_enable_lp_quat(0);
-
-    if (mask & DMP_FEATURE_6X_LP_QUAT)
-        dmp_enable_6x_lp_quat(1);
-    else
-        dmp_enable_6x_lp_quat(0);
-
-    /* Pedometer is always enabled. */
-    dmp.feature_mask = mask | DMP_FEATURE_PEDOMETER;
-    mpu_reset_fifo();
-
-    dmp.packet_length = 0;
-    if (mask & DMP_FEATURE_SEND_RAW_ACCEL)
-        dmp.packet_length += 6;
-    if (mask & DMP_FEATURE_SEND_ANY_GYRO)
-        dmp.packet_length += 6;
-    if (mask & (DMP_FEATURE_LP_QUAT | DMP_FEATURE_6X_LP_QUAT))
-        dmp.packet_length += 16;
-    if (mask & (DMP_FEATURE_TAP | DMP_FEATURE_ANDROID_ORIENT))
-        dmp.packet_length += 4;
-
-    return 0;
-}
-
-/**
- *  @brief      Get list of currently enabled DMP features.
- *  @param[out] Mask of enabled features.
- *  @return     0 if successful.
- */
-int dmp_get_enabled_features(unsigned short *mask)
-{
-    mask[0] = dmp.feature_mask;
-    return 0;
-}
-
-/**
- *  @brief      Calibrate the gyro data in the DMP.
- *  After eight seconds of no motion, the DMP will compute gyro biases and
- *  subtract them from the quaternion output. If @e dmp_enable_feature is
- *  called with @e DMP_FEATURE_SEND_CAL_GYRO, the biases will also be
- *  subtracted from the gyro output.
- *  @param[in]  enable  1 to enable gyro calibration.
- *  @return     0 if successful.
- */
-int dmp_enable_gyro_cal(unsigned char enable)
-{
-    if (enable) {
-        unsigned char regs[9] = {0xb8, 0xaa, 0xb3, 0x8d, 0xb4, 0x98, 0x0d, 0x35, 0x5d};
-        return mpu_write_mem(CFG_MOTION_BIAS, 9, regs);
-    } else {
-        unsigned char regs[9] = {0xb8, 0xaa, 0xaa, 0xaa, 0xb0, 0x88, 0xc3, 0xc5, 0xc7};
-        return mpu_write_mem(CFG_MOTION_BIAS, 9, regs);
-    }
-}
-
-/**
- *  @brief      Generate 3-axis quaternions from the DMP.
- *  In this driver, the 3-axis and 6-axis DMP quaternion features are mutually
- *  exclusive.
- *  @param[in]  enable  1 to enable 3-axis quaternion.
- *  @return     0 if successful.
- */
-int dmp_enable_lp_quat(unsigned char enable)
-{
-    unsigned char regs[4];
-    if (enable) {
-        regs[0] = DINBC0;
-        regs[1] = DINBC2;
-        regs[2] = DINBC4;
-        regs[3] = DINBC6;
-    }
-    else
-        memset(regs, 0x8B, 4);
-
-    mpu_write_mem(CFG_LP_QUAT, 4, regs);
-
-    return mpu_reset_fifo();
-}
-
-/**
- *  @brief       Generate 6-axis quaternions from the DMP.
- *  In this driver, the 3-axis and 6-axis DMP quaternion features are mutually
- *  exclusive.
- *  @param[in]   enable  1 to enable 6-axis quaternion.
- *  @return      0 if successful.
- */
-int dmp_enable_6x_lp_quat(unsigned char enable)
-{
-    unsigned char regs[4];
-    if (enable) {
-        regs[0] = DINA20;
-        regs[1] = DINA28;
-        regs[2] = DINA30;
-        regs[3] = DINA38;
-    } else
-        memset(regs, 0xA3, 4);
-
-    mpu_write_mem(CFG_8, 4, regs);
-
-    return mpu_reset_fifo();
-}
-
-/**
- *  @brief      Decode the four-byte gesture data and execute any callbacks.
- *  @param[in]  gesture Gesture data from DMP packet.
- *  @return     0 if successful.
- */
-static int decode_gesture(unsigned char *gesture)
-{
-    unsigned char tap, android_orient;
-
-    android_orient = gesture[3] & 0xC0;
-    tap = 0x3F & gesture[3];
-
-    if (gesture[1] & INT_SRC_TAP) {
-        unsigned char direction, count;
-        direction = tap >> 3;
-        count = (tap % 8) + 1;
-        if (dmp.tap_cb)
-            dmp.tap_cb(direction, count);
-    }
-
-    if (gesture[1] & INT_SRC_ANDROID_ORIENT) {
-        if (dmp.android_orient_cb)
-            dmp.android_orient_cb(android_orient >> 6);
-    }
-
-    return 0;
-}
-
-/**
- *  @brief      Specify when a DMP interrupt should occur.
- *  A DMP interrupt can be configured to trigger on either of the two
- *  conditions below:
- *  \n a. One FIFO period has elapsed (set by @e mpu_set_sample_rate).
- *  \n b. A tap event has been detected.
- *  @param[in]  mode    DMP_INT_GESTURE or DMP_INT_CONTINUOUS.
- *  @return     0 if successful.
- */
-int dmp_set_interrupt_mode(unsigned char mode)
-{
-    const unsigned char regs_continuous[11] =
-        {0xd8, 0xb1, 0xb9, 0xf3, 0x8b, 0xa3, 0x91, 0xb6, 0x09, 0xb4, 0xd9};
-    const unsigned char regs_gesture[11] =
-        {0xda, 0xb1, 0xb9, 0xf3, 0x8b, 0xa3, 0x91, 0xb6, 0xda, 0xb4, 0xda};
-
-    switch (mode) {
-    case DMP_INT_CONTINUOUS:
-        return mpu_write_mem(CFG_FIFO_ON_EVENT, 11,
-            (unsigned char*)regs_continuous);
-    case DMP_INT_GESTURE:
-        return mpu_write_mem(CFG_FIFO_ON_EVENT, 11,
-            (unsigned char*)regs_gesture);
-    default:
-        return -1;
-    }
-}
-
-/**
- *  @brief      Get one packet from the FIFO.
- *  If @e sensors does not contain a particular sensor, disregard the data
- *  returned to that pointer.
- *  \n @e sensors can contain a combination of the following flags:
- *  \n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
- *  \n INV_XYZ_GYRO
- *  \n INV_XYZ_ACCEL
- *  \n INV_WXYZ_QUAT
- *  \n If the FIFO has no new data, @e sensors will be zero.
- *  \n If the FIFO is disabled, @e sensors will be zero and this function will
- *  return a non-zero error code.
- *  @param[out] gyro        Gyro data in hardware units.
- *  @param[out] accel       Accel data in hardware units.
- *  @param[out] quat        3-axis quaternion data in hardware units.
- *  @param[out] timestamp   Timestamp in milliseconds.
- *  @param[out] sensors     Mask of sensors read from FIFO.
- *  @param[out] more        Number of remaining packets.
- *  @return     0 if successful.
- */
-int dmp_read_fifo(short *gyro, short *accel, long *quat,
-    unsigned long *timestamp, short *sensors, unsigned char *more)
-{
-    unsigned char fifo_data[MAX_PACKET_LENGTH];
-    unsigned char ii = 0;
-
-    /* TODO: sensors[0] only changes when dmp_enable_feature is called. We can
-     * cache this value and save some cycles.
-     */
-    sensors[0] = 0;
-
-    /* Get a packet. */
-    if (mpu_read_fifo_stream(dmp.packet_length, fifo_data, more))
-        return -1;
-
-    /* Parse DMP packet. */
-    if (dmp.feature_mask & (DMP_FEATURE_LP_QUAT | DMP_FEATURE_6X_LP_QUAT)) {
-#ifdef FIFO_CORRUPTION_CHECK
-        long quat_q14[4], quat_mag_sq;
-#endif
-        quat[0] = ((long)fifo_data[0] << 24) | ((long)fifo_data[1] << 16) |
-            ((long)fifo_data[2] << 8) | fifo_data[3];
-        quat[1] = ((long)fifo_data[4] << 24) | ((long)fifo_data[5] << 16) |
-            ((long)fifo_data[6] << 8) | fifo_data[7];
-        quat[2] = ((long)fifo_data[8] << 24) | ((long)fifo_data[9] << 16) |
-            ((long)fifo_data[10] << 8) | fifo_data[11];
-        quat[3] = ((long)fifo_data[12] << 24) | ((long)fifo_data[13] << 16) |
-            ((long)fifo_data[14] << 8) | fifo_data[15];
-        ii += 16;
-#ifdef FIFO_CORRUPTION_CHECK
-        /* We can detect a corrupted FIFO by monitoring the quaternion data and
-         * ensuring that the magnitude is always normalized to one. This
-         * shouldn't happen in normal operation, but if an I2C error occurs,
-         * the FIFO reads might become misaligned.
-         *
-         * Let's start by scaling down the quaternion data to avoid long long
-         * math.
-         */
-        quat_q14[0] = quat[0] >> 16;
-        quat_q14[1] = quat[1] >> 16;
-        quat_q14[2] = quat[2] >> 16;
-        quat_q14[3] = quat[3] >> 16;
-        quat_mag_sq = quat_q14[0] * quat_q14[0] + quat_q14[1] * quat_q14[1] +
-            quat_q14[2] * quat_q14[2] + quat_q14[3] * quat_q14[3];
-        if ((quat_mag_sq < QUAT_MAG_SQ_MIN) ||
-            (quat_mag_sq > QUAT_MAG_SQ_MAX)) {
-            /* Quaternion is outside of the acceptable threshold. */
-            mpu_reset_fifo();
-            sensors[0] = 0;
-            return -1;
-        }
-        sensors[0] |= INV_WXYZ_QUAT;
-#endif
-    }
-
-    if (dmp.feature_mask & DMP_FEATURE_SEND_RAW_ACCEL) {
-        accel[0] = ((short)fifo_data[ii+0] << 8) | fifo_data[ii+1];
-        accel[1] = ((short)fifo_data[ii+2] << 8) | fifo_data[ii+3];
-        accel[2] = ((short)fifo_data[ii+4] << 8) | fifo_data[ii+5];
-        ii += 6;
-        sensors[0] |= INV_XYZ_ACCEL;
-    }
-
-    if (dmp.feature_mask & DMP_FEATURE_SEND_ANY_GYRO) {
-        gyro[0] = ((short)fifo_data[ii+0] << 8) | fifo_data[ii+1];
-        gyro[1] = ((short)fifo_data[ii+2] << 8) | fifo_data[ii+3];
-        gyro[2] = ((short)fifo_data[ii+4] << 8) | fifo_data[ii+5];
-        ii += 6;
-        sensors[0] |= INV_XYZ_GYRO;
-    }
-
-    /* Gesture data is at the end of the DMP packet. Parse it and call
-     * the gesture callbacks (if registered).
-     */
-    if (dmp.feature_mask & (DMP_FEATURE_TAP | DMP_FEATURE_ANDROID_ORIENT))
-        decode_gesture(fifo_data + ii);
-
-    get_ms(timestamp);
-    return 0;
-}
-
-/**
- *  @brief      Register a function to be executed on a tap event.
- *  The tap direction is represented by one of the following:
- *  \n TAP_X_UP
- *  \n TAP_X_DOWN
- *  \n TAP_Y_UP
- *  \n TAP_Y_DOWN
- *  \n TAP_Z_UP
- *  \n TAP_Z_DOWN
- *  @param[in]  func    Callback function.
- *  @return     0 if successful.
- */
-int dmp_register_tap_cb(void (*func)(unsigned char, unsigned char))
-{
-    dmp.tap_cb = func;
-    return 0;
-}
-
-/**
- *  @brief      Register a function to be executed on a android orientation event.
- *  @param[in]  func    Callback function.
- *  @return     0 if successful.
- */
-int dmp_register_android_orient_cb(void (*func)(unsigned char))
-{
-    dmp.android_orient_cb = func;
-    return 0;
-}
-
-/**
- *  @}
- */
-

+ 0 - 97
Core备份3/imu3/inv_mpu_dmp_motion_driver3.h

@@ -1,97 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011-2012 InvenSense Corporation, All Rights Reserved.
-    See included License.txt for License information.
- $
- */
-/**
- *  @addtogroup  DRIVERS Sensor Driver Layer
- *  @brief       Hardware drivers to communicate with sensors via I2C.
- *
- *  @{
- *      @file       inv_mpu_dmp_motion_driver.h
- *      @brief      DMP image and interface functions.
- *      @details    All functions are preceded by the dmp_ prefix to
- *                  differentiate among MPL and general driver function calls.
- */
-#ifndef _INV_MPU_DMP_MOTION_DRIVER_H_
-#define _INV_MPU_DMP_MOTION_DRIVER_H_
-
-#define TAP_X               (0x01)
-#define TAP_Y               (0x02)
-#define TAP_Z               (0x04)
-#define TAP_XYZ             (0x07)
-
-#define TAP_X_UP            (0x01)
-#define TAP_X_DOWN          (0x02)
-#define TAP_Y_UP            (0x03)
-#define TAP_Y_DOWN          (0x04)
-#define TAP_Z_UP            (0x05)
-#define TAP_Z_DOWN          (0x06)
-
-#define ANDROID_ORIENT_PORTRAIT             (0x00)
-#define ANDROID_ORIENT_LANDSCAPE            (0x01)
-#define ANDROID_ORIENT_REVERSE_PORTRAIT     (0x02)
-#define ANDROID_ORIENT_REVERSE_LANDSCAPE    (0x03)
-
-#define DMP_INT_GESTURE     (0x01)
-#define DMP_INT_CONTINUOUS  (0x02)
-
-#define DMP_FEATURE_TAP             (0x001)
-#define DMP_FEATURE_ANDROID_ORIENT  (0x002)
-#define DMP_FEATURE_LP_QUAT         (0x004)
-#define DMP_FEATURE_PEDOMETER       (0x008)
-#define DMP_FEATURE_6X_LP_QUAT      (0x010)
-#define DMP_FEATURE_GYRO_CAL        (0x020)
-#define DMP_FEATURE_SEND_RAW_ACCEL  (0x040)
-#define DMP_FEATURE_SEND_RAW_GYRO   (0x080)
-#define DMP_FEATURE_SEND_CAL_GYRO   (0x100)
-
-#define INV_WXYZ_QUAT       (0x100)
-
-/* Set up functions. */
-int dmp_load_motion_driver_firmware(void);
-int dmp_set_fifo_rate(unsigned short rate);
-int dmp_get_fifo_rate(unsigned short *rate);
-int dmp_enable_feature(unsigned short mask);
-int dmp_get_enabled_features(unsigned short *mask);
-int dmp_set_interrupt_mode(unsigned char mode);
-int dmp_set_orientation(unsigned short orient);
-int dmp_set_gyro_bias(long *bias);
-int dmp_set_accel_bias(long *bias);
-
-/* Tap functions. */
-int dmp_register_tap_cb(void (*func)(unsigned char, unsigned char));
-int dmp_set_tap_thresh(unsigned char axis, unsigned short thresh);
-int dmp_set_tap_axes(unsigned char axis);
-int dmp_set_tap_count(unsigned char min_taps);
-int dmp_set_tap_time(unsigned short time);
-int dmp_set_tap_time_multi(unsigned short time);
-int dmp_set_shake_reject_thresh(long sf, unsigned short thresh);
-int dmp_set_shake_reject_time(unsigned short time);
-int dmp_set_shake_reject_timeout(unsigned short time);
-
-/* Android orientation functions. */
-int dmp_register_android_orient_cb(void (*func)(unsigned char));
-
-/* LP quaternion functions. */
-int dmp_enable_lp_quat(unsigned char enable);
-int dmp_enable_6x_lp_quat(unsigned char enable);
-
-/* Pedometer functions. */
-int dmp_get_pedometer_step_count(unsigned long *count);
-int dmp_set_pedometer_step_count(unsigned long count);
-int dmp_get_pedometer_walk_time(unsigned long *time);
-int dmp_set_pedometer_walk_time(unsigned long time);
-
-/* DMP gyro calibration functions. */
-int dmp_enable_gyro_cal(unsigned char enable);
-
-/* Read function. This function should be called whenever the MPU interrupt is
- * detected.
- */
-int dmp_read_fifo(short *gyro, short *accel, long *quat,
-    unsigned long *timestamp, short *sensors, unsigned char *more);
-
-#endif  /* #ifndef _INV_MPU_DMP_MOTION_DRIVER_H_ */
-

+ 0 - 542
Core备份3/imu4/MPU60504.c

@@ -1,542 +0,0 @@
-/*
- * MPU6050.c
- *
- *  Created on: Oct 26, 2021
- *      Author: Administrator
- */
-
-#include "MPU60504.h"
-
-#include <stdio.h>
-
- u8 IIC_Write_Byte(u8 reg, u8 value)
- {
-	 return IIC_Write_Len(MPU_ADDR, reg, 1, &value);
- }
-
- u8 IIC_Read_Byte(u8 reg)
- {
-	 u8 value = 0;
-
-	 IIC_Read_Len(MPU_ADDR, reg, 1, &value);
-
-	 return value;
- }
-
- //IIC连续写
- u8 IIC_Write_Len(u8 addr,u8 reg, u8 len, u8 *buf)
- {
-	 addr = (addr << 1) | 0;
-
-	 u8 data[10] = {0};
-	 data[0] = reg;
-	 for(int i = 0; i < len; i++)
-	 {
-		 data[1 + i] = buf[i];
-	 }
-
-	 if(HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)addr, (uint8_t*)data, len + 1, 10000)!= HAL_OK)
-	 {
-		 printf("++write len byte fail\r\n");
-		 return 1;
-	 }
-
-	 return 0;
- }
-
- //IIC连续读
- u8 IIC_Read_Len(u8 addr,u8 reg,u8 len,u8 *buf)
- {
-	 u8 tmp  = (addr << 1) | 0;
-	 if(HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)tmp, (uint8_t*)&reg, 1, 10000)!= HAL_OK)
-	 {
-		 printf("++write byte fail\r\n");
-		 return 1;
-	 }
-
-	 tmp  = (addr << 1) | 1;
-	 if(HAL_I2C_Master_Receive(&hi2c1, (uint16_t)tmp, (uint8_t *)buf, len, 10000) != HAL_OK)
-	 {
-		 printf("--read byte fail\r\n");
-	 }
-
- }
-
-
-//初始化MPU6050
-//返回值: 0,成功
-//        其他,错误代码
-u8 MPU_Init(void)
-{
-    u8 res = 0;
-
-    IIC_Write_Byte(MPU_PWR_MGMT1_REG,0X80);//复位MPU6050
-
-    HAL_Delay(100);
-
-    IIC_Write_Byte(MPU_PWR_MGMT1_REG,0X00);//唤醒MPU6050
-
-    MPU_Set_Gyro_Fsr(3); //陀螺仪传感器,±2000dps
-    MPU_Set_Accel_Fsr(0); //加速度传感器 ±2g
-    MPU_Set_Rate(50); //设置采样率50HZ
-    IIC_Write_Byte(MPU_INT_EN_REG,0X00); //关闭所有中断
-    IIC_Write_Byte(MPU_USER_CTRL_REG,0X00);//I2C主模式关闭
-    IIC_Write_Byte(MPU_FIFO_EN_REG,0X00);//关闭FIFO
-    IIC_Write_Byte(MPU_INTBP_CFG_REG,0X80);//INT引脚低电平有效
-
-    res=IIC_Read_Byte(MPU_DEVICE_ID_REG);
-
-    printf("the addr is:%d\r\n", res);
-
-    if(res==MPU_ADDR)//器件ID正确
-    {
-        IIC_Write_Byte(MPU_PWR_MGMT1_REG,0X01);//设置CLKSEL,PLL X 轴为参考
-        IIC_Write_Byte(MPU_PWR_MGMT2_REG,0X00);//加速度陀螺仪都工作
-        MPU_Set_Rate(50); //设置采样率为50HZ
-    }
-    else
-    {
-    	return 1;
-    }
-
-    return 0;
-}
-
-//设置MPU6050陀螺仪传感器满量程范围
-//fsr:0,±250dps;1,±500dps;2,±1000dps;3,±2000dps
-//返回值:0,设置成功
-//    其他,设置失败
-u8 MPU_Set_Gyro_Fsr(u8 fsr)
-{
-    return IIC_Write_Byte(MPU_GYRO_CFG_REG, fsr<<3);//设置陀螺仪满量程范围
-}
-
-//设置MPU6050加速度传感器满量程范围
-//fsr:0,±2g;1,±4g;2,±8g;3,±16g
-//返回值:0,设置成功
-//    其他,设置失败
-u8 MPU_Set_Accel_Fsr(u8 fsr)
-{
-    return IIC_Write_Byte(MPU_ACCEL_CFG_REG, fsr<<3);//设置加速度传感器满量程范围
-}
-
-//设置MPU6050的数字低通滤波器
-//lpf:数字低通滤波频率(Hz)
-//返回值:0,设置成功
-//    其他,设置失败
-u8 MPU_Set_LPF(u16 lpf)
-{
-    u8 data=0;
-    if(lpf>=188) data=1;
-    else if(lpf>=98) data=2;
-    else if(lpf>=42) data=2;
-    else if(lpf>=42) data=3;
-    else if(lpf>=20) data=4;
-    else if(lpf>=10) data=5;
-    else data=6;
-    return IIC_Write_Byte(MPU_CFG_REG,data);//设置数字低通滤波器
-}
-
-//设置MPU6050的采样率(假定Fs=1KHz)
-//rate:4~1000(Hz)
-//返回值:0,设置成功
-//    其他,设置失败
-u8 MPU_Set_Rate(u16 rate)
-{
-    u8 data;
-    if(rate>1000)rate=1000;
-    if(rate<4)rate=4;
-    data=1000/rate-1;
-    data=IIC_Write_Byte(MPU_SAMPLE_RATE_REG, data);  //设置数字低通滤波器
-    return MPU_Set_LPF(rate/2); //自动设置LPF为采样率的一半
-}
-
-//得到温度值
-//返回值:温度值(扩大了100倍)
-short MPU_Get_Temperature(void)
-{
-    u8 buf[2];
-    short raw;
-    float temp;
-    IIC_Read_Len(MPU_ADDR, MPU_TEMP_OUTH_REG, 2, buf);
-    raw=((u16)buf[0]<<8)|buf[1];
-    temp=36.53+((double)raw)/340;
-
-    return temp*100;;
-}
-
-//得到陀螺仪值(原始值)
-//gx,gy,gz:陀螺仪x,y,z轴的原始读数(带符号)
-//返回值:0,成功
-// 其他,错误代码
-u8 MPU_Get_Gyroscope(short *gx,short *gy,short *gz)
-{
-    u8 buf[6],res;
-    res=IIC_Read_Len(MPU_ADDR,MPU_GYRO_XOUTH_REG,6,buf);
-    if(res==0)
-    {
-        *gx=((u16)buf[0]<<8)|buf[1];
-        *gy=((u16)buf[2]<<8)|buf[3];
-        *gz=((u16)buf[4]<<8)|buf[5];
-    }
-    return res;
-}
-
-//得到加速度值(原始值)
-//ax,ay,az:陀螺仪x,y,z轴的原始读数(带符号)
-//返回值:0,成功
-//    其他,错误代码
-u8 MPU_Get_Accelerometer(short *ax,short *ay,short *az)
-{
-    u8 buf[6],res;
-    res=IIC_Read_Len(MPU_ADDR,MPU_ACCEL_XOUTH_REG,6,buf);
-    if(res==0)
-    {
-        *ax=((u16)buf[0]<<8)|buf[1];
-        *ay=((u16)buf[2]<<8)|buf[3];
-        *az=((u16)buf[4]<<8)|buf[5];
-    }
-    return res;;
-}
-
-/*--------------------以下为使用板载固件DMP的相关代码,这个融合得到的姿态角效果很好*/
-
-
-/**
-  * @brief  获取当前毫秒值
-  * @param  存储最新毫秒值的变量
-  * @retval 无
-  */
-int get_tick_count(unsigned long *count)
-{
-   count[0] = HAL_GetTick();
-	return 0;
-}
-
-
-#include "inv_mpu4.h"
-#include "inv_mpu_dmp_motion_driver4.h"
-
-/* Data requested by client. */
-#define PRINT_ACCEL     (0x01)
-#define PRINT_GYRO      (0x02)
-#define PRINT_QUAT      (0x04)
-
-#define ACCEL_ON        (0x01)
-#define GYRO_ON         (0x02)
-
-#define MOTION          (0)
-#define NO_MOTION       (1)
-
-/* Starting sampling rate. */ //100
-#define DEFAULT_MPU_HZ  (50)
-
-struct rx_s {
-    unsigned char header[3];
-    unsigned char cmd;
-};
-struct hal_s {
-    unsigned char sensors;
-    unsigned char dmp_on;
-    unsigned char wait_for_tap;
-    volatile unsigned char new_gyro;
-    unsigned short report;
-    unsigned short dmp_features;
-    unsigned char motion_int_mode;
-    struct rx_s rx;
-};
-static struct hal_s hal = {0};
-
-/* USB RX binary semaphore. Actually, it's just a flag. Not included in struct
- * because it's declared extern elsewhere.
- */
-volatile unsigned char rx_new;
-
-/* The sensors can be mounted onto the board in any orientation. The mounting
- * matrix seen below tells the MPL how to rotate the raw data from thei
- * driver(s).
- * TODO: The following matrices refer to the configuration on an internal test
- * board at Invensense. If needed, please modify the matrices to match the
- * chip-to-body matrix for your particular set up.
- */
-static signed char gyro_orientation[9] = {-1, 0, 0,
-                                           0,-1, 0,
-                                           0, 0, 1};
-
-/* Every time new gyro data is available, this function is called in an
- * ISR context. In this example, it sets a flag protecting the FIFO read
- * function.
- */
-static void gyro_data_ready_cb(void)
-{
-    hal.new_gyro = 1;
-}
-
-enum packet_type_e {
-    PACKET_TYPE_ACCEL,
-    PACKET_TYPE_GYRO,
-    PACKET_TYPE_QUAT,
-    PACKET_TYPE_TAP,
-    PACKET_TYPE_ANDROID_ORIENT,
-    PACKET_TYPE_PEDO,
-    PACKET_TYPE_MISC
-};
-
-#define BYTE u_char
-/* Send data to the Python client application.
- * Data is formatted as follows:
- * packet[0]    = $
- * packet[1]    = packet type (see packet_type_e)
- * packet[2+]   = data
- */
-void send_packet(char packet_type, void *data)
-{
-
-	#define MAX_BUF_LENGTH  (18)
-    char buf[MAX_BUF_LENGTH], length;
-
-    memset(buf, 0, MAX_BUF_LENGTH);
-    buf[0] = '$';
-    buf[1] = packet_type;
-
-    if (packet_type == PACKET_TYPE_ACCEL || packet_type == PACKET_TYPE_GYRO) {
-        short *sdata = (short*)data;
-        buf[2] = (char)(sdata[0] >> 8);
-        buf[3] = (char)sdata[0];
-        buf[4] = (char)(sdata[1] >> 8);
-        buf[5] = (char)sdata[1];
-        buf[6] = (char)(sdata[2] >> 8);
-        buf[7] = (char)sdata[2];
-        length = 8;
-    } else if (packet_type == PACKET_TYPE_QUAT) {
-        long *ldata = (long*)data;
-        buf[2] = (char)(ldata[0] >> 24);
-        buf[3] = (char)(ldata[0] >> 16);
-        buf[4] = (char)(ldata[0] >> 8);
-        buf[5] = (char)ldata[0];
-        buf[6] = (char)(ldata[1] >> 24);
-        buf[7] = (char)(ldata[1] >> 16);
-        buf[8] = (char)(ldata[1] >> 8);
-        buf[9] = (char)ldata[1];
-        buf[10] = (char)(ldata[2] >> 24);
-        buf[11] = (char)(ldata[2] >> 16);
-        buf[12] = (char)(ldata[2] >> 8);
-        buf[13] = (char)ldata[2];
-        buf[14] = (char)(ldata[3] >> 24);
-        buf[15] = (char)(ldata[3] >> 16);
-        buf[16] = (char)(ldata[3] >> 8);
-        buf[17] = (char)ldata[3];
-        length = 18;
-    } else if (packet_type == PACKET_TYPE_TAP) {
-        buf[2] = ((char*)data)[0];
-        buf[3] = ((char*)data)[1];
-        length = 4;
-    } else if (packet_type == PACKET_TYPE_ANDROID_ORIENT) {
-        buf[2] = ((char*)data)[0];
-        length = 3;
-    } else if (packet_type == PACKET_TYPE_PEDO) {
-        long *ldata = (long*)data;
-        buf[2] = (char)(ldata[0] >> 24);
-        buf[3] = (char)(ldata[0] >> 16);
-        buf[4] = (char)(ldata[0] >> 8);
-        buf[5] = (char)ldata[0];
-        buf[6] = (char)(ldata[1] >> 24);
-        buf[7] = (char)(ldata[1] >> 16);
-        buf[8] = (char)(ldata[1] >> 8);
-        buf[9] = (char)ldata[1];
-        length = 10;
-    } else if (packet_type == PACKET_TYPE_MISC) {
-        buf[2] = ((char*)data)[0];
-        buf[3] = ((char*)data)[1];
-        buf[4] = ((char*)data)[2];
-        buf[5] = ((char*)data)[3];
-        length = 6;
-    }
-
-//    cdcSendDataWaitTilDone((BYTE*)buf, length, CDC0_INTFNUM, 100);
-}
-
-/* These next two functions converts the orientation matrix (see
- * gyro_orientation) to a scalar representation for use by the DMP.
- * NOTE: These functions are borrowed from Invensense's MPL.
- */
-static inline unsigned short inv_row_2_scale(const signed char *row)
-{
-    unsigned short b;
-
-    if (row[0] > 0)
-        b = 0;
-    else if (row[0] < 0)
-        b = 4;
-    else if (row[1] > 0)
-        b = 1;
-    else if (row[1] < 0)
-        b = 5;
-    else if (row[2] > 0)
-        b = 2;
-    else if (row[2] < 0)
-        b = 6;
-    else
-        b = 7;      // error
-    return b;
-}
-static inline unsigned short inv_orientation_matrix_to_scalar(
-    const signed char *mtx)
-{
-    unsigned short scalar;
-
-    /*
-       XYZ  010_001_000 Identity Matrix
-       XZY  001_010_000
-       YXZ  010_000_001
-       YZX  000_010_001
-       ZXY  001_000_010
-       ZYX  000_001_010
-     */
-
-    scalar = inv_row_2_scale(mtx);
-    scalar |= inv_row_2_scale(mtx + 3) << 3;
-    scalar |= inv_row_2_scale(mtx + 6) << 6;
-
-
-    return scalar;
-}
-
-static inline void run_self_test(void)
-{
-    int result;
-    char test_packet[4] = {0};
-    long gyro[3], accel[3];
-
-    result = mpu_run_self_test(gyro, accel);
-    if (result == 0x7) {
-        /* Test passed. We can trust the gyro data here, so let's push it down
-         * to the DMP.
-         */
-        float sens;
-        unsigned short accel_sens;
-        mpu_get_gyro_sens(&sens);
-        gyro[0] = (long)(gyro[0] * sens);
-        gyro[1] = (long)(gyro[1] * sens);
-        gyro[2] = (long)(gyro[2] * sens);
-        dmp_set_gyro_bias(gyro);
-        mpu_get_accel_sens(&accel_sens);
-        accel[0] *= accel_sens;
-        accel[1] *= accel_sens;
-        accel[2] *= accel_sens;
-        dmp_set_accel_bias(accel);
-    }
-
-    /* Report results. */
-    test_packet[0] = 't';
-    test_packet[1] = result;
-    send_packet(PACKET_TYPE_MISC, test_packet);
-}
-
-
-#define INT_EXIT_LPM0 12
-
-void DMP_Init(void)
-{
-    struct int_param_s int_param;
-
-	/* Set up gyro.
-	 * Every function preceded by mpu_ is a driver function and can be found
-	 * in inv_mpu.h.
-	 */
-	int_param.cb = gyro_data_ready_cb;
-	int_param.pin = 16;
-	int_param.lp_exit = INT_EXIT_LPM0;
-	int_param.active_low = 1;
-
-	int result = mpu_init(&int_param);
-
-	printf("mpu_init, %d\r\n", result);
-
-	if(result == 0)     //mpu初始化
-	{
-		if(!mpu_set_sensors(INV_XYZ_GYRO | INV_XYZ_ACCEL))    //设置需要的传感器
-			printf("mpu_set_sensor complete ......\r\n");
-
-		if(!mpu_configure_fifo(INV_XYZ_GYRO | INV_XYZ_ACCEL)) //设置fifo
-			printf("mpu_configure_fifo complete ......\r\n");
-
-		if(!mpu_set_sample_rate(DEFAULT_MPU_HZ))              //设置采集样率
-			printf("mpu_set_sample_rate complete ......\r\n");
-
-
-		unsigned short gyro_rate = 0, gyro_fsr = 0;
-		unsigned char accel_fsr = 0;
-
-	    mpu_get_sample_rate(&gyro_rate);
-	    mpu_get_gyro_fsr(&gyro_fsr);
-	    mpu_get_accel_fsr(&accel_fsr);
-
-	    printf("gyro_rate %d, gyro_fsr %d, accel_fsr %d\r\n", gyro_rate, gyro_fsr, accel_fsr);
-
-
-
-		if(!dmp_load_motion_driver_firmware())                //加载dmp固件
-			printf("dmp_load_motion_driver_firmware complete ......\r\n");
-
-		if(!dmp_set_orientation(inv_orientation_matrix_to_scalar(gyro_orientation)))
-			printf("dmp_set_orientation complete ......\r\n"); //设置陀螺仪方向
-
-		if(!dmp_enable_feature(DMP_FEATURE_6X_LP_QUAT | DMP_FEATURE_TAP |
-				DMP_FEATURE_ANDROID_ORIENT | DMP_FEATURE_SEND_RAW_ACCEL | DMP_FEATURE_SEND_CAL_GYRO |
-				DMP_FEATURE_GYRO_CAL))
-			printf("dmp_enable_feature complete ......\r\n");
-
-		if(!dmp_set_fifo_rate(DEFAULT_MPU_HZ))    //设置速率
-			printf("dmp_set_fifo_rate complete ......\r\n");
-
-		run_self_test();                          //自检(非必要)
-
-		if(!mpu_set_dmp_state(1))                 //使能
-			printf("mpu_set_dmp_state complete ......\r\n");
-	}
-
-}
-
-#define q30 1073741824.0
-
-uint8_t Read_DMP(float* Pitch,float* Roll,float* Yaw)
-{
-	short gyro[3], accel[3], sensors;
-	float q0=1.0f,q1=0.0f,q2=0.0f,q3=0.0f;
-	unsigned long sensor_timestamp;
-	unsigned char more;
-	long quat[4];
-
-	int ret = dmp_read_fifo(gyro, accel, quat, &sensor_timestamp, &sensors, &more);
-
-//	printf("dmp_read_fifo, %d\r\n", ret);
-
-	if(ret)
-	{
-		return 1;
-	}
-
-	if (sensors & INV_WXYZ_QUAT)
-	{
-		q0=quat[0] / q30;
-		q1=quat[1] / q30;
-		q2=quat[2] / q30;
-		q3=quat[3] / q30;
-		*Pitch = (float)asin(-2 * q1 * q3 + 2 * q0* q2)* 57.3;
-		*Roll =  (float)atan2(2 * q2 * q3 + 2 * q0 * q1, -2 * q1 * q1 - 2 * q2* q2 + 1)* 57.3; // roll
-		*Yaw =   (float)atan2(2*(q1*q2 + q0*q3),q0*q0+q1*q1-q2*q2-q3*q3) * 57.3;
-		return 0;
-	}
-	else
-	{
-		return 2;
-	}
-
-}
-
-
-
-
-
-

+ 0 - 117
Core备份3/imu4/MPU60504.h

@@ -1,117 +0,0 @@
-/*
- * MPU6050.h
- *
- *  Created on: Oct 26, 2021
- *      Author: Administrator
- */
-
-#ifndef INC_MPU6050_H_
-#define INC_MPU6050_H_
-
-#include "i2c.h"
-#include "inv_mpu4.h"
-
-//#define MPU_ACCEL_OFFS_REG		0X06	//accel_offs寄存器,可读取版本号,寄存器手册未提到
-//#define MPU_PROD_ID_REG			0X0C	//prod id寄存器,在寄存器手册未提到
-#define MPU_SELF_TESTX_REG		0X0D	//自检寄存器X
-#define MPU_SELF_TESTY_REG		0X0E	//自检寄存器Y
-#define MPU_SELF_TESTZ_REG		0X0F	//自检寄存器Z
-#define MPU_SELF_TESTA_REG		0X10	//自检寄存器A
-#define MPU_SAMPLE_RATE_REG		0X19	//采样频率分频器
-#define MPU_CFG_REG				0X1A	//配置寄存器
-#define MPU_GYRO_CFG_REG		0X1B	//陀螺仪配置寄存器
-#define MPU_ACCEL_CFG_REG		0X1C	//加速度计配置寄存器
-#define MPU_MOTION_DET_REG		0X1F	//运动检测阀值设置寄存器
-#define MPU_FIFO_EN_REG			0X23	//FIFO使能寄存器
-#define MPU_I2CMST_CTRL_REG		0X24	//IIC主机控制寄存器
-#define MPU_I2CSLV0_ADDR_REG	0X25	//IIC从机0器件地址寄存器
-#define MPU_I2CSLV0_REG			0X26	//IIC从机0数据地址寄存器
-#define MPU_I2CSLV0_CTRL_REG	0X27	//IIC从机0控制寄存器
-#define MPU_I2CSLV1_ADDR_REG	0X28	//IIC从机1器件地址寄存器
-#define MPU_I2CSLV1_REG			0X29	//IIC从机1数据地址寄存器
-#define MPU_I2CSLV1_CTRL_REG	0X2A	//IIC从机1控制寄存器
-#define MPU_I2CSLV2_ADDR_REG	0X2B	//IIC从机2器件地址寄存器
-#define MPU_I2CSLV2_REG			0X2C	//IIC从机2数据地址寄存器
-#define MPU_I2CSLV2_CTRL_REG	0X2D	//IIC从机2控制寄存器
-#define MPU_I2CSLV3_ADDR_REG	0X2E	//IIC从机3器件地址寄存器
-#define MPU_I2CSLV3_REG			0X2F	//IIC从机3数据地址寄存器
-#define MPU_I2CSLV3_CTRL_REG	0X30	//IIC从机3控制寄存器
-#define MPU_I2CSLV4_ADDR_REG	0X31	//IIC从机4器件地址寄存器
-#define MPU_I2CSLV4_REG			0X32	//IIC从机4数据地址寄存器
-#define MPU_I2CSLV4_DO_REG		0X33	//IIC从机4写数据寄存器
-#define MPU_I2CSLV4_CTRL_REG	0X34	//IIC从机4控制寄存器
-#define MPU_I2CSLV4_DI_REG		0X35	//IIC从机4读数据寄存器
-
-#define MPU_I2CMST_STA_REG		0X36	//IIC主机状态寄存器
-#define MPU_INTBP_CFG_REG		0X37	//中断/旁路设置寄存器
-#define MPU_INT_EN_REG			0X38	//中断使能寄存器
-#define MPU_INT_STA_REG			0X3A	//中断状态寄存器
-
-#define MPU_ACCEL_XOUTH_REG		0X3B	//加速度值,X轴高8位寄存器
-#define MPU_ACCEL_XOUTL_REG		0X3C	//加速度值,X轴低8位寄存器
-#define MPU_ACCEL_YOUTH_REG		0X3D	//加速度值,Y轴高8位寄存器
-#define MPU_ACCEL_YOUTL_REG		0X3E	//加速度值,Y轴低8位寄存器
-#define MPU_ACCEL_ZOUTH_REG		0X3F	//加速度值,Z轴高8位寄存器
-#define MPU_ACCEL_ZOUTL_REG		0X40	//加速度值,Z轴低8位寄存器
-
-#define MPU_TEMP_OUTH_REG		0X41	//温度值高八位寄存器
-#define MPU_TEMP_OUTL_REG		0X42	//温度值低8位寄存器
-
-#define MPU_GYRO_XOUTH_REG		0X43	//陀螺仪值,X轴高8位寄存器
-#define MPU_GYRO_XOUTL_REG		0X44	//陀螺仪值,X轴低8位寄存器
-#define MPU_GYRO_YOUTH_REG		0X45	//陀螺仪值,Y轴高8位寄存器
-#define MPU_GYRO_YOUTL_REG		0X46	//陀螺仪值,Y轴低8位寄存器
-#define MPU_GYRO_ZOUTH_REG		0X47	//陀螺仪值,Z轴高8位寄存器
-#define MPU_GYRO_ZOUTL_REG		0X48	//陀螺仪值,Z轴低8位寄存器
-
-#define MPU_I2CSLV0_DO_REG		0X63	//IIC从机0数据寄存器
-#define MPU_I2CSLV1_DO_REG		0X64	//IIC从机1数据寄存器
-#define MPU_I2CSLV2_DO_REG		0X65	//IIC从机2数据寄存器
-#define MPU_I2CSLV3_DO_REG		0X66	//IIC从机3数据寄存器
-
-#define MPU_I2CMST_DELAY_REG	0X67	//IIC主机延时管理寄存器
-#define MPU_SIGPATH_RST_REG		0X68	//信号通道复位寄存器
-#define MPU_MDETECT_CTRL_REG	0X69	//运动检测控制寄存器
-#define MPU_USER_CTRL_REG		0X6A	//用户控制寄存器
-#define MPU_PWR_MGMT1_REG		0X6B	//电源管理寄存器1
-#define MPU_PWR_MGMT2_REG		0X6C	//电源管理寄存器2
-#define MPU_FIFO_CNTH_REG		0X72	//FIFO计数寄存器高八位
-#define MPU_FIFO_CNTL_REG		0X73	//FIFO计数寄存器低八位
-#define MPU_FIFO_RW_REG			0X74	//FIFO读写寄存器
-#define MPU_DEVICE_ID_REG		0X75	//器件ID寄存器
-
-//如果AD0脚接地,IIC地址为0X68(不包含最低位).
-//如果接V3.3,则IIC地址为0X69(不包含最低位).
-#define MPU_ADDR				0X68
-
-
-//因为模块AD0默认接GND,所以转为读写地址后,为0XD1和0XD0(如果接VCC,则为0XD3和0XD2)
-#define MPU_READ    0XD1
-#define MPU_WRITE   0XD0
-
-#define u8 uint8_t
-#define u16 uint16_t
-
-u8 MPU_Init(void); 								//初始化MPU6050
-u8 IIC_Write_Len(u8 addr,u8 reg,u8 len,u8 *buf);//IIC连续写
-u8 IIC_Read_Len(u8 addr,u8 reg,u8 len,u8 *buf); //IIC连续读
-u8 IIC_Write_Byte(u8 reg,u8 data);				//IIC写一个字节
-u8 IIC_Read_Byte(u8 reg);						//IIC读一个字节
-
-u8 MPU_Set_Gyro_Fsr(u8 fsr);
-u8 MPU_Set_Accel_Fsr(u8 fsr);
-u8 MPU_Set_LPF(u16 lpf);
-u8 MPU_Set_Rate(u16 rate);
-u8 MPU_Set_Fifo(u8 sens);
-
-
-short MPU_Get_Temperature(void);
-u8 MPU_Get_Gyroscope(short *gx,short *gy,short *gz);
-u8 MPU_Get_Accelerometer(short *ax,short *ay,short *az);
-
-//----------------------DMP-------------------------------
-void DMP_Init(void);
-uint8_t Read_DMP(float* Pitch,float* Roll,float* Yaw);
-int get_tick_count(unsigned long *count);
-
-#endif /* INC_MPU6050_H_ */

+ 0 - 494
Core备份3/imu4/dmpKey4.h

@@ -1,494 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011 InvenSense Corporation, All Rights Reserved.
- $
- */
-#ifndef DMPKEY_H__
-#define DMPKEY_H__
-
-#define KEY_CFG_25                  (0)
-#define KEY_CFG_24                  (KEY_CFG_25 + 1)
-#define KEY_CFG_26                  (KEY_CFG_24 + 1)
-#define KEY_CFG_27                  (KEY_CFG_26 + 1)
-#define KEY_CFG_21                  (KEY_CFG_27 + 1)
-#define KEY_CFG_20                  (KEY_CFG_21 + 1)
-#define KEY_CFG_TAP4                (KEY_CFG_20 + 1)
-#define KEY_CFG_TAP5                (KEY_CFG_TAP4 + 1)
-#define KEY_CFG_TAP6                (KEY_CFG_TAP5 + 1)
-#define KEY_CFG_TAP7                (KEY_CFG_TAP6 + 1)
-#define KEY_CFG_TAP0                (KEY_CFG_TAP7 + 1)
-#define KEY_CFG_TAP1                (KEY_CFG_TAP0 + 1)
-#define KEY_CFG_TAP2                (KEY_CFG_TAP1 + 1)
-#define KEY_CFG_TAP3                (KEY_CFG_TAP2 + 1)
-#define KEY_CFG_TAP_QUANTIZE        (KEY_CFG_TAP3 + 1)
-#define KEY_CFG_TAP_JERK            (KEY_CFG_TAP_QUANTIZE + 1)
-#define KEY_CFG_DR_INT              (KEY_CFG_TAP_JERK + 1)
-#define KEY_CFG_AUTH                (KEY_CFG_DR_INT + 1)
-#define KEY_CFG_TAP_SAVE_ACCB       (KEY_CFG_AUTH + 1)
-#define KEY_CFG_TAP_CLEAR_STICKY    (KEY_CFG_TAP_SAVE_ACCB + 1)
-#define KEY_CFG_FIFO_ON_EVENT       (KEY_CFG_TAP_CLEAR_STICKY + 1)
-#define KEY_FCFG_ACCEL_INPUT        (KEY_CFG_FIFO_ON_EVENT + 1)
-#define KEY_FCFG_ACCEL_INIT         (KEY_FCFG_ACCEL_INPUT + 1)
-#define KEY_CFG_23                  (KEY_FCFG_ACCEL_INIT + 1)
-#define KEY_FCFG_1                  (KEY_CFG_23 + 1)
-#define KEY_FCFG_3                  (KEY_FCFG_1 + 1)
-#define KEY_FCFG_2                  (KEY_FCFG_3 + 1)
-#define KEY_CFG_3D                  (KEY_FCFG_2 + 1)
-#define KEY_CFG_3B                  (KEY_CFG_3D + 1)
-#define KEY_CFG_3C                  (KEY_CFG_3B + 1)
-#define KEY_FCFG_5                  (KEY_CFG_3C + 1)
-#define KEY_FCFG_4                  (KEY_FCFG_5 + 1)
-#define KEY_FCFG_7                  (KEY_FCFG_4 + 1)
-#define KEY_FCFG_FSCALE             (KEY_FCFG_7 + 1)
-#define KEY_FCFG_AZ                 (KEY_FCFG_FSCALE + 1)
-#define KEY_FCFG_6                  (KEY_FCFG_AZ + 1)
-#define KEY_FCFG_LSB4               (KEY_FCFG_6 + 1)
-#define KEY_CFG_12                  (KEY_FCFG_LSB4 + 1)
-#define KEY_CFG_14                  (KEY_CFG_12 + 1)
-#define KEY_CFG_15                  (KEY_CFG_14 + 1)
-#define KEY_CFG_16                  (KEY_CFG_15 + 1)
-#define KEY_CFG_18                  (KEY_CFG_16 + 1)
-#define KEY_CFG_6                   (KEY_CFG_18 + 1)
-#define KEY_CFG_7                   (KEY_CFG_6 + 1)
-#define KEY_CFG_4                   (KEY_CFG_7 + 1)
-#define KEY_CFG_5                   (KEY_CFG_4 + 1)
-#define KEY_CFG_2                   (KEY_CFG_5 + 1)
-#define KEY_CFG_3                   (KEY_CFG_2 + 1)
-#define KEY_CFG_1                   (KEY_CFG_3 + 1)
-#define KEY_CFG_EXTERNAL            (KEY_CFG_1 + 1)
-#define KEY_CFG_8                   (KEY_CFG_EXTERNAL + 1)
-#define KEY_CFG_9                   (KEY_CFG_8 + 1)
-#define KEY_CFG_ORIENT_3            (KEY_CFG_9 + 1)
-#define KEY_CFG_ORIENT_2            (KEY_CFG_ORIENT_3 + 1)
-#define KEY_CFG_ORIENT_1            (KEY_CFG_ORIENT_2 + 1)
-#define KEY_CFG_GYRO_SOURCE         (KEY_CFG_ORIENT_1 + 1)
-#define KEY_CFG_ORIENT_IRQ_1        (KEY_CFG_GYRO_SOURCE + 1)
-#define KEY_CFG_ORIENT_IRQ_2        (KEY_CFG_ORIENT_IRQ_1 + 1)
-#define KEY_CFG_ORIENT_IRQ_3        (KEY_CFG_ORIENT_IRQ_2 + 1)
-#define KEY_FCFG_MAG_VAL            (KEY_CFG_ORIENT_IRQ_3 + 1)
-#define KEY_FCFG_MAG_MOV            (KEY_FCFG_MAG_VAL + 1)
-#define KEY_CFG_LP_QUAT             (KEY_FCFG_MAG_MOV + 1)
-
-/* MPU6050 keys */
-#define KEY_CFG_ACCEL_FILTER        (KEY_CFG_LP_QUAT + 1)
-#define KEY_CFG_MOTION_BIAS         (KEY_CFG_ACCEL_FILTER + 1)
-#define KEY_TEMPLABEL               (KEY_CFG_MOTION_BIAS + 1)
-
-#define KEY_D_0_22                  (KEY_TEMPLABEL + 1)
-#define KEY_D_0_24                  (KEY_D_0_22 + 1)
-#define KEY_D_0_36                  (KEY_D_0_24 + 1)
-#define KEY_D_0_52                  (KEY_D_0_36 + 1)
-#define KEY_D_0_96                  (KEY_D_0_52 + 1)
-#define KEY_D_0_104                 (KEY_D_0_96 + 1)
-#define KEY_D_0_108                 (KEY_D_0_104 + 1)
-#define KEY_D_0_163                 (KEY_D_0_108 + 1)
-#define KEY_D_0_188                 (KEY_D_0_163 + 1)
-#define KEY_D_0_192                 (KEY_D_0_188 + 1)
-#define KEY_D_0_224                 (KEY_D_0_192 + 1)
-#define KEY_D_0_228                 (KEY_D_0_224 + 1)
-#define KEY_D_0_232                 (KEY_D_0_228 + 1)
-#define KEY_D_0_236                 (KEY_D_0_232 + 1)
-
-#define KEY_DMP_PREVPTAT            (KEY_D_0_236 + 1)
-#define KEY_D_1_2                   (KEY_DMP_PREVPTAT + 1)
-#define KEY_D_1_4                   (KEY_D_1_2 + 1)
-#define KEY_D_1_8                   (KEY_D_1_4 + 1)
-#define KEY_D_1_10                  (KEY_D_1_8 + 1)
-#define KEY_D_1_24                  (KEY_D_1_10 + 1)
-#define KEY_D_1_28                  (KEY_D_1_24 + 1)
-#define KEY_D_1_36                  (KEY_D_1_28 + 1)
-#define KEY_D_1_40                  (KEY_D_1_36 + 1)
-#define KEY_D_1_44                  (KEY_D_1_40 + 1)
-#define KEY_D_1_72                  (KEY_D_1_44 + 1)
-#define KEY_D_1_74                  (KEY_D_1_72 + 1)
-#define KEY_D_1_79                  (KEY_D_1_74 + 1)
-#define KEY_D_1_88                  (KEY_D_1_79 + 1)
-#define KEY_D_1_90                  (KEY_D_1_88 + 1)
-#define KEY_D_1_92                  (KEY_D_1_90 + 1)
-#define KEY_D_1_96                  (KEY_D_1_92 + 1)
-#define KEY_D_1_98                  (KEY_D_1_96 + 1)
-#define KEY_D_1_100                 (KEY_D_1_98 + 1)
-#define KEY_D_1_106                 (KEY_D_1_100 + 1)
-#define KEY_D_1_108                 (KEY_D_1_106 + 1)
-#define KEY_D_1_112                 (KEY_D_1_108 + 1)
-#define KEY_D_1_128                 (KEY_D_1_112 + 1)
-#define KEY_D_1_152                 (KEY_D_1_128 + 1)
-#define KEY_D_1_160                 (KEY_D_1_152 + 1)
-#define KEY_D_1_168                 (KEY_D_1_160 + 1)
-#define KEY_D_1_175                 (KEY_D_1_168 + 1)
-#define KEY_D_1_176                 (KEY_D_1_175 + 1)
-#define KEY_D_1_178                 (KEY_D_1_176 + 1)
-#define KEY_D_1_179                 (KEY_D_1_178 + 1)
-#define KEY_D_1_218                 (KEY_D_1_179 + 1)
-#define KEY_D_1_232                 (KEY_D_1_218 + 1)
-#define KEY_D_1_236                 (KEY_D_1_232 + 1)
-#define KEY_D_1_240                 (KEY_D_1_236 + 1)
-#define KEY_D_1_244                 (KEY_D_1_240 + 1)
-#define KEY_D_1_250                 (KEY_D_1_244 + 1)
-#define KEY_D_1_252                 (KEY_D_1_250 + 1)
-#define KEY_D_2_12                  (KEY_D_1_252 + 1)
-#define KEY_D_2_96                  (KEY_D_2_12 + 1)
-#define KEY_D_2_108                 (KEY_D_2_96 + 1)
-#define KEY_D_2_208                 (KEY_D_2_108 + 1)
-#define KEY_FLICK_MSG               (KEY_D_2_208 + 1)
-#define KEY_FLICK_COUNTER           (KEY_FLICK_MSG + 1)
-#define KEY_FLICK_LOWER             (KEY_FLICK_COUNTER + 1)
-#define KEY_CFG_FLICK_IN            (KEY_FLICK_LOWER + 1)
-#define KEY_FLICK_UPPER             (KEY_CFG_FLICK_IN + 1)
-#define KEY_CGNOTICE_INTR           (KEY_FLICK_UPPER + 1)
-#define KEY_D_2_224                 (KEY_CGNOTICE_INTR + 1)
-#define KEY_D_2_244                 (KEY_D_2_224 + 1)
-#define KEY_D_2_248                 (KEY_D_2_244 + 1)
-#define KEY_D_2_252                 (KEY_D_2_248 + 1)
-
-#define KEY_D_GYRO_BIAS_X               (KEY_D_2_252 + 1)
-#define KEY_D_GYRO_BIAS_Y               (KEY_D_GYRO_BIAS_X + 1)
-#define KEY_D_GYRO_BIAS_Z               (KEY_D_GYRO_BIAS_Y + 1)
-#define KEY_D_ACC_BIAS_X                (KEY_D_GYRO_BIAS_Z + 1)
-#define KEY_D_ACC_BIAS_Y                (KEY_D_ACC_BIAS_X + 1)
-#define KEY_D_ACC_BIAS_Z                (KEY_D_ACC_BIAS_Y + 1)
-#define KEY_D_GYRO_ENABLE               (KEY_D_ACC_BIAS_Z + 1)
-#define KEY_D_ACCEL_ENABLE              (KEY_D_GYRO_ENABLE + 1)
-#define KEY_D_QUAT_ENABLE               (KEY_D_ACCEL_ENABLE +1)
-#define KEY_D_OUTPUT_ENABLE             (KEY_D_QUAT_ENABLE + 1)
-#define KEY_D_CR_TIME_G                 (KEY_D_OUTPUT_ENABLE + 1)
-#define KEY_D_CR_TIME_A                 (KEY_D_CR_TIME_G + 1)
-#define KEY_D_CR_TIME_Q                 (KEY_D_CR_TIME_A + 1)
-#define KEY_D_CS_TAX                    (KEY_D_CR_TIME_Q + 1)
-#define KEY_D_CS_TAY                    (KEY_D_CS_TAX + 1)
-#define KEY_D_CS_TAZ                    (KEY_D_CS_TAY + 1)
-#define KEY_D_CS_TGX                    (KEY_D_CS_TAZ + 1)
-#define KEY_D_CS_TGY                    (KEY_D_CS_TGX + 1)
-#define KEY_D_CS_TGZ                    (KEY_D_CS_TGY + 1)
-#define KEY_D_CS_TQ0                    (KEY_D_CS_TGZ + 1)
-#define KEY_D_CS_TQ1                    (KEY_D_CS_TQ0 + 1)
-#define KEY_D_CS_TQ2                    (KEY_D_CS_TQ1 + 1)
-#define KEY_D_CS_TQ3                    (KEY_D_CS_TQ2 + 1)
-
-/* Compass keys */
-#define KEY_CPASS_BIAS_X            (KEY_D_CS_TQ3 + 1)
-#define KEY_CPASS_BIAS_Y            (KEY_CPASS_BIAS_X + 1)
-#define KEY_CPASS_BIAS_Z            (KEY_CPASS_BIAS_Y + 1)
-#define KEY_CPASS_MTX_00            (KEY_CPASS_BIAS_Z + 1)
-#define KEY_CPASS_MTX_01            (KEY_CPASS_MTX_00 + 1)
-#define KEY_CPASS_MTX_02            (KEY_CPASS_MTX_01 + 1)
-#define KEY_CPASS_MTX_10            (KEY_CPASS_MTX_02 + 1)
-#define KEY_CPASS_MTX_11            (KEY_CPASS_MTX_10 + 1)
-#define KEY_CPASS_MTX_12            (KEY_CPASS_MTX_11 + 1)
-#define KEY_CPASS_MTX_20            (KEY_CPASS_MTX_12 + 1)
-#define KEY_CPASS_MTX_21            (KEY_CPASS_MTX_20 + 1)
-#define KEY_CPASS_MTX_22            (KEY_CPASS_MTX_21 + 1)
-
-/* Gesture Keys */
-#define KEY_DMP_TAPW_MIN            (KEY_CPASS_MTX_22 + 1)
-#define KEY_DMP_TAP_THR_X           (KEY_DMP_TAPW_MIN + 1)
-#define KEY_DMP_TAP_THR_Y           (KEY_DMP_TAP_THR_X + 1)
-#define KEY_DMP_TAP_THR_Z           (KEY_DMP_TAP_THR_Y + 1)
-#define KEY_DMP_SH_TH_Y             (KEY_DMP_TAP_THR_Z + 1)
-#define KEY_DMP_SH_TH_X             (KEY_DMP_SH_TH_Y + 1)
-#define KEY_DMP_SH_TH_Z             (KEY_DMP_SH_TH_X + 1)
-#define KEY_DMP_ORIENT              (KEY_DMP_SH_TH_Z + 1)
-#define KEY_D_ACT0                  (KEY_DMP_ORIENT + 1)
-#define KEY_D_ACSX                  (KEY_D_ACT0 + 1)
-#define KEY_D_ACSY                  (KEY_D_ACSX + 1)
-#define KEY_D_ACSZ                  (KEY_D_ACSY + 1)
-
-#define KEY_X_GRT_Y_TMP             (KEY_D_ACSZ + 1)
-#define KEY_SKIP_X_GRT_Y_TMP        (KEY_X_GRT_Y_TMP + 1)
-#define KEY_SKIP_END_COMPARE        (KEY_SKIP_X_GRT_Y_TMP + 1)
-#define KEY_END_COMPARE_Y_X_TMP2    (KEY_SKIP_END_COMPARE + 1)       
-#define KEY_CFG_ANDROID_ORIENT_INT  (KEY_END_COMPARE_Y_X_TMP2 + 1)
-#define KEY_NO_ORIENT_INTERRUPT     (KEY_CFG_ANDROID_ORIENT_INT + 1)
-#define KEY_END_COMPARE_Y_X_TMP     (KEY_NO_ORIENT_INTERRUPT + 1)
-#define KEY_END_ORIENT_1            (KEY_END_COMPARE_Y_X_TMP + 1)
-#define KEY_END_COMPARE_Y_X         (KEY_END_ORIENT_1 + 1) 
-#define KEY_END_ORIENT              (KEY_END_COMPARE_Y_X + 1)
-#define KEY_X_GRT_Y                 (KEY_END_ORIENT + 1)
-#define KEY_NOT_TIME_MINUS_1        (KEY_X_GRT_Y + 1)       
-#define KEY_END_COMPARE_Y_X_TMP3    (KEY_NOT_TIME_MINUS_1 + 1) 
-#define KEY_X_GRT_Y_TMP2            (KEY_END_COMPARE_Y_X_TMP3 + 1)
-
-/* Authenticate Keys */
-#define KEY_D_AUTH_OUT              (KEY_X_GRT_Y_TMP2 + 1)
-#define KEY_D_AUTH_IN               (KEY_D_AUTH_OUT + 1)
-#define KEY_D_AUTH_A                (KEY_D_AUTH_IN + 1)
-#define KEY_D_AUTH_B                (KEY_D_AUTH_A + 1)
-
-/* Pedometer standalone only keys */
-#define KEY_D_PEDSTD_BP_B           (KEY_D_AUTH_B + 1)
-#define KEY_D_PEDSTD_HP_A           (KEY_D_PEDSTD_BP_B + 1)
-#define KEY_D_PEDSTD_HP_B           (KEY_D_PEDSTD_HP_A + 1)
-#define KEY_D_PEDSTD_BP_A4          (KEY_D_PEDSTD_HP_B + 1)
-#define KEY_D_PEDSTD_BP_A3          (KEY_D_PEDSTD_BP_A4 + 1)
-#define KEY_D_PEDSTD_BP_A2          (KEY_D_PEDSTD_BP_A3 + 1)
-#define KEY_D_PEDSTD_BP_A1          (KEY_D_PEDSTD_BP_A2 + 1)
-#define KEY_D_PEDSTD_INT_THRSH      (KEY_D_PEDSTD_BP_A1 + 1)
-#define KEY_D_PEDSTD_CLIP           (KEY_D_PEDSTD_INT_THRSH + 1)
-#define KEY_D_PEDSTD_SB             (KEY_D_PEDSTD_CLIP + 1)
-#define KEY_D_PEDSTD_SB_TIME        (KEY_D_PEDSTD_SB + 1)
-#define KEY_D_PEDSTD_PEAKTHRSH      (KEY_D_PEDSTD_SB_TIME + 1)
-#define KEY_D_PEDSTD_TIML           (KEY_D_PEDSTD_PEAKTHRSH + 1)
-#define KEY_D_PEDSTD_TIMH           (KEY_D_PEDSTD_TIML + 1)
-#define KEY_D_PEDSTD_PEAK           (KEY_D_PEDSTD_TIMH + 1)
-#define KEY_D_PEDSTD_TIMECTR        (KEY_D_PEDSTD_PEAK + 1)
-#define KEY_D_PEDSTD_STEPCTR        (KEY_D_PEDSTD_TIMECTR + 1)
-#define KEY_D_PEDSTD_WALKTIME       (KEY_D_PEDSTD_STEPCTR + 1)
-#define KEY_D_PEDSTD_DECI           (KEY_D_PEDSTD_WALKTIME + 1)
-
-/*Host Based No Motion*/
-#define KEY_D_HOST_NO_MOT           (KEY_D_PEDSTD_DECI + 1)
-
-/* EIS keys */
-#define KEY_P_EIS_FIFO_FOOTER       (KEY_D_HOST_NO_MOT + 1)
-#define KEY_P_EIS_FIFO_YSHIFT       (KEY_P_EIS_FIFO_FOOTER + 1)
-#define KEY_P_EIS_DATA_RATE         (KEY_P_EIS_FIFO_YSHIFT + 1)
-#define KEY_P_EIS_FIFO_XSHIFT       (KEY_P_EIS_DATA_RATE + 1)
-#define KEY_P_EIS_FIFO_SYNC         (KEY_P_EIS_FIFO_XSHIFT + 1)
-#define KEY_P_EIS_FIFO_ZSHIFT       (KEY_P_EIS_FIFO_SYNC + 1)
-#define KEY_P_EIS_FIFO_READY        (KEY_P_EIS_FIFO_ZSHIFT + 1)
-#define KEY_DMP_FOOTER              (KEY_P_EIS_FIFO_READY + 1)
-#define KEY_DMP_INTX_HC             (KEY_DMP_FOOTER + 1)
-#define KEY_DMP_INTX_PH             (KEY_DMP_INTX_HC + 1)
-#define KEY_DMP_INTX_SH             (KEY_DMP_INTX_PH + 1)
-#define KEY_DMP_AINV_SH             (KEY_DMP_INTX_SH + 1)
-#define KEY_DMP_A_INV_XH            (KEY_DMP_AINV_SH + 1)
-#define KEY_DMP_AINV_PH             (KEY_DMP_A_INV_XH + 1)
-#define KEY_DMP_CTHX_H              (KEY_DMP_AINV_PH + 1)
-#define KEY_DMP_CTHY_H              (KEY_DMP_CTHX_H + 1)
-#define KEY_DMP_CTHZ_H              (KEY_DMP_CTHY_H + 1)
-#define KEY_DMP_NCTHX_H             (KEY_DMP_CTHZ_H + 1)
-#define KEY_DMP_NCTHY_H             (KEY_DMP_NCTHX_H + 1)
-#define KEY_DMP_NCTHZ_H             (KEY_DMP_NCTHY_H + 1)
-#define KEY_DMP_CTSQ_XH             (KEY_DMP_NCTHZ_H + 1)
-#define KEY_DMP_CTSQ_YH             (KEY_DMP_CTSQ_XH + 1)
-#define KEY_DMP_CTSQ_ZH             (KEY_DMP_CTSQ_YH + 1)
-#define KEY_DMP_INTX_H              (KEY_DMP_CTSQ_ZH + 1)
-#define KEY_DMP_INTY_H              (KEY_DMP_INTX_H + 1)
-#define KEY_DMP_INTZ_H              (KEY_DMP_INTY_H + 1)
-//#define KEY_DMP_HPX_H               (KEY_DMP_INTZ_H + 1)
-//#define KEY_DMP_HPY_H               (KEY_DMP_HPX_H + 1)
-//#define KEY_DMP_HPZ_H               (KEY_DMP_HPY_H + 1)
-
-/* Stream keys */
-#define KEY_STREAM_P_GYRO_Z         (KEY_DMP_INTZ_H + 1)
-#define KEY_STREAM_P_GYRO_Y         (KEY_STREAM_P_GYRO_Z + 1)
-#define KEY_STREAM_P_GYRO_X         (KEY_STREAM_P_GYRO_Y + 1)
-#define KEY_STREAM_P_TEMP           (KEY_STREAM_P_GYRO_X + 1)
-#define KEY_STREAM_P_AUX_Y          (KEY_STREAM_P_TEMP + 1)
-#define KEY_STREAM_P_AUX_X          (KEY_STREAM_P_AUX_Y + 1)
-#define KEY_STREAM_P_AUX_Z          (KEY_STREAM_P_AUX_X + 1)
-#define KEY_STREAM_P_ACCEL_Y        (KEY_STREAM_P_AUX_Z + 1)
-#define KEY_STREAM_P_ACCEL_X        (KEY_STREAM_P_ACCEL_Y + 1)
-#define KEY_STREAM_P_FOOTER         (KEY_STREAM_P_ACCEL_X + 1)
-#define KEY_STREAM_P_ACCEL_Z        (KEY_STREAM_P_FOOTER + 1)
-
-#define NUM_KEYS                    (KEY_STREAM_P_ACCEL_Z + 1)
-
-typedef struct {
-    unsigned short key;
-    unsigned short addr;
-} tKeyLabel;
-
-#define DINA0A 0x0a
-#define DINA22 0x22
-#define DINA42 0x42
-#define DINA5A 0x5a
-
-#define DINA06 0x06
-#define DINA0E 0x0e
-#define DINA16 0x16
-#define DINA1E 0x1e
-#define DINA26 0x26
-#define DINA2E 0x2e
-#define DINA36 0x36
-#define DINA3E 0x3e
-#define DINA46 0x46
-#define DINA4E 0x4e
-#define DINA56 0x56
-#define DINA5E 0x5e
-#define DINA66 0x66
-#define DINA6E 0x6e
-#define DINA76 0x76
-#define DINA7E 0x7e
-
-#define DINA00 0x00
-#define DINA08 0x08
-#define DINA10 0x10
-#define DINA18 0x18
-#define DINA20 0x20
-#define DINA28 0x28
-#define DINA30 0x30
-#define DINA38 0x38
-#define DINA40 0x40
-#define DINA48 0x48
-#define DINA50 0x50
-#define DINA58 0x58
-#define DINA60 0x60
-#define DINA68 0x68
-#define DINA70 0x70
-#define DINA78 0x78
-
-#define DINA04 0x04
-#define DINA0C 0x0c
-#define DINA14 0x14
-#define DINA1C 0x1C
-#define DINA24 0x24
-#define DINA2C 0x2c
-#define DINA34 0x34
-#define DINA3C 0x3c
-#define DINA44 0x44
-#define DINA4C 0x4c
-#define DINA54 0x54
-#define DINA5C 0x5c
-#define DINA64 0x64
-#define DINA6C 0x6c
-#define DINA74 0x74
-#define DINA7C 0x7c
-
-#define DINA01 0x01
-#define DINA09 0x09
-#define DINA11 0x11
-#define DINA19 0x19
-#define DINA21 0x21
-#define DINA29 0x29
-#define DINA31 0x31
-#define DINA39 0x39
-#define DINA41 0x41
-#define DINA49 0x49
-#define DINA51 0x51
-#define DINA59 0x59
-#define DINA61 0x61
-#define DINA69 0x69
-#define DINA71 0x71
-#define DINA79 0x79
-
-#define DINA25 0x25
-#define DINA2D 0x2d
-#define DINA35 0x35
-#define DINA3D 0x3d
-#define DINA4D 0x4d
-#define DINA55 0x55
-#define DINA5D 0x5D
-#define DINA6D 0x6d
-#define DINA75 0x75
-#define DINA7D 0x7d
-
-#define DINADC 0xdc
-#define DINAF2 0xf2
-#define DINAAB 0xab
-#define DINAAA 0xaa
-#define DINAF1 0xf1
-#define DINADF 0xdf
-#define DINADA 0xda
-#define DINAB1 0xb1
-#define DINAB9 0xb9
-#define DINAF3 0xf3
-#define DINA8B 0x8b
-#define DINAA3 0xa3
-#define DINA91 0x91
-#define DINAB6 0xb6
-#define DINAB4 0xb4
-
-
-#define DINC00 0x00
-#define DINC01 0x01
-#define DINC02 0x02
-#define DINC03 0x03
-#define DINC08 0x08
-#define DINC09 0x09
-#define DINC0A 0x0a
-#define DINC0B 0x0b
-#define DINC10 0x10
-#define DINC11 0x11
-#define DINC12 0x12
-#define DINC13 0x13
-#define DINC18 0x18
-#define DINC19 0x19
-#define DINC1A 0x1a
-#define DINC1B 0x1b
-
-#define DINC20 0x20
-#define DINC21 0x21
-#define DINC22 0x22
-#define DINC23 0x23
-#define DINC28 0x28
-#define DINC29 0x29
-#define DINC2A 0x2a
-#define DINC2B 0x2b
-#define DINC30 0x30
-#define DINC31 0x31
-#define DINC32 0x32
-#define DINC33 0x33
-#define DINC38 0x38
-#define DINC39 0x39
-#define DINC3A 0x3a
-#define DINC3B 0x3b
-
-#define DINC40 0x40
-#define DINC41 0x41
-#define DINC42 0x42
-#define DINC43 0x43
-#define DINC48 0x48
-#define DINC49 0x49
-#define DINC4A 0x4a
-#define DINC4B 0x4b
-#define DINC50 0x50
-#define DINC51 0x51
-#define DINC52 0x52
-#define DINC53 0x53
-#define DINC58 0x58
-#define DINC59 0x59
-#define DINC5A 0x5a
-#define DINC5B 0x5b
-
-#define DINC60 0x60
-#define DINC61 0x61
-#define DINC62 0x62
-#define DINC63 0x63
-#define DINC68 0x68
-#define DINC69 0x69
-#define DINC6A 0x6a
-#define DINC6B 0x6b
-#define DINC70 0x70
-#define DINC71 0x71
-#define DINC72 0x72
-#define DINC73 0x73
-#define DINC78 0x78
-#define DINC79 0x79
-#define DINC7A 0x7a
-#define DINC7B 0x7b
-
-#define DIND40 0x40
-
-
-#define DINA80 0x80
-#define DINA90 0x90
-#define DINAA0 0xa0
-#define DINAC9 0xc9
-#define DINACB 0xcb
-#define DINACD 0xcd
-#define DINACF 0xcf
-#define DINAC8 0xc8
-#define DINACA 0xca
-#define DINACC 0xcc
-#define DINACE 0xce
-#define DINAD8 0xd8
-#define DINADD 0xdd
-#define DINAF8 0xf0
-#define DINAFE 0xfe
-
-#define DINBF8 0xf8
-#define DINAC0 0xb0
-#define DINAC1 0xb1
-#define DINAC2 0xb4
-#define DINAC3 0xb5
-#define DINAC4 0xb8
-#define DINAC5 0xb9
-#define DINBC0 0xc0
-#define DINBC2 0xc2
-#define DINBC4 0xc4
-#define DINBC6 0xc6
-
-
-
-#endif // DMPKEY_H__

+ 0 - 264
Core备份3/imu4/dmpmap4.h

@@ -1,264 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011 InvenSense Corporation, All Rights Reserved.
- $
- */
-#ifndef DMPMAP_H
-#define DMPMAP_H
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#define DMP_PTAT    0
-#define DMP_XGYR    2
-#define DMP_YGYR    4
-#define DMP_ZGYR    6
-#define DMP_XACC    8
-#define DMP_YACC    10
-#define DMP_ZACC    12
-#define DMP_ADC1    14
-#define DMP_ADC2    16
-#define DMP_ADC3    18
-#define DMP_BIASUNC    20
-#define DMP_FIFORT    22
-#define DMP_INVGSFH    24
-#define DMP_INVGSFL    26
-#define DMP_1H    28
-#define DMP_1L    30
-#define DMP_BLPFSTCH    32
-#define DMP_BLPFSTCL    34
-#define DMP_BLPFSXH    36
-#define DMP_BLPFSXL    38
-#define DMP_BLPFSYH    40
-#define DMP_BLPFSYL    42
-#define DMP_BLPFSZH    44
-#define DMP_BLPFSZL    46
-#define DMP_BLPFMTC    48
-#define DMP_SMC    50
-#define DMP_BLPFMXH    52
-#define DMP_BLPFMXL    54
-#define DMP_BLPFMYH    56
-#define DMP_BLPFMYL    58
-#define DMP_BLPFMZH    60
-#define DMP_BLPFMZL    62
-#define DMP_BLPFC    64
-#define DMP_SMCTH    66
-#define DMP_0H2    68
-#define DMP_0L2    70
-#define DMP_BERR2H    72
-#define DMP_BERR2L    74
-#define DMP_BERR2NH    76
-#define DMP_SMCINC    78
-#define DMP_ANGVBXH    80
-#define DMP_ANGVBXL    82
-#define DMP_ANGVBYH    84
-#define DMP_ANGVBYL    86
-#define DMP_ANGVBZH    88
-#define DMP_ANGVBZL    90
-#define DMP_BERR1H    92
-#define DMP_BERR1L    94
-#define DMP_ATCH    96
-#define DMP_BIASUNCSF    98
-#define DMP_ACT2H    100
-#define DMP_ACT2L    102
-#define DMP_GSFH    104
-#define DMP_GSFL    106
-#define DMP_GH    108
-#define DMP_GL    110
-#define DMP_0_5H    112
-#define DMP_0_5L    114
-#define DMP_0_0H    116
-#define DMP_0_0L    118
-#define DMP_1_0H    120
-#define DMP_1_0L    122
-#define DMP_1_5H    124
-#define DMP_1_5L    126
-#define DMP_TMP1AH    128
-#define DMP_TMP1AL    130
-#define DMP_TMP2AH    132
-#define DMP_TMP2AL    134
-#define DMP_TMP3AH    136
-#define DMP_TMP3AL    138
-#define DMP_TMP4AH    140
-#define DMP_TMP4AL    142
-#define DMP_XACCW    144
-#define DMP_TMP5    146
-#define DMP_XACCB    148
-#define DMP_TMP8    150
-#define DMP_YACCB    152
-#define DMP_TMP9    154
-#define DMP_ZACCB    156
-#define DMP_TMP10    158
-#define DMP_DZH    160
-#define DMP_DZL    162
-#define DMP_XGCH    164
-#define DMP_XGCL    166
-#define DMP_YGCH    168
-#define DMP_YGCL    170
-#define DMP_ZGCH    172
-#define DMP_ZGCL    174
-#define DMP_YACCW    176
-#define DMP_TMP7    178
-#define DMP_AFB1H    180
-#define DMP_AFB1L    182
-#define DMP_AFB2H    184
-#define DMP_AFB2L    186
-#define DMP_MAGFBH    188
-#define DMP_MAGFBL    190
-#define DMP_QT1H    192
-#define DMP_QT1L    194
-#define DMP_QT2H    196
-#define DMP_QT2L    198
-#define DMP_QT3H    200
-#define DMP_QT3L    202
-#define DMP_QT4H    204
-#define DMP_QT4L    206
-#define DMP_CTRL1H    208
-#define DMP_CTRL1L    210
-#define DMP_CTRL2H    212
-#define DMP_CTRL2L    214
-#define DMP_CTRL3H    216
-#define DMP_CTRL3L    218
-#define DMP_CTRL4H    220
-#define DMP_CTRL4L    222
-#define DMP_CTRLS1    224
-#define DMP_CTRLSF1    226
-#define DMP_CTRLS2    228
-#define DMP_CTRLSF2    230
-#define DMP_CTRLS3    232
-#define DMP_CTRLSFNLL    234
-#define DMP_CTRLS4    236
-#define DMP_CTRLSFNL2    238
-#define DMP_CTRLSFNL    240
-#define DMP_TMP30    242
-#define DMP_CTRLSFJT    244
-#define DMP_TMP31    246
-#define DMP_TMP11    248
-#define DMP_CTRLSF2_2    250
-#define DMP_TMP12    252
-#define DMP_CTRLSF1_2    254
-#define DMP_PREVPTAT    256
-#define DMP_ACCZB    258
-#define DMP_ACCXB    264
-#define DMP_ACCYB    266
-#define DMP_1HB    272
-#define DMP_1LB    274
-#define DMP_0H    276
-#define DMP_0L    278
-#define DMP_ASR22H    280
-#define DMP_ASR22L    282
-#define DMP_ASR6H    284
-#define DMP_ASR6L    286
-#define DMP_TMP13    288
-#define DMP_TMP14    290
-#define DMP_FINTXH    292
-#define DMP_FINTXL    294
-#define DMP_FINTYH    296
-#define DMP_FINTYL    298
-#define DMP_FINTZH    300
-#define DMP_FINTZL    302
-#define DMP_TMP1BH    304
-#define DMP_TMP1BL    306
-#define DMP_TMP2BH    308
-#define DMP_TMP2BL    310
-#define DMP_TMP3BH    312
-#define DMP_TMP3BL    314
-#define DMP_TMP4BH    316
-#define DMP_TMP4BL    318
-#define DMP_STXG    320
-#define DMP_ZCTXG    322
-#define DMP_STYG    324
-#define DMP_ZCTYG    326
-#define DMP_STZG    328
-#define DMP_ZCTZG    330
-#define DMP_CTRLSFJT2    332
-#define DMP_CTRLSFJTCNT    334
-#define DMP_PVXG    336
-#define DMP_TMP15    338
-#define DMP_PVYG    340
-#define DMP_TMP16    342
-#define DMP_PVZG    344
-#define DMP_TMP17    346
-#define DMP_MNMFLAGH    352
-#define DMP_MNMFLAGL    354
-#define DMP_MNMTMH    356
-#define DMP_MNMTML    358
-#define DMP_MNMTMTHRH    360
-#define DMP_MNMTMTHRL    362
-#define DMP_MNMTHRH    364
-#define DMP_MNMTHRL    366
-#define DMP_ACCQD4H    368
-#define DMP_ACCQD4L    370
-#define DMP_ACCQD5H    372
-#define DMP_ACCQD5L    374
-#define DMP_ACCQD6H    376
-#define DMP_ACCQD6L    378
-#define DMP_ACCQD7H    380
-#define DMP_ACCQD7L    382
-#define DMP_ACCQD0H    384
-#define DMP_ACCQD0L    386
-#define DMP_ACCQD1H    388
-#define DMP_ACCQD1L    390
-#define DMP_ACCQD2H    392
-#define DMP_ACCQD2L    394
-#define DMP_ACCQD3H    396
-#define DMP_ACCQD3L    398
-#define DMP_XN2H    400
-#define DMP_XN2L    402
-#define DMP_XN1H    404
-#define DMP_XN1L    406
-#define DMP_YN2H    408
-#define DMP_YN2L    410
-#define DMP_YN1H    412
-#define DMP_YN1L    414
-#define DMP_YH    416
-#define DMP_YL    418
-#define DMP_B0H    420
-#define DMP_B0L    422
-#define DMP_A1H    424
-#define DMP_A1L    426
-#define DMP_A2H    428
-#define DMP_A2L    430
-#define DMP_SEM1    432
-#define DMP_FIFOCNT    434
-#define DMP_SH_TH_X    436
-#define DMP_PACKET    438
-#define DMP_SH_TH_Y    440
-#define DMP_FOOTER    442
-#define DMP_SH_TH_Z    444
-#define DMP_TEMP29    448
-#define DMP_TEMP30    450
-#define DMP_XACCB_PRE    452
-#define DMP_XACCB_PREL    454
-#define DMP_YACCB_PRE    456
-#define DMP_YACCB_PREL    458
-#define DMP_ZACCB_PRE    460
-#define DMP_ZACCB_PREL    462
-#define DMP_TMP22    464
-#define DMP_TAP_TIMER    466
-#define DMP_TAP_THX    468
-#define DMP_TAP_THY    472
-#define DMP_TAP_THZ    476
-#define DMP_TAPW_MIN    478
-#define DMP_TMP25    480
-#define DMP_TMP26    482
-#define DMP_TMP27    484
-#define DMP_TMP28    486
-#define DMP_ORIENT    488
-#define DMP_THRSH    490
-#define DMP_ENDIANH    492
-#define DMP_ENDIANL    494
-#define DMP_BLPFNMTCH    496
-#define DMP_BLPFNMTCL    498
-#define DMP_BLPFNMXH    500
-#define DMP_BLPFNMXL    502
-#define DMP_BLPFNMYH    504
-#define DMP_BLPFNMYL    506
-#define DMP_BLPFNMZH    508
-#define DMP_BLPFNMZL    510
-#ifdef __cplusplus
-}
-#endif
-#endif // DMPMAP_H

+ 0 - 2774
Core备份3/imu4/inv_mpu4.c

@@ -1,2774 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011-2012 InvenSense Corporation, All Rights Reserved.
-    See included License.txt for License information.
- $
- */
-/**
- *  @addtogroup  DRIVERS Sensor Driver Layer
- *  @brief       Hardware drivers to communicate with sensors via I2C.
- *
- *  @{
- *      @file       inv_mpu.c
- *      @brief      An I2C-based driver for Invensense gyroscopes.
- *      @details    This driver currently works for the following devices:
- *                  MPU6050
- *                  MPU6500
- *                  MPU9150 (or MPU6050 w/ AK8975 on the auxiliary bus)
- *                  MPU9250 (or MPU6500 w/ AK8963 on the auxiliary bus)
- */
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include "inv_mpu4.h"
-
-#include "MPU60504.h"
-
-
-/* The following functions must be defined for this platform:
- * i2c_write(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char const *data)
- * i2c_read(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char *data)
- * delay_ms(unsigned long num_ms)
- * get_ms(unsigned long *count)
- * reg_int_cb(void (*cb)(void), unsigned char port, unsigned char pin)
- * labs(long x)
- * fabsf(float x)
- * min(int a, int b)
- */
-#if defined MOTION_DRIVER_TARGET_MSP430
-#include "msp430.h"
-#include "msp430_i2c.h"
-#include "msp430_clock.h"
-#include "msp430_interrupt.h"
-#define i2c_write   msp430_i2c_write
-#define i2c_read    msp430_i2c_read
-#define delay_ms    msp430_delay_ms
-#define get_ms      msp430_get_clock_ms
-static inline int reg_int_cb(struct int_param_s *int_param)
-{
-    return msp430_reg_int_cb(int_param->cb, int_param->pin, int_param->lp_exit,
-        int_param->active_low);
-}
-#define log_i(...)     do {} while (0)
-#define log_e(...)     do {} while (0)
-/* labs is already defined by TI's toolchain. */
-/* fabs is for doubles. fabsf is for floats. */
-#define fabs        fabsf
-#define min(a,b) ((a<b)?a:b)
-#elif defined EMPL_TARGET_MSP430
-#include "msp430.h"
-#include "msp430_i2c.h"
-#include "msp430_clock.h"
-#include "msp430_interrupt.h"
-#include "log.h"
-#define i2c_write   msp430_i2c_write
-#define i2c_read    msp430_i2c_read
-#define delay_ms    msp430_delay_ms
-#define get_ms      msp430_get_clock_ms
-static inline int reg_int_cb(struct int_param_s *int_param)
-{
-    return msp430_reg_int_cb(int_param->cb, int_param->pin, int_param->lp_exit,
-        int_param->active_low);
-}
-#define log_i       MPL_LOGI
-#define log_e       MPL_LOGE
-/* labs is already defined by TI's toolchain. */
-/* fabs is for doubles. fabsf is for floats. */
-#define fabs        fabsf
-#define min(a,b) ((a<b)?a:b)
-#elif defined EMPL_TARGET_UC3L0
-/* Instead of using the standard TWI driver from the ASF library, we're using
- * a TWI driver that follows the slave address + register address convention.
- */
-#include "twi.h"
-#include "delay.h"
-#include "sysclk.h"
-#include "log.h"
-#include "sensors_xplained.h"
-#include "uc3l0_clock.h"
-#define i2c_write(a, b, c, d)   twi_write(a, b, d, c)
-#define i2c_read(a, b, c, d)    twi_read(a, b, d, c)
-/* delay_ms is a function already defined in ASF. */
-#define get_ms  uc3l0_get_clock_ms
-static inline int reg_int_cb(struct int_param_s *int_param)
-{
-    sensor_board_irq_connect(int_param->pin, int_param->cb, int_param->arg);
-    return 0;
-}
-#define log_i       MPL_LOGI
-#define log_e       MPL_LOGE
-/* UC3 is a 32-bit processor, so abs and labs are equivalent. */
-#define labs        abs
-#define fabs(x)     (((x)>0)?(x):-(x))
-#elif defined MOTION_DRIVER_TARGET_STM32
-
-/* The following functions must be defined for this platform:
- * i2c_write(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char const *data)
- * i2c_read(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char *data)
- * delay_ms(unsigned long num_ms)
- * get_ms(unsigned long *count)
- * reg_int_cb(void (*cb)(void), unsigned char port, unsigned char pin)
- * labs(long x)
- * fabsf(float x)
- * min(int a, int b)
- */
-
-#define i2c_write   IIC_Write_Len
-#define i2c_read    IIC_Read_Len
-#define delay_ms    HAL_Delay
-#define get_ms      get_tick_count
-//static inline int reg_int_cb(struct int_param_s *int_param)
-//{
-////    return msp430_reg_int_cb(int_param->cb, int_param->pin, int_param->lp_exit,
-////        int_param->active_low);
-//}
-//#define log_i(...)     do {} while (0)
-//#define log_e(...)     do {} while (0)
-
-#define log_i     printf
-#define log_e     printf
-
-/* labs is already defined by TI's toolchain. */
-/* fabs is for doubles. fabsf is for floats. */
-#define fabs        fabsf
-#define min(a,b) ((a<b)?a:b)
-
-#else
-#error  Gyro driver is missing the system layer implementations.
-#endif
-
-#if !defined MPU6050 && !defined MPU9150 && !defined MPU6500 && !defined MPU9250
-#error  Which gyro are you using? Define MPUxxxx in your compiler options.
-#endif
-
-/* Time for some messy macro work. =]
- * #define MPU9150
- * is equivalent to..
- * #define MPU6050
- * #define AK8975_SECONDARY
- *
- * #define MPU9250
- * is equivalent to..
- * #define MPU6500
- * #define AK8963_SECONDARY
- */
-#if defined MPU9150
-#ifndef MPU6050
-#define MPU6050
-#endif                          /* #ifndef MPU6050 */
-#if defined AK8963_SECONDARY
-#error "MPU9150 and AK8963_SECONDARY cannot both be defined."
-#elif !defined AK8975_SECONDARY /* #if defined AK8963_SECONDARY */
-#define AK8975_SECONDARY
-#endif                          /* #if defined AK8963_SECONDARY */
-#elif defined MPU9250           /* #if defined MPU9150 */
-#ifndef MPU6500
-#define MPU6500
-#endif                          /* #ifndef MPU6500 */
-#if defined AK8975_SECONDARY
-#error "MPU9250 and AK8975_SECONDARY cannot both be defined."
-#elif !defined AK8963_SECONDARY /* #if defined AK8975_SECONDARY */
-#define AK8963_SECONDARY
-#endif                          /* #if defined AK8975_SECONDARY */
-#endif                          /* #if defined MPU9150 */
-
-#if defined AK8975_SECONDARY || defined AK8963_SECONDARY
-#define AK89xx_SECONDARY
-#else
-/* #warning "No compass = less profit for Invensense. Lame." */
-#endif
-
-static int set_int_enable(unsigned char enable);
-
-/* Hardware registers needed by driver. */
-struct gyro_reg_s {
-    unsigned char who_am_i;
-    unsigned char rate_div;
-    unsigned char lpf;
-    unsigned char prod_id;
-    unsigned char user_ctrl;
-    unsigned char fifo_en;
-    unsigned char gyro_cfg;
-    unsigned char accel_cfg;
-    unsigned char accel_cfg2;
-    unsigned char lp_accel_odr;
-    unsigned char motion_thr;
-    unsigned char motion_dur;
-    unsigned char fifo_count_h;
-    unsigned char fifo_r_w;
-    unsigned char raw_gyro;
-    unsigned char raw_accel;
-    unsigned char temp;
-    unsigned char int_enable;
-    unsigned char dmp_int_status;
-    unsigned char int_status;
-    unsigned char accel_intel;
-    unsigned char pwr_mgmt_1;
-    unsigned char pwr_mgmt_2;
-    unsigned char int_pin_cfg;
-    unsigned char mem_r_w;
-    unsigned char accel_offs;
-    unsigned char i2c_mst;
-    unsigned char bank_sel;
-    unsigned char mem_start_addr;
-    unsigned char prgm_start_h;
-#if defined AK89xx_SECONDARY
-    unsigned char s0_addr;
-    unsigned char s0_reg;
-    unsigned char s0_ctrl;
-    unsigned char s1_addr;
-    unsigned char s1_reg;
-    unsigned char s1_ctrl;
-    unsigned char s4_ctrl;
-    unsigned char s0_do;
-    unsigned char s1_do;
-    unsigned char i2c_delay_ctrl;
-    unsigned char raw_compass;
-    /* The I2C_MST_VDDIO bit is in this register. */
-    unsigned char yg_offs_tc;
-#endif
-};
-
-/* Information specific to a particular device. */
-struct hw_s {
-    unsigned char addr;
-    unsigned short max_fifo;
-    unsigned char num_reg;
-    unsigned short temp_sens;
-    short temp_offset;
-    unsigned short bank_size;
-#if defined AK89xx_SECONDARY
-    unsigned short compass_fsr;
-#endif
-};
-
-/* When entering motion interrupt mode, the driver keeps track of the
- * previous state so that it can be restored at a later time.
- * TODO: This is tacky. Fix it.
- */
-struct motion_int_cache_s {
-    unsigned short gyro_fsr;
-    unsigned char accel_fsr;
-    unsigned short lpf;
-    unsigned short sample_rate;
-    unsigned char sensors_on;
-    unsigned char fifo_sensors;
-    unsigned char dmp_on;
-};
-
-/* Cached chip configuration data.
- * TODO: A lot of these can be handled with a bitmask.
- */
-struct chip_cfg_s {
-    /* Matches gyro_cfg >> 3 & 0x03 */
-    unsigned char gyro_fsr;
-    /* Matches accel_cfg >> 3 & 0x03 */
-    unsigned char accel_fsr;
-    /* Enabled sensors. Uses same masks as fifo_en, NOT pwr_mgmt_2. */
-    unsigned char sensors;
-    /* Matches config register. */
-    unsigned char lpf;
-    unsigned char clk_src;
-    /* Sample rate, NOT rate divider. */
-    unsigned short sample_rate;
-    /* Matches fifo_en register. */
-    unsigned char fifo_enable;
-    /* Matches int enable register. */
-    unsigned char int_enable;
-    /* 1 if devices on auxiliary I2C bus appear on the primary. */
-    unsigned char bypass_mode;
-    /* 1 if half-sensitivity.
-     * NOTE: This doesn't belong here, but everything else in hw_s is const,
-     * and this allows us to save some precious RAM.
-     */
-    unsigned char accel_half;
-    /* 1 if device in low-power accel-only mode. */
-    unsigned char lp_accel_mode;
-    /* 1 if interrupts are only triggered on motion events. */
-    unsigned char int_motion_only;
-    struct motion_int_cache_s cache;
-    /* 1 for active low interrupts. */
-    unsigned char active_low_int;
-    /* 1 for latched interrupts. */
-    unsigned char latched_int;
-    /* 1 if DMP is enabled. */
-    unsigned char dmp_on;
-    /* Ensures that DMP will only be loaded once. */
-    unsigned char dmp_loaded;
-    /* Sampling rate used when DMP is enabled. */
-    unsigned short dmp_sample_rate;
-#ifdef AK89xx_SECONDARY
-    /* Compass sample rate. */
-    unsigned short compass_sample_rate;
-    unsigned char compass_addr;
-    short mag_sens_adj[3];
-#endif
-};
-
-/* Information for self-test. */
-struct test_s {
-    unsigned long gyro_sens;
-    unsigned long accel_sens;
-    unsigned char reg_rate_div;
-    unsigned char reg_lpf;
-    unsigned char reg_gyro_fsr;
-    unsigned char reg_accel_fsr;
-    unsigned short wait_ms;
-    unsigned char packet_thresh;
-    float min_dps;
-    float max_dps;
-    float max_gyro_var;
-    float min_g;
-    float max_g;
-    float max_accel_var;
-};
-
-/* Gyro driver state variables. */
-struct gyro_state_s {
-    const struct gyro_reg_s *reg;
-    const struct hw_s *hw;
-    struct chip_cfg_s chip_cfg;
-    const struct test_s *test;
-};
-
-/* Filter configurations. */
-enum lpf_e {
-    INV_FILTER_256HZ_NOLPF2 = 0,
-    INV_FILTER_188HZ,
-    INV_FILTER_98HZ,
-    INV_FILTER_42HZ,
-    INV_FILTER_20HZ,
-    INV_FILTER_10HZ,
-    INV_FILTER_5HZ,
-    INV_FILTER_2100HZ_NOLPF,
-    NUM_FILTER
-};
-
-/* Full scale ranges. */
-enum gyro_fsr_e {
-    INV_FSR_250DPS = 0,
-    INV_FSR_500DPS,
-    INV_FSR_1000DPS,
-    INV_FSR_2000DPS,
-    NUM_GYRO_FSR
-};
-
-/* Full scale ranges. */
-enum accel_fsr_e {
-    INV_FSR_2G = 0,
-    INV_FSR_4G,
-    INV_FSR_8G,
-    INV_FSR_16G,
-    NUM_ACCEL_FSR
-};
-
-/* Clock sources. */
-enum clock_sel_e {
-    INV_CLK_INTERNAL = 0,
-    INV_CLK_PLL,
-    NUM_CLK
-};
-
-/* Low-power accel wakeup rates. */
-enum lp_accel_rate_e {
-#if defined MPU6050
-    INV_LPA_1_25HZ,
-    INV_LPA_5HZ,
-    INV_LPA_20HZ,
-    INV_LPA_40HZ
-#elif defined MPU6500
-    INV_LPA_0_3125HZ,
-    INV_LPA_0_625HZ,
-    INV_LPA_1_25HZ,
-    INV_LPA_2_5HZ,
-    INV_LPA_5HZ,
-    INV_LPA_10HZ,
-    INV_LPA_20HZ,
-    INV_LPA_40HZ,
-    INV_LPA_80HZ,
-    INV_LPA_160HZ,
-    INV_LPA_320HZ,
-    INV_LPA_640HZ
-#endif
-};
-
-#define BIT_I2C_MST_VDDIO   (0x80)
-#define BIT_FIFO_EN         (0x40)
-#define BIT_DMP_EN          (0x80)
-#define BIT_FIFO_RST        (0x04)
-#define BIT_DMP_RST         (0x08)
-#define BIT_FIFO_OVERFLOW   (0x10)
-#define BIT_DATA_RDY_EN     (0x01)
-#define BIT_DMP_INT_EN      (0x02)
-#define BIT_MOT_INT_EN      (0x40)
-#define BITS_FSR            (0x18)
-#define BITS_LPF            (0x07)
-#define BITS_HPF            (0x07)
-#define BITS_CLK            (0x07)
-#define BIT_FIFO_SIZE_1024  (0x40)
-#define BIT_FIFO_SIZE_2048  (0x80)
-#define BIT_FIFO_SIZE_4096  (0xC0)
-#define BIT_RESET           (0x80)
-#define BIT_SLEEP           (0x40)
-#define BIT_S0_DELAY_EN     (0x01)
-#define BIT_S2_DELAY_EN     (0x04)
-#define BITS_SLAVE_LENGTH   (0x0F)
-#define BIT_SLAVE_BYTE_SW   (0x40)
-#define BIT_SLAVE_GROUP     (0x10)
-#define BIT_SLAVE_EN        (0x80)
-#define BIT_I2C_READ        (0x80)
-#define BITS_I2C_MASTER_DLY (0x1F)
-#define BIT_AUX_IF_EN       (0x20)
-#define BIT_ACTL            (0x80)
-#define BIT_LATCH_EN        (0x20)
-#define BIT_ANY_RD_CLR      (0x10)
-#define BIT_BYPASS_EN       (0x02)
-#define BITS_WOM_EN         (0xC0)
-#define BIT_LPA_CYCLE       (0x20)
-#define BIT_STBY_XA         (0x20)
-#define BIT_STBY_YA         (0x10)
-#define BIT_STBY_ZA         (0x08)
-#define BIT_STBY_XG         (0x04)
-#define BIT_STBY_YG         (0x02)
-#define BIT_STBY_ZG         (0x01)
-#define BIT_STBY_XYZA       (BIT_STBY_XA | BIT_STBY_YA | BIT_STBY_ZA)
-#define BIT_STBY_XYZG       (BIT_STBY_XG | BIT_STBY_YG | BIT_STBY_ZG)
-
-#if defined AK8975_SECONDARY
-#define SUPPORTS_AK89xx_HIGH_SENS   (0x00)
-#define AK89xx_FSR                  (9830)
-#elif defined AK8963_SECONDARY
-#define SUPPORTS_AK89xx_HIGH_SENS   (0x10)
-#define AK89xx_FSR                  (4915)
-#endif
-
-#ifdef AK89xx_SECONDARY
-#define AKM_REG_WHOAMI      (0x00)
-
-#define AKM_REG_ST1         (0x02)
-#define AKM_REG_HXL         (0x03)
-#define AKM_REG_ST2         (0x09)
-
-#define AKM_REG_CNTL        (0x0A)
-#define AKM_REG_ASTC        (0x0C)
-#define AKM_REG_ASAX        (0x10)
-#define AKM_REG_ASAY        (0x11)
-#define AKM_REG_ASAZ        (0x12)
-
-#define AKM_DATA_READY      (0x01)
-#define AKM_DATA_OVERRUN    (0x02)
-#define AKM_OVERFLOW        (0x80)
-#define AKM_DATA_ERROR      (0x40)
-
-#define AKM_BIT_SELF_TEST   (0x40)
-
-#define AKM_POWER_DOWN          (0x00 | SUPPORTS_AK89xx_HIGH_SENS)
-#define AKM_SINGLE_MEASUREMENT  (0x01 | SUPPORTS_AK89xx_HIGH_SENS)
-#define AKM_FUSE_ROM_ACCESS     (0x0F | SUPPORTS_AK89xx_HIGH_SENS)
-#define AKM_MODE_SELF_TEST      (0x08 | SUPPORTS_AK89xx_HIGH_SENS)
-
-#define AKM_WHOAMI      (0x48)
-#endif
-
-#if defined MPU6050
-const struct gyro_reg_s reg = {
-    .who_am_i       = 0x75,
-    .rate_div       = 0x19,
-    .lpf            = 0x1A,
-    .prod_id        = 0x0C,
-    .user_ctrl      = 0x6A,
-    .fifo_en        = 0x23,
-    .gyro_cfg       = 0x1B,
-    .accel_cfg      = 0x1C,
-    .motion_thr     = 0x1F,
-    .motion_dur     = 0x20,
-    .fifo_count_h   = 0x72,
-    .fifo_r_w       = 0x74,
-    .raw_gyro       = 0x43,
-    .raw_accel      = 0x3B,
-    .temp           = 0x41,
-    .int_enable     = 0x38,
-    .dmp_int_status = 0x39,
-    .int_status     = 0x3A,
-    .pwr_mgmt_1     = 0x6B,
-    .pwr_mgmt_2     = 0x6C,
-    .int_pin_cfg    = 0x37,
-    .mem_r_w        = 0x6F,
-    .accel_offs     = 0x06,
-    .i2c_mst        = 0x24,
-    .bank_sel       = 0x6D,
-    .mem_start_addr = 0x6E,
-    .prgm_start_h   = 0x70
-#ifdef AK89xx_SECONDARY
-    ,.raw_compass   = 0x49,
-    .yg_offs_tc     = 0x01,
-    .s0_addr        = 0x25,
-    .s0_reg         = 0x26,
-    .s0_ctrl        = 0x27,
-    .s1_addr        = 0x28,
-    .s1_reg         = 0x29,
-    .s1_ctrl        = 0x2A,
-    .s4_ctrl        = 0x34,
-    .s0_do          = 0x63,
-    .s1_do          = 0x64,
-    .i2c_delay_ctrl = 0x67
-#endif
-};
-const struct hw_s hw = {
-    .addr           = 0x68,
-    .max_fifo       = 1024,
-    .num_reg        = 118,
-    .temp_sens      = 340,
-    .temp_offset    = -521,
-    .bank_size      = 256
-#if defined AK89xx_SECONDARY
-    ,.compass_fsr    = AK89xx_FSR
-#endif
-};
-
-const struct test_s test = {
-    .gyro_sens      = 32768/250,
-    .accel_sens     = 32768/16,
-    .reg_rate_div   = 0,    /* 1kHz. */
-    .reg_lpf        = 1,    /* 188Hz. */
-    .reg_gyro_fsr   = 0,    /* 250dps. */
-    .reg_accel_fsr  = 0x18, /* 16g. */
-    .wait_ms        = 50,
-    .packet_thresh  = 5,    /* 5% */
-    .min_dps        = 10.f,
-    .max_dps        = 105.f,
-    .max_gyro_var   = 0.14f,
-    .min_g          = 0.3f,
-    .max_g          = 0.95f,
-    .max_accel_var  = 0.14f
-};
-
-static struct gyro_state_s st = {
-    .reg = &reg,
-    .hw = &hw,
-    .test = &test
-};
-#elif defined MPU6500
-const struct gyro_reg_s reg = {
-    .who_am_i       = 0x75,
-    .rate_div       = 0x19,
-    .lpf            = 0x1A,
-    .prod_id        = 0x0C,
-    .user_ctrl      = 0x6A,
-    .fifo_en        = 0x23,
-    .gyro_cfg       = 0x1B,
-    .accel_cfg      = 0x1C,
-    .accel_cfg2     = 0x1D,
-    .lp_accel_odr   = 0x1E,
-    .motion_thr     = 0x1F,
-    .motion_dur     = 0x20,
-    .fifo_count_h   = 0x72,
-    .fifo_r_w       = 0x74,
-    .raw_gyro       = 0x43,
-    .raw_accel      = 0x3B,
-    .temp           = 0x41,
-    .int_enable     = 0x38,
-    .dmp_int_status = 0x39,
-    .int_status     = 0x3A,
-    .accel_intel    = 0x69,
-    .pwr_mgmt_1     = 0x6B,
-    .pwr_mgmt_2     = 0x6C,
-    .int_pin_cfg    = 0x37,
-    .mem_r_w        = 0x6F,
-    .accel_offs     = 0x77,
-    .i2c_mst        = 0x24,
-    .bank_sel       = 0x6D,
-    .mem_start_addr = 0x6E,
-    .prgm_start_h   = 0x70
-#ifdef AK89xx_SECONDARY
-    ,.raw_compass   = 0x49,
-    .s0_addr        = 0x25,
-    .s0_reg         = 0x26,
-    .s0_ctrl        = 0x27,
-    .s1_addr        = 0x28,
-    .s1_reg         = 0x29,
-    .s1_ctrl        = 0x2A,
-    .s4_ctrl        = 0x34,
-    .s0_do          = 0x63,
-    .s1_do          = 0x64,
-    .i2c_delay_ctrl = 0x67
-#endif
-};
-const struct hw_s hw = {
-    .addr           = 0x68,
-    .max_fifo       = 1024,
-    .num_reg        = 128,
-    .temp_sens      = 321,
-    .temp_offset    = 0,
-    .bank_size      = 256
-#if defined AK89xx_SECONDARY
-    ,.compass_fsr    = AK89xx_FSR
-#endif
-};
-
-const struct test_s test = {
-    .gyro_sens      = 32768/250,
-    .accel_sens     = 32768/16,
-    .reg_rate_div   = 0,    /* 1kHz. */
-    .reg_lpf        = 1,    /* 188Hz. */
-    .reg_gyro_fsr   = 0,    /* 250dps. */
-    .reg_accel_fsr  = 0x18, /* 16g. */
-    .wait_ms        = 50,
-    .packet_thresh  = 5,    /* 5% */
-    .min_dps        = 10.f,
-    .max_dps        = 105.f,
-    .max_gyro_var   = 0.14f,
-    .min_g          = 0.3f,
-    .max_g          = 0.95f,
-    .max_accel_var  = 0.14f
-};
-
-static struct gyro_state_s st = {
-    .reg = &reg,
-    .hw = &hw,
-    .test = &test
-};
-#endif
-
-#define MAX_PACKET_LENGTH (12)
-
-#ifdef AK89xx_SECONDARY
-static int setup_compass(void);
-#define MAX_COMPASS_SAMPLE_RATE (100)
-#endif
-
-/**
- *  @brief      Enable/disable data ready interrupt.
- *  If the DMP is on, the DMP interrupt is enabled. Otherwise, the data ready
- *  interrupt is used.
- *  @param[in]  enable      1 to enable interrupt.
- *  @return     0 if successful.
- */
-static int set_int_enable(unsigned char enable)
-{
-    unsigned char tmp;
-
-    if (st.chip_cfg.dmp_on) {
-        if (enable)
-            tmp = BIT_DMP_INT_EN;
-        else
-            tmp = 0x00;
-        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &tmp))
-            return -1;
-        st.chip_cfg.int_enable = tmp;
-    } else {
-        if (!st.chip_cfg.sensors)
-            return -1;
-        if (enable && st.chip_cfg.int_enable)
-            return 0;
-        if (enable)
-            tmp = BIT_DATA_RDY_EN;
-        else
-            tmp = 0x00;
-        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &tmp))
-            return -1;
-        st.chip_cfg.int_enable = tmp;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Register dump for testing.
- *  @return     0 if successful.
- */
-int mpu_reg_dump(void)
-{
-    unsigned char ii;
-    unsigned char data;
-
-    for (ii = 0; ii < st.hw->num_reg; ii++) {
-        if (ii == st.reg->fifo_r_w || ii == st.reg->mem_r_w)
-            continue;
-        if (i2c_read(st.hw->addr, ii, 1, &data))
-            return -1;
-        log_i("%#5x: %#5x\r\n", ii, data);
-    }
-    return 0;
-}
-
-/**
- *  @brief      Read from a single register.
- *  NOTE: The memory and FIFO read/write registers cannot be accessed.
- *  @param[in]  reg     Register address.
- *  @param[out] data    Register data.
- *  @return     0 if successful.
- */
-int mpu_read_reg(unsigned char reg, unsigned char *data)
-{
-    if (reg == st.reg->fifo_r_w || reg == st.reg->mem_r_w)
-        return -1;
-    if (reg >= st.hw->num_reg)
-        return -1;
-    return i2c_read(st.hw->addr, reg, 1, data);
-}
-
-/**
- *  @brief      Initialize hardware.
- *  Initial configuration:\n
- *  Gyro FSR: +/- 2000DPS\n
- *  Accel FSR +/- 2G\n
- *  DLPF: 42Hz\n
- *  FIFO rate: 50Hz\n
- *  Clock source: Gyro PLL\n
- *  FIFO: Disabled.\n
- *  Data ready interrupt: Disabled, active low, unlatched.
- *  @param[in]  int_param   Platform-specific parameters to interrupt API.
- *  @return     0 if successful.
- */
-int mpu_init(struct int_param_s *int_param)
-{
-    unsigned char data[6], rev;
-
-    /* Reset device. */
-    data[0] = BIT_RESET;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, data))
-        return -1;
-    delay_ms(100);
-
-    /* Wake up chip. */
-    data[0] = 0x00;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, data))
-        return -1;
-
-#if defined MPU6050
-    /* Check product revision. */
-    if (i2c_read(st.hw->addr, st.reg->accel_offs, 6, data))
-        return -1;
-    rev = ((data[5] & 0x01) << 2) | ((data[3] & 0x01) << 1) |
-        (data[1] & 0x01);
-
-    if (rev) {
-        /* Congrats, these parts are better. */
-        if (rev == 1)
-            st.chip_cfg.accel_half = 1;
-        else if (rev == 2)
-            st.chip_cfg.accel_half = 0;
-        else {
-            log_e("Unsupported software product rev %d.\n", rev);
-            return -1;
-        }
-    } else {
-        if (i2c_read(st.hw->addr, st.reg->prod_id, 1, data))
-            return -1;
-        rev = data[0] & 0x0F;
-        if (!rev) {
-            log_e("Product ID read as 0 indicates device is either "
-                "incompatible or an MPU3050.\n");
-            return -1;
-        } else if (rev == 4) {
-            log_i("Half sensitivity part found.\n");
-            st.chip_cfg.accel_half = 1;
-        } else
-            st.chip_cfg.accel_half = 0;
-    }
-#elif defined MPU6500
-#define MPU6500_MEM_REV_ADDR    (0x17)
-    if (mpu_read_mem(MPU6500_MEM_REV_ADDR, 1, &rev))
-        return -1;
-    if (rev == 0x1)
-        st.chip_cfg.accel_half = 0;
-    else {
-        log_e("Unsupported software product rev %d.\n", rev);
-        return -1;
-    }
-
-    /* MPU6500 shares 4kB of memory between the DMP and the FIFO. Since the
-     * first 3kB are needed by the DMP, we'll use the last 1kB for the FIFO.
-     */
-    data[0] = BIT_FIFO_SIZE_1024 | 0x8;
-    if (i2c_write(st.hw->addr, st.reg->accel_cfg2, 1, data))
-        return -1;
-#endif
-
-    /* Set to invalid values to ensure no I2C writes are skipped. */
-    st.chip_cfg.sensors = 0xFF;
-    st.chip_cfg.gyro_fsr = 0xFF;
-    st.chip_cfg.accel_fsr = 0xFF;
-    st.chip_cfg.lpf = 0xFF;
-    st.chip_cfg.sample_rate = 0xFFFF;
-    st.chip_cfg.fifo_enable = 0xFF;
-    st.chip_cfg.bypass_mode = 0xFF;
-#ifdef AK89xx_SECONDARY
-    st.chip_cfg.compass_sample_rate = 0xFFFF;
-#endif
-    /* mpu_set_sensors always preserves this setting. */
-    st.chip_cfg.clk_src = INV_CLK_PLL;
-    /* Handled in next call to mpu_set_bypass. */
-    st.chip_cfg.active_low_int = 1;
-    st.chip_cfg.latched_int = 0;
-    st.chip_cfg.int_motion_only = 0;
-    st.chip_cfg.lp_accel_mode = 0;
-    memset(&st.chip_cfg.cache, 0, sizeof(st.chip_cfg.cache));
-    st.chip_cfg.dmp_on = 0;
-    st.chip_cfg.dmp_loaded = 0;
-    st.chip_cfg.dmp_sample_rate = 0;
-
-    if (mpu_set_gyro_fsr(2000))
-        return -1;
-    if (mpu_set_accel_fsr(2))
-        return -1;
-    if (mpu_set_lpf(42))
-        return -1;
-    if (mpu_set_sample_rate(50))
-        return -1;
-    if (mpu_configure_fifo(0))
-        return -1;
-
-#ifndef MOTION_DRIVER_TARGET_STM32
-    if (int_param)
-        reg_int_cb(int_param);
-#endif
-
-#ifdef AK89xx_SECONDARY
-    setup_compass();
-    if (mpu_set_compass_sample_rate(10))
-        return -1;
-#else
-    /* Already disabled by setup_compass. */
-    if (mpu_set_bypass(0))
-        return -1;
-#endif
-
-    mpu_set_sensors(0);
-    return 0;
-}
-
-/**
- *  @brief      Enter low-power accel-only mode.
- *  In low-power accel mode, the chip goes to sleep and only wakes up to sample
- *  the accelerometer at one of the following frequencies:
- *  \n MPU6050: 1.25Hz, 5Hz, 20Hz, 40Hz
- *  \n MPU6500: 1.25Hz, 2.5Hz, 5Hz, 10Hz, 20Hz, 40Hz, 80Hz, 160Hz, 320Hz, 640Hz
- *  \n If the requested rate is not one listed above, the device will be set to
- *  the next highest rate. Requesting a rate above the maximum supported
- *  frequency will result in an error.
- *  \n To select a fractional wake-up frequency, round down the value passed to
- *  @e rate.
- *  @param[in]  rate        Minimum sampling rate, or zero to disable LP
- *                          accel mode.
- *  @return     0 if successful.
- */
-int mpu_lp_accel_mode(unsigned char rate)
-{
-    unsigned char tmp[2];
-
-    if (rate > 40)
-        return -1;
-
-    if (!rate) {
-        mpu_set_int_latched(0);
-        tmp[0] = 0;
-        tmp[1] = BIT_STBY_XYZG;
-        if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 2, tmp))
-            return -1;
-        st.chip_cfg.lp_accel_mode = 0;
-        return 0;
-    }
-    /* For LP accel, we automatically configure the hardware to produce latched
-     * interrupts. In LP accel mode, the hardware cycles into sleep mode before
-     * it gets a chance to deassert the interrupt pin; therefore, we shift this
-     * responsibility over to the MCU.
-     *
-     * Any register read will clear the interrupt.
-     */
-    mpu_set_int_latched(1);
-#if defined MPU6050
-    tmp[0] = BIT_LPA_CYCLE;
-    if (rate == 1) {
-        tmp[1] = INV_LPA_1_25HZ;
-        mpu_set_lpf(5);
-    } else if (rate <= 5) {
-        tmp[1] = INV_LPA_5HZ;
-        mpu_set_lpf(5);
-    } else if (rate <= 20) {
-        tmp[1] = INV_LPA_20HZ;
-        mpu_set_lpf(10);
-    } else {
-        tmp[1] = INV_LPA_40HZ;
-        mpu_set_lpf(20);
-    }
-    tmp[1] = (tmp[1] << 6) | BIT_STBY_XYZG;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 2, tmp))
-        return -1;
-#elif defined MPU6500
-    /* Set wake frequency. */
-    if (rate == 1)
-        tmp[0] = INV_LPA_1_25HZ;
-    else if (rate == 2)
-        tmp[0] = INV_LPA_2_5HZ;
-    else if (rate <= 5)
-        tmp[0] = INV_LPA_5HZ;
-    else if (rate <= 10)
-        tmp[0] = INV_LPA_10HZ;
-    else if (rate <= 20)
-        tmp[0] = INV_LPA_20HZ;
-    else if (rate <= 40)
-        tmp[0] = INV_LPA_40HZ;
-    else if (rate <= 80)
-        tmp[0] = INV_LPA_80HZ;
-    else if (rate <= 160)
-        tmp[0] = INV_LPA_160HZ;
-    else if (rate <= 320)
-        tmp[0] = INV_LPA_320HZ;
-    else
-        tmp[0] = INV_LPA_640HZ;
-    if (i2c_write(st.hw->addr, st.reg->lp_accel_odr, 1, tmp))
-        return -1;
-    tmp[0] = BIT_LPA_CYCLE;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, tmp))
-        return -1;
-#endif
-    st.chip_cfg.sensors = INV_XYZ_ACCEL;
-    st.chip_cfg.clk_src = 0;
-    st.chip_cfg.lp_accel_mode = 1;
-    mpu_configure_fifo(0);
-
-    return 0;
-}
-
-/**
- *  @brief      Read raw gyro data directly from the registers.
- *  @param[out] data        Raw data in hardware units.
- *  @param[out] timestamp   Timestamp in milliseconds. Null if not needed.
- *  @return     0 if successful.
- */
-int mpu_get_gyro_reg(short *data, unsigned long *timestamp)
-{
-    unsigned char tmp[6];
-
-    if (!(st.chip_cfg.sensors & INV_XYZ_GYRO))
-        return -1;
-
-    if (i2c_read(st.hw->addr, st.reg->raw_gyro, 6, tmp))
-        return -1;
-    data[0] = (tmp[0] << 8) | tmp[1];
-    data[1] = (tmp[2] << 8) | tmp[3];
-    data[2] = (tmp[4] << 8) | tmp[5];
-    if (timestamp)
-        get_ms(timestamp);
-    return 0;
-}
-
-/**
- *  @brief      Read raw accel data directly from the registers.
- *  @param[out] data        Raw data in hardware units.
- *  @param[out] timestamp   Timestamp in milliseconds. Null if not needed.
- *  @return     0 if successful.
- */
-int mpu_get_accel_reg(short *data, unsigned long *timestamp)
-{
-    unsigned char tmp[6];
-
-    if (!(st.chip_cfg.sensors & INV_XYZ_ACCEL))
-        return -1;
-
-    if (i2c_read(st.hw->addr, st.reg->raw_accel, 6, tmp))
-        return -1;
-    data[0] = (tmp[0] << 8) | tmp[1];
-    data[1] = (tmp[2] << 8) | tmp[3];
-    data[2] = (tmp[4] << 8) | tmp[5];
-    if (timestamp)
-        get_ms(timestamp);
-    return 0;
-}
-
-/**
- *  @brief      Read temperature data directly from the registers.
- *  @param[out] data        Data in q16 format.
- *  @param[out] timestamp   Timestamp in milliseconds. Null if not needed.
- *  @return     0 if successful.
- */
-int mpu_get_temperature(long *data, unsigned long *timestamp)
-{
-    unsigned char tmp[2];
-    short raw;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    if (i2c_read(st.hw->addr, st.reg->temp, 2, tmp))
-        return -1;
-    raw = (tmp[0] << 8) | tmp[1];
-    if (timestamp)
-        get_ms(timestamp);
-
-    data[0] = (long)((35 + ((raw - (float)st.hw->temp_offset) / st.hw->temp_sens)) * 65536L);
-    return 0;
-}
-
-/**
- *  @brief      Push biases to the accel bias registers.
- *  This function expects biases relative to the current sensor output, and
- *  these biases will be added to the factory-supplied values.
- *  @param[in]  accel_bias  New biases.
- *  @return     0 if successful.
- */
-int mpu_set_accel_bias(const long *accel_bias)
-{
-    unsigned char data[6];
-    short accel_hw[3];
-    short got_accel[3];
-    short fg[3];
-
-    if (!accel_bias)
-        return -1;
-    if (!accel_bias[0] && !accel_bias[1] && !accel_bias[2])
-        return 0;
-
-    if (i2c_read(st.hw->addr, 3, 3, data))
-        return -1;
-    fg[0] = ((data[0] >> 4) + 8) & 0xf;
-    fg[1] = ((data[1] >> 4) + 8) & 0xf;
-    fg[2] = ((data[2] >> 4) + 8) & 0xf;
-
-    accel_hw[0] = (short)(accel_bias[0] * 2 / (64 + fg[0]));
-    accel_hw[1] = (short)(accel_bias[1] * 2 / (64 + fg[1]));
-    accel_hw[2] = (short)(accel_bias[2] * 2 / (64 + fg[2]));
-
-    if (i2c_read(st.hw->addr, 0x06, 6, data))
-        return -1;
-
-    got_accel[0] = ((short)data[0] << 8) | data[1];
-    got_accel[1] = ((short)data[2] << 8) | data[3];
-    got_accel[2] = ((short)data[4] << 8) | data[5];
-
-    accel_hw[0] += got_accel[0];
-    accel_hw[1] += got_accel[1];
-    accel_hw[2] += got_accel[2];
-
-    data[0] = (accel_hw[0] >> 8) & 0xff;
-    data[1] = (accel_hw[0]) & 0xff;
-    data[2] = (accel_hw[1] >> 8) & 0xff;
-    data[3] = (accel_hw[1]) & 0xff;
-    data[4] = (accel_hw[2] >> 8) & 0xff;
-    data[5] = (accel_hw[2]) & 0xff;
-
-    if (i2c_write(st.hw->addr, 0x06, 6, data))
-        return -1;
-    return 0;
-}
-
-/**
- *  @brief  Reset FIFO read/write pointers.
- *  @return 0 if successful.
- */
-int mpu_reset_fifo(void)
-{
-    unsigned char data;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    data = 0;
-    if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, &data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
-        return -1;
-
-    if (st.chip_cfg.dmp_on) {
-        data = BIT_FIFO_RST | BIT_DMP_RST;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
-            return -1;
-        delay_ms(50);
-        data = BIT_DMP_EN | BIT_FIFO_EN;
-        if (st.chip_cfg.sensors & INV_XYZ_COMPASS)
-            data |= BIT_AUX_IF_EN;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
-            return -1;
-        if (st.chip_cfg.int_enable)
-            data = BIT_DMP_INT_EN;
-        else
-            data = 0;
-        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &data))
-            return -1;
-        data = 0;
-        if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, &data))
-            return -1;
-    } else {
-        data = BIT_FIFO_RST;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
-            return -1;
-        if (st.chip_cfg.bypass_mode || !(st.chip_cfg.sensors & INV_XYZ_COMPASS))
-            data = BIT_FIFO_EN;
-        else
-            data = BIT_FIFO_EN | BIT_AUX_IF_EN;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
-            return -1;
-        delay_ms(50);
-        if (st.chip_cfg.int_enable)
-            data = BIT_DATA_RDY_EN;
-        else
-            data = 0;
-        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &data))
-            return -1;
-        if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, &st.chip_cfg.fifo_enable))
-            return -1;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Get the gyro full-scale range.
- *  @param[out] fsr Current full-scale range.
- *  @return     0 if successful.
- */
-int mpu_get_gyro_fsr(unsigned short *fsr)
-{
-    switch (st.chip_cfg.gyro_fsr) {
-    case INV_FSR_250DPS:
-        fsr[0] = 250;
-        break;
-    case INV_FSR_500DPS:
-        fsr[0] = 500;
-        break;
-    case INV_FSR_1000DPS:
-        fsr[0] = 1000;
-        break;
-    case INV_FSR_2000DPS:
-        fsr[0] = 2000;
-        break;
-    default:
-        fsr[0] = 0;
-        break;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Set the gyro full-scale range.
- *  @param[in]  fsr Desired full-scale range.
- *  @return     0 if successful.
- */
-int mpu_set_gyro_fsr(unsigned short fsr)
-{
-    unsigned char data;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    switch (fsr) {
-    case 250:
-        data = INV_FSR_250DPS << 3;
-        break;
-    case 500:
-        data = INV_FSR_500DPS << 3;
-        break;
-    case 1000:
-        data = INV_FSR_1000DPS << 3;
-        break;
-    case 2000:
-        data = INV_FSR_2000DPS << 3;
-        break;
-    default:
-        return -1;
-    }
-
-    if (st.chip_cfg.gyro_fsr == (data >> 3))
-        return 0;
-    if (i2c_write(st.hw->addr, st.reg->gyro_cfg, 1, &data))
-        return -1;
-    st.chip_cfg.gyro_fsr = data >> 3;
-    return 0;
-}
-
-/**
- *  @brief      Get the accel full-scale range.
- *  @param[out] fsr Current full-scale range.
- *  @return     0 if successful.
- */
-int mpu_get_accel_fsr(unsigned char *fsr)
-{
-    switch (st.chip_cfg.accel_fsr) {
-    case INV_FSR_2G:
-        fsr[0] = 2;
-        break;
-    case INV_FSR_4G:
-        fsr[0] = 4;
-        break;
-    case INV_FSR_8G:
-        fsr[0] = 8;
-        break;
-    case INV_FSR_16G:
-        fsr[0] = 16;
-        break;
-    default:
-        return -1;
-    }
-    if (st.chip_cfg.accel_half)
-        fsr[0] <<= 1;
-    return 0;
-}
-
-/**
- *  @brief      Set the accel full-scale range.
- *  @param[in]  fsr Desired full-scale range.
- *  @return     0 if successful.
- */
-int mpu_set_accel_fsr(unsigned char fsr)
-{
-    unsigned char data;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    switch (fsr) {
-    case 2:
-        data = INV_FSR_2G << 3;
-        break;
-    case 4:
-        data = INV_FSR_4G << 3;
-        break;
-    case 8:
-        data = INV_FSR_8G << 3;
-        break;
-    case 16:
-        data = INV_FSR_16G << 3;
-        break;
-    default:
-        return -1;
-    }
-
-    if (st.chip_cfg.accel_fsr == (data >> 3))
-        return 0;
-    if (i2c_write(st.hw->addr, st.reg->accel_cfg, 1, &data))
-        return -1;
-    st.chip_cfg.accel_fsr = data >> 3;
-    return 0;
-}
-
-/**
- *  @brief      Get the current DLPF setting.
- *  @param[out] lpf Current LPF setting.
- *  0 if successful.
- */
-int mpu_get_lpf(unsigned short *lpf)
-{
-    switch (st.chip_cfg.lpf) {
-    case INV_FILTER_188HZ:
-        lpf[0] = 188;
-        break;
-    case INV_FILTER_98HZ:
-        lpf[0] = 98;
-        break;
-    case INV_FILTER_42HZ:
-        lpf[0] = 42;
-        break;
-    case INV_FILTER_20HZ:
-        lpf[0] = 20;
-        break;
-    case INV_FILTER_10HZ:
-        lpf[0] = 10;
-        break;
-    case INV_FILTER_5HZ:
-        lpf[0] = 5;
-        break;
-    case INV_FILTER_256HZ_NOLPF2:
-    case INV_FILTER_2100HZ_NOLPF:
-    default:
-        lpf[0] = 0;
-        break;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Set digital low pass filter.
- *  The following LPF settings are supported: 188, 98, 42, 20, 10, 5.
- *  @param[in]  lpf Desired LPF setting.
- *  @return     0 if successful.
- */
-int mpu_set_lpf(unsigned short lpf)
-{
-    unsigned char data;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    if (lpf >= 188)
-        data = INV_FILTER_188HZ;
-    else if (lpf >= 98)
-        data = INV_FILTER_98HZ;
-    else if (lpf >= 42)
-        data = INV_FILTER_42HZ;
-    else if (lpf >= 20)
-        data = INV_FILTER_20HZ;
-    else if (lpf >= 10)
-        data = INV_FILTER_10HZ;
-    else
-        data = INV_FILTER_5HZ;
-
-    if (st.chip_cfg.lpf == data)
-        return 0;
-    if (i2c_write(st.hw->addr, st.reg->lpf, 1, &data))
-        return -1;
-    st.chip_cfg.lpf = data;
-    return 0;
-}
-
-/**
- *  @brief      Get sampling rate.
- *  @param[out] rate    Current sampling rate (Hz).
- *  @return     0 if successful.
- */
-int mpu_get_sample_rate(unsigned short *rate)
-{
-    if (st.chip_cfg.dmp_on)
-        return -1;
-    else
-        rate[0] = st.chip_cfg.sample_rate;
-
-    return 0;
-}
-
-/**
- *  @brief      Set sampling rate.
- *  Sampling rate must be between 4Hz and 1kHz.
- *  @param[in]  rate    Desired sampling rate (Hz).
- *  @return     0 if successful.
- */
-int mpu_set_sample_rate(unsigned short rate)
-{
-    unsigned char data;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    if (st.chip_cfg.dmp_on)
-        return -1;
-    else {
-        if (st.chip_cfg.lp_accel_mode) {
-            if (rate && (rate <= 40)) {
-                /* Just stay in low-power accel mode. */
-                mpu_lp_accel_mode(rate);
-                return 0;
-            }
-            /* Requested rate exceeds the allowed frequencies in LP accel mode,
-             * switch back to full-power mode.
-             */
-            mpu_lp_accel_mode(0);
-        }
-        if (rate < 4)
-            rate = 4;
-        else if (rate > 1000)
-            rate = 1000;
-
-        data = 1000 / rate - 1;
-        if (i2c_write(st.hw->addr, st.reg->rate_div, 1, &data))
-            return -1;
-
-        st.chip_cfg.sample_rate = 1000 / (1 + data);
-
-#ifdef AK89xx_SECONDARY
-        mpu_set_compass_sample_rate(min(st.chip_cfg.compass_sample_rate, MAX_COMPASS_SAMPLE_RATE));
-#endif
-
-        /* Automatically set LPF to 1/2 sampling rate. */
-        mpu_set_lpf(st.chip_cfg.sample_rate >> 1);
-        return 0;
-    }
-}
-
-/**
- *  @brief      Get compass sampling rate.
- *  @param[out] rate    Current compass sampling rate (Hz).
- *  @return     0 if successful.
- */
-int mpu_get_compass_sample_rate(unsigned short *rate)
-{
-#ifdef AK89xx_SECONDARY
-    rate[0] = st.chip_cfg.compass_sample_rate;
-    return 0;
-#else
-    rate[0] = 0;
-    return -1;
-#endif
-}
-
-/**
- *  @brief      Set compass sampling rate.
- *  The compass on the auxiliary I2C bus is read by the MPU hardware at a
- *  maximum of 100Hz. The actual rate can be set to a fraction of the gyro
- *  sampling rate.
- *
- *  \n WARNING: The new rate may be different than what was requested. Call
- *  mpu_get_compass_sample_rate to check the actual setting.
- *  @param[in]  rate    Desired compass sampling rate (Hz).
- *  @return     0 if successful.
- */
-int mpu_set_compass_sample_rate(unsigned short rate)
-{
-#ifdef AK89xx_SECONDARY
-    unsigned char div;
-    if (!rate || rate > st.chip_cfg.sample_rate || rate > MAX_COMPASS_SAMPLE_RATE)
-        return -1;
-
-    div = st.chip_cfg.sample_rate / rate - 1;
-    if (i2c_write(st.hw->addr, st.reg->s4_ctrl, 1, &div))
-        return -1;
-    st.chip_cfg.compass_sample_rate = st.chip_cfg.sample_rate / (div + 1);
-    return 0;
-#else
-    return -1;
-#endif
-}
-
-/**
- *  @brief      Get gyro sensitivity scale factor.
- *  @param[out] sens    Conversion from hardware units to dps.
- *  @return     0 if successful.
- */
-int mpu_get_gyro_sens(float *sens)
-{
-    switch (st.chip_cfg.gyro_fsr) {
-    case INV_FSR_250DPS:
-        sens[0] = 131.f;
-        break;
-    case INV_FSR_500DPS:
-        sens[0] = 65.5f;
-        break;
-    case INV_FSR_1000DPS:
-        sens[0] = 32.8f;
-        break;
-    case INV_FSR_2000DPS:
-        sens[0] = 16.4f;
-        break;
-    default:
-        return -1;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Get accel sensitivity scale factor.
- *  @param[out] sens    Conversion from hardware units to g's.
- *  @return     0 if successful.
- */
-int mpu_get_accel_sens(unsigned short *sens)
-{
-    switch (st.chip_cfg.accel_fsr) {
-    case INV_FSR_2G:
-        sens[0] = 16384;
-        break;
-    case INV_FSR_4G:
-        sens[0] = 8092;
-        break;
-    case INV_FSR_8G:
-        sens[0] = 4096;
-        break;
-    case INV_FSR_16G:
-        sens[0] = 2048;
-        break;
-    default:
-        return -1;
-    }
-    if (st.chip_cfg.accel_half)
-        sens[0] >>= 1;
-    return 0;
-}
-
-/**
- *  @brief      Get current FIFO configuration.
- *  @e sensors can contain a combination of the following flags:
- *  \n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
- *  \n INV_XYZ_GYRO
- *  \n INV_XYZ_ACCEL
- *  @param[out] sensors Mask of sensors in FIFO.
- *  @return     0 if successful.
- */
-int mpu_get_fifo_config(unsigned char *sensors)
-{
-    sensors[0] = st.chip_cfg.fifo_enable;
-    return 0;
-}
-
-/**
- *  @brief      Select which sensors are pushed to FIFO.
- *  @e sensors can contain a combination of the following flags:
- *  \n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
- *  \n INV_XYZ_GYRO
- *  \n INV_XYZ_ACCEL
- *  @param[in]  sensors Mask of sensors to push to FIFO.
- *  @return     0 if successful.
- */
-int mpu_configure_fifo(unsigned char sensors)
-{
-    unsigned char prev;
-    int result = 0;
-
-    /* Compass data isn't going into the FIFO. Stop trying. */
-    sensors &= ~INV_XYZ_COMPASS;
-
-    if (st.chip_cfg.dmp_on)
-        return 0;
-    else {
-        if (!(st.chip_cfg.sensors))
-            return -1;
-        prev = st.chip_cfg.fifo_enable;
-        st.chip_cfg.fifo_enable = sensors & st.chip_cfg.sensors;
-        if (st.chip_cfg.fifo_enable != sensors)
-            /* You're not getting what you asked for. Some sensors are
-             * asleep.
-             */
-            result = -1;
-        else
-            result = 0;
-        if (sensors || st.chip_cfg.lp_accel_mode)
-            set_int_enable(1);
-        else
-            set_int_enable(0);
-        if (sensors) {
-            if (mpu_reset_fifo()) {
-                st.chip_cfg.fifo_enable = prev;
-                return -1;
-            }
-        }
-    }
-
-    return result;
-}
-
-/**
- *  @brief      Get current power state.
- *  @param[in]  power_on    1 if turned on, 0 if suspended.
- *  @return     0 if successful.
- */
-int mpu_get_power_state(unsigned char *power_on)
-{
-    if (st.chip_cfg.sensors)
-        power_on[0] = 1;
-    else
-        power_on[0] = 0;
-    return 0;
-}
-
-/**
- *  @brief      Turn specific sensors on/off.
- *  @e sensors can contain a combination of the following flags:
- *  \n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
- *  \n INV_XYZ_GYRO
- *  \n INV_XYZ_ACCEL
- *  \n INV_XYZ_COMPASS
- *  @param[in]  sensors    Mask of sensors to wake.
- *  @return     0 if successful.
- */
-int mpu_set_sensors(unsigned char sensors)
-{
-    unsigned char data;
-#ifdef AK89xx_SECONDARY
-    unsigned char user_ctrl;
-#endif
-
-    if (sensors & INV_XYZ_GYRO)
-        data = INV_CLK_PLL;
-    else if (sensors)
-        data = 0;
-    else
-        data = BIT_SLEEP;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, &data)) {
-        st.chip_cfg.sensors = 0;
-        return -1;
-    }
-    st.chip_cfg.clk_src = data & ~BIT_SLEEP;
-
-    data = 0;
-    if (!(sensors & INV_X_GYRO))
-        data |= BIT_STBY_XG;
-    if (!(sensors & INV_Y_GYRO))
-        data |= BIT_STBY_YG;
-    if (!(sensors & INV_Z_GYRO))
-        data |= BIT_STBY_ZG;
-    if (!(sensors & INV_XYZ_ACCEL))
-        data |= BIT_STBY_XYZA;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_2, 1, &data)) {
-        st.chip_cfg.sensors = 0;
-        return -1;
-    }
-
-    if (sensors && (sensors != INV_XYZ_ACCEL))
-        /* Latched interrupts only used in LP accel mode. */
-        mpu_set_int_latched(0);
-
-#ifdef AK89xx_SECONDARY
-#ifdef AK89xx_BYPASS
-    if (sensors & INV_XYZ_COMPASS)
-        mpu_set_bypass(1);
-    else
-        mpu_set_bypass(0);
-#else
-    if (i2c_read(st.hw->addr, st.reg->user_ctrl, 1, &user_ctrl))
-        return -1;
-    /* Handle AKM power management. */
-    if (sensors & INV_XYZ_COMPASS) {
-        data = AKM_SINGLE_MEASUREMENT;
-        user_ctrl |= BIT_AUX_IF_EN;
-    } else {
-        data = AKM_POWER_DOWN;
-        user_ctrl &= ~BIT_AUX_IF_EN;
-    }
-    if (st.chip_cfg.dmp_on)
-        user_ctrl |= BIT_DMP_EN;
-    else
-        user_ctrl &= ~BIT_DMP_EN;
-    if (i2c_write(st.hw->addr, st.reg->s1_do, 1, &data))
-        return -1;
-    /* Enable/disable I2C master mode. */
-    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &user_ctrl))
-        return -1;
-#endif
-#endif
-
-    st.chip_cfg.sensors = sensors;
-    st.chip_cfg.lp_accel_mode = 0;
-    delay_ms(50);
-    return 0;
-}
-
-/**
- *  @brief      Read the MPU interrupt status registers.
- *  @param[out] status  Mask of interrupt bits.
- *  @return     0 if successful.
- */
-int mpu_get_int_status(short *status)
-{
-    unsigned char tmp[2];
-    if (!st.chip_cfg.sensors)
-        return -1;
-    if (i2c_read(st.hw->addr, st.reg->dmp_int_status, 2, tmp))
-        return -1;
-    status[0] = (tmp[0] << 8) | tmp[1];
-    return 0;
-}
-
-/**
- *  @brief      Get one packet from the FIFO.
- *  If @e sensors does not contain a particular sensor, disregard the data
- *  returned to that pointer.
- *  \n @e sensors can contain a combination of the following flags:
- *  \n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
- *  \n INV_XYZ_GYRO
- *  \n INV_XYZ_ACCEL
- *  \n If the FIFO has no new data, @e sensors will be zero.
- *  \n If the FIFO is disabled, @e sensors will be zero and this function will
- *  return a non-zero error code.
- *  @param[out] gyro        Gyro data in hardware units.
- *  @param[out] accel       Accel data in hardware units.
- *  @param[out] timestamp   Timestamp in milliseconds.
- *  @param[out] sensors     Mask of sensors read from FIFO.
- *  @param[out] more        Number of remaining packets.
- *  @return     0 if successful.
- */
-int mpu_read_fifo(short *gyro, short *accel, unsigned long *timestamp,
-        unsigned char *sensors, unsigned char *more)
-{
-    /* Assumes maximum packet size is gyro (6) + accel (6). */
-    unsigned char data[MAX_PACKET_LENGTH];
-    unsigned char packet_size = 0;
-    unsigned short fifo_count, index = 0;
-
-    if (st.chip_cfg.dmp_on)
-        return -1;
-
-    sensors[0] = 0;
-    if (!st.chip_cfg.sensors)
-        return -1;
-    if (!st.chip_cfg.fifo_enable)
-        return -1;
-
-    if (st.chip_cfg.fifo_enable & INV_X_GYRO)
-        packet_size += 2;
-    if (st.chip_cfg.fifo_enable & INV_Y_GYRO)
-        packet_size += 2;
-    if (st.chip_cfg.fifo_enable & INV_Z_GYRO)
-        packet_size += 2;
-    if (st.chip_cfg.fifo_enable & INV_XYZ_ACCEL)
-        packet_size += 6;
-
-    if (i2c_read(st.hw->addr, st.reg->fifo_count_h, 2, data))
-        return -1;
-    fifo_count = (data[0] << 8) | data[1];
-    if (fifo_count < packet_size)
-        return 0;
-//    log_i("FIFO count: %hd\n", fifo_count);
-    if (fifo_count > (st.hw->max_fifo >> 1)) {
-        /* FIFO is 50% full, better check overflow bit. */
-        if (i2c_read(st.hw->addr, st.reg->int_status, 1, data))
-            return -1;
-        if (data[0] & BIT_FIFO_OVERFLOW) {
-            mpu_reset_fifo();
-            return -2;
-        }
-    }
-    get_ms((unsigned long*)timestamp);
-
-    if (i2c_read(st.hw->addr, st.reg->fifo_r_w, packet_size, data))
-        return -1;
-    more[0] = fifo_count / packet_size - 1;
-    sensors[0] = 0;
-
-    if ((index != packet_size) && st.chip_cfg.fifo_enable & INV_XYZ_ACCEL) {
-        accel[0] = (data[index+0] << 8) | data[index+1];
-        accel[1] = (data[index+2] << 8) | data[index+3];
-        accel[2] = (data[index+4] << 8) | data[index+5];
-        sensors[0] |= INV_XYZ_ACCEL;
-        index += 6;
-    }
-    if ((index != packet_size) && st.chip_cfg.fifo_enable & INV_X_GYRO) {
-        gyro[0] = (data[index+0] << 8) | data[index+1];
-        sensors[0] |= INV_X_GYRO;
-        index += 2;
-    }
-    if ((index != packet_size) && st.chip_cfg.fifo_enable & INV_Y_GYRO) {
-        gyro[1] = (data[index+0] << 8) | data[index+1];
-        sensors[0] |= INV_Y_GYRO;
-        index += 2;
-    }
-    if ((index != packet_size) && st.chip_cfg.fifo_enable & INV_Z_GYRO) {
-        gyro[2] = (data[index+0] << 8) | data[index+1];
-        sensors[0] |= INV_Z_GYRO;
-        index += 2;
-    }
-
-    return 0;
-}
-
-/**
- *  @brief      Get one unparsed packet from the FIFO.
- *  This function should be used if the packet is to be parsed elsewhere.
- *  @param[in]  length  Length of one FIFO packet.
- *  @param[in]  data    FIFO packet.
- *  @param[in]  more    Number of remaining packets.
- */
-int mpu_read_fifo_stream(unsigned short length, unsigned char *data,
-    unsigned char *more)
-{
-    unsigned char tmp[2];
-    unsigned short fifo_count;
-
-//    printf("addr %d, dmp_on %d, sensors %d\r\n", st.hw->addr, st.chip_cfg.dmp_on, st.chip_cfg.sensors);
-
-    if (!st.chip_cfg.dmp_on)
-        return -1;
-    if (!st.chip_cfg.sensors)
-        return -1;
-
-//    printf("----1\r\n");
-
-    if (i2c_read(st.hw->addr, st.reg->fifo_count_h, 2, tmp))
-        return -1;
-
-//    printf("----2\r\n");
-
-    fifo_count = (tmp[0] << 8) | tmp[1];
-    if (fifo_count < length) {
-        more[0] = 0;
-        return -1;
-    }
-
-//    printf("----3\r\n");
-    if (fifo_count > (st.hw->max_fifo >> 1)) {
-
-//        printf("----3.1\r\n");
-        /* FIFO is 50% full, better check overflow bit. */
-        if (i2c_read(st.hw->addr, st.reg->int_status, 1, tmp))
-            return -1;
-
-//        printf("----3.2\r\n");
-        if (tmp[0] & BIT_FIFO_OVERFLOW) {
-            mpu_reset_fifo();
-            return -2;
-        }
-    }
-
-//    printf("----4\r\n");
-    if (i2c_read(st.hw->addr, st.reg->fifo_r_w, length, data))
-        return -1;
-
-    more[0] = fifo_count / length - 1;
-    return 0;
-}
-
-/**
- *  @brief      Set device to bypass mode.
- *  @param[in]  bypass_on   1 to enable bypass mode.
- *  @return     0 if successful.
- */
-int mpu_set_bypass(unsigned char bypass_on)
-{
-    unsigned char tmp;
-
-    if (st.chip_cfg.bypass_mode == bypass_on)
-        return 0;
-
-    if (bypass_on) {
-        if (i2c_read(st.hw->addr, st.reg->user_ctrl, 1, &tmp))
-            return -1;
-        tmp &= ~BIT_AUX_IF_EN;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &tmp))
-            return -1;
-        delay_ms(3);
-        tmp = BIT_BYPASS_EN;
-        if (st.chip_cfg.active_low_int)
-            tmp |= BIT_ACTL;
-        if (st.chip_cfg.latched_int)
-            tmp |= BIT_LATCH_EN | BIT_ANY_RD_CLR;
-        if (i2c_write(st.hw->addr, st.reg->int_pin_cfg, 1, &tmp))
-            return -1;
-    } else {
-        /* Enable I2C master mode if compass is being used. */
-        if (i2c_read(st.hw->addr, st.reg->user_ctrl, 1, &tmp))
-            return -1;
-        if (st.chip_cfg.sensors & INV_XYZ_COMPASS)
-            tmp |= BIT_AUX_IF_EN;
-        else
-            tmp &= ~BIT_AUX_IF_EN;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &tmp))
-            return -1;
-        delay_ms(3);
-        if (st.chip_cfg.active_low_int)
-            tmp = BIT_ACTL;
-        else
-            tmp = 0;
-        if (st.chip_cfg.latched_int)
-            tmp |= BIT_LATCH_EN | BIT_ANY_RD_CLR;
-        if (i2c_write(st.hw->addr, st.reg->int_pin_cfg, 1, &tmp))
-            return -1;
-    }
-    st.chip_cfg.bypass_mode = bypass_on;
-    return 0;
-}
-
-/**
- *  @brief      Set interrupt level.
- *  @param[in]  active_low  1 for active low, 0 for active high.
- *  @return     0 if successful.
- */
-int mpu_set_int_level(unsigned char active_low)
-{
-    st.chip_cfg.active_low_int = active_low;
-    return 0;
-}
-
-/**
- *  @brief      Enable latched interrupts.
- *  Any MPU register will clear the interrupt.
- *  @param[in]  enable  1 to enable, 0 to disable.
- *  @return     0 if successful.
- */
-int mpu_set_int_latched(unsigned char enable)
-{
-    unsigned char tmp;
-    if (st.chip_cfg.latched_int == enable)
-        return 0;
-
-    if (enable)
-        tmp = BIT_LATCH_EN | BIT_ANY_RD_CLR;
-    else
-        tmp = 0;
-    if (st.chip_cfg.bypass_mode)
-        tmp |= BIT_BYPASS_EN;
-    if (st.chip_cfg.active_low_int)
-        tmp |= BIT_ACTL;
-    if (i2c_write(st.hw->addr, st.reg->int_pin_cfg, 1, &tmp))
-        return -1;
-    st.chip_cfg.latched_int = enable;
-    return 0;
-}
-
-#ifdef MPU6050
-static int get_accel_prod_shift(float *st_shift)
-{
-    unsigned char tmp[4], shift_code[3], ii;
-
-    if (i2c_read(st.hw->addr, 0x0D, 4, tmp))
-        return 0x07;
-
-    shift_code[0] = ((tmp[0] & 0xE0) >> 3) | ((tmp[3] & 0x30) >> 4);
-    shift_code[1] = ((tmp[1] & 0xE0) >> 3) | ((tmp[3] & 0x0C) >> 2);
-    shift_code[2] = ((tmp[2] & 0xE0) >> 3) | (tmp[3] & 0x03);
-    for (ii = 0; ii < 3; ii++) {
-        if (!shift_code[ii]) {
-            st_shift[ii] = 0.f;
-            continue;
-        }
-        /* Equivalent to..
-         * st_shift[ii] = 0.34f * powf(0.92f/0.34f, (shift_code[ii]-1) / 30.f)
-         */
-        st_shift[ii] = 0.34f;
-        while (--shift_code[ii])
-            st_shift[ii] *= 1.034f;
-    }
-    return 0;
-}
-
-static int accel_self_test(long *bias_regular, long *bias_st)
-{
-    int jj, result = 0;
-    float st_shift[3], st_shift_cust, st_shift_var;
-
-    get_accel_prod_shift(st_shift);
-    for(jj = 0; jj < 3; jj++) {
-        st_shift_cust = labs(bias_regular[jj] - bias_st[jj]) / 65536.f;
-        if (st_shift[jj]) {
-            st_shift_var = st_shift_cust / st_shift[jj] - 1.f;
-            if (fabs(st_shift_var) > test.max_accel_var)
-                result |= 1 << jj;
-        } else if ((st_shift_cust < test.min_g) ||
-            (st_shift_cust > test.max_g))
-            result |= 1 << jj;
-    }
-
-    return result;
-}
-
-static int gyro_self_test(long *bias_regular, long *bias_st)
-{
-    int jj, result = 0;
-    unsigned char tmp[3];
-    float st_shift, st_shift_cust, st_shift_var;
-
-    if (i2c_read(st.hw->addr, 0x0D, 3, tmp))
-        return 0x07;
-
-    tmp[0] &= 0x1F;
-    tmp[1] &= 0x1F;
-    tmp[2] &= 0x1F;
-
-    for (jj = 0; jj < 3; jj++) {
-        st_shift_cust = labs(bias_regular[jj] - bias_st[jj]) / 65536.f;
-        if (tmp[jj]) {
-            st_shift = 3275.f / test.gyro_sens;
-            while (--tmp[jj])
-                st_shift *= 1.046f;
-            st_shift_var = st_shift_cust / st_shift - 1.f;
-            if (fabs(st_shift_var) > test.max_gyro_var)
-                result |= 1 << jj;
-        } else if ((st_shift_cust < test.min_dps) ||
-            (st_shift_cust > test.max_dps))
-            result |= 1 << jj;
-    }
-    return result;
-}
-
-#ifdef AK89xx_SECONDARY
-static int compass_self_test(void)
-{
-    unsigned char tmp[6];
-    unsigned char tries = 10;
-    int result = 0x07;
-    short data;
-
-    mpu_set_bypass(1);
-
-    tmp[0] = AKM_POWER_DOWN;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, tmp))
-        return 0x07;
-    tmp[0] = AKM_BIT_SELF_TEST;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_ASTC, 1, tmp))
-        goto AKM_restore;
-    tmp[0] = AKM_MODE_SELF_TEST;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, tmp))
-        goto AKM_restore;
-
-    do {
-        delay_ms(10);
-        if (i2c_read(st.chip_cfg.compass_addr, AKM_REG_ST1, 1, tmp))
-            goto AKM_restore;
-        if (tmp[0] & AKM_DATA_READY)
-            break;
-    } while (tries--);
-    if (!(tmp[0] & AKM_DATA_READY))
-        goto AKM_restore;
-
-    if (i2c_read(st.chip_cfg.compass_addr, AKM_REG_HXL, 6, tmp))
-        goto AKM_restore;
-
-    result = 0;
-    data = (short)(tmp[1] << 8) | tmp[0];
-    if ((data > 100) || (data < -100))
-        result |= 0x01;
-    data = (short)(tmp[3] << 8) | tmp[2];
-    if ((data > 100) || (data < -100))
-        result |= 0x02;
-    data = (short)(tmp[5] << 8) | tmp[4];
-    if ((data > -300) || (data < -1000))
-        result |= 0x04;
-
-AKM_restore:
-    tmp[0] = 0 | SUPPORTS_AK89xx_HIGH_SENS;
-    i2c_write(st.chip_cfg.compass_addr, AKM_REG_ASTC, 1, tmp);
-    tmp[0] = SUPPORTS_AK89xx_HIGH_SENS;
-    i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, tmp);
-    mpu_set_bypass(0);
-    return result;
-}
-#endif
-#endif
-
-static int get_st_biases(long *gyro, long *accel, unsigned char hw_test)
-{
-    unsigned char data[MAX_PACKET_LENGTH];
-    unsigned char packet_count, ii;
-    unsigned short fifo_count;
-
-    data[0] = 0x01;
-    data[1] = 0;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 2, data))
-        return -1;
-    delay_ms(200);
-    data[0] = 0;
-    if (i2c_write(st.hw->addr, st.reg->int_enable, 1, data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->i2c_mst, 1, data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, data))
-        return -1;
-    data[0] = BIT_FIFO_RST | BIT_DMP_RST;
-    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, data))
-        return -1;
-    delay_ms(15);
-    data[0] = st.test->reg_lpf;
-    if (i2c_write(st.hw->addr, st.reg->lpf, 1, data))
-        return -1;
-    data[0] = st.test->reg_rate_div;
-    if (i2c_write(st.hw->addr, st.reg->rate_div, 1, data))
-        return -1;
-    if (hw_test)
-        data[0] = st.test->reg_gyro_fsr | 0xE0;
-    else
-        data[0] = st.test->reg_gyro_fsr;
-    if (i2c_write(st.hw->addr, st.reg->gyro_cfg, 1, data))
-        return -1;
-
-    if (hw_test)
-        data[0] = st.test->reg_accel_fsr | 0xE0;
-    else
-        data[0] = test.reg_accel_fsr;
-    if (i2c_write(st.hw->addr, st.reg->accel_cfg, 1, data))
-        return -1;
-    if (hw_test)
-        delay_ms(200);
-
-    /* Fill FIFO for test.wait_ms milliseconds. */
-    data[0] = BIT_FIFO_EN;
-    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, data))
-        return -1;
-
-    data[0] = INV_XYZ_GYRO | INV_XYZ_ACCEL;
-    if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, data))
-        return -1;
-    delay_ms(test.wait_ms);
-    data[0] = 0;
-    if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, data))
-        return -1;
-
-    if (i2c_read(st.hw->addr, st.reg->fifo_count_h, 2, data))
-        return -1;
-
-    fifo_count = (data[0] << 8) | data[1];
-    packet_count = fifo_count / MAX_PACKET_LENGTH;
-    gyro[0] = gyro[1] = gyro[2] = 0;
-    accel[0] = accel[1] = accel[2] = 0;
-
-    for (ii = 0; ii < packet_count; ii++) {
-        short accel_cur[3], gyro_cur[3];
-        if (i2c_read(st.hw->addr, st.reg->fifo_r_w, MAX_PACKET_LENGTH, data))
-            return -1;
-        accel_cur[0] = ((short)data[0] << 8) | data[1];
-        accel_cur[1] = ((short)data[2] << 8) | data[3];
-        accel_cur[2] = ((short)data[4] << 8) | data[5];
-        accel[0] += (long)accel_cur[0];
-        accel[1] += (long)accel_cur[1];
-        accel[2] += (long)accel_cur[2];
-        gyro_cur[0] = (((short)data[6] << 8) | data[7]);
-        gyro_cur[1] = (((short)data[8] << 8) | data[9]);
-        gyro_cur[2] = (((short)data[10] << 8) | data[11]);
-        gyro[0] += (long)gyro_cur[0];
-        gyro[1] += (long)gyro_cur[1];
-        gyro[2] += (long)gyro_cur[2];
-    }
-#ifdef EMPL_NO_64BIT
-    gyro[0] = (long)(((float)gyro[0]*65536.f) / test.gyro_sens / packet_count);
-    gyro[1] = (long)(((float)gyro[1]*65536.f) / test.gyro_sens / packet_count);
-    gyro[2] = (long)(((float)gyro[2]*65536.f) / test.gyro_sens / packet_count);
-    if (has_accel) {
-        accel[0] = (long)(((float)accel[0]*65536.f) / test.accel_sens /
-            packet_count);
-        accel[1] = (long)(((float)accel[1]*65536.f) / test.accel_sens /
-            packet_count);
-        accel[2] = (long)(((float)accel[2]*65536.f) / test.accel_sens /
-            packet_count);
-        /* Don't remove gravity! */
-        accel[2] -= 65536L;
-    }
-#else
-    gyro[0] = (long)(((long long)gyro[0]<<16) / test.gyro_sens / packet_count);
-    gyro[1] = (long)(((long long)gyro[1]<<16) / test.gyro_sens / packet_count);
-    gyro[2] = (long)(((long long)gyro[2]<<16) / test.gyro_sens / packet_count);
-    accel[0] = (long)(((long long)accel[0]<<16) / test.accel_sens /
-        packet_count);
-    accel[1] = (long)(((long long)accel[1]<<16) / test.accel_sens /
-        packet_count);
-    accel[2] = (long)(((long long)accel[2]<<16) / test.accel_sens /
-        packet_count);
-    /* Don't remove gravity! */
-    if (accel[2] > 0L)
-        accel[2] -= 65536L;
-    else
-        accel[2] += 65536L;
-#endif
-
-    return 0;
-}
-
-/**
- *  @brief      Trigger gyro/accel/compass self-test.
- *  On success/error, the self-test returns a mask representing the sensor(s)
- *  that failed. For each bit, a one (1) represents a "pass" case; conversely,
- *  a zero (0) indicates a failure.
- *
- *  \n The mask is defined as follows:
- *  \n Bit 0:   Gyro.
- *  \n Bit 1:   Accel.
- *  \n Bit 2:   Compass.
- *
- *  \n Currently, the hardware self-test is unsupported for MPU6500. However,
- *  this function can still be used to obtain the accel and gyro biases.
- *
- *  \n This function must be called with the device either face-up or face-down
- *  (z-axis is parallel to gravity).
- *  @param[out] gyro        Gyro biases in q16 format.
- *  @param[out] accel       Accel biases (if applicable) in q16 format.
- *  @return     Result mask (see above).
- */
-int mpu_run_self_test(long *gyro, long *accel)
-{
-#ifdef MPU6050
-    const unsigned char tries = 2;
-    long gyro_st[3], accel_st[3];
-    unsigned char accel_result, gyro_result;
-#ifdef AK89xx_SECONDARY
-    unsigned char compass_result;
-#endif
-    int ii;
-#endif
-    int result;
-    unsigned char accel_fsr, fifo_sensors, sensors_on;
-    unsigned short gyro_fsr, sample_rate, lpf;
-    unsigned char dmp_was_on;
-
-    if (st.chip_cfg.dmp_on) {
-        mpu_set_dmp_state(0);
-        dmp_was_on = 1;
-    } else
-        dmp_was_on = 0;
-
-    /* Get initial settings. */
-    mpu_get_gyro_fsr(&gyro_fsr);
-    mpu_get_accel_fsr(&accel_fsr);
-    mpu_get_lpf(&lpf);
-    mpu_get_sample_rate(&sample_rate);
-    sensors_on = st.chip_cfg.sensors;
-    mpu_get_fifo_config(&fifo_sensors);
-
-    /* For older chips, the self-test will be different. */
-#if defined MPU6050
-    for (ii = 0; ii < tries; ii++)
-        if (!get_st_biases(gyro, accel, 0))
-            break;
-    if (ii == tries) {
-        /* If we reach this point, we most likely encountered an I2C error.
-         * We'll just report an error for all three sensors.
-         */
-        result = 0;
-        goto restore;
-    }
-    for (ii = 0; ii < tries; ii++)
-        if (!get_st_biases(gyro_st, accel_st, 1))
-            break;
-    if (ii == tries) {
-        /* Again, probably an I2C error. */
-        result = 0;
-        goto restore;
-    }
-    accel_result = accel_self_test(accel, accel_st);
-    gyro_result = gyro_self_test(gyro, gyro_st);
-
-    result = 0;
-    if (!gyro_result)
-        result |= 0x01;
-    if (!accel_result)
-        result |= 0x02;
-
-#ifdef AK89xx_SECONDARY
-    compass_result = compass_self_test();
-    if (!compass_result)
-        result |= 0x04;
-#endif
-restore:
-#elif defined MPU6500
-    /* For now, this function will return a "pass" result for all three sensors
-     * for compatibility with current test applications.
-     */
-    get_st_biases(gyro, accel, 0);
-    result = 0x7;
-#endif
-    /* Set to invalid values to ensure no I2C writes are skipped. */
-    st.chip_cfg.gyro_fsr = 0xFF;
-    st.chip_cfg.accel_fsr = 0xFF;
-    st.chip_cfg.lpf = 0xFF;
-    st.chip_cfg.sample_rate = 0xFFFF;
-    st.chip_cfg.sensors = 0xFF;
-    st.chip_cfg.fifo_enable = 0xFF;
-    st.chip_cfg.clk_src = INV_CLK_PLL;
-    mpu_set_gyro_fsr(gyro_fsr);
-    mpu_set_accel_fsr(accel_fsr);
-    mpu_set_lpf(lpf);
-    mpu_set_sample_rate(sample_rate);
-    mpu_set_sensors(sensors_on);
-    mpu_configure_fifo(fifo_sensors);
-
-    if (dmp_was_on)
-        mpu_set_dmp_state(1);
-
-    return result;
-}
-
-/**
- *  @brief      Write to the DMP memory.
- *  This function prevents I2C writes past the bank boundaries. The DMP memory
- *  is only accessible when the chip is awake.
- *  @param[in]  mem_addr    Memory location (bank << 8 | start address)
- *  @param[in]  length      Number of bytes to write.
- *  @param[in]  data        Bytes to write to memory.
- *  @return     0 if successful.
- */
-int mpu_write_mem(unsigned short mem_addr, unsigned short length,
-        unsigned char *data)
-{
-    unsigned char tmp[2];
-
-    if (!data)
-        return -1;
-    if (!st.chip_cfg.sensors)
-        return -1;
-
-    tmp[0] = (unsigned char)(mem_addr >> 8);
-    tmp[1] = (unsigned char)(mem_addr & 0xFF);
-
-    /* Check bank boundaries. */
-    if (tmp[1] + length > st.hw->bank_size)
-        return -1;
-
-    if (i2c_write(st.hw->addr, st.reg->bank_sel, 2, tmp))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->mem_r_w, length, data))
-        return -1;
-    return 0;
-}
-
-/**
- *  @brief      Read from the DMP memory.
- *  This function prevents I2C reads past the bank boundaries. The DMP memory
- *  is only accessible when the chip is awake.
- *  @param[in]  mem_addr    Memory location (bank << 8 | start address)
- *  @param[in]  length      Number of bytes to read.
- *  @param[out] data        Bytes read from memory.
- *  @return     0 if successful.
- */
-int mpu_read_mem(unsigned short mem_addr, unsigned short length,
-        unsigned char *data)
-{
-    unsigned char tmp[2];
-
-    if (!data)
-        return -1;
-    if (!st.chip_cfg.sensors)
-        return -1;
-
-    tmp[0] = (unsigned char)(mem_addr >> 8);
-    tmp[1] = (unsigned char)(mem_addr & 0xFF);
-
-    /* Check bank boundaries. */
-    if (tmp[1] + length > st.hw->bank_size)
-        return -1;
-
-    if (i2c_write(st.hw->addr, st.reg->bank_sel, 2, tmp))
-        return -1;
-    if (i2c_read(st.hw->addr, st.reg->mem_r_w, length, data))
-        return -1;
-    return 0;
-}
-
-/**
- *  @brief      Load and verify DMP image.
- *  @param[in]  length      Length of DMP image.
- *  @param[in]  firmware    DMP code.
- *  @param[in]  start_addr  Starting address of DMP code memory.
- *  @param[in]  sample_rate Fixed sampling rate used when DMP is enabled.
- *  @return     0 if successful.
- */
-int mpu_load_firmware(unsigned short length, const unsigned char *firmware,
-    unsigned short start_addr, unsigned short sample_rate)
-{
-    unsigned short ii;
-    unsigned short this_write;
-    /* Must divide evenly into st.hw->bank_size to avoid bank crossings. */
-#define LOAD_CHUNK  (16)
-    unsigned char cur[LOAD_CHUNK], tmp[2];
-
-    if (st.chip_cfg.dmp_loaded)
-        /* DMP should only be loaded once. */
-        return -1;
-
-    if (!firmware)
-        return -1;
-    for (ii = 0; ii < length; ii += this_write) {
-        this_write = min(LOAD_CHUNK, length - ii);
-        if (mpu_write_mem(ii, this_write, (unsigned char*)&firmware[ii]))
-            return -1;
-        if (mpu_read_mem(ii, this_write, cur))
-            return -1;
-        if (memcmp(firmware+ii, cur, this_write))
-            return -2;
-    }
-
-    /* Set program start address. */
-    tmp[0] = start_addr >> 8;
-    tmp[1] = start_addr & 0xFF;
-    if (i2c_write(st.hw->addr, st.reg->prgm_start_h, 2, tmp))
-        return -1;
-
-    st.chip_cfg.dmp_loaded = 1;
-    st.chip_cfg.dmp_sample_rate = sample_rate;
-    return 0;
-}
-
-/**
- *  @brief      Enable/disable DMP support.
- *  @param[in]  enable  1 to turn on the DMP.
- *  @return     0 if successful.
- */
-int mpu_set_dmp_state(unsigned char enable)
-{
-    unsigned char tmp;
-    if (st.chip_cfg.dmp_on == enable)
-        return 0;
-
-    if (enable) {
-        if (!st.chip_cfg.dmp_loaded)
-            return -1;
-        /* Disable data ready interrupt. */
-        set_int_enable(0);
-        /* Disable bypass mode. */
-        mpu_set_bypass(0);
-        /* Keep constant sample rate, FIFO rate controlled by DMP. */
-        mpu_set_sample_rate(st.chip_cfg.dmp_sample_rate);
-        /* Remove FIFO elements. */
-        tmp = 0;
-        i2c_write(st.hw->addr, 0x23, 1, &tmp);
-        st.chip_cfg.dmp_on = 1;
-        /* Enable DMP interrupt. */
-        set_int_enable(1);
-        mpu_reset_fifo();
-    } else {
-        /* Disable DMP interrupt. */
-        set_int_enable(0);
-        /* Restore FIFO settings. */
-        tmp = st.chip_cfg.fifo_enable;
-        i2c_write(st.hw->addr, 0x23, 1, &tmp);
-        st.chip_cfg.dmp_on = 0;
-        mpu_reset_fifo();
-    }
-    return 0;
-}
-
-/**
- *  @brief      Get DMP state.
- *  @param[out] enabled 1 if enabled.
- *  @return     0 if successful.
- */
-int mpu_get_dmp_state(unsigned char *enabled)
-{
-    enabled[0] = st.chip_cfg.dmp_on;
-    return 0;
-}
-
-
-/* This initialization is similar to the one in ak8975.c. */
-static int setup_compass(void)
-{
-#ifdef AK89xx_SECONDARY
-    unsigned char data[4], akm_addr;
-
-    mpu_set_bypass(1);
-
-    /* Find compass. Possible addresses range from 0x0C to 0x0F. */
-    for (akm_addr = 0x0C; akm_addr <= 0x0F; akm_addr++) {
-        int result;
-        result = i2c_read(akm_addr, AKM_REG_WHOAMI, 1, data);
-        if (!result && (data[0] == AKM_WHOAMI))
-            break;
-    }
-
-    if (akm_addr > 0x0F) {
-        /* TODO: Handle this case in all compass-related functions. */
-        log_e("Compass not found.\n");
-        return -1;
-    }
-
-    st.chip_cfg.compass_addr = akm_addr;
-
-    data[0] = AKM_POWER_DOWN;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, data))
-        return -1;
-    delay_ms(1);
-
-    data[0] = AKM_FUSE_ROM_ACCESS;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, data))
-        return -1;
-    delay_ms(1);
-
-    /* Get sensitivity adjustment data from fuse ROM. */
-    if (i2c_read(st.chip_cfg.compass_addr, AKM_REG_ASAX, 3, data))
-        return -1;
-    st.chip_cfg.mag_sens_adj[0] = (long)data[0] + 128;
-    st.chip_cfg.mag_sens_adj[1] = (long)data[1] + 128;
-    st.chip_cfg.mag_sens_adj[2] = (long)data[2] + 128;
-
-    data[0] = AKM_POWER_DOWN;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, data))
-        return -1;
-    delay_ms(1);
-
-    mpu_set_bypass(0);
-
-    /* Set up master mode, master clock, and ES bit. */
-    data[0] = 0x40;
-    if (i2c_write(st.hw->addr, st.reg->i2c_mst, 1, data))
-        return -1;
-
-    /* Slave 0 reads from AKM data registers. */
-    data[0] = BIT_I2C_READ | st.chip_cfg.compass_addr;
-    if (i2c_write(st.hw->addr, st.reg->s0_addr, 1, data))
-        return -1;
-
-    /* Compass reads start at this register. */
-    data[0] = AKM_REG_ST1;
-    if (i2c_write(st.hw->addr, st.reg->s0_reg, 1, data))
-        return -1;
-
-    /* Enable slave 0, 8-byte reads. */
-    data[0] = BIT_SLAVE_EN | 8;
-    if (i2c_write(st.hw->addr, st.reg->s0_ctrl, 1, data))
-        return -1;
-
-    /* Slave 1 changes AKM measurement mode. */
-    data[0] = st.chip_cfg.compass_addr;
-    if (i2c_write(st.hw->addr, st.reg->s1_addr, 1, data))
-        return -1;
-
-    /* AKM measurement mode register. */
-    data[0] = AKM_REG_CNTL;
-    if (i2c_write(st.hw->addr, st.reg->s1_reg, 1, data))
-        return -1;
-
-    /* Enable slave 1, 1-byte writes. */
-    data[0] = BIT_SLAVE_EN | 1;
-    if (i2c_write(st.hw->addr, st.reg->s1_ctrl, 1, data))
-        return -1;
-
-    /* Set slave 1 data. */
-    data[0] = AKM_SINGLE_MEASUREMENT;
-    if (i2c_write(st.hw->addr, st.reg->s1_do, 1, data))
-        return -1;
-
-    /* Trigger slave 0 and slave 1 actions at each sample. */
-    data[0] = 0x03;
-    if (i2c_write(st.hw->addr, st.reg->i2c_delay_ctrl, 1, data))
-        return -1;
-
-#ifdef MPU9150
-    /* For the MPU9150, the auxiliary I2C bus needs to be set to VDD. */
-    data[0] = BIT_I2C_MST_VDDIO;
-    if (i2c_write(st.hw->addr, st.reg->yg_offs_tc, 1, data))
-        return -1;
-#endif
-
-    return 0;
-#else
-    return -1;
-#endif
-}
-
-/**
- *  @brief      Read raw compass data.
- *  @param[out] data        Raw data in hardware units.
- *  @param[out] timestamp   Timestamp in milliseconds. Null if not needed.
- *  @return     0 if successful.
- */
-int mpu_get_compass_reg(short *data, unsigned long *timestamp)
-{
-#ifdef AK89xx_SECONDARY
-    unsigned char tmp[9];
-
-    if (!(st.chip_cfg.sensors & INV_XYZ_COMPASS))
-        return -1;
-
-#ifdef AK89xx_BYPASS
-    if (i2c_read(st.chip_cfg.compass_addr, AKM_REG_ST1, 8, tmp))
-        return -1;
-    tmp[8] = AKM_SINGLE_MEASUREMENT;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, tmp+8))
-        return -1;
-#else
-    if (i2c_read(st.hw->addr, st.reg->raw_compass, 8, tmp))
-        return -1;
-#endif
-
-#if defined AK8975_SECONDARY
-    /* AK8975 doesn't have the overrun error bit. */
-    if (!(tmp[0] & AKM_DATA_READY))
-        return -2;
-    if ((tmp[7] & AKM_OVERFLOW) || (tmp[7] & AKM_DATA_ERROR))
-        return -3;
-#elif defined AK8963_SECONDARY
-    /* AK8963 doesn't have the data read error bit. */
-    if (!(tmp[0] & AKM_DATA_READY) || (tmp[0] & AKM_DATA_OVERRUN))
-        return -2;
-    if (tmp[7] & AKM_OVERFLOW)
-        return -3;
-#endif
-    data[0] = (tmp[2] << 8) | tmp[1];
-    data[1] = (tmp[4] << 8) | tmp[3];
-    data[2] = (tmp[6] << 8) | tmp[5];
-
-    data[0] = ((long)data[0] * st.chip_cfg.mag_sens_adj[0]) >> 8;
-    data[1] = ((long)data[1] * st.chip_cfg.mag_sens_adj[1]) >> 8;
-    data[2] = ((long)data[2] * st.chip_cfg.mag_sens_adj[2]) >> 8;
-
-    if (timestamp)
-        get_ms(timestamp);
-    return 0;
-#else
-    return -1;
-#endif
-}
-
-/**
- *  @brief      Get the compass full-scale range.
- *  @param[out] fsr Current full-scale range.
- *  @return     0 if successful.
- */
-int mpu_get_compass_fsr(unsigned short *fsr)
-{
-#ifdef AK89xx_SECONDARY
-    fsr[0] = st.hw->compass_fsr;
-    return 0;
-#else
-    return -1;
-#endif
-}
-
-/**
- *  @brief      Enters LP accel motion interrupt mode.
- *  The behaviour of this feature is very different between the MPU6050 and the
- *  MPU6500. Each chip's version of this feature is explained below.
- *
- *  \n The hardware motion threshold can be between 32mg and 8160mg in 32mg
- *  increments.
- *
- *  \n Low-power accel mode supports the following frequencies:
- *  \n 1.25Hz, 5Hz, 20Hz, 40Hz
- *
- *  \n MPU6500:
- *  \n Unlike the MPU6050 version, the hardware does not "lock in" a reference
- *  sample. The hardware monitors the accel data and detects any large change
- *  over a short period of time.
- *
- *  \n The hardware motion threshold can be between 4mg and 1020mg in 4mg
- *  increments.
- *
- *  \n MPU6500 Low-power accel mode supports the following frequencies:
- *  \n 1.25Hz, 2.5Hz, 5Hz, 10Hz, 20Hz, 40Hz, 80Hz, 160Hz, 320Hz, 640Hz
- *
- *  \n\n NOTES:
- *  \n The driver will round down @e thresh to the nearest supported value if
- *  an unsupported threshold is selected.
- *  \n To select a fractional wake-up frequency, round down the value passed to
- *  @e lpa_freq.
- *  \n The MPU6500 does not support a delay parameter. If this function is used
- *  for the MPU6500, the value passed to @e time will be ignored.
- *  \n To disable this mode, set @e lpa_freq to zero. The driver will restore
- *  the previous configuration.
- *
- *  @param[in]  thresh      Motion threshold in mg.
- *  @param[in]  time        Duration in milliseconds that the accel data must
- *                          exceed @e thresh before motion is reported.
- *  @param[in]  lpa_freq    Minimum sampling rate, or zero to disable.
- *  @return     0 if successful.
- */
-int mpu_lp_motion_interrupt(unsigned short thresh, unsigned char time,
-    unsigned char lpa_freq)
-{
-    unsigned char data[3];
-
-    if (lpa_freq) {
-        unsigned char thresh_hw;
-
-#if defined MPU6500
-        /* 1LSb = 4mg. */
-        if (thresh > 1020)
-            thresh_hw = 255;
-        else if (thresh < 4)
-            thresh_hw = 1;
-        else
-            thresh_hw = thresh >> 2;
-#endif
-
-        if (!time)
-            /* Minimum duration must be 1ms. */
-            time = 1;
-
-#if defined MPU6500
-        if (lpa_freq > 640)
-#endif
-            /* At this point, the chip has not been re-configured, so the
-             * function can safely exit.
-             */
-            return -1;
-
-        if (!st.chip_cfg.int_motion_only) {
-            /* Store current settings for later. */
-            if (st.chip_cfg.dmp_on) {
-                mpu_set_dmp_state(0);
-                st.chip_cfg.cache.dmp_on = 1;
-            } else
-                st.chip_cfg.cache.dmp_on = 0;
-            mpu_get_gyro_fsr(&st.chip_cfg.cache.gyro_fsr);
-            mpu_get_accel_fsr(&st.chip_cfg.cache.accel_fsr);
-            mpu_get_lpf(&st.chip_cfg.cache.lpf);
-            mpu_get_sample_rate(&st.chip_cfg.cache.sample_rate);
-            st.chip_cfg.cache.sensors_on = st.chip_cfg.sensors;
-            mpu_get_fifo_config(&st.chip_cfg.cache.fifo_sensors);
-        }
-
-#if defined MPU6500
-        /* Disable hardware interrupts. */
-        set_int_enable(0);
-
-        /* Enter full-power accel-only mode, no FIFO/DMP. */
-        data[0] = 0;
-        data[1] = 0;
-        data[2] = BIT_STBY_XYZG;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 3, data))
-            goto lp_int_restore;
-
-        /* Set motion threshold. */
-        data[0] = thresh_hw;
-        if (i2c_write(st.hw->addr, st.reg->motion_thr, 1, data))
-            goto lp_int_restore;
-
-        /* Set wake frequency. */
-        if (lpa_freq == 1)
-            data[0] = INV_LPA_1_25HZ;
-        else if (lpa_freq == 2)
-            data[0] = INV_LPA_2_5HZ;
-        else if (lpa_freq <= 5)
-            data[0] = INV_LPA_5HZ;
-        else if (lpa_freq <= 10)
-            data[0] = INV_LPA_10HZ;
-        else if (lpa_freq <= 20)
-            data[0] = INV_LPA_20HZ;
-        else if (lpa_freq <= 40)
-            data[0] = INV_LPA_40HZ;
-        else if (lpa_freq <= 80)
-            data[0] = INV_LPA_80HZ;
-        else if (lpa_freq <= 160)
-            data[0] = INV_LPA_160HZ;
-        else if (lpa_freq <= 320)
-            data[0] = INV_LPA_320HZ;
-        else
-            data[0] = INV_LPA_640HZ;
-        if (i2c_write(st.hw->addr, st.reg->lp_accel_odr, 1, data))
-            goto lp_int_restore;
-
-        /* Enable motion interrupt (MPU6500 version). */
-        data[0] = BITS_WOM_EN;
-        if (i2c_write(st.hw->addr, st.reg->accel_intel, 1, data))
-            goto lp_int_restore;
-
-        /* Enable cycle mode. */
-        data[0] = BIT_LPA_CYCLE;
-        if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, data))
-            goto lp_int_restore;
-
-        /* Enable interrupt. */
-        data[0] = BIT_MOT_INT_EN;
-        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, data))
-            goto lp_int_restore;
-
-        st.chip_cfg.int_motion_only = 1;
-        return 0;
-#endif
-    } else {
-        /* Don't "restore" the previous state if no state has been saved. */
-        int ii;
-        char *cache_ptr = (char*)&st.chip_cfg.cache;
-        for (ii = 0; ii < sizeof(st.chip_cfg.cache); ii++) {
-            if (cache_ptr[ii] != 0)
-                goto lp_int_restore;
-        }
-        /* If we reach this point, motion interrupt mode hasn't been used yet. */
-        return -1;
-    }
-lp_int_restore:
-    /* Set to invalid values to ensure no I2C writes are skipped. */
-    st.chip_cfg.gyro_fsr = 0xFF;
-    st.chip_cfg.accel_fsr = 0xFF;
-    st.chip_cfg.lpf = 0xFF;
-    st.chip_cfg.sample_rate = 0xFFFF;
-    st.chip_cfg.sensors = 0xFF;
-    st.chip_cfg.fifo_enable = 0xFF;
-    st.chip_cfg.clk_src = INV_CLK_PLL;
-    mpu_set_sensors(st.chip_cfg.cache.sensors_on);
-    mpu_set_gyro_fsr(st.chip_cfg.cache.gyro_fsr);
-    mpu_set_accel_fsr(st.chip_cfg.cache.accel_fsr);
-    mpu_set_lpf(st.chip_cfg.cache.lpf);
-    mpu_set_sample_rate(st.chip_cfg.cache.sample_rate);
-    mpu_configure_fifo(st.chip_cfg.cache.fifo_sensors);
-
-    if (st.chip_cfg.cache.dmp_on)
-        mpu_set_dmp_state(1);
-
-#ifdef MPU6500
-    /* Disable motion interrupt (MPU6500 version). */
-    data[0] = 0;
-    if (i2c_write(st.hw->addr, st.reg->accel_intel, 1, data))
-        goto lp_int_restore;
-#endif
-
-    st.chip_cfg.int_motion_only = 0;
-    return 0;
-}
-
-/**
- *  @}
- */
-

+ 0 - 132
Core备份3/imu4/inv_mpu4.h

@@ -1,132 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011-2012 InvenSense Corporation, All Rights Reserved.
-    See included License.txt for License information.
- $
- */
-/**
- *  @addtogroup  DRIVERS Sensor Driver Layer
- *  @brief       Hardware drivers to communicate with sensors via I2C.
- *
- *  @{
- *      @file       inv_mpu.h
- *      @brief      An I2C-based driver for Invensense gyroscopes.
- *      @details    This driver currently works for the following devices:
- *                  MPU6050
- *                  MPU6500
- *                  MPU9150 (or MPU6050 w/ AK8975 on the auxiliary bus)
- *                  MPU9250 (or MPU6500 w/ AK8963 on the auxiliary bus)
- */
-
-#ifndef _INV_MPU_H_
-#define _INV_MPU_H_
-
-#define MOTION_DRIVER_TARGET_STM32
-#define MPU6050
-//#define EMPL
-//#define USE_DMP
-
-#define INV_X_GYRO      (0x40)
-#define INV_Y_GYRO      (0x20)
-#define INV_Z_GYRO      (0x10)
-#define INV_XYZ_GYRO    (INV_X_GYRO | INV_Y_GYRO | INV_Z_GYRO)
-#define INV_XYZ_ACCEL   (0x08)
-#define INV_XYZ_COMPASS (0x01)
-
-struct int_param_s {
-#if defined EMPL_TARGET_MSP430 || defined MOTION_DRIVER_TARGET_MSP430 || defined MOTION_DRIVER_TARGET_STM32
-    void (*cb)(void);
-    unsigned short pin;
-    unsigned char lp_exit;
-    unsigned char active_low;
-#elif defined EMPL_TARGET_UC3L0
-    unsigned long pin;
-    void (*cb)(volatile void*);
-    void *arg;
-#endif
-};
-
-#define MPU_INT_STATUS_DATA_READY       (0x0001)
-#define MPU_INT_STATUS_DMP              (0x0002)
-#define MPU_INT_STATUS_PLL_READY        (0x0004)
-#define MPU_INT_STATUS_I2C_MST          (0x0008)
-#define MPU_INT_STATUS_FIFO_OVERFLOW    (0x0010)
-#define MPU_INT_STATUS_ZMOT             (0x0020)
-#define MPU_INT_STATUS_MOT              (0x0040)
-#define MPU_INT_STATUS_FREE_FALL        (0x0080)
-#define MPU_INT_STATUS_DMP_0            (0x0100)
-#define MPU_INT_STATUS_DMP_1            (0x0200)
-#define MPU_INT_STATUS_DMP_2            (0x0400)
-#define MPU_INT_STATUS_DMP_3            (0x0800)
-#define MPU_INT_STATUS_DMP_4            (0x1000)
-#define MPU_INT_STATUS_DMP_5            (0x2000)
-
-/* Set up APIs */
-int mpu_init(struct int_param_s *int_param);
-int mpu_init_slave(void);
-int mpu_set_bypass(unsigned char bypass_on);
-
-/* Configuration APIs */
-int mpu_lp_accel_mode(unsigned char rate);
-int mpu_lp_motion_interrupt(unsigned short thresh, unsigned char time,
-    unsigned char lpa_freq);
-int mpu_set_int_level(unsigned char active_low);
-int mpu_set_int_latched(unsigned char enable);
-
-int mpu_set_dmp_state(unsigned char enable);
-int mpu_get_dmp_state(unsigned char *enabled);
-
-int mpu_get_lpf(unsigned short *lpf);
-int mpu_set_lpf(unsigned short lpf);
-
-int mpu_get_gyro_fsr(unsigned short *fsr);
-int mpu_set_gyro_fsr(unsigned short fsr);
-
-int mpu_get_accel_fsr(unsigned char *fsr);
-int mpu_set_accel_fsr(unsigned char fsr);
-
-int mpu_get_compass_fsr(unsigned short *fsr);
-
-int mpu_get_gyro_sens(float *sens);
-int mpu_get_accel_sens(unsigned short *sens);
-
-int mpu_get_sample_rate(unsigned short *rate);
-int mpu_set_sample_rate(unsigned short rate);
-int mpu_get_compass_sample_rate(unsigned short *rate);
-int mpu_set_compass_sample_rate(unsigned short rate);
-
-int mpu_get_fifo_config(unsigned char *sensors);
-int mpu_configure_fifo(unsigned char sensors);
-
-int mpu_get_power_state(unsigned char *power_on);
-int mpu_set_sensors(unsigned char sensors);
-
-int mpu_set_accel_bias(const long *accel_bias);
-
-/* Data getter/setter APIs */
-int mpu_get_gyro_reg(short *data, unsigned long *timestamp);
-int mpu_get_accel_reg(short *data, unsigned long *timestamp);
-int mpu_get_compass_reg(short *data, unsigned long *timestamp);
-int mpu_get_temperature(long *data, unsigned long *timestamp);
-
-int mpu_get_int_status(short *status);
-int mpu_read_fifo(short *gyro, short *accel, unsigned long *timestamp,
-    unsigned char *sensors, unsigned char *more);
-int mpu_read_fifo_stream(unsigned short length, unsigned char *data,
-    unsigned char *more);
-int mpu_reset_fifo(void);
-
-int mpu_write_mem(unsigned short mem_addr, unsigned short length,
-    unsigned char *data);
-int mpu_read_mem(unsigned short mem_addr, unsigned short length,
-    unsigned char *data);
-int mpu_load_firmware(unsigned short length, const unsigned char *firmware,
-    unsigned short start_addr, unsigned short sample_rate);
-
-int mpu_reg_dump(void);
-int mpu_read_reg(unsigned char reg, unsigned char *data);
-int mpu_run_self_test(long *gyro, long *accel);
-int mpu_register_tap_cb(void (*func)(unsigned char, unsigned char));
-
-#endif  /* #ifndef _INV_MPU_H_ */
-

+ 0 - 1380
Core备份3/imu4/inv_mpu_dmp_motion_driver4.c

@@ -1,1380 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011-2012 InvenSense Corporation, All Rights Reserved.
-    See included License.txt for License information.
- $
- */
-/**
- *  @addtogroup  DRIVERS Sensor Driver Layer
- *  @brief       Hardware drivers to communicate with sensors via I2C.
- *
- *  @{
- *      @file       inv_mpu_dmp_motion_driver.c
- *      @brief      DMP image and interface functions.
- *      @details    All functions are preceded by the dmp_ prefix to
- *                  differentiate among MPL and general driver function calls.
- */
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include "inv_mpu4.h"
-#include "inv_mpu_dmp_motion_driver4.h"
-#include "dmpKey4.h"
-#include "dmpmap4.h"
-
-#include "MPU60504.h"
-
-/* The following functions must be defined for this platform:
- * i2c_write(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char const *data)
- * i2c_read(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char *data)
- * delay_ms(unsigned long num_ms)
- * get_ms(unsigned long *count)
- */
-#if defined MOTION_DRIVER_TARGET_MSP430
-#include "msp430.h"
-#include "msp430_clock.h"
-#define delay_ms    msp430_delay_ms
-#define get_ms      msp430_get_clock_ms
-#define log_i(...)     do {} while (0)
-#define log_e(...)     do {} while (0)
-
-#elif defined EMPL_TARGET_MSP430
-#include "msp430.h"
-#include "msp430_clock.h"
-#include "log.h"
-#define delay_ms    msp430_delay_ms
-#define get_ms      msp430_get_clock_ms
-#define log_i       MPL_LOGI
-#define log_e       MPL_LOGE
-
-#elif defined EMPL_TARGET_UC3L0
-/* Instead of using the standard TWI driver from the ASF library, we're using
- * a TWI driver that follows the slave address + register address convention.
- */
-#include "delay.h"
-#include "sysclk.h"
-#include "log.h"
-#include "uc3l0_clock.h"
-/* delay_ms is a function already defined in ASF. */
-#define get_ms  uc3l0_get_clock_ms
-#define log_i       MPL_LOGI
-#define log_e       MPL_LOGE
-
-#elif defined MOTION_DRIVER_TARGET_STM32
-
-#define delay_ms    HAL_Delay
-#define get_ms      get_tick_count
-
-#define log_i(...)     do {} while (0)
-#define log_e(...)     do {} while (0)
-
-#else
-#error  Gyro driver is missing the system layer implementations.
-#endif
-
-/* These defines are copied from dmpDefaultMPU6050.c in the general MPL
- * releases. These defines may change for each DMP image, so be sure to modify
- * these values when switching to a new image.
- */
-#define CFG_LP_QUAT             (2712)
-#define END_ORIENT_TEMP         (1866)
-#define CFG_27                  (2742)
-#define CFG_20                  (2224)
-#define CFG_23                  (2745)
-#define CFG_FIFO_ON_EVENT       (2690)
-#define END_PREDICTION_UPDATE   (1761)
-#define CGNOTICE_INTR           (2620)
-#define X_GRT_Y_TMP             (1358)
-#define CFG_DR_INT              (1029)
-#define CFG_AUTH                (1035)
-#define UPDATE_PROP_ROT         (1835)
-#define END_COMPARE_Y_X_TMP2    (1455)
-#define SKIP_X_GRT_Y_TMP        (1359)
-#define SKIP_END_COMPARE        (1435)
-#define FCFG_3                  (1088)
-#define FCFG_2                  (1066)
-#define FCFG_1                  (1062)
-#define END_COMPARE_Y_X_TMP3    (1434)
-#define FCFG_7                  (1073)
-#define FCFG_6                  (1106)
-#define FLAT_STATE_END          (1713)
-#define SWING_END_4             (1616)
-#define SWING_END_2             (1565)
-#define SWING_END_3             (1587)
-#define SWING_END_1             (1550)
-#define CFG_8                   (2718)
-#define CFG_15                  (2727)
-#define CFG_16                  (2746)
-#define CFG_EXT_GYRO_BIAS       (1189)
-#define END_COMPARE_Y_X_TMP     (1407)
-#define DO_NOT_UPDATE_PROP_ROT  (1839)
-#define CFG_7                   (1205)
-#define FLAT_STATE_END_TEMP     (1683)
-#define END_COMPARE_Y_X         (1484)
-#define SKIP_SWING_END_1        (1551)
-#define SKIP_SWING_END_3        (1588)
-#define SKIP_SWING_END_2        (1566)
-#define TILTG75_START           (1672)
-#define CFG_6                   (2753)
-#define TILTL75_END             (1669)
-#define END_ORIENT              (1884)
-#define CFG_FLICK_IN            (2573)
-#define TILTL75_START           (1643)
-#define CFG_MOTION_BIAS         (1208)
-#define X_GRT_Y                 (1408)
-#define TEMPLABEL               (2324)
-#define CFG_ANDROID_ORIENT_INT  (1853)
-#define CFG_GYRO_RAW_DATA       (2722)
-#define X_GRT_Y_TMP2            (1379)
-
-#define D_0_22                  (22+512)
-#define D_0_24                  (24+512)
-
-#define D_0_36                  (36)
-#define D_0_52                  (52)
-#define D_0_96                  (96)
-#define D_0_104                 (104)
-#define D_0_108                 (108)
-#define D_0_163                 (163)
-#define D_0_188                 (188)
-#define D_0_192                 (192)
-#define D_0_224                 (224)
-#define D_0_228                 (228)
-#define D_0_232                 (232)
-#define D_0_236                 (236)
-
-#define D_1_2                   (256 + 2)
-#define D_1_4                   (256 + 4)
-#define D_1_8                   (256 + 8)
-#define D_1_10                  (256 + 10)
-#define D_1_24                  (256 + 24)
-#define D_1_28                  (256 + 28)
-#define D_1_36                  (256 + 36)
-#define D_1_40                  (256 + 40)
-#define D_1_44                  (256 + 44)
-#define D_1_72                  (256 + 72)
-#define D_1_74                  (256 + 74)
-#define D_1_79                  (256 + 79)
-#define D_1_88                  (256 + 88)
-#define D_1_90                  (256 + 90)
-#define D_1_92                  (256 + 92)
-#define D_1_96                  (256 + 96)
-#define D_1_98                  (256 + 98)
-#define D_1_106                 (256 + 106)
-#define D_1_108                 (256 + 108)
-#define D_1_112                 (256 + 112)
-#define D_1_128                 (256 + 144)
-#define D_1_152                 (256 + 12)
-#define D_1_160                 (256 + 160)
-#define D_1_176                 (256 + 176)
-#define D_1_178                 (256 + 178)
-#define D_1_218                 (256 + 218)
-#define D_1_232                 (256 + 232)
-#define D_1_236                 (256 + 236)
-#define D_1_240                 (256 + 240)
-#define D_1_244                 (256 + 244)
-#define D_1_250                 (256 + 250)
-#define D_1_252                 (256 + 252)
-#define D_2_12                  (512 + 12)
-#define D_2_96                  (512 + 96)
-#define D_2_108                 (512 + 108)
-#define D_2_208                 (512 + 208)
-#define D_2_224                 (512 + 224)
-#define D_2_236                 (512 + 236)
-#define D_2_244                 (512 + 244)
-#define D_2_248                 (512 + 248)
-#define D_2_252                 (512 + 252)
-
-#define CPASS_BIAS_X            (35 * 16 + 4)
-#define CPASS_BIAS_Y            (35 * 16 + 8)
-#define CPASS_BIAS_Z            (35 * 16 + 12)
-#define CPASS_MTX_00            (36 * 16)
-#define CPASS_MTX_01            (36 * 16 + 4)
-#define CPASS_MTX_02            (36 * 16 + 8)
-#define CPASS_MTX_10            (36 * 16 + 12)
-#define CPASS_MTX_11            (37 * 16)
-#define CPASS_MTX_12            (37 * 16 + 4)
-#define CPASS_MTX_20            (37 * 16 + 8)
-#define CPASS_MTX_21            (37 * 16 + 12)
-#define CPASS_MTX_22            (43 * 16 + 12)
-#define D_EXT_GYRO_BIAS_X       (61 * 16)
-#define D_EXT_GYRO_BIAS_Y       (61 * 16) + 4
-#define D_EXT_GYRO_BIAS_Z       (61 * 16) + 8
-#define D_ACT0                  (40 * 16)
-#define D_ACSX                  (40 * 16 + 4)
-#define D_ACSY                  (40 * 16 + 8)
-#define D_ACSZ                  (40 * 16 + 12)
-
-#define FLICK_MSG               (45 * 16 + 4)
-#define FLICK_COUNTER           (45 * 16 + 8)
-#define FLICK_LOWER             (45 * 16 + 12)
-#define FLICK_UPPER             (46 * 16 + 12)
-
-#define D_AUTH_OUT              (992)
-#define D_AUTH_IN               (996)
-#define D_AUTH_A                (1000)
-#define D_AUTH_B                (1004)
-
-#define D_PEDSTD_BP_B           (768 + 0x1C)
-#define D_PEDSTD_HP_A           (768 + 0x78)
-#define D_PEDSTD_HP_B           (768 + 0x7C)
-#define D_PEDSTD_BP_A4          (768 + 0x40)
-#define D_PEDSTD_BP_A3          (768 + 0x44)
-#define D_PEDSTD_BP_A2          (768 + 0x48)
-#define D_PEDSTD_BP_A1          (768 + 0x4C)
-#define D_PEDSTD_INT_THRSH      (768 + 0x68)
-#define D_PEDSTD_CLIP           (768 + 0x6C)
-#define D_PEDSTD_SB             (768 + 0x28)
-#define D_PEDSTD_SB_TIME        (768 + 0x2C)
-#define D_PEDSTD_PEAKTHRSH      (768 + 0x98)
-#define D_PEDSTD_TIML           (768 + 0x2A)
-#define D_PEDSTD_TIMH           (768 + 0x2E)
-#define D_PEDSTD_PEAK           (768 + 0X94)
-#define D_PEDSTD_STEPCTR        (768 + 0x60)
-#define D_PEDSTD_TIMECTR        (964)
-#define D_PEDSTD_DECI           (768 + 0xA0)
-
-#define D_HOST_NO_MOT           (976)
-#define D_ACCEL_BIAS            (660)
-
-#define D_ORIENT_GAP            (76)
-
-#define D_TILT0_H               (48)
-#define D_TILT0_L               (50)
-#define D_TILT1_H               (52)
-#define D_TILT1_L               (54)
-#define D_TILT2_H               (56)
-#define D_TILT2_L               (58)
-#define D_TILT3_H               (60)
-#define D_TILT3_L               (62)
-
-#define DMP_CODE_SIZE           (3062)
-
-static const unsigned char dmp_memory[DMP_CODE_SIZE] = {
-    /* bank # 0 */
-    0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x00, 0x00,
-    0x00, 0x65, 0x00, 0x54, 0xff, 0xef, 0x00, 0x00, 0xfa, 0x80, 0x00, 0x0b, 0x12, 0x82, 0x00, 0x01,
-    0x03, 0x0c, 0x30, 0xc3, 0x0e, 0x8c, 0x8c, 0xe9, 0x14, 0xd5, 0x40, 0x02, 0x13, 0x71, 0x0f, 0x8e,
-    0x38, 0x83, 0xf8, 0x83, 0x30, 0x00, 0xf8, 0x83, 0x25, 0x8e, 0xf8, 0x83, 0x30, 0x00, 0xf8, 0x83,
-    0xff, 0xff, 0xff, 0xff, 0x0f, 0xfe, 0xa9, 0xd6, 0x24, 0x00, 0x04, 0x00, 0x1a, 0x82, 0x79, 0xa1,
-    0x00, 0x00, 0x00, 0x3c, 0xff, 0xff, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x38, 0x83, 0x6f, 0xa2,
-    0x00, 0x3e, 0x03, 0x30, 0x40, 0x00, 0x00, 0x00, 0x02, 0xca, 0xe3, 0x09, 0x3e, 0x80, 0x00, 0x00,
-    0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
-    0x00, 0x0c, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x6e, 0x00, 0x00, 0x06, 0x92, 0x0a, 0x16, 0xc0, 0xdf,
-    0xff, 0xff, 0x02, 0x56, 0xfd, 0x8c, 0xd3, 0x77, 0xff, 0xe1, 0xc4, 0x96, 0xe0, 0xc5, 0xbe, 0xaa,
-    0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0b, 0x2b, 0x00, 0x00, 0x16, 0x57, 0x00, 0x00, 0x03, 0x59,
-    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0xfa, 0x00, 0x02, 0x6c, 0x1d, 0x00, 0x00, 0x00, 0x00,
-    0x3f, 0xff, 0xdf, 0xeb, 0x00, 0x3e, 0xb3, 0xb6, 0x00, 0x0d, 0x22, 0x78, 0x00, 0x00, 0x2f, 0x3c,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x42, 0xb5, 0x00, 0x00, 0x39, 0xa2, 0x00, 0x00, 0xb3, 0x65,
-    0xd9, 0x0e, 0x9f, 0xc9, 0x1d, 0xcf, 0x4c, 0x34, 0x30, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00,
-    0x3b, 0xb6, 0x7a, 0xe8, 0x00, 0x64, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    /* bank # 1 */
-    0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0xfa, 0x92, 0x10, 0x00, 0x22, 0x5e, 0x00, 0x0d, 0x22, 0x9f,
-    0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0xff, 0x46, 0x00, 0x00, 0x63, 0xd4, 0x00, 0x00,
-    0x10, 0x00, 0x00, 0x00, 0x04, 0xd6, 0x00, 0x00, 0x04, 0xcc, 0x00, 0x00, 0x04, 0xcc, 0x00, 0x00,
-    0x00, 0x00, 0x10, 0x72, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x06, 0x00, 0x02, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x64, 0x00, 0x20, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, 0x00,
-    0x00, 0x00, 0x00, 0x32, 0xf8, 0x98, 0x00, 0x00, 0xff, 0x65, 0x00, 0x00, 0x83, 0x0f, 0x00, 0x00,
-    0xff, 0x9b, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
-    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0xb2, 0x6a, 0x00, 0x02, 0x00, 0x00,
-    0x00, 0x01, 0xfb, 0x83, 0x00, 0x68, 0x00, 0x00, 0x00, 0xd9, 0xfc, 0x00, 0x7c, 0xf1, 0xff, 0x83,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x64, 0x03, 0xe8, 0x00, 0x64, 0x00, 0x28,
-    0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x16, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
-    0x00, 0x00, 0x10, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x01, 0xf4, 0x00, 0x00, 0x10, 0x00,
-    /* bank # 2 */
-    0x00, 0x28, 0x00, 0x00, 0xff, 0xff, 0x45, 0x81, 0xff, 0xff, 0xfa, 0x72, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x05, 0x00, 0x05, 0xba, 0xc6, 0x00, 0x47, 0x78, 0xa2,
-    0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x14,
-    0x00, 0x00, 0x25, 0x4d, 0x00, 0x2f, 0x70, 0x6d, 0x00, 0x00, 0x05, 0xae, 0x00, 0x0c, 0x02, 0xd0,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x64, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x0e,
-    0x00, 0x00, 0x0a, 0xc7, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0xff, 0xff, 0xff, 0x9c,
-    0x00, 0x00, 0x0b, 0x2b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x64,
-    0xff, 0xe5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    /* bank # 3 */
-    0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x24, 0x26, 0xd3,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x96, 0x00, 0x3c,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x0c, 0x0a, 0x4e, 0x68, 0xcd, 0xcf, 0x77, 0x09, 0x50, 0x16, 0x67, 0x59, 0xc6, 0x19, 0xce, 0x82,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xd7, 0x84, 0x00, 0x03, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc7, 0x93, 0x8f, 0x9d, 0x1e, 0x1b, 0x1c, 0x19,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x18, 0x85, 0x00, 0x00, 0x40, 0x00,
-    0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x67, 0x7d, 0xdf, 0x7e, 0x72, 0x90, 0x2e, 0x55, 0x4c, 0xf6, 0xe6, 0x88,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-
-    /* bank # 4 */
-    0xd8, 0xdc, 0xb4, 0xb8, 0xb0, 0xd8, 0xb9, 0xab, 0xf3, 0xf8, 0xfa, 0xb3, 0xb7, 0xbb, 0x8e, 0x9e,
-    0xae, 0xf1, 0x32, 0xf5, 0x1b, 0xf1, 0xb4, 0xb8, 0xb0, 0x80, 0x97, 0xf1, 0xa9, 0xdf, 0xdf, 0xdf,
-    0xaa, 0xdf, 0xdf, 0xdf, 0xf2, 0xaa, 0xc5, 0xcd, 0xc7, 0xa9, 0x0c, 0xc9, 0x2c, 0x97, 0xf1, 0xa9,
-    0x89, 0x26, 0x46, 0x66, 0xb2, 0x89, 0x99, 0xa9, 0x2d, 0x55, 0x7d, 0xb0, 0xb0, 0x8a, 0xa8, 0x96,
-    0x36, 0x56, 0x76, 0xf1, 0xba, 0xa3, 0xb4, 0xb2, 0x80, 0xc0, 0xb8, 0xa8, 0x97, 0x11, 0xb2, 0x83,
-    0x98, 0xba, 0xa3, 0xf0, 0x24, 0x08, 0x44, 0x10, 0x64, 0x18, 0xb2, 0xb9, 0xb4, 0x98, 0x83, 0xf1,
-    0xa3, 0x29, 0x55, 0x7d, 0xba, 0xb5, 0xb1, 0xa3, 0x83, 0x93, 0xf0, 0x00, 0x28, 0x50, 0xf5, 0xb2,
-    0xb6, 0xaa, 0x83, 0x93, 0x28, 0x54, 0x7c, 0xf1, 0xb9, 0xa3, 0x82, 0x93, 0x61, 0xba, 0xa2, 0xda,
-    0xde, 0xdf, 0xdb, 0x81, 0x9a, 0xb9, 0xae, 0xf5, 0x60, 0x68, 0x70, 0xf1, 0xda, 0xba, 0xa2, 0xdf,
-    0xd9, 0xba, 0xa2, 0xfa, 0xb9, 0xa3, 0x82, 0x92, 0xdb, 0x31, 0xba, 0xa2, 0xd9, 0xba, 0xa2, 0xf8,
-    0xdf, 0x85, 0xa4, 0xd0, 0xc1, 0xbb, 0xad, 0x83, 0xc2, 0xc5, 0xc7, 0xb8, 0xa2, 0xdf, 0xdf, 0xdf,
-    0xba, 0xa0, 0xdf, 0xdf, 0xdf, 0xd8, 0xd8, 0xf1, 0xb8, 0xaa, 0xb3, 0x8d, 0xb4, 0x98, 0x0d, 0x35,
-    0x5d, 0xb2, 0xb6, 0xba, 0xaf, 0x8c, 0x96, 0x19, 0x8f, 0x9f, 0xa7, 0x0e, 0x16, 0x1e, 0xb4, 0x9a,
-    0xb8, 0xaa, 0x87, 0x2c, 0x54, 0x7c, 0xba, 0xa4, 0xb0, 0x8a, 0xb6, 0x91, 0x32, 0x56, 0x76, 0xb2,
-    0x84, 0x94, 0xa4, 0xc8, 0x08, 0xcd, 0xd8, 0xb8, 0xb4, 0xb0, 0xf1, 0x99, 0x82, 0xa8, 0x2d, 0x55,
-    0x7d, 0x98, 0xa8, 0x0e, 0x16, 0x1e, 0xa2, 0x2c, 0x54, 0x7c, 0x92, 0xa4, 0xf0, 0x2c, 0x50, 0x78,
-    /* bank # 5 */
-    0xf1, 0x84, 0xa8, 0x98, 0xc4, 0xcd, 0xfc, 0xd8, 0x0d, 0xdb, 0xa8, 0xfc, 0x2d, 0xf3, 0xd9, 0xba,
-    0xa6, 0xf8, 0xda, 0xba, 0xa6, 0xde, 0xd8, 0xba, 0xb2, 0xb6, 0x86, 0x96, 0xa6, 0xd0, 0xf3, 0xc8,
-    0x41, 0xda, 0xa6, 0xc8, 0xf8, 0xd8, 0xb0, 0xb4, 0xb8, 0x82, 0xa8, 0x92, 0xf5, 0x2c, 0x54, 0x88,
-    0x98, 0xf1, 0x35, 0xd9, 0xf4, 0x18, 0xd8, 0xf1, 0xa2, 0xd0, 0xf8, 0xf9, 0xa8, 0x84, 0xd9, 0xc7,
-    0xdf, 0xf8, 0xf8, 0x83, 0xc5, 0xda, 0xdf, 0x69, 0xdf, 0x83, 0xc1, 0xd8, 0xf4, 0x01, 0x14, 0xf1,
-    0xa8, 0x82, 0x4e, 0xa8, 0x84, 0xf3, 0x11, 0xd1, 0x82, 0xf5, 0xd9, 0x92, 0x28, 0x97, 0x88, 0xf1,
-    0x09, 0xf4, 0x1c, 0x1c, 0xd8, 0x84, 0xa8, 0xf3, 0xc0, 0xf9, 0xd1, 0xd9, 0x97, 0x82, 0xf1, 0x29,
-    0xf4, 0x0d, 0xd8, 0xf3, 0xf9, 0xf9, 0xd1, 0xd9, 0x82, 0xf4, 0xc2, 0x03, 0xd8, 0xde, 0xdf, 0x1a,
-    0xd8, 0xf1, 0xa2, 0xfa, 0xf9, 0xa8, 0x84, 0x98, 0xd9, 0xc7, 0xdf, 0xf8, 0xf8, 0xf8, 0x83, 0xc7,
-    0xda, 0xdf, 0x69, 0xdf, 0xf8, 0x83, 0xc3, 0xd8, 0xf4, 0x01, 0x14, 0xf1, 0x98, 0xa8, 0x82, 0x2e,
-    0xa8, 0x84, 0xf3, 0x11, 0xd1, 0x82, 0xf5, 0xd9, 0x92, 0x50, 0x97, 0x88, 0xf1, 0x09, 0xf4, 0x1c,
-    0xd8, 0x84, 0xa8, 0xf3, 0xc0, 0xf8, 0xf9, 0xd1, 0xd9, 0x97, 0x82, 0xf1, 0x49, 0xf4, 0x0d, 0xd8,
-    0xf3, 0xf9, 0xf9, 0xd1, 0xd9, 0x82, 0xf4, 0xc4, 0x03, 0xd8, 0xde, 0xdf, 0xd8, 0xf1, 0xad, 0x88,
-    0x98, 0xcc, 0xa8, 0x09, 0xf9, 0xd9, 0x82, 0x92, 0xa8, 0xf5, 0x7c, 0xf1, 0x88, 0x3a, 0xcf, 0x94,
-    0x4a, 0x6e, 0x98, 0xdb, 0x69, 0x31, 0xda, 0xad, 0xf2, 0xde, 0xf9, 0xd8, 0x87, 0x95, 0xa8, 0xf2,
-    0x21, 0xd1, 0xda, 0xa5, 0xf9, 0xf4, 0x17, 0xd9, 0xf1, 0xae, 0x8e, 0xd0, 0xc0, 0xc3, 0xae, 0x82,
-    /* bank # 6 */
-    0xc6, 0x84, 0xc3, 0xa8, 0x85, 0x95, 0xc8, 0xa5, 0x88, 0xf2, 0xc0, 0xf1, 0xf4, 0x01, 0x0e, 0xf1,
-    0x8e, 0x9e, 0xa8, 0xc6, 0x3e, 0x56, 0xf5, 0x54, 0xf1, 0x88, 0x72, 0xf4, 0x01, 0x15, 0xf1, 0x98,
-    0x45, 0x85, 0x6e, 0xf5, 0x8e, 0x9e, 0x04, 0x88, 0xf1, 0x42, 0x98, 0x5a, 0x8e, 0x9e, 0x06, 0x88,
-    0x69, 0xf4, 0x01, 0x1c, 0xf1, 0x98, 0x1e, 0x11, 0x08, 0xd0, 0xf5, 0x04, 0xf1, 0x1e, 0x97, 0x02,
-    0x02, 0x98, 0x36, 0x25, 0xdb, 0xf9, 0xd9, 0x85, 0xa5, 0xf3, 0xc1, 0xda, 0x85, 0xa5, 0xf3, 0xdf,
-    0xd8, 0x85, 0x95, 0xa8, 0xf3, 0x09, 0xda, 0xa5, 0xfa, 0xd8, 0x82, 0x92, 0xa8, 0xf5, 0x78, 0xf1,
-    0x88, 0x1a, 0x84, 0x9f, 0x26, 0x88, 0x98, 0x21, 0xda, 0xf4, 0x1d, 0xf3, 0xd8, 0x87, 0x9f, 0x39,
-    0xd1, 0xaf, 0xd9, 0xdf, 0xdf, 0xfb, 0xf9, 0xf4, 0x0c, 0xf3, 0xd8, 0xfa, 0xd0, 0xf8, 0xda, 0xf9,
-    0xf9, 0xd0, 0xdf, 0xd9, 0xf9, 0xd8, 0xf4, 0x0b, 0xd8, 0xf3, 0x87, 0x9f, 0x39, 0xd1, 0xaf, 0xd9,
-    0xdf, 0xdf, 0xf4, 0x1d, 0xf3, 0xd8, 0xfa, 0xfc, 0xa8, 0x69, 0xf9, 0xf9, 0xaf, 0xd0, 0xda, 0xde,
-    0xfa, 0xd9, 0xf8, 0x8f, 0x9f, 0xa8, 0xf1, 0xcc, 0xf3, 0x98, 0xdb, 0x45, 0xd9, 0xaf, 0xdf, 0xd0,
-    0xf8, 0xd8, 0xf1, 0x8f, 0x9f, 0xa8, 0xca, 0xf3, 0x88, 0x09, 0xda, 0xaf, 0x8f, 0xcb, 0xf8, 0xd8,
-    0xf2, 0xad, 0x97, 0x8d, 0x0c, 0xd9, 0xa5, 0xdf, 0xf9, 0xba, 0xa6, 0xf3, 0xfa, 0xf4, 0x12, 0xf2,
-    0xd8, 0x95, 0x0d, 0xd1, 0xd9, 0xba, 0xa6, 0xf3, 0xfa, 0xda, 0xa5, 0xf2, 0xc1, 0xba, 0xa6, 0xf3,
-    0xdf, 0xd8, 0xf1, 0xba, 0xb2, 0xb6, 0x86, 0x96, 0xa6, 0xd0, 0xca, 0xf3, 0x49, 0xda, 0xa6, 0xcb,
-    0xf8, 0xd8, 0xb0, 0xb4, 0xb8, 0xd8, 0xad, 0x84, 0xf2, 0xc0, 0xdf, 0xf1, 0x8f, 0xcb, 0xc3, 0xa8,
-    /* bank # 7 */
-    0xb2, 0xb6, 0x86, 0x96, 0xc8, 0xc1, 0xcb, 0xc3, 0xf3, 0xb0, 0xb4, 0x88, 0x98, 0xa8, 0x21, 0xdb,
-    0x71, 0x8d, 0x9d, 0x71, 0x85, 0x95, 0x21, 0xd9, 0xad, 0xf2, 0xfa, 0xd8, 0x85, 0x97, 0xa8, 0x28,
-    0xd9, 0xf4, 0x08, 0xd8, 0xf2, 0x8d, 0x29, 0xda, 0xf4, 0x05, 0xd9, 0xf2, 0x85, 0xa4, 0xc2, 0xf2,
-    0xd8, 0xa8, 0x8d, 0x94, 0x01, 0xd1, 0xd9, 0xf4, 0x11, 0xf2, 0xd8, 0x87, 0x21, 0xd8, 0xf4, 0x0a,
-    0xd8, 0xf2, 0x84, 0x98, 0xa8, 0xc8, 0x01, 0xd1, 0xd9, 0xf4, 0x11, 0xd8, 0xf3, 0xa4, 0xc8, 0xbb,
-    0xaf, 0xd0, 0xf2, 0xde, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xd8, 0xf1, 0xb8, 0xf6,
-    0xb5, 0xb9, 0xb0, 0x8a, 0x95, 0xa3, 0xde, 0x3c, 0xa3, 0xd9, 0xf8, 0xd8, 0x5c, 0xa3, 0xd9, 0xf8,
-    0xd8, 0x7c, 0xa3, 0xd9, 0xf8, 0xd8, 0xf8, 0xf9, 0xd1, 0xa5, 0xd9, 0xdf, 0xda, 0xfa, 0xd8, 0xb1,
-    0x85, 0x30, 0xf7, 0xd9, 0xde, 0xd8, 0xf8, 0x30, 0xad, 0xda, 0xde, 0xd8, 0xf2, 0xb4, 0x8c, 0x99,
-    0xa3, 0x2d, 0x55, 0x7d, 0xa0, 0x83, 0xdf, 0xdf, 0xdf, 0xb5, 0x91, 0xa0, 0xf6, 0x29, 0xd9, 0xfb,
-    0xd8, 0xa0, 0xfc, 0x29, 0xd9, 0xfa, 0xd8, 0xa0, 0xd0, 0x51, 0xd9, 0xf8, 0xd8, 0xfc, 0x51, 0xd9,
-    0xf9, 0xd8, 0x79, 0xd9, 0xfb, 0xd8, 0xa0, 0xd0, 0xfc, 0x79, 0xd9, 0xfa, 0xd8, 0xa1, 0xf9, 0xf9,
-    0xf9, 0xf9, 0xf9, 0xa0, 0xda, 0xdf, 0xdf, 0xdf, 0xd8, 0xa1, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xac,
-    0xde, 0xf8, 0xad, 0xde, 0x83, 0x93, 0xac, 0x2c, 0x54, 0x7c, 0xf1, 0xa8, 0xdf, 0xdf, 0xdf, 0xf6,
-    0x9d, 0x2c, 0xda, 0xa0, 0xdf, 0xd9, 0xfa, 0xdb, 0x2d, 0xf8, 0xd8, 0xa8, 0x50, 0xda, 0xa0, 0xd0,
-    0xde, 0xd9, 0xd0, 0xf8, 0xf8, 0xf8, 0xdb, 0x55, 0xf8, 0xd8, 0xa8, 0x78, 0xda, 0xa0, 0xd0, 0xdf,
-    /* bank # 8 */
-    0xd9, 0xd0, 0xfa, 0xf8, 0xf8, 0xf8, 0xf8, 0xdb, 0x7d, 0xf8, 0xd8, 0x9c, 0xa8, 0x8c, 0xf5, 0x30,
-    0xdb, 0x38, 0xd9, 0xd0, 0xde, 0xdf, 0xa0, 0xd0, 0xde, 0xdf, 0xd8, 0xa8, 0x48, 0xdb, 0x58, 0xd9,
-    0xdf, 0xd0, 0xde, 0xa0, 0xdf, 0xd0, 0xde, 0xd8, 0xa8, 0x68, 0xdb, 0x70, 0xd9, 0xdf, 0xdf, 0xa0,
-    0xdf, 0xdf, 0xd8, 0xf1, 0xa8, 0x88, 0x90, 0x2c, 0x54, 0x7c, 0x98, 0xa8, 0xd0, 0x5c, 0x38, 0xd1,
-    0xda, 0xf2, 0xae, 0x8c, 0xdf, 0xf9, 0xd8, 0xb0, 0x87, 0xa8, 0xc1, 0xc1, 0xb1, 0x88, 0xa8, 0xc6,
-    0xf9, 0xf9, 0xda, 0x36, 0xd8, 0xa8, 0xf9, 0xda, 0x36, 0xd8, 0xa8, 0xf9, 0xda, 0x36, 0xd8, 0xa8,
-    0xf9, 0xda, 0x36, 0xd8, 0xa8, 0xf9, 0xda, 0x36, 0xd8, 0xf7, 0x8d, 0x9d, 0xad, 0xf8, 0x18, 0xda,
-    0xf2, 0xae, 0xdf, 0xd8, 0xf7, 0xad, 0xfa, 0x30, 0xd9, 0xa4, 0xde, 0xf9, 0xd8, 0xf2, 0xae, 0xde,
-    0xfa, 0xf9, 0x83, 0xa7, 0xd9, 0xc3, 0xc5, 0xc7, 0xf1, 0x88, 0x9b, 0xa7, 0x7a, 0xad, 0xf7, 0xde,
-    0xdf, 0xa4, 0xf8, 0x84, 0x94, 0x08, 0xa7, 0x97, 0xf3, 0x00, 0xae, 0xf2, 0x98, 0x19, 0xa4, 0x88,
-    0xc6, 0xa3, 0x94, 0x88, 0xf6, 0x32, 0xdf, 0xf2, 0x83, 0x93, 0xdb, 0x09, 0xd9, 0xf2, 0xaa, 0xdf,
-    0xd8, 0xd8, 0xae, 0xf8, 0xf9, 0xd1, 0xda, 0xf3, 0xa4, 0xde, 0xa7, 0xf1, 0x88, 0x9b, 0x7a, 0xd8,
-    0xf3, 0x84, 0x94, 0xae, 0x19, 0xf9, 0xda, 0xaa, 0xf1, 0xdf, 0xd8, 0xa8, 0x81, 0xc0, 0xc3, 0xc5,
-    0xc7, 0xa3, 0x92, 0x83, 0xf6, 0x28, 0xad, 0xde, 0xd9, 0xf8, 0xd8, 0xa3, 0x50, 0xad, 0xd9, 0xf8,
-    0xd8, 0xa3, 0x78, 0xad, 0xd9, 0xf8, 0xd8, 0xf8, 0xf9, 0xd1, 0xa1, 0xda, 0xde, 0xc3, 0xc5, 0xc7,
-    0xd8, 0xa1, 0x81, 0x94, 0xf8, 0x18, 0xf2, 0xb0, 0x89, 0xac, 0xc3, 0xc5, 0xc7, 0xf1, 0xd8, 0xb8,
-    /* bank # 9 */
-    0xb4, 0xb0, 0x97, 0x86, 0xa8, 0x31, 0x9b, 0x06, 0x99, 0x07, 0xab, 0x97, 0x28, 0x88, 0x9b, 0xf0,
-    0x0c, 0x20, 0x14, 0x40, 0xb0, 0xb4, 0xb8, 0xf0, 0xa8, 0x8a, 0x9a, 0x28, 0x50, 0x78, 0xb7, 0x9b,
-    0xa8, 0x29, 0x51, 0x79, 0x24, 0x70, 0x59, 0x44, 0x69, 0x38, 0x64, 0x48, 0x31, 0xf1, 0xbb, 0xab,
-    0x88, 0x00, 0x2c, 0x54, 0x7c, 0xf0, 0xb3, 0x8b, 0xb8, 0xa8, 0x04, 0x28, 0x50, 0x78, 0xf1, 0xb0,
-    0x88, 0xb4, 0x97, 0x26, 0xa8, 0x59, 0x98, 0xbb, 0xab, 0xb3, 0x8b, 0x02, 0x26, 0x46, 0x66, 0xb0,
-    0xb8, 0xf0, 0x8a, 0x9c, 0xa8, 0x29, 0x51, 0x79, 0x8b, 0x29, 0x51, 0x79, 0x8a, 0x24, 0x70, 0x59,
-    0x8b, 0x20, 0x58, 0x71, 0x8a, 0x44, 0x69, 0x38, 0x8b, 0x39, 0x40, 0x68, 0x8a, 0x64, 0x48, 0x31,
-    0x8b, 0x30, 0x49, 0x60, 0x88, 0xf1, 0xac, 0x00, 0x2c, 0x54, 0x7c, 0xf0, 0x8c, 0xa8, 0x04, 0x28,
-    0x50, 0x78, 0xf1, 0x88, 0x97, 0x26, 0xa8, 0x59, 0x98, 0xac, 0x8c, 0x02, 0x26, 0x46, 0x66, 0xf0,
-    0x89, 0x9c, 0xa8, 0x29, 0x51, 0x79, 0x24, 0x70, 0x59, 0x44, 0x69, 0x38, 0x64, 0x48, 0x31, 0xa9,
-    0x88, 0x09, 0x20, 0x59, 0x70, 0xab, 0x11, 0x38, 0x40, 0x69, 0xa8, 0x19, 0x31, 0x48, 0x60, 0x8c,
-    0xa8, 0x3c, 0x41, 0x5c, 0x20, 0x7c, 0x00, 0xf1, 0x87, 0x98, 0x19, 0x86, 0xa8, 0x6e, 0x76, 0x7e,
-    0xa9, 0x99, 0x88, 0x2d, 0x55, 0x7d, 0xd8, 0xb1, 0xb5, 0xb9, 0xa3, 0xdf, 0xdf, 0xdf, 0xae, 0xd0,
-    0xdf, 0xaa, 0xd0, 0xde, 0xf2, 0xab, 0xf8, 0xf9, 0xd9, 0xb0, 0x87, 0xc4, 0xaa, 0xf1, 0xdf, 0xdf,
-    0xbb, 0xaf, 0xdf, 0xdf, 0xb9, 0xd8, 0xb1, 0xf1, 0xa3, 0x97, 0x8e, 0x60, 0xdf, 0xb0, 0x84, 0xf2,
-    0xc8, 0xf8, 0xf9, 0xd9, 0xde, 0xd8, 0x93, 0x85, 0xf1, 0x4a, 0xb1, 0x83, 0xa3, 0x08, 0xb5, 0x83,
-    /* bank # 10 */
-    0x9a, 0x08, 0x10, 0xb7, 0x9f, 0x10, 0xd8, 0xf1, 0xb0, 0xba, 0xae, 0xb0, 0x8a, 0xc2, 0xb2, 0xb6,
-    0x8e, 0x9e, 0xf1, 0xfb, 0xd9, 0xf4, 0x1d, 0xd8, 0xf9, 0xd9, 0x0c, 0xf1, 0xd8, 0xf8, 0xf8, 0xad,
-    0x61, 0xd9, 0xae, 0xfb, 0xd8, 0xf4, 0x0c, 0xf1, 0xd8, 0xf8, 0xf8, 0xad, 0x19, 0xd9, 0xae, 0xfb,
-    0xdf, 0xd8, 0xf4, 0x16, 0xf1, 0xd8, 0xf8, 0xad, 0x8d, 0x61, 0xd9, 0xf4, 0xf4, 0xac, 0xf5, 0x9c,
-    0x9c, 0x8d, 0xdf, 0x2b, 0xba, 0xb6, 0xae, 0xfa, 0xf8, 0xf4, 0x0b, 0xd8, 0xf1, 0xae, 0xd0, 0xf8,
-    0xad, 0x51, 0xda, 0xae, 0xfa, 0xf8, 0xf1, 0xd8, 0xb9, 0xb1, 0xb6, 0xa3, 0x83, 0x9c, 0x08, 0xb9,
-    0xb1, 0x83, 0x9a, 0xb5, 0xaa, 0xc0, 0xfd, 0x30, 0x83, 0xb7, 0x9f, 0x10, 0xb5, 0x8b, 0x93, 0xf2,
-    0x02, 0x02, 0xd1, 0xab, 0xda, 0xde, 0xd8, 0xf1, 0xb0, 0x80, 0xba, 0xab, 0xc0, 0xc3, 0xb2, 0x84,
-    0xc1, 0xc3, 0xd8, 0xb1, 0xb9, 0xf3, 0x8b, 0xa3, 0x91, 0xb6, 0x09, 0xb4, 0xd9, 0xab, 0xde, 0xb0,
-    0x87, 0x9c, 0xb9, 0xa3, 0xdd, 0xf1, 0xb3, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0xb0, 0x87, 0xa3, 0xa3,
-    0xa3, 0xa3, 0xb2, 0x8b, 0xb6, 0x9b, 0xf2, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3,
-    0xa3, 0xf1, 0xb0, 0x87, 0xb5, 0x9a, 0xa3, 0xf3, 0x9b, 0xa3, 0xa3, 0xdc, 0xba, 0xac, 0xdf, 0xb9,
-    0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3,
-    0xd8, 0xd8, 0xd8, 0xbb, 0xb3, 0xb7, 0xf1, 0xaa, 0xf9, 0xda, 0xff, 0xd9, 0x80, 0x9a, 0xaa, 0x28,
-    0xb4, 0x80, 0x98, 0xa7, 0x20, 0xb7, 0x97, 0x87, 0xa8, 0x66, 0x88, 0xf0, 0x79, 0x51, 0xf1, 0x90,
-    0x2c, 0x87, 0x0c, 0xa7, 0x81, 0x97, 0x62, 0x93, 0xf0, 0x71, 0x71, 0x60, 0x85, 0x94, 0x01, 0x29,
-    /* bank # 11 */
-    0x51, 0x79, 0x90, 0xa5, 0xf1, 0x28, 0x4c, 0x6c, 0x87, 0x0c, 0x95, 0x18, 0x85, 0x78, 0xa3, 0x83,
-    0x90, 0x28, 0x4c, 0x6c, 0x88, 0x6c, 0xd8, 0xf3, 0xa2, 0x82, 0x00, 0xf2, 0x10, 0xa8, 0x92, 0x19,
-    0x80, 0xa2, 0xf2, 0xd9, 0x26, 0xd8, 0xf1, 0x88, 0xa8, 0x4d, 0xd9, 0x48, 0xd8, 0x96, 0xa8, 0x39,
-    0x80, 0xd9, 0x3c, 0xd8, 0x95, 0x80, 0xa8, 0x39, 0xa6, 0x86, 0x98, 0xd9, 0x2c, 0xda, 0x87, 0xa7,
-    0x2c, 0xd8, 0xa8, 0x89, 0x95, 0x19, 0xa9, 0x80, 0xd9, 0x38, 0xd8, 0xa8, 0x89, 0x39, 0xa9, 0x80,
-    0xda, 0x3c, 0xd8, 0xa8, 0x2e, 0xa8, 0x39, 0x90, 0xd9, 0x0c, 0xd8, 0xa8, 0x95, 0x31, 0x98, 0xd9,
-    0x0c, 0xd8, 0xa8, 0x09, 0xd9, 0xff, 0xd8, 0x01, 0xda, 0xff, 0xd8, 0x95, 0x39, 0xa9, 0xda, 0x26,
-    0xff, 0xd8, 0x90, 0xa8, 0x0d, 0x89, 0x99, 0xa8, 0x10, 0x80, 0x98, 0x21, 0xda, 0x2e, 0xd8, 0x89,
-    0x99, 0xa8, 0x31, 0x80, 0xda, 0x2e, 0xd8, 0xa8, 0x86, 0x96, 0x31, 0x80, 0xda, 0x2e, 0xd8, 0xa8,
-    0x87, 0x31, 0x80, 0xda, 0x2e, 0xd8, 0xa8, 0x82, 0x92, 0xf3, 0x41, 0x80, 0xf1, 0xd9, 0x2e, 0xd8,
-    0xa8, 0x82, 0xf3, 0x19, 0x80, 0xf1, 0xd9, 0x2e, 0xd8, 0x82, 0xac, 0xf3, 0xc0, 0xa2, 0x80, 0x22,
-    0xf1, 0xa6, 0x2e, 0xa7, 0x2e, 0xa9, 0x22, 0x98, 0xa8, 0x29, 0xda, 0xac, 0xde, 0xff, 0xd8, 0xa2,
-    0xf2, 0x2a, 0xf1, 0xa9, 0x2e, 0x82, 0x92, 0xa8, 0xf2, 0x31, 0x80, 0xa6, 0x96, 0xf1, 0xd9, 0x00,
-    0xac, 0x8c, 0x9c, 0x0c, 0x30, 0xac, 0xde, 0xd0, 0xde, 0xff, 0xd8, 0x8c, 0x9c, 0xac, 0xd0, 0x10,
-    0xac, 0xde, 0x80, 0x92, 0xa2, 0xf2, 0x4c, 0x82, 0xa8, 0xf1, 0xca, 0xf2, 0x35, 0xf1, 0x96, 0x88,
-    0xa6, 0xd9, 0x00, 0xd8, 0xf1, 0xff
-};
-
-static const unsigned short sStartAddress = 0x0400;
-
-/* END OF SECTION COPIED FROM dmpDefaultMPU6050.c */
-
-#define INT_SRC_TAP             (0x01)
-#define INT_SRC_ANDROID_ORIENT  (0x08)
-
-#define DMP_FEATURE_SEND_ANY_GYRO   (DMP_FEATURE_SEND_RAW_GYRO | \
-                                     DMP_FEATURE_SEND_CAL_GYRO)
-
-#define MAX_PACKET_LENGTH   (32)
-
-#define DMP_SAMPLE_RATE     (200)
-#define GYRO_SF             (46850825LL * 200 / DMP_SAMPLE_RATE)
-
-#define FIFO_CORRUPTION_CHECK
-#ifdef FIFO_CORRUPTION_CHECK
-#define QUAT_ERROR_THRESH       (1L<<24)
-#define QUAT_MAG_SQ_NORMALIZED  (1L<<28)
-#define QUAT_MAG_SQ_MIN         (QUAT_MAG_SQ_NORMALIZED - QUAT_ERROR_THRESH)
-#define QUAT_MAG_SQ_MAX         (QUAT_MAG_SQ_NORMALIZED + QUAT_ERROR_THRESH)
-#endif
-
-struct dmp_s {
-    void (*tap_cb)(unsigned char count, unsigned char direction);
-    void (*android_orient_cb)(unsigned char orientation);
-    unsigned short orient;
-    unsigned short feature_mask;
-    unsigned short fifo_rate;
-    unsigned char packet_length;
-};
-
-static struct dmp_s dmp = {
-    .tap_cb = NULL,
-    .android_orient_cb = NULL,
-    .orient = 0,
-    .feature_mask = 0,
-    .fifo_rate = 0,
-    .packet_length = 0
-};
-
-/**
- *  @brief  Load the DMP with this image.
- *  @return 0 if successful.
- */
-int dmp_load_motion_driver_firmware(void)
-{
-    return mpu_load_firmware(DMP_CODE_SIZE, dmp_memory, sStartAddress,
-        DMP_SAMPLE_RATE);
-}
-
-/**
- *  @brief      Push gyro and accel orientation to the DMP.
- *  The orientation is represented here as the output of
- *  @e inv_orientation_matrix_to_scalar.
- *  @param[in]  orient  Gyro and accel orientation in body frame.
- *  @return     0 if successful.
- */
-int dmp_set_orientation(unsigned short orient)
-{
-    unsigned char gyro_regs[3], accel_regs[3];
-    const unsigned char gyro_axes[3] = {DINA4C, DINACD, DINA6C};
-    const unsigned char accel_axes[3] = {DINA0C, DINAC9, DINA2C};
-    const unsigned char gyro_sign[3] = {DINA36, DINA56, DINA76};
-    const unsigned char accel_sign[3] = {DINA26, DINA46, DINA66};
-
-    gyro_regs[0] = gyro_axes[orient & 3];
-    gyro_regs[1] = gyro_axes[(orient >> 3) & 3];
-    gyro_regs[2] = gyro_axes[(orient >> 6) & 3];
-    accel_regs[0] = accel_axes[orient & 3];
-    accel_regs[1] = accel_axes[(orient >> 3) & 3];
-    accel_regs[2] = accel_axes[(orient >> 6) & 3];
-
-    /* Chip-to-body, axes only. */
-    if (mpu_write_mem(FCFG_1, 3, gyro_regs))
-        return -1;
-    if (mpu_write_mem(FCFG_2, 3, accel_regs))
-        return -1;
-
-    memcpy(gyro_regs, gyro_sign, 3);
-    memcpy(accel_regs, accel_sign, 3);
-    if (orient & 4) {
-        gyro_regs[0] |= 1;
-        accel_regs[0] |= 1;
-    }
-    if (orient & 0x20) {
-        gyro_regs[1] |= 1;
-        accel_regs[1] |= 1;
-    }
-    if (orient & 0x100) {
-        gyro_regs[2] |= 1;
-        accel_regs[2] |= 1;
-    }
-
-    /* Chip-to-body, sign only. */
-    if (mpu_write_mem(FCFG_3, 3, gyro_regs))
-        return -1;
-    if (mpu_write_mem(FCFG_7, 3, accel_regs))
-        return -1;
-    dmp.orient = orient;
-    return 0;
-}
-
-/**
- *  @brief      Push gyro biases to the DMP.
- *  Because the gyro integration is handled in the DMP, any gyro biases
- *  calculated by the MPL should be pushed down to DMP memory to remove
- *  3-axis quaternion drift.
- *  \n NOTE: If the DMP-based gyro calibration is enabled, the DMP will
- *  overwrite the biases written to this location once a new one is computed.
- *  @param[in]  bias    Gyro biases in q16.
- *  @return     0 if successful.
- */
-int dmp_set_gyro_bias(long *bias)
-{
-    long gyro_bias_body[3];
-    unsigned char regs[4];
-
-    gyro_bias_body[0] = bias[dmp.orient & 3];
-    if (dmp.orient & 4)
-        gyro_bias_body[0] *= -1;
-    gyro_bias_body[1] = bias[(dmp.orient >> 3) & 3];
-    if (dmp.orient & 0x20)
-        gyro_bias_body[1] *= -1;
-    gyro_bias_body[2] = bias[(dmp.orient >> 6) & 3];
-    if (dmp.orient & 0x100)
-        gyro_bias_body[2] *= -1;
-
-#ifdef EMPL_NO_64BIT
-    gyro_bias_body[0] = (long)(((float)gyro_bias_body[0] * GYRO_SF) / 1073741824.f);
-    gyro_bias_body[1] = (long)(((float)gyro_bias_body[1] * GYRO_SF) / 1073741824.f);
-    gyro_bias_body[2] = (long)(((float)gyro_bias_body[2] * GYRO_SF) / 1073741824.f);
-#else
-    gyro_bias_body[0] = (long)(((long long)gyro_bias_body[0] * GYRO_SF) >> 30);
-    gyro_bias_body[1] = (long)(((long long)gyro_bias_body[1] * GYRO_SF) >> 30);
-    gyro_bias_body[2] = (long)(((long long)gyro_bias_body[2] * GYRO_SF) >> 30);
-#endif
-
-    regs[0] = (unsigned char)((gyro_bias_body[0] >> 24) & 0xFF);
-    regs[1] = (unsigned char)((gyro_bias_body[0] >> 16) & 0xFF);
-    regs[2] = (unsigned char)((gyro_bias_body[0] >> 8) & 0xFF);
-    regs[3] = (unsigned char)(gyro_bias_body[0] & 0xFF);
-    if (mpu_write_mem(D_EXT_GYRO_BIAS_X, 4, regs))
-        return -1;
-
-    regs[0] = (unsigned char)((gyro_bias_body[1] >> 24) & 0xFF);
-    regs[1] = (unsigned char)((gyro_bias_body[1] >> 16) & 0xFF);
-    regs[2] = (unsigned char)((gyro_bias_body[1] >> 8) & 0xFF);
-    regs[3] = (unsigned char)(gyro_bias_body[1] & 0xFF);
-    if (mpu_write_mem(D_EXT_GYRO_BIAS_Y, 4, regs))
-        return -1;
-
-    regs[0] = (unsigned char)((gyro_bias_body[2] >> 24) & 0xFF);
-    regs[1] = (unsigned char)((gyro_bias_body[2] >> 16) & 0xFF);
-    regs[2] = (unsigned char)((gyro_bias_body[2] >> 8) & 0xFF);
-    regs[3] = (unsigned char)(gyro_bias_body[2] & 0xFF);
-    return mpu_write_mem(D_EXT_GYRO_BIAS_Z, 4, regs);
-}
-
-/**
- *  @brief      Push accel biases to the DMP.
- *  These biases will be removed from the DMP 6-axis quaternion.
- *  @param[in]  bias    Accel biases in q16.
- *  @return     0 if successful.
- */
-int dmp_set_accel_bias(long *bias)
-{
-    long accel_bias_body[3];
-    unsigned char regs[12];
-    long long accel_sf;
-    unsigned short accel_sens;
-
-    mpu_get_accel_sens(&accel_sens);
-    accel_sf = (long long)accel_sens << 15;
-//    __no_operation();
-    __NOP();
-
-    accel_bias_body[0] = bias[dmp.orient & 3];
-    if (dmp.orient & 4)
-        accel_bias_body[0] *= -1;
-    accel_bias_body[1] = bias[(dmp.orient >> 3) & 3];
-    if (dmp.orient & 0x20)
-        accel_bias_body[1] *= -1;
-    accel_bias_body[2] = bias[(dmp.orient >> 6) & 3];
-    if (dmp.orient & 0x100)
-        accel_bias_body[2] *= -1;
-
-#ifdef EMPL_NO_64BIT
-    accel_bias_body[0] = (long)(((float)accel_bias_body[0] * accel_sf) / 1073741824.f);
-    accel_bias_body[1] = (long)(((float)accel_bias_body[1] * accel_sf) / 1073741824.f);
-    accel_bias_body[2] = (long)(((float)accel_bias_body[2] * accel_sf) / 1073741824.f);
-#else
-    accel_bias_body[0] = (long)(((long long)accel_bias_body[0] * accel_sf) >> 30);
-    accel_bias_body[1] = (long)(((long long)accel_bias_body[1] * accel_sf) >> 30);
-    accel_bias_body[2] = (long)(((long long)accel_bias_body[2] * accel_sf) >> 30);
-#endif
-
-    regs[0] = (unsigned char)((accel_bias_body[0] >> 24) & 0xFF);
-    regs[1] = (unsigned char)((accel_bias_body[0] >> 16) & 0xFF);
-    regs[2] = (unsigned char)((accel_bias_body[0] >> 8) & 0xFF);
-    regs[3] = (unsigned char)(accel_bias_body[0] & 0xFF);
-    regs[4] = (unsigned char)((accel_bias_body[1] >> 24) & 0xFF);
-    regs[5] = (unsigned char)((accel_bias_body[1] >> 16) & 0xFF);
-    regs[6] = (unsigned char)((accel_bias_body[1] >> 8) & 0xFF);
-    regs[7] = (unsigned char)(accel_bias_body[1] & 0xFF);
-    regs[8] = (unsigned char)((accel_bias_body[2] >> 24) & 0xFF);
-    regs[9] = (unsigned char)((accel_bias_body[2] >> 16) & 0xFF);
-    regs[10] = (unsigned char)((accel_bias_body[2] >> 8) & 0xFF);
-    regs[11] = (unsigned char)(accel_bias_body[2] & 0xFF);
-    return mpu_write_mem(D_ACCEL_BIAS, 12, regs);
-}
-
-/**
- *  @brief      Set DMP output rate.
- *  Only used when DMP is on.
- *  @param[in]  rate    Desired fifo rate (Hz).
- *  @return     0 if successful.
- */
-int dmp_set_fifo_rate(unsigned short rate)
-{
-    const unsigned char regs_end[12] = {DINAFE, DINAF2, DINAAB,
-        0xc4, DINAAA, DINAF1, DINADF, DINADF, 0xBB, 0xAF, DINADF, DINADF};
-    unsigned short div;
-    unsigned char tmp[8];
-
-    if (rate > DMP_SAMPLE_RATE)
-        return -1;
-    div = DMP_SAMPLE_RATE / rate - 1;
-    tmp[0] = (unsigned char)((div >> 8) & 0xFF);
-    tmp[1] = (unsigned char)(div & 0xFF);
-    if (mpu_write_mem(D_0_22, 2, tmp))
-        return -1;
-    if (mpu_write_mem(CFG_6, 12, (unsigned char*)regs_end))
-        return -1;
-
-    dmp.fifo_rate = rate;
-    return 0;
-}
-
-/**
- *  @brief      Get DMP output rate.
- *  @param[out] rate    Current fifo rate (Hz).
- *  @return     0 if successful.
- */
-int dmp_get_fifo_rate(unsigned short *rate)
-{
-    rate[0] = dmp.fifo_rate;
-    return 0;
-}
-
-/**
- *  @brief      Set tap threshold for a specific axis.
- *  @param[in]  axis    1, 2, and 4 for XYZ accel, respectively.
- *  @param[in]  thresh  Tap threshold, in mg/ms.
- *  @return     0 if successful.
- */
-int dmp_set_tap_thresh(unsigned char axis, unsigned short thresh)
-{
-    unsigned char tmp[4], accel_fsr;
-    float scaled_thresh;
-    unsigned short dmp_thresh, dmp_thresh_2;
-    if (!(axis & TAP_XYZ) || thresh > 1600)
-        return -1;
-
-    scaled_thresh = (float)thresh / DMP_SAMPLE_RATE;
-
-    mpu_get_accel_fsr(&accel_fsr);
-    switch (accel_fsr) {
-    case 2:
-        dmp_thresh = (unsigned short)(scaled_thresh * 16384);
-        /* dmp_thresh * 0.75 */
-        dmp_thresh_2 = (unsigned short)(scaled_thresh * 12288);
-        break;
-    case 4:
-        dmp_thresh = (unsigned short)(scaled_thresh * 8192);
-        /* dmp_thresh * 0.75 */
-        dmp_thresh_2 = (unsigned short)(scaled_thresh * 6144);
-        break;
-    case 8:
-        dmp_thresh = (unsigned short)(scaled_thresh * 4096);
-        /* dmp_thresh * 0.75 */
-        dmp_thresh_2 = (unsigned short)(scaled_thresh * 3072);
-        break;
-    case 16:
-        dmp_thresh = (unsigned short)(scaled_thresh * 2048);
-        /* dmp_thresh * 0.75 */
-        dmp_thresh_2 = (unsigned short)(scaled_thresh * 1536);
-        break;
-    default:
-        return -1;
-    }
-    tmp[0] = (unsigned char)(dmp_thresh >> 8);
-    tmp[1] = (unsigned char)(dmp_thresh & 0xFF);
-    tmp[2] = (unsigned char)(dmp_thresh_2 >> 8);
-    tmp[3] = (unsigned char)(dmp_thresh_2 & 0xFF);
-
-    if (axis & TAP_X) {
-        if (mpu_write_mem(DMP_TAP_THX, 2, tmp))
-            return -1;
-        if (mpu_write_mem(D_1_36, 2, tmp+2))
-            return -1;
-    }
-    if (axis & TAP_Y) {
-        if (mpu_write_mem(DMP_TAP_THY, 2, tmp))
-            return -1;
-        if (mpu_write_mem(D_1_40, 2, tmp+2))
-            return -1;
-    }
-    if (axis & TAP_Z) {
-        if (mpu_write_mem(DMP_TAP_THZ, 2, tmp))
-            return -1;
-        if (mpu_write_mem(D_1_44, 2, tmp+2))
-            return -1;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Set which axes will register a tap.
- *  @param[in]  axis    1, 2, and 4 for XYZ, respectively.
- *  @return     0 if successful.
- */
-int dmp_set_tap_axes(unsigned char axis)
-{
-    unsigned char tmp = 0;
-
-    if (axis & TAP_X)
-        tmp |= 0x30;
-    if (axis & TAP_Y)
-        tmp |= 0x0C;
-    if (axis & TAP_Z)
-        tmp |= 0x03;
-    return mpu_write_mem(D_1_72, 1, &tmp);
-}
-
-/**
- *  @brief      Set minimum number of taps needed for an interrupt.
- *  @param[in]  min_taps    Minimum consecutive taps (1-4).
- *  @return     0 if successful.
- */
-int dmp_set_tap_count(unsigned char min_taps)
-{
-    unsigned char tmp;
-
-    if (min_taps < 1)
-        min_taps = 1;
-    else if (min_taps > 4)
-        min_taps = 4;
-
-    tmp = min_taps - 1;
-    return mpu_write_mem(D_1_79, 1, &tmp);
-}
-
-/**
- *  @brief      Set length between valid taps.
- *  @param[in]  time    Milliseconds between taps.
- *  @return     0 if successful.
- */
-int dmp_set_tap_time(unsigned short time)
-{
-    unsigned short dmp_time;
-    unsigned char tmp[2];
-
-    dmp_time = time / (1000 / DMP_SAMPLE_RATE);
-    tmp[0] = (unsigned char)(dmp_time >> 8);
-    tmp[1] = (unsigned char)(dmp_time & 0xFF);
-    return mpu_write_mem(DMP_TAPW_MIN, 2, tmp);
-}
-
-/**
- *  @brief      Set max time between taps to register as a multi-tap.
- *  @param[in]  time    Max milliseconds between taps.
- *  @return     0 if successful.
- */
-int dmp_set_tap_time_multi(unsigned short time)
-{
-    unsigned short dmp_time;
-    unsigned char tmp[2];
-
-    dmp_time = time / (1000 / DMP_SAMPLE_RATE);
-    tmp[0] = (unsigned char)(dmp_time >> 8);
-    tmp[1] = (unsigned char)(dmp_time & 0xFF);
-    return mpu_write_mem(D_1_218, 2, tmp);
-}
-
-/**
- *  @brief      Set shake rejection threshold.
- *  If the DMP detects a gyro sample larger than @e thresh, taps are rejected.
- *  @param[in]  sf      Gyro scale factor.
- *  @param[in]  thresh  Gyro threshold in dps.
- *  @return     0 if successful.
- */
-int dmp_set_shake_reject_thresh(long sf, unsigned short thresh)
-{
-    unsigned char tmp[4];
-    long thresh_scaled = sf / 1000 * thresh;
-    tmp[0] = (unsigned char)(((long)thresh_scaled >> 24) & 0xFF);
-    tmp[1] = (unsigned char)(((long)thresh_scaled >> 16) & 0xFF);
-    tmp[2] = (unsigned char)(((long)thresh_scaled >> 8) & 0xFF);
-    tmp[3] = (unsigned char)((long)thresh_scaled & 0xFF);
-    return mpu_write_mem(D_1_92, 4, tmp);
-}
-
-/**
- *  @brief      Set shake rejection time.
- *  Sets the length of time that the gyro must be outside of the threshold set
- *  by @e gyro_set_shake_reject_thresh before taps are rejected. A mandatory
- *  60 ms is added to this parameter.
- *  @param[in]  time    Time in milliseconds.
- *  @return     0 if successful.
- */
-int dmp_set_shake_reject_time(unsigned short time)
-{
-    unsigned char tmp[2];
-
-    time /= (1000 / DMP_SAMPLE_RATE);
-    tmp[0] = time >> 8;
-    tmp[1] = time & 0xFF;
-    return mpu_write_mem(D_1_90,2,tmp);
-}
-
-/**
- *  @brief      Set shake rejection timeout.
- *  Sets the length of time after a shake rejection that the gyro must stay
- *  inside of the threshold before taps can be detected again. A mandatory
- *  60 ms is added to this parameter.
- *  @param[in]  time    Time in milliseconds.
- *  @return     0 if successful.
- */
-int dmp_set_shake_reject_timeout(unsigned short time)
-{
-    unsigned char tmp[2];
-
-    time /= (1000 / DMP_SAMPLE_RATE);
-    tmp[0] = time >> 8;
-    tmp[1] = time & 0xFF;
-    return mpu_write_mem(D_1_88,2,tmp);
-}
-
-/**
- *  @brief      Get current step count.
- *  @param[out] count   Number of steps detected.
- *  @return     0 if successful.
- */
-int dmp_get_pedometer_step_count(unsigned long *count)
-{
-    unsigned char tmp[4];
-    if (!count)
-        return -1;
-
-    if (mpu_read_mem(D_PEDSTD_STEPCTR, 4, tmp))
-        return -1;
-
-    count[0] = ((unsigned long)tmp[0] << 24) | ((unsigned long)tmp[1] << 16) |
-        ((unsigned long)tmp[2] << 8) | tmp[3];
-    return 0;
-}
-
-/**
- *  @brief      Overwrite current step count.
- *  WARNING: This function writes to DMP memory and could potentially encounter
- *  a race condition if called while the pedometer is enabled.
- *  @param[in]  count   New step count.
- *  @return     0 if successful.
- */
-int dmp_set_pedometer_step_count(unsigned long count)
-{
-    unsigned char tmp[4];
-
-    tmp[0] = (unsigned char)((count >> 24) & 0xFF);
-    tmp[1] = (unsigned char)((count >> 16) & 0xFF);
-    tmp[2] = (unsigned char)((count >> 8) & 0xFF);
-    tmp[3] = (unsigned char)(count & 0xFF);
-    return mpu_write_mem(D_PEDSTD_STEPCTR, 4, tmp);
-}
-
-/**
- *  @brief      Get duration of walking time.
- *  @param[in]  time    Walk time in milliseconds.
- *  @return     0 if successful.
- */
-int dmp_get_pedometer_walk_time(unsigned long *time)
-{
-    unsigned char tmp[4];
-    if (!time)
-        return -1;
-
-    if (mpu_read_mem(D_PEDSTD_TIMECTR, 4, tmp))
-        return -1;
-
-    time[0] = (((unsigned long)tmp[0] << 24) | ((unsigned long)tmp[1] << 16) |
-        ((unsigned long)tmp[2] << 8) | tmp[3]) * 20;
-    return 0;
-}
-
-/**
- *  @brief      Overwrite current walk time.
- *  WARNING: This function writes to DMP memory and could potentially encounter
- *  a race condition if called while the pedometer is enabled.
- *  @param[in]  time    New walk time in milliseconds.
- */
-int dmp_set_pedometer_walk_time(unsigned long time)
-{
-    unsigned char tmp[4];
-
-    time /= 20;
-
-    tmp[0] = (unsigned char)((time >> 24) & 0xFF);
-    tmp[1] = (unsigned char)((time >> 16) & 0xFF);
-    tmp[2] = (unsigned char)((time >> 8) & 0xFF);
-    tmp[3] = (unsigned char)(time & 0xFF);
-    return mpu_write_mem(D_PEDSTD_TIMECTR, 4, tmp);
-}
-
-/**
- *  @brief      Enable DMP features.
- *  The following \#define's are used in the input mask:
- *  \n DMP_FEATURE_TAP
- *  \n DMP_FEATURE_ANDROID_ORIENT
- *  \n DMP_FEATURE_LP_QUAT
- *  \n DMP_FEATURE_6X_LP_QUAT
- *  \n DMP_FEATURE_GYRO_CAL
- *  \n DMP_FEATURE_SEND_RAW_ACCEL
- *  \n DMP_FEATURE_SEND_RAW_GYRO
- *  \n NOTE: DMP_FEATURE_LP_QUAT and DMP_FEATURE_6X_LP_QUAT are mutually
- *  exclusive.
- *  \n NOTE: DMP_FEATURE_SEND_RAW_GYRO and DMP_FEATURE_SEND_CAL_GYRO are also
- *  mutually exclusive.
- *  @param[in]  mask    Mask of features to enable.
- *  @return     0 if successful.
- */
-int dmp_enable_feature(unsigned short mask)
-{
-    unsigned char tmp[10];
-
-    /* TODO: All of these settings can probably be integrated into the default
-     * DMP image.
-     */
-    /* Set integration scale factor. */
-    tmp[0] = (unsigned char)((GYRO_SF >> 24) & 0xFF);
-    tmp[1] = (unsigned char)((GYRO_SF >> 16) & 0xFF);
-    tmp[2] = (unsigned char)((GYRO_SF >> 8) & 0xFF);
-    tmp[3] = (unsigned char)(GYRO_SF & 0xFF);
-    mpu_write_mem(D_0_104, 4, tmp);
-
-    /* Send sensor data to the FIFO. */
-    tmp[0] = 0xA3;
-    if (mask & DMP_FEATURE_SEND_RAW_ACCEL) {
-        tmp[1] = 0xC0;
-        tmp[2] = 0xC8;
-        tmp[3] = 0xC2;
-    } else {
-        tmp[1] = 0xA3;
-        tmp[2] = 0xA3;
-        tmp[3] = 0xA3;
-    }
-    if (mask & DMP_FEATURE_SEND_ANY_GYRO) {
-        tmp[4] = 0xC4;
-        tmp[5] = 0xCC;
-        tmp[6] = 0xC6;
-    } else {
-        tmp[4] = 0xA3;
-        tmp[5] = 0xA3;
-        tmp[6] = 0xA3;
-    }
-    tmp[7] = 0xA3;
-    tmp[8] = 0xA3;
-    tmp[9] = 0xA3;
-    mpu_write_mem(CFG_15,10,tmp);
-
-    /* Send gesture data to the FIFO. */
-    if (mask & (DMP_FEATURE_TAP | DMP_FEATURE_ANDROID_ORIENT))
-        tmp[0] = DINA20;
-    else
-        tmp[0] = 0xD8;
-    mpu_write_mem(CFG_27,1,tmp);
-
-    if (mask & DMP_FEATURE_GYRO_CAL)
-        dmp_enable_gyro_cal(1);
-    else
-        dmp_enable_gyro_cal(0);
-
-    if (mask & DMP_FEATURE_SEND_ANY_GYRO) {
-        if (mask & DMP_FEATURE_SEND_CAL_GYRO) {
-            tmp[0] = 0xB2;
-            tmp[1] = 0x8B;
-            tmp[2] = 0xB6;
-            tmp[3] = 0x9B;
-        } else {
-            tmp[0] = DINAC0;
-            tmp[1] = DINA80;
-            tmp[2] = DINAC2;
-            tmp[3] = DINA90;
-        }
-        mpu_write_mem(CFG_GYRO_RAW_DATA, 4, tmp);
-    }
-
-    if (mask & DMP_FEATURE_TAP) {
-        /* Enable tap. */
-        tmp[0] = 0xF8;
-        mpu_write_mem(CFG_20, 1, tmp);
-        dmp_set_tap_thresh(TAP_XYZ, 250);
-        dmp_set_tap_axes(TAP_XYZ);
-        dmp_set_tap_count(1);
-        dmp_set_tap_time(100);
-        dmp_set_tap_time_multi(500);
-
-        dmp_set_shake_reject_thresh(GYRO_SF, 200);
-        dmp_set_shake_reject_time(40);
-        dmp_set_shake_reject_timeout(10);
-    } else {
-        tmp[0] = 0xD8;
-        mpu_write_mem(CFG_20, 1, tmp);
-    }
-
-    if (mask & DMP_FEATURE_ANDROID_ORIENT) {
-        tmp[0] = 0xD9;
-    } else
-        tmp[0] = 0xD8;
-    mpu_write_mem(CFG_ANDROID_ORIENT_INT, 1, tmp);
-
-    if (mask & DMP_FEATURE_LP_QUAT)
-        dmp_enable_lp_quat(1);
-    else
-        dmp_enable_lp_quat(0);
-
-    if (mask & DMP_FEATURE_6X_LP_QUAT)
-        dmp_enable_6x_lp_quat(1);
-    else
-        dmp_enable_6x_lp_quat(0);
-
-    /* Pedometer is always enabled. */
-    dmp.feature_mask = mask | DMP_FEATURE_PEDOMETER;
-    mpu_reset_fifo();
-
-    dmp.packet_length = 0;
-    if (mask & DMP_FEATURE_SEND_RAW_ACCEL)
-        dmp.packet_length += 6;
-    if (mask & DMP_FEATURE_SEND_ANY_GYRO)
-        dmp.packet_length += 6;
-    if (mask & (DMP_FEATURE_LP_QUAT | DMP_FEATURE_6X_LP_QUAT))
-        dmp.packet_length += 16;
-    if (mask & (DMP_FEATURE_TAP | DMP_FEATURE_ANDROID_ORIENT))
-        dmp.packet_length += 4;
-
-    return 0;
-}
-
-/**
- *  @brief      Get list of currently enabled DMP features.
- *  @param[out] Mask of enabled features.
- *  @return     0 if successful.
- */
-int dmp_get_enabled_features(unsigned short *mask)
-{
-    mask[0] = dmp.feature_mask;
-    return 0;
-}
-
-/**
- *  @brief      Calibrate the gyro data in the DMP.
- *  After eight seconds of no motion, the DMP will compute gyro biases and
- *  subtract them from the quaternion output. If @e dmp_enable_feature is
- *  called with @e DMP_FEATURE_SEND_CAL_GYRO, the biases will also be
- *  subtracted from the gyro output.
- *  @param[in]  enable  1 to enable gyro calibration.
- *  @return     0 if successful.
- */
-int dmp_enable_gyro_cal(unsigned char enable)
-{
-    if (enable) {
-        unsigned char regs[9] = {0xb8, 0xaa, 0xb3, 0x8d, 0xb4, 0x98, 0x0d, 0x35, 0x5d};
-        return mpu_write_mem(CFG_MOTION_BIAS, 9, regs);
-    } else {
-        unsigned char regs[9] = {0xb8, 0xaa, 0xaa, 0xaa, 0xb0, 0x88, 0xc3, 0xc5, 0xc7};
-        return mpu_write_mem(CFG_MOTION_BIAS, 9, regs);
-    }
-}
-
-/**
- *  @brief      Generate 3-axis quaternions from the DMP.
- *  In this driver, the 3-axis and 6-axis DMP quaternion features are mutually
- *  exclusive.
- *  @param[in]  enable  1 to enable 3-axis quaternion.
- *  @return     0 if successful.
- */
-int dmp_enable_lp_quat(unsigned char enable)
-{
-    unsigned char regs[4];
-    if (enable) {
-        regs[0] = DINBC0;
-        regs[1] = DINBC2;
-        regs[2] = DINBC4;
-        regs[3] = DINBC6;
-    }
-    else
-        memset(regs, 0x8B, 4);
-
-    mpu_write_mem(CFG_LP_QUAT, 4, regs);
-
-    return mpu_reset_fifo();
-}
-
-/**
- *  @brief       Generate 6-axis quaternions from the DMP.
- *  In this driver, the 3-axis and 6-axis DMP quaternion features are mutually
- *  exclusive.
- *  @param[in]   enable  1 to enable 6-axis quaternion.
- *  @return      0 if successful.
- */
-int dmp_enable_6x_lp_quat(unsigned char enable)
-{
-    unsigned char regs[4];
-    if (enable) {
-        regs[0] = DINA20;
-        regs[1] = DINA28;
-        regs[2] = DINA30;
-        regs[3] = DINA38;
-    } else
-        memset(regs, 0xA3, 4);
-
-    mpu_write_mem(CFG_8, 4, regs);
-
-    return mpu_reset_fifo();
-}
-
-/**
- *  @brief      Decode the four-byte gesture data and execute any callbacks.
- *  @param[in]  gesture Gesture data from DMP packet.
- *  @return     0 if successful.
- */
-static int decode_gesture(unsigned char *gesture)
-{
-    unsigned char tap, android_orient;
-
-    android_orient = gesture[3] & 0xC0;
-    tap = 0x3F & gesture[3];
-
-    if (gesture[1] & INT_SRC_TAP) {
-        unsigned char direction, count;
-        direction = tap >> 3;
-        count = (tap % 8) + 1;
-        if (dmp.tap_cb)
-            dmp.tap_cb(direction, count);
-    }
-
-    if (gesture[1] & INT_SRC_ANDROID_ORIENT) {
-        if (dmp.android_orient_cb)
-            dmp.android_orient_cb(android_orient >> 6);
-    }
-
-    return 0;
-}
-
-/**
- *  @brief      Specify when a DMP interrupt should occur.
- *  A DMP interrupt can be configured to trigger on either of the two
- *  conditions below:
- *  \n a. One FIFO period has elapsed (set by @e mpu_set_sample_rate).
- *  \n b. A tap event has been detected.
- *  @param[in]  mode    DMP_INT_GESTURE or DMP_INT_CONTINUOUS.
- *  @return     0 if successful.
- */
-int dmp_set_interrupt_mode(unsigned char mode)
-{
-    const unsigned char regs_continuous[11] =
-        {0xd8, 0xb1, 0xb9, 0xf3, 0x8b, 0xa3, 0x91, 0xb6, 0x09, 0xb4, 0xd9};
-    const unsigned char regs_gesture[11] =
-        {0xda, 0xb1, 0xb9, 0xf3, 0x8b, 0xa3, 0x91, 0xb6, 0xda, 0xb4, 0xda};
-
-    switch (mode) {
-    case DMP_INT_CONTINUOUS:
-        return mpu_write_mem(CFG_FIFO_ON_EVENT, 11,
-            (unsigned char*)regs_continuous);
-    case DMP_INT_GESTURE:
-        return mpu_write_mem(CFG_FIFO_ON_EVENT, 11,
-            (unsigned char*)regs_gesture);
-    default:
-        return -1;
-    }
-}
-
-/**
- *  @brief      Get one packet from the FIFO.
- *  If @e sensors does not contain a particular sensor, disregard the data
- *  returned to that pointer.
- *  \n @e sensors can contain a combination of the following flags:
- *  \n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
- *  \n INV_XYZ_GYRO
- *  \n INV_XYZ_ACCEL
- *  \n INV_WXYZ_QUAT
- *  \n If the FIFO has no new data, @e sensors will be zero.
- *  \n If the FIFO is disabled, @e sensors will be zero and this function will
- *  return a non-zero error code.
- *  @param[out] gyro        Gyro data in hardware units.
- *  @param[out] accel       Accel data in hardware units.
- *  @param[out] quat        3-axis quaternion data in hardware units.
- *  @param[out] timestamp   Timestamp in milliseconds.
- *  @param[out] sensors     Mask of sensors read from FIFO.
- *  @param[out] more        Number of remaining packets.
- *  @return     0 if successful.
- */
-int dmp_read_fifo(short *gyro, short *accel, long *quat,
-    unsigned long *timestamp, short *sensors, unsigned char *more)
-{
-    unsigned char fifo_data[MAX_PACKET_LENGTH];
-    unsigned char ii = 0;
-
-    /* TODO: sensors[0] only changes when dmp_enable_feature is called. We can
-     * cache this value and save some cycles.
-     */
-    sensors[0] = 0;
-
-    /* Get a packet. */
-    if (mpu_read_fifo_stream(dmp.packet_length, fifo_data, more))
-        return -1;
-
-    /* Parse DMP packet. */
-    if (dmp.feature_mask & (DMP_FEATURE_LP_QUAT | DMP_FEATURE_6X_LP_QUAT)) {
-#ifdef FIFO_CORRUPTION_CHECK
-        long quat_q14[4], quat_mag_sq;
-#endif
-        quat[0] = ((long)fifo_data[0] << 24) | ((long)fifo_data[1] << 16) |
-            ((long)fifo_data[2] << 8) | fifo_data[3];
-        quat[1] = ((long)fifo_data[4] << 24) | ((long)fifo_data[5] << 16) |
-            ((long)fifo_data[6] << 8) | fifo_data[7];
-        quat[2] = ((long)fifo_data[8] << 24) | ((long)fifo_data[9] << 16) |
-            ((long)fifo_data[10] << 8) | fifo_data[11];
-        quat[3] = ((long)fifo_data[12] << 24) | ((long)fifo_data[13] << 16) |
-            ((long)fifo_data[14] << 8) | fifo_data[15];
-        ii += 16;
-#ifdef FIFO_CORRUPTION_CHECK
-        /* We can detect a corrupted FIFO by monitoring the quaternion data and
-         * ensuring that the magnitude is always normalized to one. This
-         * shouldn't happen in normal operation, but if an I2C error occurs,
-         * the FIFO reads might become misaligned.
-         *
-         * Let's start by scaling down the quaternion data to avoid long long
-         * math.
-         */
-        quat_q14[0] = quat[0] >> 16;
-        quat_q14[1] = quat[1] >> 16;
-        quat_q14[2] = quat[2] >> 16;
-        quat_q14[3] = quat[3] >> 16;
-        quat_mag_sq = quat_q14[0] * quat_q14[0] + quat_q14[1] * quat_q14[1] +
-            quat_q14[2] * quat_q14[2] + quat_q14[3] * quat_q14[3];
-        if ((quat_mag_sq < QUAT_MAG_SQ_MIN) ||
-            (quat_mag_sq > QUAT_MAG_SQ_MAX)) {
-            /* Quaternion is outside of the acceptable threshold. */
-            mpu_reset_fifo();
-            sensors[0] = 0;
-            return -1;
-        }
-        sensors[0] |= INV_WXYZ_QUAT;
-#endif
-    }
-
-    if (dmp.feature_mask & DMP_FEATURE_SEND_RAW_ACCEL) {
-        accel[0] = ((short)fifo_data[ii+0] << 8) | fifo_data[ii+1];
-        accel[1] = ((short)fifo_data[ii+2] << 8) | fifo_data[ii+3];
-        accel[2] = ((short)fifo_data[ii+4] << 8) | fifo_data[ii+5];
-        ii += 6;
-        sensors[0] |= INV_XYZ_ACCEL;
-    }
-
-    if (dmp.feature_mask & DMP_FEATURE_SEND_ANY_GYRO) {
-        gyro[0] = ((short)fifo_data[ii+0] << 8) | fifo_data[ii+1];
-        gyro[1] = ((short)fifo_data[ii+2] << 8) | fifo_data[ii+3];
-        gyro[2] = ((short)fifo_data[ii+4] << 8) | fifo_data[ii+5];
-        ii += 6;
-        sensors[0] |= INV_XYZ_GYRO;
-    }
-
-    /* Gesture data is at the end of the DMP packet. Parse it and call
-     * the gesture callbacks (if registered).
-     */
-    if (dmp.feature_mask & (DMP_FEATURE_TAP | DMP_FEATURE_ANDROID_ORIENT))
-        decode_gesture(fifo_data + ii);
-
-    get_ms(timestamp);
-    return 0;
-}
-
-/**
- *  @brief      Register a function to be executed on a tap event.
- *  The tap direction is represented by one of the following:
- *  \n TAP_X_UP
- *  \n TAP_X_DOWN
- *  \n TAP_Y_UP
- *  \n TAP_Y_DOWN
- *  \n TAP_Z_UP
- *  \n TAP_Z_DOWN
- *  @param[in]  func    Callback function.
- *  @return     0 if successful.
- */
-int dmp_register_tap_cb(void (*func)(unsigned char, unsigned char))
-{
-    dmp.tap_cb = func;
-    return 0;
-}
-
-/**
- *  @brief      Register a function to be executed on a android orientation event.
- *  @param[in]  func    Callback function.
- *  @return     0 if successful.
- */
-int dmp_register_android_orient_cb(void (*func)(unsigned char))
-{
-    dmp.android_orient_cb = func;
-    return 0;
-}
-
-/**
- *  @}
- */
-

+ 0 - 97
Core备份3/imu4/inv_mpu_dmp_motion_driver4.h

@@ -1,97 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011-2012 InvenSense Corporation, All Rights Reserved.
-    See included License.txt for License information.
- $
- */
-/**
- *  @addtogroup  DRIVERS Sensor Driver Layer
- *  @brief       Hardware drivers to communicate with sensors via I2C.
- *
- *  @{
- *      @file       inv_mpu_dmp_motion_driver.h
- *      @brief      DMP image and interface functions.
- *      @details    All functions are preceded by the dmp_ prefix to
- *                  differentiate among MPL and general driver function calls.
- */
-#ifndef _INV_MPU_DMP_MOTION_DRIVER_H_
-#define _INV_MPU_DMP_MOTION_DRIVER_H_
-
-#define TAP_X               (0x01)
-#define TAP_Y               (0x02)
-#define TAP_Z               (0x04)
-#define TAP_XYZ             (0x07)
-
-#define TAP_X_UP            (0x01)
-#define TAP_X_DOWN          (0x02)
-#define TAP_Y_UP            (0x03)
-#define TAP_Y_DOWN          (0x04)
-#define TAP_Z_UP            (0x05)
-#define TAP_Z_DOWN          (0x06)
-
-#define ANDROID_ORIENT_PORTRAIT             (0x00)
-#define ANDROID_ORIENT_LANDSCAPE            (0x01)
-#define ANDROID_ORIENT_REVERSE_PORTRAIT     (0x02)
-#define ANDROID_ORIENT_REVERSE_LANDSCAPE    (0x03)
-
-#define DMP_INT_GESTURE     (0x01)
-#define DMP_INT_CONTINUOUS  (0x02)
-
-#define DMP_FEATURE_TAP             (0x001)
-#define DMP_FEATURE_ANDROID_ORIENT  (0x002)
-#define DMP_FEATURE_LP_QUAT         (0x004)
-#define DMP_FEATURE_PEDOMETER       (0x008)
-#define DMP_FEATURE_6X_LP_QUAT      (0x010)
-#define DMP_FEATURE_GYRO_CAL        (0x020)
-#define DMP_FEATURE_SEND_RAW_ACCEL  (0x040)
-#define DMP_FEATURE_SEND_RAW_GYRO   (0x080)
-#define DMP_FEATURE_SEND_CAL_GYRO   (0x100)
-
-#define INV_WXYZ_QUAT       (0x100)
-
-/* Set up functions. */
-int dmp_load_motion_driver_firmware(void);
-int dmp_set_fifo_rate(unsigned short rate);
-int dmp_get_fifo_rate(unsigned short *rate);
-int dmp_enable_feature(unsigned short mask);
-int dmp_get_enabled_features(unsigned short *mask);
-int dmp_set_interrupt_mode(unsigned char mode);
-int dmp_set_orientation(unsigned short orient);
-int dmp_set_gyro_bias(long *bias);
-int dmp_set_accel_bias(long *bias);
-
-/* Tap functions. */
-int dmp_register_tap_cb(void (*func)(unsigned char, unsigned char));
-int dmp_set_tap_thresh(unsigned char axis, unsigned short thresh);
-int dmp_set_tap_axes(unsigned char axis);
-int dmp_set_tap_count(unsigned char min_taps);
-int dmp_set_tap_time(unsigned short time);
-int dmp_set_tap_time_multi(unsigned short time);
-int dmp_set_shake_reject_thresh(long sf, unsigned short thresh);
-int dmp_set_shake_reject_time(unsigned short time);
-int dmp_set_shake_reject_timeout(unsigned short time);
-
-/* Android orientation functions. */
-int dmp_register_android_orient_cb(void (*func)(unsigned char));
-
-/* LP quaternion functions. */
-int dmp_enable_lp_quat(unsigned char enable);
-int dmp_enable_6x_lp_quat(unsigned char enable);
-
-/* Pedometer functions. */
-int dmp_get_pedometer_step_count(unsigned long *count);
-int dmp_set_pedometer_step_count(unsigned long count);
-int dmp_get_pedometer_walk_time(unsigned long *time);
-int dmp_set_pedometer_walk_time(unsigned long time);
-
-/* DMP gyro calibration functions. */
-int dmp_enable_gyro_cal(unsigned char enable);
-
-/* Read function. This function should be called whenever the MPU interrupt is
- * detected.
- */
-int dmp_read_fifo(short *gyro, short *accel, long *quat,
-    unsigned long *timestamp, short *sensors, unsigned char *more);
-
-#endif  /* #ifndef _INV_MPU_DMP_MOTION_DRIVER_H_ */
-

+ 0 - 542
Core备份3/imu5/MPU60505.c

@@ -1,542 +0,0 @@
-/*
- * MPU6050.c
- *
- *  Created on: Oct 26, 2021
- *      Author: Administrator
- */
-
-#include "MPU60505.h"
-
-#include <stdio.h>
-
- u8 IIC_Write_Byte(u8 reg, u8 value)
- {
-	 return IIC_Write_Len(MPU_ADDR, reg, 1, &value);
- }
-
- u8 IIC_Read_Byte(u8 reg)
- {
-	 u8 value = 0;
-
-	 IIC_Read_Len(MPU_ADDR, reg, 1, &value);
-
-	 return value;
- }
-
- //IIC连续写
- u8 IIC_Write_Len(u8 addr,u8 reg, u8 len, u8 *buf)
- {
-	 addr = (addr << 1) | 0;
-
-	 u8 data[10] = {0};
-	 data[0] = reg;
-	 for(int i = 0; i < len; i++)
-	 {
-		 data[1 + i] = buf[i];
-	 }
-
-	 if(HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)addr, (uint8_t*)data, len + 1, 10000)!= HAL_OK)
-	 {
-		 printf("++write len byte fail\r\n");
-		 return 1;
-	 }
-
-	 return 0;
- }
-
- //IIC连续读
- u8 IIC_Read_Len(u8 addr,u8 reg,u8 len,u8 *buf)
- {
-	 u8 tmp  = (addr << 1) | 0;
-	 if(HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)tmp, (uint8_t*)&reg, 1, 10000)!= HAL_OK)
-	 {
-		 printf("++write byte fail\r\n");
-		 return 1;
-	 }
-
-	 tmp  = (addr << 1) | 1;
-	 if(HAL_I2C_Master_Receive(&hi2c1, (uint16_t)tmp, (uint8_t *)buf, len, 10000) != HAL_OK)
-	 {
-		 printf("--read byte fail\r\n");
-	 }
-
- }
-
-
-//初始化MPU6050
-//返回值: 0,成功
-//        其他,错误代码
-u8 MPU_Init(void)
-{
-    u8 res = 0;
-
-    IIC_Write_Byte(MPU_PWR_MGMT1_REG,0X80);//复位MPU6050
-
-    HAL_Delay(100);
-
-    IIC_Write_Byte(MPU_PWR_MGMT1_REG,0X00);//唤醒MPU6050
-
-    MPU_Set_Gyro_Fsr(3); //陀螺仪传感器,±2000dps
-    MPU_Set_Accel_Fsr(0); //加速度传感器 ±2g
-    MPU_Set_Rate(50); //设置采样率50HZ
-    IIC_Write_Byte(MPU_INT_EN_REG,0X00); //关闭所有中断
-    IIC_Write_Byte(MPU_USER_CTRL_REG,0X00);//I2C主模式关闭
-    IIC_Write_Byte(MPU_FIFO_EN_REG,0X00);//关闭FIFO
-    IIC_Write_Byte(MPU_INTBP_CFG_REG,0X80);//INT引脚低电平有效
-
-    res=IIC_Read_Byte(MPU_DEVICE_ID_REG);
-
-    printf("the addr is:%d\r\n", res);
-
-    if(res==MPU_ADDR)//器件ID正确
-    {
-        IIC_Write_Byte(MPU_PWR_MGMT1_REG,0X01);//设置CLKSEL,PLL X 轴为参考
-        IIC_Write_Byte(MPU_PWR_MGMT2_REG,0X00);//加速度陀螺仪都工作
-        MPU_Set_Rate(50); //设置采样率为50HZ
-    }
-    else
-    {
-    	return 1;
-    }
-
-    return 0;
-}
-
-//设置MPU6050陀螺仪传感器满量程范围
-//fsr:0,±250dps;1,±500dps;2,±1000dps;3,±2000dps
-//返回值:0,设置成功
-//    其他,设置失败
-u8 MPU_Set_Gyro_Fsr(u8 fsr)
-{
-    return IIC_Write_Byte(MPU_GYRO_CFG_REG, fsr<<3);//设置陀螺仪满量程范围
-}
-
-//设置MPU6050加速度传感器满量程范围
-//fsr:0,±2g;1,±4g;2,±8g;3,±16g
-//返回值:0,设置成功
-//    其他,设置失败
-u8 MPU_Set_Accel_Fsr(u8 fsr)
-{
-    return IIC_Write_Byte(MPU_ACCEL_CFG_REG, fsr<<3);//设置加速度传感器满量程范围
-}
-
-//设置MPU6050的数字低通滤波器
-//lpf:数字低通滤波频率(Hz)
-//返回值:0,设置成功
-//    其他,设置失败
-u8 MPU_Set_LPF(u16 lpf)
-{
-    u8 data=0;
-    if(lpf>=188) data=1;
-    else if(lpf>=98) data=2;
-    else if(lpf>=42) data=2;
-    else if(lpf>=42) data=3;
-    else if(lpf>=20) data=4;
-    else if(lpf>=10) data=5;
-    else data=6;
-    return IIC_Write_Byte(MPU_CFG_REG,data);//设置数字低通滤波器
-}
-
-//设置MPU6050的采样率(假定Fs=1KHz)
-//rate:4~1000(Hz)
-//返回值:0,设置成功
-//    其他,设置失败
-u8 MPU_Set_Rate(u16 rate)
-{
-    u8 data;
-    if(rate>1000)rate=1000;
-    if(rate<4)rate=4;
-    data=1000/rate-1;
-    data=IIC_Write_Byte(MPU_SAMPLE_RATE_REG, data);  //设置数字低通滤波器
-    return MPU_Set_LPF(rate/2); //自动设置LPF为采样率的一半
-}
-
-//得到温度值
-//返回值:温度值(扩大了100倍)
-short MPU_Get_Temperature(void)
-{
-    u8 buf[2];
-    short raw;
-    float temp;
-    IIC_Read_Len(MPU_ADDR, MPU_TEMP_OUTH_REG, 2, buf);
-    raw=((u16)buf[0]<<8)|buf[1];
-    temp=36.53+((double)raw)/340;
-
-    return temp*100;;
-}
-
-//得到陀螺仪值(原始值)
-//gx,gy,gz:陀螺仪x,y,z轴的原始读数(带符号)
-//返回值:0,成功
-// 其他,错误代码
-u8 MPU_Get_Gyroscope(short *gx,short *gy,short *gz)
-{
-    u8 buf[6],res;
-    res=IIC_Read_Len(MPU_ADDR,MPU_GYRO_XOUTH_REG,6,buf);
-    if(res==0)
-    {
-        *gx=((u16)buf[0]<<8)|buf[1];
-        *gy=((u16)buf[2]<<8)|buf[3];
-        *gz=((u16)buf[4]<<8)|buf[5];
-    }
-    return res;
-}
-
-//得到加速度值(原始值)
-//ax,ay,az:陀螺仪x,y,z轴的原始读数(带符号)
-//返回值:0,成功
-//    其他,错误代码
-u8 MPU_Get_Accelerometer(short *ax,short *ay,short *az)
-{
-    u8 buf[6],res;
-    res=IIC_Read_Len(MPU_ADDR,MPU_ACCEL_XOUTH_REG,6,buf);
-    if(res==0)
-    {
-        *ax=((u16)buf[0]<<8)|buf[1];
-        *ay=((u16)buf[2]<<8)|buf[3];
-        *az=((u16)buf[4]<<8)|buf[5];
-    }
-    return res;;
-}
-
-/*--------------------以下为使用板载固件DMP的相关代码,这个融合得到的姿态角效果很好*/
-
-
-/**
-  * @brief  获取当前毫秒值
-  * @param  存储最新毫秒值的变量
-  * @retval 无
-  */
-int get_tick_count(unsigned long *count)
-{
-   count[0] = HAL_GetTick();
-	return 0;
-}
-
-
-#include "inv_mpu5.h"
-#include "inv_mpu_dmp_motion_driver5.h"
-
-/* Data requested by client. */
-#define PRINT_ACCEL     (0x01)
-#define PRINT_GYRO      (0x02)
-#define PRINT_QUAT      (0x04)
-
-#define ACCEL_ON        (0x01)
-#define GYRO_ON         (0x02)
-
-#define MOTION          (0)
-#define NO_MOTION       (1)
-
-/* Starting sampling rate. */ //100
-#define DEFAULT_MPU_HZ  (50)
-
-struct rx_s {
-    unsigned char header[3];
-    unsigned char cmd;
-};
-struct hal_s {
-    unsigned char sensors;
-    unsigned char dmp_on;
-    unsigned char wait_for_tap;
-    volatile unsigned char new_gyro;
-    unsigned short report;
-    unsigned short dmp_features;
-    unsigned char motion_int_mode;
-    struct rx_s rx;
-};
-static struct hal_s hal = {0};
-
-/* USB RX binary semaphore. Actually, it's just a flag. Not included in struct
- * because it's declared extern elsewhere.
- */
-volatile unsigned char rx_new;
-
-/* The sensors can be mounted onto the board in any orientation. The mounting
- * matrix seen below tells the MPL how to rotate the raw data from thei
- * driver(s).
- * TODO: The following matrices refer to the configuration on an internal test
- * board at Invensense. If needed, please modify the matrices to match the
- * chip-to-body matrix for your particular set up.
- */
-static signed char gyro_orientation[9] = {-1, 0, 0,
-                                           0,-1, 0,
-                                           0, 0, 1};
-
-/* Every time new gyro data is available, this function is called in an
- * ISR context. In this example, it sets a flag protecting the FIFO read
- * function.
- */
-static void gyro_data_ready_cb(void)
-{
-    hal.new_gyro = 1;
-}
-
-enum packet_type_e {
-    PACKET_TYPE_ACCEL,
-    PACKET_TYPE_GYRO,
-    PACKET_TYPE_QUAT,
-    PACKET_TYPE_TAP,
-    PACKET_TYPE_ANDROID_ORIENT,
-    PACKET_TYPE_PEDO,
-    PACKET_TYPE_MISC
-};
-
-#define BYTE u_char
-/* Send data to the Python client application.
- * Data is formatted as follows:
- * packet[0]    = $
- * packet[1]    = packet type (see packet_type_e)
- * packet[2+]   = data
- */
-void send_packet(char packet_type, void *data)
-{
-
-	#define MAX_BUF_LENGTH  (18)
-    char buf[MAX_BUF_LENGTH], length;
-
-    memset(buf, 0, MAX_BUF_LENGTH);
-    buf[0] = '$';
-    buf[1] = packet_type;
-
-    if (packet_type == PACKET_TYPE_ACCEL || packet_type == PACKET_TYPE_GYRO) {
-        short *sdata = (short*)data;
-        buf[2] = (char)(sdata[0] >> 8);
-        buf[3] = (char)sdata[0];
-        buf[4] = (char)(sdata[1] >> 8);
-        buf[5] = (char)sdata[1];
-        buf[6] = (char)(sdata[2] >> 8);
-        buf[7] = (char)sdata[2];
-        length = 8;
-    } else if (packet_type == PACKET_TYPE_QUAT) {
-        long *ldata = (long*)data;
-        buf[2] = (char)(ldata[0] >> 24);
-        buf[3] = (char)(ldata[0] >> 16);
-        buf[4] = (char)(ldata[0] >> 8);
-        buf[5] = (char)ldata[0];
-        buf[6] = (char)(ldata[1] >> 24);
-        buf[7] = (char)(ldata[1] >> 16);
-        buf[8] = (char)(ldata[1] >> 8);
-        buf[9] = (char)ldata[1];
-        buf[10] = (char)(ldata[2] >> 24);
-        buf[11] = (char)(ldata[2] >> 16);
-        buf[12] = (char)(ldata[2] >> 8);
-        buf[13] = (char)ldata[2];
-        buf[14] = (char)(ldata[3] >> 24);
-        buf[15] = (char)(ldata[3] >> 16);
-        buf[16] = (char)(ldata[3] >> 8);
-        buf[17] = (char)ldata[3];
-        length = 18;
-    } else if (packet_type == PACKET_TYPE_TAP) {
-        buf[2] = ((char*)data)[0];
-        buf[3] = ((char*)data)[1];
-        length = 4;
-    } else if (packet_type == PACKET_TYPE_ANDROID_ORIENT) {
-        buf[2] = ((char*)data)[0];
-        length = 3;
-    } else if (packet_type == PACKET_TYPE_PEDO) {
-        long *ldata = (long*)data;
-        buf[2] = (char)(ldata[0] >> 24);
-        buf[3] = (char)(ldata[0] >> 16);
-        buf[4] = (char)(ldata[0] >> 8);
-        buf[5] = (char)ldata[0];
-        buf[6] = (char)(ldata[1] >> 24);
-        buf[7] = (char)(ldata[1] >> 16);
-        buf[8] = (char)(ldata[1] >> 8);
-        buf[9] = (char)ldata[1];
-        length = 10;
-    } else if (packet_type == PACKET_TYPE_MISC) {
-        buf[2] = ((char*)data)[0];
-        buf[3] = ((char*)data)[1];
-        buf[4] = ((char*)data)[2];
-        buf[5] = ((char*)data)[3];
-        length = 6;
-    }
-
-//    cdcSendDataWaitTilDone((BYTE*)buf, length, CDC0_INTFNUM, 100);
-}
-
-/* These next two functions converts the orientation matrix (see
- * gyro_orientation) to a scalar representation for use by the DMP.
- * NOTE: These functions are borrowed from Invensense's MPL.
- */
-static inline unsigned short inv_row_2_scale(const signed char *row)
-{
-    unsigned short b;
-
-    if (row[0] > 0)
-        b = 0;
-    else if (row[0] < 0)
-        b = 4;
-    else if (row[1] > 0)
-        b = 1;
-    else if (row[1] < 0)
-        b = 5;
-    else if (row[2] > 0)
-        b = 2;
-    else if (row[2] < 0)
-        b = 6;
-    else
-        b = 7;      // error
-    return b;
-}
-static inline unsigned short inv_orientation_matrix_to_scalar(
-    const signed char *mtx)
-{
-    unsigned short scalar;
-
-    /*
-       XYZ  010_001_000 Identity Matrix
-       XZY  001_010_000
-       YXZ  010_000_001
-       YZX  000_010_001
-       ZXY  001_000_010
-       ZYX  000_001_010
-     */
-
-    scalar = inv_row_2_scale(mtx);
-    scalar |= inv_row_2_scale(mtx + 3) << 3;
-    scalar |= inv_row_2_scale(mtx + 6) << 6;
-
-
-    return scalar;
-}
-
-static inline void run_self_test(void)
-{
-    int result;
-    char test_packet[4] = {0};
-    long gyro[3], accel[3];
-
-    result = mpu_run_self_test(gyro, accel);
-    if (result == 0x7) {
-        /* Test passed. We can trust the gyro data here, so let's push it down
-         * to the DMP.
-         */
-        float sens;
-        unsigned short accel_sens;
-        mpu_get_gyro_sens(&sens);
-        gyro[0] = (long)(gyro[0] * sens);
-        gyro[1] = (long)(gyro[1] * sens);
-        gyro[2] = (long)(gyro[2] * sens);
-        dmp_set_gyro_bias(gyro);
-        mpu_get_accel_sens(&accel_sens);
-        accel[0] *= accel_sens;
-        accel[1] *= accel_sens;
-        accel[2] *= accel_sens;
-        dmp_set_accel_bias(accel);
-    }
-
-    /* Report results. */
-    test_packet[0] = 't';
-    test_packet[1] = result;
-    send_packet(PACKET_TYPE_MISC, test_packet);
-}
-
-
-#define INT_EXIT_LPM0 12
-
-void DMP_Init(void)
-{
-    struct int_param_s int_param;
-
-	/* Set up gyro.
-	 * Every function preceded by mpu_ is a driver function and can be found
-	 * in inv_mpu.h.
-	 */
-	int_param.cb = gyro_data_ready_cb;
-	int_param.pin = 16;
-	int_param.lp_exit = INT_EXIT_LPM0;
-	int_param.active_low = 1;
-
-	int result = mpu_init(&int_param);
-
-	printf("mpu_init, %d\r\n", result);
-
-	if(result == 0)     //mpu初始化
-	{
-		if(!mpu_set_sensors(INV_XYZ_GYRO | INV_XYZ_ACCEL))    //设置需要的传感器
-			printf("mpu_set_sensor complete ......\r\n");
-
-		if(!mpu_configure_fifo(INV_XYZ_GYRO | INV_XYZ_ACCEL)) //设置fifo
-			printf("mpu_configure_fifo complete ......\r\n");
-
-		if(!mpu_set_sample_rate(DEFAULT_MPU_HZ))              //设置采集样率
-			printf("mpu_set_sample_rate complete ......\r\n");
-
-
-		unsigned short gyro_rate = 0, gyro_fsr = 0;
-		unsigned char accel_fsr = 0;
-
-	    mpu_get_sample_rate(&gyro_rate);
-	    mpu_get_gyro_fsr(&gyro_fsr);
-	    mpu_get_accel_fsr(&accel_fsr);
-
-	    printf("gyro_rate %d, gyro_fsr %d, accel_fsr %d\r\n", gyro_rate, gyro_fsr, accel_fsr);
-
-
-
-		if(!dmp_load_motion_driver_firmware())                //加载dmp固件
-			printf("dmp_load_motion_driver_firmware complete ......\r\n");
-
-		if(!dmp_set_orientation(inv_orientation_matrix_to_scalar(gyro_orientation)))
-			printf("dmp_set_orientation complete ......\r\n"); //设置陀螺仪方向
-
-		if(!dmp_enable_feature(DMP_FEATURE_6X_LP_QUAT | DMP_FEATURE_TAP |
-				DMP_FEATURE_ANDROID_ORIENT | DMP_FEATURE_SEND_RAW_ACCEL | DMP_FEATURE_SEND_CAL_GYRO |
-				DMP_FEATURE_GYRO_CAL))
-			printf("dmp_enable_feature complete ......\r\n");
-
-		if(!dmp_set_fifo_rate(DEFAULT_MPU_HZ))    //设置速率
-			printf("dmp_set_fifo_rate complete ......\r\n");
-
-		run_self_test();                          //自检(非必要)
-
-		if(!mpu_set_dmp_state(1))                 //使能
-			printf("mpu_set_dmp_state complete ......\r\n");
-	}
-
-}
-
-#define q30 1073741824.0
-
-uint8_t Read_DMP(float* Pitch,float* Roll,float* Yaw)
-{
-	short gyro[3], accel[3], sensors;
-	float q0=1.0f,q1=0.0f,q2=0.0f,q3=0.0f;
-	unsigned long sensor_timestamp;
-	unsigned char more;
-	long quat[4];
-
-	int ret = dmp_read_fifo(gyro, accel, quat, &sensor_timestamp, &sensors, &more);
-
-//	printf("dmp_read_fifo, %d\r\n", ret);
-
-	if(ret)
-	{
-		return 1;
-	}
-
-	if (sensors & INV_WXYZ_QUAT)
-	{
-		q0=quat[0] / q30;
-		q1=quat[1] / q30;
-		q2=quat[2] / q30;
-		q3=quat[3] / q30;
-		*Pitch = (float)asin(-2 * q1 * q3 + 2 * q0* q2)* 57.3;
-		*Roll =  (float)atan2(2 * q2 * q3 + 2 * q0 * q1, -2 * q1 * q1 - 2 * q2* q2 + 1)* 57.3; // roll
-		*Yaw =   (float)atan2(2*(q1*q2 + q0*q3),q0*q0+q1*q1-q2*q2-q3*q3) * 57.3;
-		return 0;
-	}
-	else
-	{
-		return 2;
-	}
-
-}
-
-
-
-
-
-

+ 0 - 117
Core备份3/imu5/MPU60505.h

@@ -1,117 +0,0 @@
-/*
- * MPU6050.h
- *
- *  Created on: Oct 26, 2021
- *      Author: Administrator
- */
-
-#ifndef INC_MPU6050_H_
-#define INC_MPU6050_H_
-
-#include "i2c.h"
-#include "inv_mpu5.h"
-
-//#define MPU_ACCEL_OFFS_REG		0X06	//accel_offs寄存器,可读取版本号,寄存器手册未提到
-//#define MPU_PROD_ID_REG			0X0C	//prod id寄存器,在寄存器手册未提到
-#define MPU_SELF_TESTX_REG		0X0D	//自检寄存器X
-#define MPU_SELF_TESTY_REG		0X0E	//自检寄存器Y
-#define MPU_SELF_TESTZ_REG		0X0F	//自检寄存器Z
-#define MPU_SELF_TESTA_REG		0X10	//自检寄存器A
-#define MPU_SAMPLE_RATE_REG		0X19	//采样频率分频器
-#define MPU_CFG_REG				0X1A	//配置寄存器
-#define MPU_GYRO_CFG_REG		0X1B	//陀螺仪配置寄存器
-#define MPU_ACCEL_CFG_REG		0X1C	//加速度计配置寄存器
-#define MPU_MOTION_DET_REG		0X1F	//运动检测阀值设置寄存器
-#define MPU_FIFO_EN_REG			0X23	//FIFO使能寄存器
-#define MPU_I2CMST_CTRL_REG		0X24	//IIC主机控制寄存器
-#define MPU_I2CSLV0_ADDR_REG	0X25	//IIC从机0器件地址寄存器
-#define MPU_I2CSLV0_REG			0X26	//IIC从机0数据地址寄存器
-#define MPU_I2CSLV0_CTRL_REG	0X27	//IIC从机0控制寄存器
-#define MPU_I2CSLV1_ADDR_REG	0X28	//IIC从机1器件地址寄存器
-#define MPU_I2CSLV1_REG			0X29	//IIC从机1数据地址寄存器
-#define MPU_I2CSLV1_CTRL_REG	0X2A	//IIC从机1控制寄存器
-#define MPU_I2CSLV2_ADDR_REG	0X2B	//IIC从机2器件地址寄存器
-#define MPU_I2CSLV2_REG			0X2C	//IIC从机2数据地址寄存器
-#define MPU_I2CSLV2_CTRL_REG	0X2D	//IIC从机2控制寄存器
-#define MPU_I2CSLV3_ADDR_REG	0X2E	//IIC从机3器件地址寄存器
-#define MPU_I2CSLV3_REG			0X2F	//IIC从机3数据地址寄存器
-#define MPU_I2CSLV3_CTRL_REG	0X30	//IIC从机3控制寄存器
-#define MPU_I2CSLV4_ADDR_REG	0X31	//IIC从机4器件地址寄存器
-#define MPU_I2CSLV4_REG			0X32	//IIC从机4数据地址寄存器
-#define MPU_I2CSLV4_DO_REG		0X33	//IIC从机4写数据寄存器
-#define MPU_I2CSLV4_CTRL_REG	0X34	//IIC从机4控制寄存器
-#define MPU_I2CSLV4_DI_REG		0X35	//IIC从机4读数据寄存器
-
-#define MPU_I2CMST_STA_REG		0X36	//IIC主机状态寄存器
-#define MPU_INTBP_CFG_REG		0X37	//中断/旁路设置寄存器
-#define MPU_INT_EN_REG			0X38	//中断使能寄存器
-#define MPU_INT_STA_REG			0X3A	//中断状态寄存器
-
-#define MPU_ACCEL_XOUTH_REG		0X3B	//加速度值,X轴高8位寄存器
-#define MPU_ACCEL_XOUTL_REG		0X3C	//加速度值,X轴低8位寄存器
-#define MPU_ACCEL_YOUTH_REG		0X3D	//加速度值,Y轴高8位寄存器
-#define MPU_ACCEL_YOUTL_REG		0X3E	//加速度值,Y轴低8位寄存器
-#define MPU_ACCEL_ZOUTH_REG		0X3F	//加速度值,Z轴高8位寄存器
-#define MPU_ACCEL_ZOUTL_REG		0X40	//加速度值,Z轴低8位寄存器
-
-#define MPU_TEMP_OUTH_REG		0X41	//温度值高八位寄存器
-#define MPU_TEMP_OUTL_REG		0X42	//温度值低8位寄存器
-
-#define MPU_GYRO_XOUTH_REG		0X43	//陀螺仪值,X轴高8位寄存器
-#define MPU_GYRO_XOUTL_REG		0X44	//陀螺仪值,X轴低8位寄存器
-#define MPU_GYRO_YOUTH_REG		0X45	//陀螺仪值,Y轴高8位寄存器
-#define MPU_GYRO_YOUTL_REG		0X46	//陀螺仪值,Y轴低8位寄存器
-#define MPU_GYRO_ZOUTH_REG		0X47	//陀螺仪值,Z轴高8位寄存器
-#define MPU_GYRO_ZOUTL_REG		0X48	//陀螺仪值,Z轴低8位寄存器
-
-#define MPU_I2CSLV0_DO_REG		0X63	//IIC从机0数据寄存器
-#define MPU_I2CSLV1_DO_REG		0X64	//IIC从机1数据寄存器
-#define MPU_I2CSLV2_DO_REG		0X65	//IIC从机2数据寄存器
-#define MPU_I2CSLV3_DO_REG		0X66	//IIC从机3数据寄存器
-
-#define MPU_I2CMST_DELAY_REG	0X67	//IIC主机延时管理寄存器
-#define MPU_SIGPATH_RST_REG		0X68	//信号通道复位寄存器
-#define MPU_MDETECT_CTRL_REG	0X69	//运动检测控制寄存器
-#define MPU_USER_CTRL_REG		0X6A	//用户控制寄存器
-#define MPU_PWR_MGMT1_REG		0X6B	//电源管理寄存器1
-#define MPU_PWR_MGMT2_REG		0X6C	//电源管理寄存器2
-#define MPU_FIFO_CNTH_REG		0X72	//FIFO计数寄存器高八位
-#define MPU_FIFO_CNTL_REG		0X73	//FIFO计数寄存器低八位
-#define MPU_FIFO_RW_REG			0X74	//FIFO读写寄存器
-#define MPU_DEVICE_ID_REG		0X75	//器件ID寄存器
-
-//如果AD0脚接地,IIC地址为0X68(不包含最低位).
-//如果接V3.3,则IIC地址为0X69(不包含最低位).
-#define MPU_ADDR				0X68
-
-
-//因为模块AD0默认接GND,所以转为读写地址后,为0XD1和0XD0(如果接VCC,则为0XD3和0XD2)
-#define MPU_READ    0XD1
-#define MPU_WRITE   0XD0
-
-#define u8 uint8_t
-#define u16 uint16_t
-
-u8 MPU_Init(void); 								//初始化MPU6050
-u8 IIC_Write_Len(u8 addr,u8 reg,u8 len,u8 *buf);//IIC连续写
-u8 IIC_Read_Len(u8 addr,u8 reg,u8 len,u8 *buf); //IIC连续读
-u8 IIC_Write_Byte(u8 reg,u8 data);				//IIC写一个字节
-u8 IIC_Read_Byte(u8 reg);						//IIC读一个字节
-
-u8 MPU_Set_Gyro_Fsr(u8 fsr);
-u8 MPU_Set_Accel_Fsr(u8 fsr);
-u8 MPU_Set_LPF(u16 lpf);
-u8 MPU_Set_Rate(u16 rate);
-u8 MPU_Set_Fifo(u8 sens);
-
-
-short MPU_Get_Temperature(void);
-u8 MPU_Get_Gyroscope(short *gx,short *gy,short *gz);
-u8 MPU_Get_Accelerometer(short *ax,short *ay,short *az);
-
-//----------------------DMP-------------------------------
-void DMP_Init(void);
-uint8_t Read_DMP(float* Pitch,float* Roll,float* Yaw);
-int get_tick_count(unsigned long *count);
-
-#endif /* INC_MPU6050_H_ */

+ 0 - 494
Core备份3/imu5/dmpKey5.h

@@ -1,494 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011 InvenSense Corporation, All Rights Reserved.
- $
- */
-#ifndef DMPKEY_H__
-#define DMPKEY_H__
-
-#define KEY_CFG_25                  (0)
-#define KEY_CFG_24                  (KEY_CFG_25 + 1)
-#define KEY_CFG_26                  (KEY_CFG_24 + 1)
-#define KEY_CFG_27                  (KEY_CFG_26 + 1)
-#define KEY_CFG_21                  (KEY_CFG_27 + 1)
-#define KEY_CFG_20                  (KEY_CFG_21 + 1)
-#define KEY_CFG_TAP4                (KEY_CFG_20 + 1)
-#define KEY_CFG_TAP5                (KEY_CFG_TAP4 + 1)
-#define KEY_CFG_TAP6                (KEY_CFG_TAP5 + 1)
-#define KEY_CFG_TAP7                (KEY_CFG_TAP6 + 1)
-#define KEY_CFG_TAP0                (KEY_CFG_TAP7 + 1)
-#define KEY_CFG_TAP1                (KEY_CFG_TAP0 + 1)
-#define KEY_CFG_TAP2                (KEY_CFG_TAP1 + 1)
-#define KEY_CFG_TAP3                (KEY_CFG_TAP2 + 1)
-#define KEY_CFG_TAP_QUANTIZE        (KEY_CFG_TAP3 + 1)
-#define KEY_CFG_TAP_JERK            (KEY_CFG_TAP_QUANTIZE + 1)
-#define KEY_CFG_DR_INT              (KEY_CFG_TAP_JERK + 1)
-#define KEY_CFG_AUTH                (KEY_CFG_DR_INT + 1)
-#define KEY_CFG_TAP_SAVE_ACCB       (KEY_CFG_AUTH + 1)
-#define KEY_CFG_TAP_CLEAR_STICKY    (KEY_CFG_TAP_SAVE_ACCB + 1)
-#define KEY_CFG_FIFO_ON_EVENT       (KEY_CFG_TAP_CLEAR_STICKY + 1)
-#define KEY_FCFG_ACCEL_INPUT        (KEY_CFG_FIFO_ON_EVENT + 1)
-#define KEY_FCFG_ACCEL_INIT         (KEY_FCFG_ACCEL_INPUT + 1)
-#define KEY_CFG_23                  (KEY_FCFG_ACCEL_INIT + 1)
-#define KEY_FCFG_1                  (KEY_CFG_23 + 1)
-#define KEY_FCFG_3                  (KEY_FCFG_1 + 1)
-#define KEY_FCFG_2                  (KEY_FCFG_3 + 1)
-#define KEY_CFG_3D                  (KEY_FCFG_2 + 1)
-#define KEY_CFG_3B                  (KEY_CFG_3D + 1)
-#define KEY_CFG_3C                  (KEY_CFG_3B + 1)
-#define KEY_FCFG_5                  (KEY_CFG_3C + 1)
-#define KEY_FCFG_4                  (KEY_FCFG_5 + 1)
-#define KEY_FCFG_7                  (KEY_FCFG_4 + 1)
-#define KEY_FCFG_FSCALE             (KEY_FCFG_7 + 1)
-#define KEY_FCFG_AZ                 (KEY_FCFG_FSCALE + 1)
-#define KEY_FCFG_6                  (KEY_FCFG_AZ + 1)
-#define KEY_FCFG_LSB4               (KEY_FCFG_6 + 1)
-#define KEY_CFG_12                  (KEY_FCFG_LSB4 + 1)
-#define KEY_CFG_14                  (KEY_CFG_12 + 1)
-#define KEY_CFG_15                  (KEY_CFG_14 + 1)
-#define KEY_CFG_16                  (KEY_CFG_15 + 1)
-#define KEY_CFG_18                  (KEY_CFG_16 + 1)
-#define KEY_CFG_6                   (KEY_CFG_18 + 1)
-#define KEY_CFG_7                   (KEY_CFG_6 + 1)
-#define KEY_CFG_4                   (KEY_CFG_7 + 1)
-#define KEY_CFG_5                   (KEY_CFG_4 + 1)
-#define KEY_CFG_2                   (KEY_CFG_5 + 1)
-#define KEY_CFG_3                   (KEY_CFG_2 + 1)
-#define KEY_CFG_1                   (KEY_CFG_3 + 1)
-#define KEY_CFG_EXTERNAL            (KEY_CFG_1 + 1)
-#define KEY_CFG_8                   (KEY_CFG_EXTERNAL + 1)
-#define KEY_CFG_9                   (KEY_CFG_8 + 1)
-#define KEY_CFG_ORIENT_3            (KEY_CFG_9 + 1)
-#define KEY_CFG_ORIENT_2            (KEY_CFG_ORIENT_3 + 1)
-#define KEY_CFG_ORIENT_1            (KEY_CFG_ORIENT_2 + 1)
-#define KEY_CFG_GYRO_SOURCE         (KEY_CFG_ORIENT_1 + 1)
-#define KEY_CFG_ORIENT_IRQ_1        (KEY_CFG_GYRO_SOURCE + 1)
-#define KEY_CFG_ORIENT_IRQ_2        (KEY_CFG_ORIENT_IRQ_1 + 1)
-#define KEY_CFG_ORIENT_IRQ_3        (KEY_CFG_ORIENT_IRQ_2 + 1)
-#define KEY_FCFG_MAG_VAL            (KEY_CFG_ORIENT_IRQ_3 + 1)
-#define KEY_FCFG_MAG_MOV            (KEY_FCFG_MAG_VAL + 1)
-#define KEY_CFG_LP_QUAT             (KEY_FCFG_MAG_MOV + 1)
-
-/* MPU6050 keys */
-#define KEY_CFG_ACCEL_FILTER        (KEY_CFG_LP_QUAT + 1)
-#define KEY_CFG_MOTION_BIAS         (KEY_CFG_ACCEL_FILTER + 1)
-#define KEY_TEMPLABEL               (KEY_CFG_MOTION_BIAS + 1)
-
-#define KEY_D_0_22                  (KEY_TEMPLABEL + 1)
-#define KEY_D_0_24                  (KEY_D_0_22 + 1)
-#define KEY_D_0_36                  (KEY_D_0_24 + 1)
-#define KEY_D_0_52                  (KEY_D_0_36 + 1)
-#define KEY_D_0_96                  (KEY_D_0_52 + 1)
-#define KEY_D_0_104                 (KEY_D_0_96 + 1)
-#define KEY_D_0_108                 (KEY_D_0_104 + 1)
-#define KEY_D_0_163                 (KEY_D_0_108 + 1)
-#define KEY_D_0_188                 (KEY_D_0_163 + 1)
-#define KEY_D_0_192                 (KEY_D_0_188 + 1)
-#define KEY_D_0_224                 (KEY_D_0_192 + 1)
-#define KEY_D_0_228                 (KEY_D_0_224 + 1)
-#define KEY_D_0_232                 (KEY_D_0_228 + 1)
-#define KEY_D_0_236                 (KEY_D_0_232 + 1)
-
-#define KEY_DMP_PREVPTAT            (KEY_D_0_236 + 1)
-#define KEY_D_1_2                   (KEY_DMP_PREVPTAT + 1)
-#define KEY_D_1_4                   (KEY_D_1_2 + 1)
-#define KEY_D_1_8                   (KEY_D_1_4 + 1)
-#define KEY_D_1_10                  (KEY_D_1_8 + 1)
-#define KEY_D_1_24                  (KEY_D_1_10 + 1)
-#define KEY_D_1_28                  (KEY_D_1_24 + 1)
-#define KEY_D_1_36                  (KEY_D_1_28 + 1)
-#define KEY_D_1_40                  (KEY_D_1_36 + 1)
-#define KEY_D_1_44                  (KEY_D_1_40 + 1)
-#define KEY_D_1_72                  (KEY_D_1_44 + 1)
-#define KEY_D_1_74                  (KEY_D_1_72 + 1)
-#define KEY_D_1_79                  (KEY_D_1_74 + 1)
-#define KEY_D_1_88                  (KEY_D_1_79 + 1)
-#define KEY_D_1_90                  (KEY_D_1_88 + 1)
-#define KEY_D_1_92                  (KEY_D_1_90 + 1)
-#define KEY_D_1_96                  (KEY_D_1_92 + 1)
-#define KEY_D_1_98                  (KEY_D_1_96 + 1)
-#define KEY_D_1_100                 (KEY_D_1_98 + 1)
-#define KEY_D_1_106                 (KEY_D_1_100 + 1)
-#define KEY_D_1_108                 (KEY_D_1_106 + 1)
-#define KEY_D_1_112                 (KEY_D_1_108 + 1)
-#define KEY_D_1_128                 (KEY_D_1_112 + 1)
-#define KEY_D_1_152                 (KEY_D_1_128 + 1)
-#define KEY_D_1_160                 (KEY_D_1_152 + 1)
-#define KEY_D_1_168                 (KEY_D_1_160 + 1)
-#define KEY_D_1_175                 (KEY_D_1_168 + 1)
-#define KEY_D_1_176                 (KEY_D_1_175 + 1)
-#define KEY_D_1_178                 (KEY_D_1_176 + 1)
-#define KEY_D_1_179                 (KEY_D_1_178 + 1)
-#define KEY_D_1_218                 (KEY_D_1_179 + 1)
-#define KEY_D_1_232                 (KEY_D_1_218 + 1)
-#define KEY_D_1_236                 (KEY_D_1_232 + 1)
-#define KEY_D_1_240                 (KEY_D_1_236 + 1)
-#define KEY_D_1_244                 (KEY_D_1_240 + 1)
-#define KEY_D_1_250                 (KEY_D_1_244 + 1)
-#define KEY_D_1_252                 (KEY_D_1_250 + 1)
-#define KEY_D_2_12                  (KEY_D_1_252 + 1)
-#define KEY_D_2_96                  (KEY_D_2_12 + 1)
-#define KEY_D_2_108                 (KEY_D_2_96 + 1)
-#define KEY_D_2_208                 (KEY_D_2_108 + 1)
-#define KEY_FLICK_MSG               (KEY_D_2_208 + 1)
-#define KEY_FLICK_COUNTER           (KEY_FLICK_MSG + 1)
-#define KEY_FLICK_LOWER             (KEY_FLICK_COUNTER + 1)
-#define KEY_CFG_FLICK_IN            (KEY_FLICK_LOWER + 1)
-#define KEY_FLICK_UPPER             (KEY_CFG_FLICK_IN + 1)
-#define KEY_CGNOTICE_INTR           (KEY_FLICK_UPPER + 1)
-#define KEY_D_2_224                 (KEY_CGNOTICE_INTR + 1)
-#define KEY_D_2_244                 (KEY_D_2_224 + 1)
-#define KEY_D_2_248                 (KEY_D_2_244 + 1)
-#define KEY_D_2_252                 (KEY_D_2_248 + 1)
-
-#define KEY_D_GYRO_BIAS_X               (KEY_D_2_252 + 1)
-#define KEY_D_GYRO_BIAS_Y               (KEY_D_GYRO_BIAS_X + 1)
-#define KEY_D_GYRO_BIAS_Z               (KEY_D_GYRO_BIAS_Y + 1)
-#define KEY_D_ACC_BIAS_X                (KEY_D_GYRO_BIAS_Z + 1)
-#define KEY_D_ACC_BIAS_Y                (KEY_D_ACC_BIAS_X + 1)
-#define KEY_D_ACC_BIAS_Z                (KEY_D_ACC_BIAS_Y + 1)
-#define KEY_D_GYRO_ENABLE               (KEY_D_ACC_BIAS_Z + 1)
-#define KEY_D_ACCEL_ENABLE              (KEY_D_GYRO_ENABLE + 1)
-#define KEY_D_QUAT_ENABLE               (KEY_D_ACCEL_ENABLE +1)
-#define KEY_D_OUTPUT_ENABLE             (KEY_D_QUAT_ENABLE + 1)
-#define KEY_D_CR_TIME_G                 (KEY_D_OUTPUT_ENABLE + 1)
-#define KEY_D_CR_TIME_A                 (KEY_D_CR_TIME_G + 1)
-#define KEY_D_CR_TIME_Q                 (KEY_D_CR_TIME_A + 1)
-#define KEY_D_CS_TAX                    (KEY_D_CR_TIME_Q + 1)
-#define KEY_D_CS_TAY                    (KEY_D_CS_TAX + 1)
-#define KEY_D_CS_TAZ                    (KEY_D_CS_TAY + 1)
-#define KEY_D_CS_TGX                    (KEY_D_CS_TAZ + 1)
-#define KEY_D_CS_TGY                    (KEY_D_CS_TGX + 1)
-#define KEY_D_CS_TGZ                    (KEY_D_CS_TGY + 1)
-#define KEY_D_CS_TQ0                    (KEY_D_CS_TGZ + 1)
-#define KEY_D_CS_TQ1                    (KEY_D_CS_TQ0 + 1)
-#define KEY_D_CS_TQ2                    (KEY_D_CS_TQ1 + 1)
-#define KEY_D_CS_TQ3                    (KEY_D_CS_TQ2 + 1)
-
-/* Compass keys */
-#define KEY_CPASS_BIAS_X            (KEY_D_CS_TQ3 + 1)
-#define KEY_CPASS_BIAS_Y            (KEY_CPASS_BIAS_X + 1)
-#define KEY_CPASS_BIAS_Z            (KEY_CPASS_BIAS_Y + 1)
-#define KEY_CPASS_MTX_00            (KEY_CPASS_BIAS_Z + 1)
-#define KEY_CPASS_MTX_01            (KEY_CPASS_MTX_00 + 1)
-#define KEY_CPASS_MTX_02            (KEY_CPASS_MTX_01 + 1)
-#define KEY_CPASS_MTX_10            (KEY_CPASS_MTX_02 + 1)
-#define KEY_CPASS_MTX_11            (KEY_CPASS_MTX_10 + 1)
-#define KEY_CPASS_MTX_12            (KEY_CPASS_MTX_11 + 1)
-#define KEY_CPASS_MTX_20            (KEY_CPASS_MTX_12 + 1)
-#define KEY_CPASS_MTX_21            (KEY_CPASS_MTX_20 + 1)
-#define KEY_CPASS_MTX_22            (KEY_CPASS_MTX_21 + 1)
-
-/* Gesture Keys */
-#define KEY_DMP_TAPW_MIN            (KEY_CPASS_MTX_22 + 1)
-#define KEY_DMP_TAP_THR_X           (KEY_DMP_TAPW_MIN + 1)
-#define KEY_DMP_TAP_THR_Y           (KEY_DMP_TAP_THR_X + 1)
-#define KEY_DMP_TAP_THR_Z           (KEY_DMP_TAP_THR_Y + 1)
-#define KEY_DMP_SH_TH_Y             (KEY_DMP_TAP_THR_Z + 1)
-#define KEY_DMP_SH_TH_X             (KEY_DMP_SH_TH_Y + 1)
-#define KEY_DMP_SH_TH_Z             (KEY_DMP_SH_TH_X + 1)
-#define KEY_DMP_ORIENT              (KEY_DMP_SH_TH_Z + 1)
-#define KEY_D_ACT0                  (KEY_DMP_ORIENT + 1)
-#define KEY_D_ACSX                  (KEY_D_ACT0 + 1)
-#define KEY_D_ACSY                  (KEY_D_ACSX + 1)
-#define KEY_D_ACSZ                  (KEY_D_ACSY + 1)
-
-#define KEY_X_GRT_Y_TMP             (KEY_D_ACSZ + 1)
-#define KEY_SKIP_X_GRT_Y_TMP        (KEY_X_GRT_Y_TMP + 1)
-#define KEY_SKIP_END_COMPARE        (KEY_SKIP_X_GRT_Y_TMP + 1)
-#define KEY_END_COMPARE_Y_X_TMP2    (KEY_SKIP_END_COMPARE + 1)       
-#define KEY_CFG_ANDROID_ORIENT_INT  (KEY_END_COMPARE_Y_X_TMP2 + 1)
-#define KEY_NO_ORIENT_INTERRUPT     (KEY_CFG_ANDROID_ORIENT_INT + 1)
-#define KEY_END_COMPARE_Y_X_TMP     (KEY_NO_ORIENT_INTERRUPT + 1)
-#define KEY_END_ORIENT_1            (KEY_END_COMPARE_Y_X_TMP + 1)
-#define KEY_END_COMPARE_Y_X         (KEY_END_ORIENT_1 + 1) 
-#define KEY_END_ORIENT              (KEY_END_COMPARE_Y_X + 1)
-#define KEY_X_GRT_Y                 (KEY_END_ORIENT + 1)
-#define KEY_NOT_TIME_MINUS_1        (KEY_X_GRT_Y + 1)       
-#define KEY_END_COMPARE_Y_X_TMP3    (KEY_NOT_TIME_MINUS_1 + 1) 
-#define KEY_X_GRT_Y_TMP2            (KEY_END_COMPARE_Y_X_TMP3 + 1)
-
-/* Authenticate Keys */
-#define KEY_D_AUTH_OUT              (KEY_X_GRT_Y_TMP2 + 1)
-#define KEY_D_AUTH_IN               (KEY_D_AUTH_OUT + 1)
-#define KEY_D_AUTH_A                (KEY_D_AUTH_IN + 1)
-#define KEY_D_AUTH_B                (KEY_D_AUTH_A + 1)
-
-/* Pedometer standalone only keys */
-#define KEY_D_PEDSTD_BP_B           (KEY_D_AUTH_B + 1)
-#define KEY_D_PEDSTD_HP_A           (KEY_D_PEDSTD_BP_B + 1)
-#define KEY_D_PEDSTD_HP_B           (KEY_D_PEDSTD_HP_A + 1)
-#define KEY_D_PEDSTD_BP_A4          (KEY_D_PEDSTD_HP_B + 1)
-#define KEY_D_PEDSTD_BP_A3          (KEY_D_PEDSTD_BP_A4 + 1)
-#define KEY_D_PEDSTD_BP_A2          (KEY_D_PEDSTD_BP_A3 + 1)
-#define KEY_D_PEDSTD_BP_A1          (KEY_D_PEDSTD_BP_A2 + 1)
-#define KEY_D_PEDSTD_INT_THRSH      (KEY_D_PEDSTD_BP_A1 + 1)
-#define KEY_D_PEDSTD_CLIP           (KEY_D_PEDSTD_INT_THRSH + 1)
-#define KEY_D_PEDSTD_SB             (KEY_D_PEDSTD_CLIP + 1)
-#define KEY_D_PEDSTD_SB_TIME        (KEY_D_PEDSTD_SB + 1)
-#define KEY_D_PEDSTD_PEAKTHRSH      (KEY_D_PEDSTD_SB_TIME + 1)
-#define KEY_D_PEDSTD_TIML           (KEY_D_PEDSTD_PEAKTHRSH + 1)
-#define KEY_D_PEDSTD_TIMH           (KEY_D_PEDSTD_TIML + 1)
-#define KEY_D_PEDSTD_PEAK           (KEY_D_PEDSTD_TIMH + 1)
-#define KEY_D_PEDSTD_TIMECTR        (KEY_D_PEDSTD_PEAK + 1)
-#define KEY_D_PEDSTD_STEPCTR        (KEY_D_PEDSTD_TIMECTR + 1)
-#define KEY_D_PEDSTD_WALKTIME       (KEY_D_PEDSTD_STEPCTR + 1)
-#define KEY_D_PEDSTD_DECI           (KEY_D_PEDSTD_WALKTIME + 1)
-
-/*Host Based No Motion*/
-#define KEY_D_HOST_NO_MOT           (KEY_D_PEDSTD_DECI + 1)
-
-/* EIS keys */
-#define KEY_P_EIS_FIFO_FOOTER       (KEY_D_HOST_NO_MOT + 1)
-#define KEY_P_EIS_FIFO_YSHIFT       (KEY_P_EIS_FIFO_FOOTER + 1)
-#define KEY_P_EIS_DATA_RATE         (KEY_P_EIS_FIFO_YSHIFT + 1)
-#define KEY_P_EIS_FIFO_XSHIFT       (KEY_P_EIS_DATA_RATE + 1)
-#define KEY_P_EIS_FIFO_SYNC         (KEY_P_EIS_FIFO_XSHIFT + 1)
-#define KEY_P_EIS_FIFO_ZSHIFT       (KEY_P_EIS_FIFO_SYNC + 1)
-#define KEY_P_EIS_FIFO_READY        (KEY_P_EIS_FIFO_ZSHIFT + 1)
-#define KEY_DMP_FOOTER              (KEY_P_EIS_FIFO_READY + 1)
-#define KEY_DMP_INTX_HC             (KEY_DMP_FOOTER + 1)
-#define KEY_DMP_INTX_PH             (KEY_DMP_INTX_HC + 1)
-#define KEY_DMP_INTX_SH             (KEY_DMP_INTX_PH + 1)
-#define KEY_DMP_AINV_SH             (KEY_DMP_INTX_SH + 1)
-#define KEY_DMP_A_INV_XH            (KEY_DMP_AINV_SH + 1)
-#define KEY_DMP_AINV_PH             (KEY_DMP_A_INV_XH + 1)
-#define KEY_DMP_CTHX_H              (KEY_DMP_AINV_PH + 1)
-#define KEY_DMP_CTHY_H              (KEY_DMP_CTHX_H + 1)
-#define KEY_DMP_CTHZ_H              (KEY_DMP_CTHY_H + 1)
-#define KEY_DMP_NCTHX_H             (KEY_DMP_CTHZ_H + 1)
-#define KEY_DMP_NCTHY_H             (KEY_DMP_NCTHX_H + 1)
-#define KEY_DMP_NCTHZ_H             (KEY_DMP_NCTHY_H + 1)
-#define KEY_DMP_CTSQ_XH             (KEY_DMP_NCTHZ_H + 1)
-#define KEY_DMP_CTSQ_YH             (KEY_DMP_CTSQ_XH + 1)
-#define KEY_DMP_CTSQ_ZH             (KEY_DMP_CTSQ_YH + 1)
-#define KEY_DMP_INTX_H              (KEY_DMP_CTSQ_ZH + 1)
-#define KEY_DMP_INTY_H              (KEY_DMP_INTX_H + 1)
-#define KEY_DMP_INTZ_H              (KEY_DMP_INTY_H + 1)
-//#define KEY_DMP_HPX_H               (KEY_DMP_INTZ_H + 1)
-//#define KEY_DMP_HPY_H               (KEY_DMP_HPX_H + 1)
-//#define KEY_DMP_HPZ_H               (KEY_DMP_HPY_H + 1)
-
-/* Stream keys */
-#define KEY_STREAM_P_GYRO_Z         (KEY_DMP_INTZ_H + 1)
-#define KEY_STREAM_P_GYRO_Y         (KEY_STREAM_P_GYRO_Z + 1)
-#define KEY_STREAM_P_GYRO_X         (KEY_STREAM_P_GYRO_Y + 1)
-#define KEY_STREAM_P_TEMP           (KEY_STREAM_P_GYRO_X + 1)
-#define KEY_STREAM_P_AUX_Y          (KEY_STREAM_P_TEMP + 1)
-#define KEY_STREAM_P_AUX_X          (KEY_STREAM_P_AUX_Y + 1)
-#define KEY_STREAM_P_AUX_Z          (KEY_STREAM_P_AUX_X + 1)
-#define KEY_STREAM_P_ACCEL_Y        (KEY_STREAM_P_AUX_Z + 1)
-#define KEY_STREAM_P_ACCEL_X        (KEY_STREAM_P_ACCEL_Y + 1)
-#define KEY_STREAM_P_FOOTER         (KEY_STREAM_P_ACCEL_X + 1)
-#define KEY_STREAM_P_ACCEL_Z        (KEY_STREAM_P_FOOTER + 1)
-
-#define NUM_KEYS                    (KEY_STREAM_P_ACCEL_Z + 1)
-
-typedef struct {
-    unsigned short key;
-    unsigned short addr;
-} tKeyLabel;
-
-#define DINA0A 0x0a
-#define DINA22 0x22
-#define DINA42 0x42
-#define DINA5A 0x5a
-
-#define DINA06 0x06
-#define DINA0E 0x0e
-#define DINA16 0x16
-#define DINA1E 0x1e
-#define DINA26 0x26
-#define DINA2E 0x2e
-#define DINA36 0x36
-#define DINA3E 0x3e
-#define DINA46 0x46
-#define DINA4E 0x4e
-#define DINA56 0x56
-#define DINA5E 0x5e
-#define DINA66 0x66
-#define DINA6E 0x6e
-#define DINA76 0x76
-#define DINA7E 0x7e
-
-#define DINA00 0x00
-#define DINA08 0x08
-#define DINA10 0x10
-#define DINA18 0x18
-#define DINA20 0x20
-#define DINA28 0x28
-#define DINA30 0x30
-#define DINA38 0x38
-#define DINA40 0x40
-#define DINA48 0x48
-#define DINA50 0x50
-#define DINA58 0x58
-#define DINA60 0x60
-#define DINA68 0x68
-#define DINA70 0x70
-#define DINA78 0x78
-
-#define DINA04 0x04
-#define DINA0C 0x0c
-#define DINA14 0x14
-#define DINA1C 0x1C
-#define DINA24 0x24
-#define DINA2C 0x2c
-#define DINA34 0x34
-#define DINA3C 0x3c
-#define DINA44 0x44
-#define DINA4C 0x4c
-#define DINA54 0x54
-#define DINA5C 0x5c
-#define DINA64 0x64
-#define DINA6C 0x6c
-#define DINA74 0x74
-#define DINA7C 0x7c
-
-#define DINA01 0x01
-#define DINA09 0x09
-#define DINA11 0x11
-#define DINA19 0x19
-#define DINA21 0x21
-#define DINA29 0x29
-#define DINA31 0x31
-#define DINA39 0x39
-#define DINA41 0x41
-#define DINA49 0x49
-#define DINA51 0x51
-#define DINA59 0x59
-#define DINA61 0x61
-#define DINA69 0x69
-#define DINA71 0x71
-#define DINA79 0x79
-
-#define DINA25 0x25
-#define DINA2D 0x2d
-#define DINA35 0x35
-#define DINA3D 0x3d
-#define DINA4D 0x4d
-#define DINA55 0x55
-#define DINA5D 0x5D
-#define DINA6D 0x6d
-#define DINA75 0x75
-#define DINA7D 0x7d
-
-#define DINADC 0xdc
-#define DINAF2 0xf2
-#define DINAAB 0xab
-#define DINAAA 0xaa
-#define DINAF1 0xf1
-#define DINADF 0xdf
-#define DINADA 0xda
-#define DINAB1 0xb1
-#define DINAB9 0xb9
-#define DINAF3 0xf3
-#define DINA8B 0x8b
-#define DINAA3 0xa3
-#define DINA91 0x91
-#define DINAB6 0xb6
-#define DINAB4 0xb4
-
-
-#define DINC00 0x00
-#define DINC01 0x01
-#define DINC02 0x02
-#define DINC03 0x03
-#define DINC08 0x08
-#define DINC09 0x09
-#define DINC0A 0x0a
-#define DINC0B 0x0b
-#define DINC10 0x10
-#define DINC11 0x11
-#define DINC12 0x12
-#define DINC13 0x13
-#define DINC18 0x18
-#define DINC19 0x19
-#define DINC1A 0x1a
-#define DINC1B 0x1b
-
-#define DINC20 0x20
-#define DINC21 0x21
-#define DINC22 0x22
-#define DINC23 0x23
-#define DINC28 0x28
-#define DINC29 0x29
-#define DINC2A 0x2a
-#define DINC2B 0x2b
-#define DINC30 0x30
-#define DINC31 0x31
-#define DINC32 0x32
-#define DINC33 0x33
-#define DINC38 0x38
-#define DINC39 0x39
-#define DINC3A 0x3a
-#define DINC3B 0x3b
-
-#define DINC40 0x40
-#define DINC41 0x41
-#define DINC42 0x42
-#define DINC43 0x43
-#define DINC48 0x48
-#define DINC49 0x49
-#define DINC4A 0x4a
-#define DINC4B 0x4b
-#define DINC50 0x50
-#define DINC51 0x51
-#define DINC52 0x52
-#define DINC53 0x53
-#define DINC58 0x58
-#define DINC59 0x59
-#define DINC5A 0x5a
-#define DINC5B 0x5b
-
-#define DINC60 0x60
-#define DINC61 0x61
-#define DINC62 0x62
-#define DINC63 0x63
-#define DINC68 0x68
-#define DINC69 0x69
-#define DINC6A 0x6a
-#define DINC6B 0x6b
-#define DINC70 0x70
-#define DINC71 0x71
-#define DINC72 0x72
-#define DINC73 0x73
-#define DINC78 0x78
-#define DINC79 0x79
-#define DINC7A 0x7a
-#define DINC7B 0x7b
-
-#define DIND40 0x40
-
-
-#define DINA80 0x80
-#define DINA90 0x90
-#define DINAA0 0xa0
-#define DINAC9 0xc9
-#define DINACB 0xcb
-#define DINACD 0xcd
-#define DINACF 0xcf
-#define DINAC8 0xc8
-#define DINACA 0xca
-#define DINACC 0xcc
-#define DINACE 0xce
-#define DINAD8 0xd8
-#define DINADD 0xdd
-#define DINAF8 0xf0
-#define DINAFE 0xfe
-
-#define DINBF8 0xf8
-#define DINAC0 0xb0
-#define DINAC1 0xb1
-#define DINAC2 0xb4
-#define DINAC3 0xb5
-#define DINAC4 0xb8
-#define DINAC5 0xb9
-#define DINBC0 0xc0
-#define DINBC2 0xc2
-#define DINBC4 0xc4
-#define DINBC6 0xc6
-
-
-
-#endif // DMPKEY_H__

+ 0 - 264
Core备份3/imu5/dmpmap5.h

@@ -1,264 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011 InvenSense Corporation, All Rights Reserved.
- $
- */
-#ifndef DMPMAP_H
-#define DMPMAP_H
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#define DMP_PTAT    0
-#define DMP_XGYR    2
-#define DMP_YGYR    4
-#define DMP_ZGYR    6
-#define DMP_XACC    8
-#define DMP_YACC    10
-#define DMP_ZACC    12
-#define DMP_ADC1    14
-#define DMP_ADC2    16
-#define DMP_ADC3    18
-#define DMP_BIASUNC    20
-#define DMP_FIFORT    22
-#define DMP_INVGSFH    24
-#define DMP_INVGSFL    26
-#define DMP_1H    28
-#define DMP_1L    30
-#define DMP_BLPFSTCH    32
-#define DMP_BLPFSTCL    34
-#define DMP_BLPFSXH    36
-#define DMP_BLPFSXL    38
-#define DMP_BLPFSYH    40
-#define DMP_BLPFSYL    42
-#define DMP_BLPFSZH    44
-#define DMP_BLPFSZL    46
-#define DMP_BLPFMTC    48
-#define DMP_SMC    50
-#define DMP_BLPFMXH    52
-#define DMP_BLPFMXL    54
-#define DMP_BLPFMYH    56
-#define DMP_BLPFMYL    58
-#define DMP_BLPFMZH    60
-#define DMP_BLPFMZL    62
-#define DMP_BLPFC    64
-#define DMP_SMCTH    66
-#define DMP_0H2    68
-#define DMP_0L2    70
-#define DMP_BERR2H    72
-#define DMP_BERR2L    74
-#define DMP_BERR2NH    76
-#define DMP_SMCINC    78
-#define DMP_ANGVBXH    80
-#define DMP_ANGVBXL    82
-#define DMP_ANGVBYH    84
-#define DMP_ANGVBYL    86
-#define DMP_ANGVBZH    88
-#define DMP_ANGVBZL    90
-#define DMP_BERR1H    92
-#define DMP_BERR1L    94
-#define DMP_ATCH    96
-#define DMP_BIASUNCSF    98
-#define DMP_ACT2H    100
-#define DMP_ACT2L    102
-#define DMP_GSFH    104
-#define DMP_GSFL    106
-#define DMP_GH    108
-#define DMP_GL    110
-#define DMP_0_5H    112
-#define DMP_0_5L    114
-#define DMP_0_0H    116
-#define DMP_0_0L    118
-#define DMP_1_0H    120
-#define DMP_1_0L    122
-#define DMP_1_5H    124
-#define DMP_1_5L    126
-#define DMP_TMP1AH    128
-#define DMP_TMP1AL    130
-#define DMP_TMP2AH    132
-#define DMP_TMP2AL    134
-#define DMP_TMP3AH    136
-#define DMP_TMP3AL    138
-#define DMP_TMP4AH    140
-#define DMP_TMP4AL    142
-#define DMP_XACCW    144
-#define DMP_TMP5    146
-#define DMP_XACCB    148
-#define DMP_TMP8    150
-#define DMP_YACCB    152
-#define DMP_TMP9    154
-#define DMP_ZACCB    156
-#define DMP_TMP10    158
-#define DMP_DZH    160
-#define DMP_DZL    162
-#define DMP_XGCH    164
-#define DMP_XGCL    166
-#define DMP_YGCH    168
-#define DMP_YGCL    170
-#define DMP_ZGCH    172
-#define DMP_ZGCL    174
-#define DMP_YACCW    176
-#define DMP_TMP7    178
-#define DMP_AFB1H    180
-#define DMP_AFB1L    182
-#define DMP_AFB2H    184
-#define DMP_AFB2L    186
-#define DMP_MAGFBH    188
-#define DMP_MAGFBL    190
-#define DMP_QT1H    192
-#define DMP_QT1L    194
-#define DMP_QT2H    196
-#define DMP_QT2L    198
-#define DMP_QT3H    200
-#define DMP_QT3L    202
-#define DMP_QT4H    204
-#define DMP_QT4L    206
-#define DMP_CTRL1H    208
-#define DMP_CTRL1L    210
-#define DMP_CTRL2H    212
-#define DMP_CTRL2L    214
-#define DMP_CTRL3H    216
-#define DMP_CTRL3L    218
-#define DMP_CTRL4H    220
-#define DMP_CTRL4L    222
-#define DMP_CTRLS1    224
-#define DMP_CTRLSF1    226
-#define DMP_CTRLS2    228
-#define DMP_CTRLSF2    230
-#define DMP_CTRLS3    232
-#define DMP_CTRLSFNLL    234
-#define DMP_CTRLS4    236
-#define DMP_CTRLSFNL2    238
-#define DMP_CTRLSFNL    240
-#define DMP_TMP30    242
-#define DMP_CTRLSFJT    244
-#define DMP_TMP31    246
-#define DMP_TMP11    248
-#define DMP_CTRLSF2_2    250
-#define DMP_TMP12    252
-#define DMP_CTRLSF1_2    254
-#define DMP_PREVPTAT    256
-#define DMP_ACCZB    258
-#define DMP_ACCXB    264
-#define DMP_ACCYB    266
-#define DMP_1HB    272
-#define DMP_1LB    274
-#define DMP_0H    276
-#define DMP_0L    278
-#define DMP_ASR22H    280
-#define DMP_ASR22L    282
-#define DMP_ASR6H    284
-#define DMP_ASR6L    286
-#define DMP_TMP13    288
-#define DMP_TMP14    290
-#define DMP_FINTXH    292
-#define DMP_FINTXL    294
-#define DMP_FINTYH    296
-#define DMP_FINTYL    298
-#define DMP_FINTZH    300
-#define DMP_FINTZL    302
-#define DMP_TMP1BH    304
-#define DMP_TMP1BL    306
-#define DMP_TMP2BH    308
-#define DMP_TMP2BL    310
-#define DMP_TMP3BH    312
-#define DMP_TMP3BL    314
-#define DMP_TMP4BH    316
-#define DMP_TMP4BL    318
-#define DMP_STXG    320
-#define DMP_ZCTXG    322
-#define DMP_STYG    324
-#define DMP_ZCTYG    326
-#define DMP_STZG    328
-#define DMP_ZCTZG    330
-#define DMP_CTRLSFJT2    332
-#define DMP_CTRLSFJTCNT    334
-#define DMP_PVXG    336
-#define DMP_TMP15    338
-#define DMP_PVYG    340
-#define DMP_TMP16    342
-#define DMP_PVZG    344
-#define DMP_TMP17    346
-#define DMP_MNMFLAGH    352
-#define DMP_MNMFLAGL    354
-#define DMP_MNMTMH    356
-#define DMP_MNMTML    358
-#define DMP_MNMTMTHRH    360
-#define DMP_MNMTMTHRL    362
-#define DMP_MNMTHRH    364
-#define DMP_MNMTHRL    366
-#define DMP_ACCQD4H    368
-#define DMP_ACCQD4L    370
-#define DMP_ACCQD5H    372
-#define DMP_ACCQD5L    374
-#define DMP_ACCQD6H    376
-#define DMP_ACCQD6L    378
-#define DMP_ACCQD7H    380
-#define DMP_ACCQD7L    382
-#define DMP_ACCQD0H    384
-#define DMP_ACCQD0L    386
-#define DMP_ACCQD1H    388
-#define DMP_ACCQD1L    390
-#define DMP_ACCQD2H    392
-#define DMP_ACCQD2L    394
-#define DMP_ACCQD3H    396
-#define DMP_ACCQD3L    398
-#define DMP_XN2H    400
-#define DMP_XN2L    402
-#define DMP_XN1H    404
-#define DMP_XN1L    406
-#define DMP_YN2H    408
-#define DMP_YN2L    410
-#define DMP_YN1H    412
-#define DMP_YN1L    414
-#define DMP_YH    416
-#define DMP_YL    418
-#define DMP_B0H    420
-#define DMP_B0L    422
-#define DMP_A1H    424
-#define DMP_A1L    426
-#define DMP_A2H    428
-#define DMP_A2L    430
-#define DMP_SEM1    432
-#define DMP_FIFOCNT    434
-#define DMP_SH_TH_X    436
-#define DMP_PACKET    438
-#define DMP_SH_TH_Y    440
-#define DMP_FOOTER    442
-#define DMP_SH_TH_Z    444
-#define DMP_TEMP29    448
-#define DMP_TEMP30    450
-#define DMP_XACCB_PRE    452
-#define DMP_XACCB_PREL    454
-#define DMP_YACCB_PRE    456
-#define DMP_YACCB_PREL    458
-#define DMP_ZACCB_PRE    460
-#define DMP_ZACCB_PREL    462
-#define DMP_TMP22    464
-#define DMP_TAP_TIMER    466
-#define DMP_TAP_THX    468
-#define DMP_TAP_THY    472
-#define DMP_TAP_THZ    476
-#define DMP_TAPW_MIN    478
-#define DMP_TMP25    480
-#define DMP_TMP26    482
-#define DMP_TMP27    484
-#define DMP_TMP28    486
-#define DMP_ORIENT    488
-#define DMP_THRSH    490
-#define DMP_ENDIANH    492
-#define DMP_ENDIANL    494
-#define DMP_BLPFNMTCH    496
-#define DMP_BLPFNMTCL    498
-#define DMP_BLPFNMXH    500
-#define DMP_BLPFNMXL    502
-#define DMP_BLPFNMYH    504
-#define DMP_BLPFNMYL    506
-#define DMP_BLPFNMZH    508
-#define DMP_BLPFNMZL    510
-#ifdef __cplusplus
-}
-#endif
-#endif // DMPMAP_H

+ 0 - 2774
Core备份3/imu5/inv_mpu5.c

@@ -1,2774 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011-2012 InvenSense Corporation, All Rights Reserved.
-    See included License.txt for License information.
- $
- */
-/**
- *  @addtogroup  DRIVERS Sensor Driver Layer
- *  @brief       Hardware drivers to communicate with sensors via I2C.
- *
- *  @{
- *      @file       inv_mpu.c
- *      @brief      An I2C-based driver for Invensense gyroscopes.
- *      @details    This driver currently works for the following devices:
- *                  MPU6050
- *                  MPU6500
- *                  MPU9150 (or MPU6050 w/ AK8975 on the auxiliary bus)
- *                  MPU9250 (or MPU6500 w/ AK8963 on the auxiliary bus)
- */
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include "inv_mpu5.h"
-
-#include "MPU60505.h"
-
-
-/* The following functions must be defined for this platform:
- * i2c_write(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char const *data)
- * i2c_read(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char *data)
- * delay_ms(unsigned long num_ms)
- * get_ms(unsigned long *count)
- * reg_int_cb(void (*cb)(void), unsigned char port, unsigned char pin)
- * labs(long x)
- * fabsf(float x)
- * min(int a, int b)
- */
-#if defined MOTION_DRIVER_TARGET_MSP430
-#include "msp430.h"
-#include "msp430_i2c.h"
-#include "msp430_clock.h"
-#include "msp430_interrupt.h"
-#define i2c_write   msp430_i2c_write
-#define i2c_read    msp430_i2c_read
-#define delay_ms    msp430_delay_ms
-#define get_ms      msp430_get_clock_ms
-static inline int reg_int_cb(struct int_param_s *int_param)
-{
-    return msp430_reg_int_cb(int_param->cb, int_param->pin, int_param->lp_exit,
-        int_param->active_low);
-}
-#define log_i(...)     do {} while (0)
-#define log_e(...)     do {} while (0)
-/* labs is already defined by TI's toolchain. */
-/* fabs is for doubles. fabsf is for floats. */
-#define fabs        fabsf
-#define min(a,b) ((a<b)?a:b)
-#elif defined EMPL_TARGET_MSP430
-#include "msp430.h"
-#include "msp430_i2c.h"
-#include "msp430_clock.h"
-#include "msp430_interrupt.h"
-#include "log.h"
-#define i2c_write   msp430_i2c_write
-#define i2c_read    msp430_i2c_read
-#define delay_ms    msp430_delay_ms
-#define get_ms      msp430_get_clock_ms
-static inline int reg_int_cb(struct int_param_s *int_param)
-{
-    return msp430_reg_int_cb(int_param->cb, int_param->pin, int_param->lp_exit,
-        int_param->active_low);
-}
-#define log_i       MPL_LOGI
-#define log_e       MPL_LOGE
-/* labs is already defined by TI's toolchain. */
-/* fabs is for doubles. fabsf is for floats. */
-#define fabs        fabsf
-#define min(a,b) ((a<b)?a:b)
-#elif defined EMPL_TARGET_UC3L0
-/* Instead of using the standard TWI driver from the ASF library, we're using
- * a TWI driver that follows the slave address + register address convention.
- */
-#include "twi.h"
-#include "delay.h"
-#include "sysclk.h"
-#include "log.h"
-#include "sensors_xplained.h"
-#include "uc3l0_clock.h"
-#define i2c_write(a, b, c, d)   twi_write(a, b, d, c)
-#define i2c_read(a, b, c, d)    twi_read(a, b, d, c)
-/* delay_ms is a function already defined in ASF. */
-#define get_ms  uc3l0_get_clock_ms
-static inline int reg_int_cb(struct int_param_s *int_param)
-{
-    sensor_board_irq_connect(int_param->pin, int_param->cb, int_param->arg);
-    return 0;
-}
-#define log_i       MPL_LOGI
-#define log_e       MPL_LOGE
-/* UC3 is a 32-bit processor, so abs and labs are equivalent. */
-#define labs        abs
-#define fabs(x)     (((x)>0)?(x):-(x))
-#elif defined MOTION_DRIVER_TARGET_STM32
-
-/* The following functions must be defined for this platform:
- * i2c_write(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char const *data)
- * i2c_read(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char *data)
- * delay_ms(unsigned long num_ms)
- * get_ms(unsigned long *count)
- * reg_int_cb(void (*cb)(void), unsigned char port, unsigned char pin)
- * labs(long x)
- * fabsf(float x)
- * min(int a, int b)
- */
-
-#define i2c_write   IIC_Write_Len
-#define i2c_read    IIC_Read_Len
-#define delay_ms    HAL_Delay
-#define get_ms      get_tick_count
-//static inline int reg_int_cb(struct int_param_s *int_param)
-//{
-////    return msp430_reg_int_cb(int_param->cb, int_param->pin, int_param->lp_exit,
-////        int_param->active_low);
-//}
-//#define log_i(...)     do {} while (0)
-//#define log_e(...)     do {} while (0)
-
-#define log_i     printf
-#define log_e     printf
-
-/* labs is already defined by TI's toolchain. */
-/* fabs is for doubles. fabsf is for floats. */
-#define fabs        fabsf
-#define min(a,b) ((a<b)?a:b)
-
-#else
-#error  Gyro driver is missing the system layer implementations.
-#endif
-
-#if !defined MPU6050 && !defined MPU9150 && !defined MPU6500 && !defined MPU9250
-#error  Which gyro are you using? Define MPUxxxx in your compiler options.
-#endif
-
-/* Time for some messy macro work. =]
- * #define MPU9150
- * is equivalent to..
- * #define MPU6050
- * #define AK8975_SECONDARY
- *
- * #define MPU9250
- * is equivalent to..
- * #define MPU6500
- * #define AK8963_SECONDARY
- */
-#if defined MPU9150
-#ifndef MPU6050
-#define MPU6050
-#endif                          /* #ifndef MPU6050 */
-#if defined AK8963_SECONDARY
-#error "MPU9150 and AK8963_SECONDARY cannot both be defined."
-#elif !defined AK8975_SECONDARY /* #if defined AK8963_SECONDARY */
-#define AK8975_SECONDARY
-#endif                          /* #if defined AK8963_SECONDARY */
-#elif defined MPU9250           /* #if defined MPU9150 */
-#ifndef MPU6500
-#define MPU6500
-#endif                          /* #ifndef MPU6500 */
-#if defined AK8975_SECONDARY
-#error "MPU9250 and AK8975_SECONDARY cannot both be defined."
-#elif !defined AK8963_SECONDARY /* #if defined AK8975_SECONDARY */
-#define AK8963_SECONDARY
-#endif                          /* #if defined AK8975_SECONDARY */
-#endif                          /* #if defined MPU9150 */
-
-#if defined AK8975_SECONDARY || defined AK8963_SECONDARY
-#define AK89xx_SECONDARY
-#else
-/* #warning "No compass = less profit for Invensense. Lame." */
-#endif
-
-static int set_int_enable(unsigned char enable);
-
-/* Hardware registers needed by driver. */
-struct gyro_reg_s {
-    unsigned char who_am_i;
-    unsigned char rate_div;
-    unsigned char lpf;
-    unsigned char prod_id;
-    unsigned char user_ctrl;
-    unsigned char fifo_en;
-    unsigned char gyro_cfg;
-    unsigned char accel_cfg;
-    unsigned char accel_cfg2;
-    unsigned char lp_accel_odr;
-    unsigned char motion_thr;
-    unsigned char motion_dur;
-    unsigned char fifo_count_h;
-    unsigned char fifo_r_w;
-    unsigned char raw_gyro;
-    unsigned char raw_accel;
-    unsigned char temp;
-    unsigned char int_enable;
-    unsigned char dmp_int_status;
-    unsigned char int_status;
-    unsigned char accel_intel;
-    unsigned char pwr_mgmt_1;
-    unsigned char pwr_mgmt_2;
-    unsigned char int_pin_cfg;
-    unsigned char mem_r_w;
-    unsigned char accel_offs;
-    unsigned char i2c_mst;
-    unsigned char bank_sel;
-    unsigned char mem_start_addr;
-    unsigned char prgm_start_h;
-#if defined AK89xx_SECONDARY
-    unsigned char s0_addr;
-    unsigned char s0_reg;
-    unsigned char s0_ctrl;
-    unsigned char s1_addr;
-    unsigned char s1_reg;
-    unsigned char s1_ctrl;
-    unsigned char s4_ctrl;
-    unsigned char s0_do;
-    unsigned char s1_do;
-    unsigned char i2c_delay_ctrl;
-    unsigned char raw_compass;
-    /* The I2C_MST_VDDIO bit is in this register. */
-    unsigned char yg_offs_tc;
-#endif
-};
-
-/* Information specific to a particular device. */
-struct hw_s {
-    unsigned char addr;
-    unsigned short max_fifo;
-    unsigned char num_reg;
-    unsigned short temp_sens;
-    short temp_offset;
-    unsigned short bank_size;
-#if defined AK89xx_SECONDARY
-    unsigned short compass_fsr;
-#endif
-};
-
-/* When entering motion interrupt mode, the driver keeps track of the
- * previous state so that it can be restored at a later time.
- * TODO: This is tacky. Fix it.
- */
-struct motion_int_cache_s {
-    unsigned short gyro_fsr;
-    unsigned char accel_fsr;
-    unsigned short lpf;
-    unsigned short sample_rate;
-    unsigned char sensors_on;
-    unsigned char fifo_sensors;
-    unsigned char dmp_on;
-};
-
-/* Cached chip configuration data.
- * TODO: A lot of these can be handled with a bitmask.
- */
-struct chip_cfg_s {
-    /* Matches gyro_cfg >> 3 & 0x03 */
-    unsigned char gyro_fsr;
-    /* Matches accel_cfg >> 3 & 0x03 */
-    unsigned char accel_fsr;
-    /* Enabled sensors. Uses same masks as fifo_en, NOT pwr_mgmt_2. */
-    unsigned char sensors;
-    /* Matches config register. */
-    unsigned char lpf;
-    unsigned char clk_src;
-    /* Sample rate, NOT rate divider. */
-    unsigned short sample_rate;
-    /* Matches fifo_en register. */
-    unsigned char fifo_enable;
-    /* Matches int enable register. */
-    unsigned char int_enable;
-    /* 1 if devices on auxiliary I2C bus appear on the primary. */
-    unsigned char bypass_mode;
-    /* 1 if half-sensitivity.
-     * NOTE: This doesn't belong here, but everything else in hw_s is const,
-     * and this allows us to save some precious RAM.
-     */
-    unsigned char accel_half;
-    /* 1 if device in low-power accel-only mode. */
-    unsigned char lp_accel_mode;
-    /* 1 if interrupts are only triggered on motion events. */
-    unsigned char int_motion_only;
-    struct motion_int_cache_s cache;
-    /* 1 for active low interrupts. */
-    unsigned char active_low_int;
-    /* 1 for latched interrupts. */
-    unsigned char latched_int;
-    /* 1 if DMP is enabled. */
-    unsigned char dmp_on;
-    /* Ensures that DMP will only be loaded once. */
-    unsigned char dmp_loaded;
-    /* Sampling rate used when DMP is enabled. */
-    unsigned short dmp_sample_rate;
-#ifdef AK89xx_SECONDARY
-    /* Compass sample rate. */
-    unsigned short compass_sample_rate;
-    unsigned char compass_addr;
-    short mag_sens_adj[3];
-#endif
-};
-
-/* Information for self-test. */
-struct test_s {
-    unsigned long gyro_sens;
-    unsigned long accel_sens;
-    unsigned char reg_rate_div;
-    unsigned char reg_lpf;
-    unsigned char reg_gyro_fsr;
-    unsigned char reg_accel_fsr;
-    unsigned short wait_ms;
-    unsigned char packet_thresh;
-    float min_dps;
-    float max_dps;
-    float max_gyro_var;
-    float min_g;
-    float max_g;
-    float max_accel_var;
-};
-
-/* Gyro driver state variables. */
-struct gyro_state_s {
-    const struct gyro_reg_s *reg;
-    const struct hw_s *hw;
-    struct chip_cfg_s chip_cfg;
-    const struct test_s *test;
-};
-
-/* Filter configurations. */
-enum lpf_e {
-    INV_FILTER_256HZ_NOLPF2 = 0,
-    INV_FILTER_188HZ,
-    INV_FILTER_98HZ,
-    INV_FILTER_42HZ,
-    INV_FILTER_20HZ,
-    INV_FILTER_10HZ,
-    INV_FILTER_5HZ,
-    INV_FILTER_2100HZ_NOLPF,
-    NUM_FILTER
-};
-
-/* Full scale ranges. */
-enum gyro_fsr_e {
-    INV_FSR_250DPS = 0,
-    INV_FSR_500DPS,
-    INV_FSR_1000DPS,
-    INV_FSR_2000DPS,
-    NUM_GYRO_FSR
-};
-
-/* Full scale ranges. */
-enum accel_fsr_e {
-    INV_FSR_2G = 0,
-    INV_FSR_4G,
-    INV_FSR_8G,
-    INV_FSR_16G,
-    NUM_ACCEL_FSR
-};
-
-/* Clock sources. */
-enum clock_sel_e {
-    INV_CLK_INTERNAL = 0,
-    INV_CLK_PLL,
-    NUM_CLK
-};
-
-/* Low-power accel wakeup rates. */
-enum lp_accel_rate_e {
-#if defined MPU6050
-    INV_LPA_1_25HZ,
-    INV_LPA_5HZ,
-    INV_LPA_20HZ,
-    INV_LPA_40HZ
-#elif defined MPU6500
-    INV_LPA_0_3125HZ,
-    INV_LPA_0_625HZ,
-    INV_LPA_1_25HZ,
-    INV_LPA_2_5HZ,
-    INV_LPA_5HZ,
-    INV_LPA_10HZ,
-    INV_LPA_20HZ,
-    INV_LPA_40HZ,
-    INV_LPA_80HZ,
-    INV_LPA_160HZ,
-    INV_LPA_320HZ,
-    INV_LPA_640HZ
-#endif
-};
-
-#define BIT_I2C_MST_VDDIO   (0x80)
-#define BIT_FIFO_EN         (0x40)
-#define BIT_DMP_EN          (0x80)
-#define BIT_FIFO_RST        (0x04)
-#define BIT_DMP_RST         (0x08)
-#define BIT_FIFO_OVERFLOW   (0x10)
-#define BIT_DATA_RDY_EN     (0x01)
-#define BIT_DMP_INT_EN      (0x02)
-#define BIT_MOT_INT_EN      (0x40)
-#define BITS_FSR            (0x18)
-#define BITS_LPF            (0x07)
-#define BITS_HPF            (0x07)
-#define BITS_CLK            (0x07)
-#define BIT_FIFO_SIZE_1024  (0x40)
-#define BIT_FIFO_SIZE_2048  (0x80)
-#define BIT_FIFO_SIZE_4096  (0xC0)
-#define BIT_RESET           (0x80)
-#define BIT_SLEEP           (0x40)
-#define BIT_S0_DELAY_EN     (0x01)
-#define BIT_S2_DELAY_EN     (0x04)
-#define BITS_SLAVE_LENGTH   (0x0F)
-#define BIT_SLAVE_BYTE_SW   (0x40)
-#define BIT_SLAVE_GROUP     (0x10)
-#define BIT_SLAVE_EN        (0x80)
-#define BIT_I2C_READ        (0x80)
-#define BITS_I2C_MASTER_DLY (0x1F)
-#define BIT_AUX_IF_EN       (0x20)
-#define BIT_ACTL            (0x80)
-#define BIT_LATCH_EN        (0x20)
-#define BIT_ANY_RD_CLR      (0x10)
-#define BIT_BYPASS_EN       (0x02)
-#define BITS_WOM_EN         (0xC0)
-#define BIT_LPA_CYCLE       (0x20)
-#define BIT_STBY_XA         (0x20)
-#define BIT_STBY_YA         (0x10)
-#define BIT_STBY_ZA         (0x08)
-#define BIT_STBY_XG         (0x04)
-#define BIT_STBY_YG         (0x02)
-#define BIT_STBY_ZG         (0x01)
-#define BIT_STBY_XYZA       (BIT_STBY_XA | BIT_STBY_YA | BIT_STBY_ZA)
-#define BIT_STBY_XYZG       (BIT_STBY_XG | BIT_STBY_YG | BIT_STBY_ZG)
-
-#if defined AK8975_SECONDARY
-#define SUPPORTS_AK89xx_HIGH_SENS   (0x00)
-#define AK89xx_FSR                  (9830)
-#elif defined AK8963_SECONDARY
-#define SUPPORTS_AK89xx_HIGH_SENS   (0x10)
-#define AK89xx_FSR                  (4915)
-#endif
-
-#ifdef AK89xx_SECONDARY
-#define AKM_REG_WHOAMI      (0x00)
-
-#define AKM_REG_ST1         (0x02)
-#define AKM_REG_HXL         (0x03)
-#define AKM_REG_ST2         (0x09)
-
-#define AKM_REG_CNTL        (0x0A)
-#define AKM_REG_ASTC        (0x0C)
-#define AKM_REG_ASAX        (0x10)
-#define AKM_REG_ASAY        (0x11)
-#define AKM_REG_ASAZ        (0x12)
-
-#define AKM_DATA_READY      (0x01)
-#define AKM_DATA_OVERRUN    (0x02)
-#define AKM_OVERFLOW        (0x80)
-#define AKM_DATA_ERROR      (0x40)
-
-#define AKM_BIT_SELF_TEST   (0x40)
-
-#define AKM_POWER_DOWN          (0x00 | SUPPORTS_AK89xx_HIGH_SENS)
-#define AKM_SINGLE_MEASUREMENT  (0x01 | SUPPORTS_AK89xx_HIGH_SENS)
-#define AKM_FUSE_ROM_ACCESS     (0x0F | SUPPORTS_AK89xx_HIGH_SENS)
-#define AKM_MODE_SELF_TEST      (0x08 | SUPPORTS_AK89xx_HIGH_SENS)
-
-#define AKM_WHOAMI      (0x48)
-#endif
-
-#if defined MPU6050
-const struct gyro_reg_s reg = {
-    .who_am_i       = 0x75,
-    .rate_div       = 0x19,
-    .lpf            = 0x1A,
-    .prod_id        = 0x0C,
-    .user_ctrl      = 0x6A,
-    .fifo_en        = 0x23,
-    .gyro_cfg       = 0x1B,
-    .accel_cfg      = 0x1C,
-    .motion_thr     = 0x1F,
-    .motion_dur     = 0x20,
-    .fifo_count_h   = 0x72,
-    .fifo_r_w       = 0x74,
-    .raw_gyro       = 0x43,
-    .raw_accel      = 0x3B,
-    .temp           = 0x41,
-    .int_enable     = 0x38,
-    .dmp_int_status = 0x39,
-    .int_status     = 0x3A,
-    .pwr_mgmt_1     = 0x6B,
-    .pwr_mgmt_2     = 0x6C,
-    .int_pin_cfg    = 0x37,
-    .mem_r_w        = 0x6F,
-    .accel_offs     = 0x06,
-    .i2c_mst        = 0x24,
-    .bank_sel       = 0x6D,
-    .mem_start_addr = 0x6E,
-    .prgm_start_h   = 0x70
-#ifdef AK89xx_SECONDARY
-    ,.raw_compass   = 0x49,
-    .yg_offs_tc     = 0x01,
-    .s0_addr        = 0x25,
-    .s0_reg         = 0x26,
-    .s0_ctrl        = 0x27,
-    .s1_addr        = 0x28,
-    .s1_reg         = 0x29,
-    .s1_ctrl        = 0x2A,
-    .s4_ctrl        = 0x34,
-    .s0_do          = 0x63,
-    .s1_do          = 0x64,
-    .i2c_delay_ctrl = 0x67
-#endif
-};
-const struct hw_s hw = {
-    .addr           = 0x68,
-    .max_fifo       = 1024,
-    .num_reg        = 118,
-    .temp_sens      = 340,
-    .temp_offset    = -521,
-    .bank_size      = 256
-#if defined AK89xx_SECONDARY
-    ,.compass_fsr    = AK89xx_FSR
-#endif
-};
-
-const struct test_s test = {
-    .gyro_sens      = 32768/250,
-    .accel_sens     = 32768/16,
-    .reg_rate_div   = 0,    /* 1kHz. */
-    .reg_lpf        = 1,    /* 188Hz. */
-    .reg_gyro_fsr   = 0,    /* 250dps. */
-    .reg_accel_fsr  = 0x18, /* 16g. */
-    .wait_ms        = 50,
-    .packet_thresh  = 5,    /* 5% */
-    .min_dps        = 10.f,
-    .max_dps        = 105.f,
-    .max_gyro_var   = 0.14f,
-    .min_g          = 0.3f,
-    .max_g          = 0.95f,
-    .max_accel_var  = 0.14f
-};
-
-static struct gyro_state_s st = {
-    .reg = &reg,
-    .hw = &hw,
-    .test = &test
-};
-#elif defined MPU6500
-const struct gyro_reg_s reg = {
-    .who_am_i       = 0x75,
-    .rate_div       = 0x19,
-    .lpf            = 0x1A,
-    .prod_id        = 0x0C,
-    .user_ctrl      = 0x6A,
-    .fifo_en        = 0x23,
-    .gyro_cfg       = 0x1B,
-    .accel_cfg      = 0x1C,
-    .accel_cfg2     = 0x1D,
-    .lp_accel_odr   = 0x1E,
-    .motion_thr     = 0x1F,
-    .motion_dur     = 0x20,
-    .fifo_count_h   = 0x72,
-    .fifo_r_w       = 0x74,
-    .raw_gyro       = 0x43,
-    .raw_accel      = 0x3B,
-    .temp           = 0x41,
-    .int_enable     = 0x38,
-    .dmp_int_status = 0x39,
-    .int_status     = 0x3A,
-    .accel_intel    = 0x69,
-    .pwr_mgmt_1     = 0x6B,
-    .pwr_mgmt_2     = 0x6C,
-    .int_pin_cfg    = 0x37,
-    .mem_r_w        = 0x6F,
-    .accel_offs     = 0x77,
-    .i2c_mst        = 0x24,
-    .bank_sel       = 0x6D,
-    .mem_start_addr = 0x6E,
-    .prgm_start_h   = 0x70
-#ifdef AK89xx_SECONDARY
-    ,.raw_compass   = 0x49,
-    .s0_addr        = 0x25,
-    .s0_reg         = 0x26,
-    .s0_ctrl        = 0x27,
-    .s1_addr        = 0x28,
-    .s1_reg         = 0x29,
-    .s1_ctrl        = 0x2A,
-    .s4_ctrl        = 0x34,
-    .s0_do          = 0x63,
-    .s1_do          = 0x64,
-    .i2c_delay_ctrl = 0x67
-#endif
-};
-const struct hw_s hw = {
-    .addr           = 0x68,
-    .max_fifo       = 1024,
-    .num_reg        = 128,
-    .temp_sens      = 321,
-    .temp_offset    = 0,
-    .bank_size      = 256
-#if defined AK89xx_SECONDARY
-    ,.compass_fsr    = AK89xx_FSR
-#endif
-};
-
-const struct test_s test = {
-    .gyro_sens      = 32768/250,
-    .accel_sens     = 32768/16,
-    .reg_rate_div   = 0,    /* 1kHz. */
-    .reg_lpf        = 1,    /* 188Hz. */
-    .reg_gyro_fsr   = 0,    /* 250dps. */
-    .reg_accel_fsr  = 0x18, /* 16g. */
-    .wait_ms        = 50,
-    .packet_thresh  = 5,    /* 5% */
-    .min_dps        = 10.f,
-    .max_dps        = 105.f,
-    .max_gyro_var   = 0.14f,
-    .min_g          = 0.3f,
-    .max_g          = 0.95f,
-    .max_accel_var  = 0.14f
-};
-
-static struct gyro_state_s st = {
-    .reg = &reg,
-    .hw = &hw,
-    .test = &test
-};
-#endif
-
-#define MAX_PACKET_LENGTH (12)
-
-#ifdef AK89xx_SECONDARY
-static int setup_compass(void);
-#define MAX_COMPASS_SAMPLE_RATE (100)
-#endif
-
-/**
- *  @brief      Enable/disable data ready interrupt.
- *  If the DMP is on, the DMP interrupt is enabled. Otherwise, the data ready
- *  interrupt is used.
- *  @param[in]  enable      1 to enable interrupt.
- *  @return     0 if successful.
- */
-static int set_int_enable(unsigned char enable)
-{
-    unsigned char tmp;
-
-    if (st.chip_cfg.dmp_on) {
-        if (enable)
-            tmp = BIT_DMP_INT_EN;
-        else
-            tmp = 0x00;
-        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &tmp))
-            return -1;
-        st.chip_cfg.int_enable = tmp;
-    } else {
-        if (!st.chip_cfg.sensors)
-            return -1;
-        if (enable && st.chip_cfg.int_enable)
-            return 0;
-        if (enable)
-            tmp = BIT_DATA_RDY_EN;
-        else
-            tmp = 0x00;
-        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &tmp))
-            return -1;
-        st.chip_cfg.int_enable = tmp;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Register dump for testing.
- *  @return     0 if successful.
- */
-int mpu_reg_dump(void)
-{
-    unsigned char ii;
-    unsigned char data;
-
-    for (ii = 0; ii < st.hw->num_reg; ii++) {
-        if (ii == st.reg->fifo_r_w || ii == st.reg->mem_r_w)
-            continue;
-        if (i2c_read(st.hw->addr, ii, 1, &data))
-            return -1;
-        log_i("%#5x: %#5x\r\n", ii, data);
-    }
-    return 0;
-}
-
-/**
- *  @brief      Read from a single register.
- *  NOTE: The memory and FIFO read/write registers cannot be accessed.
- *  @param[in]  reg     Register address.
- *  @param[out] data    Register data.
- *  @return     0 if successful.
- */
-int mpu_read_reg(unsigned char reg, unsigned char *data)
-{
-    if (reg == st.reg->fifo_r_w || reg == st.reg->mem_r_w)
-        return -1;
-    if (reg >= st.hw->num_reg)
-        return -1;
-    return i2c_read(st.hw->addr, reg, 1, data);
-}
-
-/**
- *  @brief      Initialize hardware.
- *  Initial configuration:\n
- *  Gyro FSR: +/- 2000DPS\n
- *  Accel FSR +/- 2G\n
- *  DLPF: 42Hz\n
- *  FIFO rate: 50Hz\n
- *  Clock source: Gyro PLL\n
- *  FIFO: Disabled.\n
- *  Data ready interrupt: Disabled, active low, unlatched.
- *  @param[in]  int_param   Platform-specific parameters to interrupt API.
- *  @return     0 if successful.
- */
-int mpu_init(struct int_param_s *int_param)
-{
-    unsigned char data[6], rev;
-
-    /* Reset device. */
-    data[0] = BIT_RESET;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, data))
-        return -1;
-    delay_ms(100);
-
-    /* Wake up chip. */
-    data[0] = 0x00;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, data))
-        return -1;
-
-#if defined MPU6050
-    /* Check product revision. */
-    if (i2c_read(st.hw->addr, st.reg->accel_offs, 6, data))
-        return -1;
-    rev = ((data[5] & 0x01) << 2) | ((data[3] & 0x01) << 1) |
-        (data[1] & 0x01);
-
-    if (rev) {
-        /* Congrats, these parts are better. */
-        if (rev == 1)
-            st.chip_cfg.accel_half = 1;
-        else if (rev == 2)
-            st.chip_cfg.accel_half = 0;
-        else {
-            log_e("Unsupported software product rev %d.\n", rev);
-            return -1;
-        }
-    } else {
-        if (i2c_read(st.hw->addr, st.reg->prod_id, 1, data))
-            return -1;
-        rev = data[0] & 0x0F;
-        if (!rev) {
-            log_e("Product ID read as 0 indicates device is either "
-                "incompatible or an MPU3050.\n");
-            return -1;
-        } else if (rev == 4) {
-            log_i("Half sensitivity part found.\n");
-            st.chip_cfg.accel_half = 1;
-        } else
-            st.chip_cfg.accel_half = 0;
-    }
-#elif defined MPU6500
-#define MPU6500_MEM_REV_ADDR    (0x17)
-    if (mpu_read_mem(MPU6500_MEM_REV_ADDR, 1, &rev))
-        return -1;
-    if (rev == 0x1)
-        st.chip_cfg.accel_half = 0;
-    else {
-        log_e("Unsupported software product rev %d.\n", rev);
-        return -1;
-    }
-
-    /* MPU6500 shares 4kB of memory between the DMP and the FIFO. Since the
-     * first 3kB are needed by the DMP, we'll use the last 1kB for the FIFO.
-     */
-    data[0] = BIT_FIFO_SIZE_1024 | 0x8;
-    if (i2c_write(st.hw->addr, st.reg->accel_cfg2, 1, data))
-        return -1;
-#endif
-
-    /* Set to invalid values to ensure no I2C writes are skipped. */
-    st.chip_cfg.sensors = 0xFF;
-    st.chip_cfg.gyro_fsr = 0xFF;
-    st.chip_cfg.accel_fsr = 0xFF;
-    st.chip_cfg.lpf = 0xFF;
-    st.chip_cfg.sample_rate = 0xFFFF;
-    st.chip_cfg.fifo_enable = 0xFF;
-    st.chip_cfg.bypass_mode = 0xFF;
-#ifdef AK89xx_SECONDARY
-    st.chip_cfg.compass_sample_rate = 0xFFFF;
-#endif
-    /* mpu_set_sensors always preserves this setting. */
-    st.chip_cfg.clk_src = INV_CLK_PLL;
-    /* Handled in next call to mpu_set_bypass. */
-    st.chip_cfg.active_low_int = 1;
-    st.chip_cfg.latched_int = 0;
-    st.chip_cfg.int_motion_only = 0;
-    st.chip_cfg.lp_accel_mode = 0;
-    memset(&st.chip_cfg.cache, 0, sizeof(st.chip_cfg.cache));
-    st.chip_cfg.dmp_on = 0;
-    st.chip_cfg.dmp_loaded = 0;
-    st.chip_cfg.dmp_sample_rate = 0;
-
-    if (mpu_set_gyro_fsr(2000))
-        return -1;
-    if (mpu_set_accel_fsr(2))
-        return -1;
-    if (mpu_set_lpf(42))
-        return -1;
-    if (mpu_set_sample_rate(50))
-        return -1;
-    if (mpu_configure_fifo(0))
-        return -1;
-
-#ifndef MOTION_DRIVER_TARGET_STM32
-    if (int_param)
-        reg_int_cb(int_param);
-#endif
-
-#ifdef AK89xx_SECONDARY
-    setup_compass();
-    if (mpu_set_compass_sample_rate(10))
-        return -1;
-#else
-    /* Already disabled by setup_compass. */
-    if (mpu_set_bypass(0))
-        return -1;
-#endif
-
-    mpu_set_sensors(0);
-    return 0;
-}
-
-/**
- *  @brief      Enter low-power accel-only mode.
- *  In low-power accel mode, the chip goes to sleep and only wakes up to sample
- *  the accelerometer at one of the following frequencies:
- *  \n MPU6050: 1.25Hz, 5Hz, 20Hz, 40Hz
- *  \n MPU6500: 1.25Hz, 2.5Hz, 5Hz, 10Hz, 20Hz, 40Hz, 80Hz, 160Hz, 320Hz, 640Hz
- *  \n If the requested rate is not one listed above, the device will be set to
- *  the next highest rate. Requesting a rate above the maximum supported
- *  frequency will result in an error.
- *  \n To select a fractional wake-up frequency, round down the value passed to
- *  @e rate.
- *  @param[in]  rate        Minimum sampling rate, or zero to disable LP
- *                          accel mode.
- *  @return     0 if successful.
- */
-int mpu_lp_accel_mode(unsigned char rate)
-{
-    unsigned char tmp[2];
-
-    if (rate > 40)
-        return -1;
-
-    if (!rate) {
-        mpu_set_int_latched(0);
-        tmp[0] = 0;
-        tmp[1] = BIT_STBY_XYZG;
-        if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 2, tmp))
-            return -1;
-        st.chip_cfg.lp_accel_mode = 0;
-        return 0;
-    }
-    /* For LP accel, we automatically configure the hardware to produce latched
-     * interrupts. In LP accel mode, the hardware cycles into sleep mode before
-     * it gets a chance to deassert the interrupt pin; therefore, we shift this
-     * responsibility over to the MCU.
-     *
-     * Any register read will clear the interrupt.
-     */
-    mpu_set_int_latched(1);
-#if defined MPU6050
-    tmp[0] = BIT_LPA_CYCLE;
-    if (rate == 1) {
-        tmp[1] = INV_LPA_1_25HZ;
-        mpu_set_lpf(5);
-    } else if (rate <= 5) {
-        tmp[1] = INV_LPA_5HZ;
-        mpu_set_lpf(5);
-    } else if (rate <= 20) {
-        tmp[1] = INV_LPA_20HZ;
-        mpu_set_lpf(10);
-    } else {
-        tmp[1] = INV_LPA_40HZ;
-        mpu_set_lpf(20);
-    }
-    tmp[1] = (tmp[1] << 6) | BIT_STBY_XYZG;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 2, tmp))
-        return -1;
-#elif defined MPU6500
-    /* Set wake frequency. */
-    if (rate == 1)
-        tmp[0] = INV_LPA_1_25HZ;
-    else if (rate == 2)
-        tmp[0] = INV_LPA_2_5HZ;
-    else if (rate <= 5)
-        tmp[0] = INV_LPA_5HZ;
-    else if (rate <= 10)
-        tmp[0] = INV_LPA_10HZ;
-    else if (rate <= 20)
-        tmp[0] = INV_LPA_20HZ;
-    else if (rate <= 40)
-        tmp[0] = INV_LPA_40HZ;
-    else if (rate <= 80)
-        tmp[0] = INV_LPA_80HZ;
-    else if (rate <= 160)
-        tmp[0] = INV_LPA_160HZ;
-    else if (rate <= 320)
-        tmp[0] = INV_LPA_320HZ;
-    else
-        tmp[0] = INV_LPA_640HZ;
-    if (i2c_write(st.hw->addr, st.reg->lp_accel_odr, 1, tmp))
-        return -1;
-    tmp[0] = BIT_LPA_CYCLE;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, tmp))
-        return -1;
-#endif
-    st.chip_cfg.sensors = INV_XYZ_ACCEL;
-    st.chip_cfg.clk_src = 0;
-    st.chip_cfg.lp_accel_mode = 1;
-    mpu_configure_fifo(0);
-
-    return 0;
-}
-
-/**
- *  @brief      Read raw gyro data directly from the registers.
- *  @param[out] data        Raw data in hardware units.
- *  @param[out] timestamp   Timestamp in milliseconds. Null if not needed.
- *  @return     0 if successful.
- */
-int mpu_get_gyro_reg(short *data, unsigned long *timestamp)
-{
-    unsigned char tmp[6];
-
-    if (!(st.chip_cfg.sensors & INV_XYZ_GYRO))
-        return -1;
-
-    if (i2c_read(st.hw->addr, st.reg->raw_gyro, 6, tmp))
-        return -1;
-    data[0] = (tmp[0] << 8) | tmp[1];
-    data[1] = (tmp[2] << 8) | tmp[3];
-    data[2] = (tmp[4] << 8) | tmp[5];
-    if (timestamp)
-        get_ms(timestamp);
-    return 0;
-}
-
-/**
- *  @brief      Read raw accel data directly from the registers.
- *  @param[out] data        Raw data in hardware units.
- *  @param[out] timestamp   Timestamp in milliseconds. Null if not needed.
- *  @return     0 if successful.
- */
-int mpu_get_accel_reg(short *data, unsigned long *timestamp)
-{
-    unsigned char tmp[6];
-
-    if (!(st.chip_cfg.sensors & INV_XYZ_ACCEL))
-        return -1;
-
-    if (i2c_read(st.hw->addr, st.reg->raw_accel, 6, tmp))
-        return -1;
-    data[0] = (tmp[0] << 8) | tmp[1];
-    data[1] = (tmp[2] << 8) | tmp[3];
-    data[2] = (tmp[4] << 8) | tmp[5];
-    if (timestamp)
-        get_ms(timestamp);
-    return 0;
-}
-
-/**
- *  @brief      Read temperature data directly from the registers.
- *  @param[out] data        Data in q16 format.
- *  @param[out] timestamp   Timestamp in milliseconds. Null if not needed.
- *  @return     0 if successful.
- */
-int mpu_get_temperature(long *data, unsigned long *timestamp)
-{
-    unsigned char tmp[2];
-    short raw;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    if (i2c_read(st.hw->addr, st.reg->temp, 2, tmp))
-        return -1;
-    raw = (tmp[0] << 8) | tmp[1];
-    if (timestamp)
-        get_ms(timestamp);
-
-    data[0] = (long)((35 + ((raw - (float)st.hw->temp_offset) / st.hw->temp_sens)) * 65536L);
-    return 0;
-}
-
-/**
- *  @brief      Push biases to the accel bias registers.
- *  This function expects biases relative to the current sensor output, and
- *  these biases will be added to the factory-supplied values.
- *  @param[in]  accel_bias  New biases.
- *  @return     0 if successful.
- */
-int mpu_set_accel_bias(const long *accel_bias)
-{
-    unsigned char data[6];
-    short accel_hw[3];
-    short got_accel[3];
-    short fg[3];
-
-    if (!accel_bias)
-        return -1;
-    if (!accel_bias[0] && !accel_bias[1] && !accel_bias[2])
-        return 0;
-
-    if (i2c_read(st.hw->addr, 3, 3, data))
-        return -1;
-    fg[0] = ((data[0] >> 4) + 8) & 0xf;
-    fg[1] = ((data[1] >> 4) + 8) & 0xf;
-    fg[2] = ((data[2] >> 4) + 8) & 0xf;
-
-    accel_hw[0] = (short)(accel_bias[0] * 2 / (64 + fg[0]));
-    accel_hw[1] = (short)(accel_bias[1] * 2 / (64 + fg[1]));
-    accel_hw[2] = (short)(accel_bias[2] * 2 / (64 + fg[2]));
-
-    if (i2c_read(st.hw->addr, 0x06, 6, data))
-        return -1;
-
-    got_accel[0] = ((short)data[0] << 8) | data[1];
-    got_accel[1] = ((short)data[2] << 8) | data[3];
-    got_accel[2] = ((short)data[4] << 8) | data[5];
-
-    accel_hw[0] += got_accel[0];
-    accel_hw[1] += got_accel[1];
-    accel_hw[2] += got_accel[2];
-
-    data[0] = (accel_hw[0] >> 8) & 0xff;
-    data[1] = (accel_hw[0]) & 0xff;
-    data[2] = (accel_hw[1] >> 8) & 0xff;
-    data[3] = (accel_hw[1]) & 0xff;
-    data[4] = (accel_hw[2] >> 8) & 0xff;
-    data[5] = (accel_hw[2]) & 0xff;
-
-    if (i2c_write(st.hw->addr, 0x06, 6, data))
-        return -1;
-    return 0;
-}
-
-/**
- *  @brief  Reset FIFO read/write pointers.
- *  @return 0 if successful.
- */
-int mpu_reset_fifo(void)
-{
-    unsigned char data;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    data = 0;
-    if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, &data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
-        return -1;
-
-    if (st.chip_cfg.dmp_on) {
-        data = BIT_FIFO_RST | BIT_DMP_RST;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
-            return -1;
-        delay_ms(50);
-        data = BIT_DMP_EN | BIT_FIFO_EN;
-        if (st.chip_cfg.sensors & INV_XYZ_COMPASS)
-            data |= BIT_AUX_IF_EN;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
-            return -1;
-        if (st.chip_cfg.int_enable)
-            data = BIT_DMP_INT_EN;
-        else
-            data = 0;
-        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &data))
-            return -1;
-        data = 0;
-        if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, &data))
-            return -1;
-    } else {
-        data = BIT_FIFO_RST;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
-            return -1;
-        if (st.chip_cfg.bypass_mode || !(st.chip_cfg.sensors & INV_XYZ_COMPASS))
-            data = BIT_FIFO_EN;
-        else
-            data = BIT_FIFO_EN | BIT_AUX_IF_EN;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
-            return -1;
-        delay_ms(50);
-        if (st.chip_cfg.int_enable)
-            data = BIT_DATA_RDY_EN;
-        else
-            data = 0;
-        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &data))
-            return -1;
-        if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, &st.chip_cfg.fifo_enable))
-            return -1;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Get the gyro full-scale range.
- *  @param[out] fsr Current full-scale range.
- *  @return     0 if successful.
- */
-int mpu_get_gyro_fsr(unsigned short *fsr)
-{
-    switch (st.chip_cfg.gyro_fsr) {
-    case INV_FSR_250DPS:
-        fsr[0] = 250;
-        break;
-    case INV_FSR_500DPS:
-        fsr[0] = 500;
-        break;
-    case INV_FSR_1000DPS:
-        fsr[0] = 1000;
-        break;
-    case INV_FSR_2000DPS:
-        fsr[0] = 2000;
-        break;
-    default:
-        fsr[0] = 0;
-        break;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Set the gyro full-scale range.
- *  @param[in]  fsr Desired full-scale range.
- *  @return     0 if successful.
- */
-int mpu_set_gyro_fsr(unsigned short fsr)
-{
-    unsigned char data;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    switch (fsr) {
-    case 250:
-        data = INV_FSR_250DPS << 3;
-        break;
-    case 500:
-        data = INV_FSR_500DPS << 3;
-        break;
-    case 1000:
-        data = INV_FSR_1000DPS << 3;
-        break;
-    case 2000:
-        data = INV_FSR_2000DPS << 3;
-        break;
-    default:
-        return -1;
-    }
-
-    if (st.chip_cfg.gyro_fsr == (data >> 3))
-        return 0;
-    if (i2c_write(st.hw->addr, st.reg->gyro_cfg, 1, &data))
-        return -1;
-    st.chip_cfg.gyro_fsr = data >> 3;
-    return 0;
-}
-
-/**
- *  @brief      Get the accel full-scale range.
- *  @param[out] fsr Current full-scale range.
- *  @return     0 if successful.
- */
-int mpu_get_accel_fsr(unsigned char *fsr)
-{
-    switch (st.chip_cfg.accel_fsr) {
-    case INV_FSR_2G:
-        fsr[0] = 2;
-        break;
-    case INV_FSR_4G:
-        fsr[0] = 4;
-        break;
-    case INV_FSR_8G:
-        fsr[0] = 8;
-        break;
-    case INV_FSR_16G:
-        fsr[0] = 16;
-        break;
-    default:
-        return -1;
-    }
-    if (st.chip_cfg.accel_half)
-        fsr[0] <<= 1;
-    return 0;
-}
-
-/**
- *  @brief      Set the accel full-scale range.
- *  @param[in]  fsr Desired full-scale range.
- *  @return     0 if successful.
- */
-int mpu_set_accel_fsr(unsigned char fsr)
-{
-    unsigned char data;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    switch (fsr) {
-    case 2:
-        data = INV_FSR_2G << 3;
-        break;
-    case 4:
-        data = INV_FSR_4G << 3;
-        break;
-    case 8:
-        data = INV_FSR_8G << 3;
-        break;
-    case 16:
-        data = INV_FSR_16G << 3;
-        break;
-    default:
-        return -1;
-    }
-
-    if (st.chip_cfg.accel_fsr == (data >> 3))
-        return 0;
-    if (i2c_write(st.hw->addr, st.reg->accel_cfg, 1, &data))
-        return -1;
-    st.chip_cfg.accel_fsr = data >> 3;
-    return 0;
-}
-
-/**
- *  @brief      Get the current DLPF setting.
- *  @param[out] lpf Current LPF setting.
- *  0 if successful.
- */
-int mpu_get_lpf(unsigned short *lpf)
-{
-    switch (st.chip_cfg.lpf) {
-    case INV_FILTER_188HZ:
-        lpf[0] = 188;
-        break;
-    case INV_FILTER_98HZ:
-        lpf[0] = 98;
-        break;
-    case INV_FILTER_42HZ:
-        lpf[0] = 42;
-        break;
-    case INV_FILTER_20HZ:
-        lpf[0] = 20;
-        break;
-    case INV_FILTER_10HZ:
-        lpf[0] = 10;
-        break;
-    case INV_FILTER_5HZ:
-        lpf[0] = 5;
-        break;
-    case INV_FILTER_256HZ_NOLPF2:
-    case INV_FILTER_2100HZ_NOLPF:
-    default:
-        lpf[0] = 0;
-        break;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Set digital low pass filter.
- *  The following LPF settings are supported: 188, 98, 42, 20, 10, 5.
- *  @param[in]  lpf Desired LPF setting.
- *  @return     0 if successful.
- */
-int mpu_set_lpf(unsigned short lpf)
-{
-    unsigned char data;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    if (lpf >= 188)
-        data = INV_FILTER_188HZ;
-    else if (lpf >= 98)
-        data = INV_FILTER_98HZ;
-    else if (lpf >= 42)
-        data = INV_FILTER_42HZ;
-    else if (lpf >= 20)
-        data = INV_FILTER_20HZ;
-    else if (lpf >= 10)
-        data = INV_FILTER_10HZ;
-    else
-        data = INV_FILTER_5HZ;
-
-    if (st.chip_cfg.lpf == data)
-        return 0;
-    if (i2c_write(st.hw->addr, st.reg->lpf, 1, &data))
-        return -1;
-    st.chip_cfg.lpf = data;
-    return 0;
-}
-
-/**
- *  @brief      Get sampling rate.
- *  @param[out] rate    Current sampling rate (Hz).
- *  @return     0 if successful.
- */
-int mpu_get_sample_rate(unsigned short *rate)
-{
-    if (st.chip_cfg.dmp_on)
-        return -1;
-    else
-        rate[0] = st.chip_cfg.sample_rate;
-
-    return 0;
-}
-
-/**
- *  @brief      Set sampling rate.
- *  Sampling rate must be between 4Hz and 1kHz.
- *  @param[in]  rate    Desired sampling rate (Hz).
- *  @return     0 if successful.
- */
-int mpu_set_sample_rate(unsigned short rate)
-{
-    unsigned char data;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    if (st.chip_cfg.dmp_on)
-        return -1;
-    else {
-        if (st.chip_cfg.lp_accel_mode) {
-            if (rate && (rate <= 40)) {
-                /* Just stay in low-power accel mode. */
-                mpu_lp_accel_mode(rate);
-                return 0;
-            }
-            /* Requested rate exceeds the allowed frequencies in LP accel mode,
-             * switch back to full-power mode.
-             */
-            mpu_lp_accel_mode(0);
-        }
-        if (rate < 4)
-            rate = 4;
-        else if (rate > 1000)
-            rate = 1000;
-
-        data = 1000 / rate - 1;
-        if (i2c_write(st.hw->addr, st.reg->rate_div, 1, &data))
-            return -1;
-
-        st.chip_cfg.sample_rate = 1000 / (1 + data);
-
-#ifdef AK89xx_SECONDARY
-        mpu_set_compass_sample_rate(min(st.chip_cfg.compass_sample_rate, MAX_COMPASS_SAMPLE_RATE));
-#endif
-
-        /* Automatically set LPF to 1/2 sampling rate. */
-        mpu_set_lpf(st.chip_cfg.sample_rate >> 1);
-        return 0;
-    }
-}
-
-/**
- *  @brief      Get compass sampling rate.
- *  @param[out] rate    Current compass sampling rate (Hz).
- *  @return     0 if successful.
- */
-int mpu_get_compass_sample_rate(unsigned short *rate)
-{
-#ifdef AK89xx_SECONDARY
-    rate[0] = st.chip_cfg.compass_sample_rate;
-    return 0;
-#else
-    rate[0] = 0;
-    return -1;
-#endif
-}
-
-/**
- *  @brief      Set compass sampling rate.
- *  The compass on the auxiliary I2C bus is read by the MPU hardware at a
- *  maximum of 100Hz. The actual rate can be set to a fraction of the gyro
- *  sampling rate.
- *
- *  \n WARNING: The new rate may be different than what was requested. Call
- *  mpu_get_compass_sample_rate to check the actual setting.
- *  @param[in]  rate    Desired compass sampling rate (Hz).
- *  @return     0 if successful.
- */
-int mpu_set_compass_sample_rate(unsigned short rate)
-{
-#ifdef AK89xx_SECONDARY
-    unsigned char div;
-    if (!rate || rate > st.chip_cfg.sample_rate || rate > MAX_COMPASS_SAMPLE_RATE)
-        return -1;
-
-    div = st.chip_cfg.sample_rate / rate - 1;
-    if (i2c_write(st.hw->addr, st.reg->s4_ctrl, 1, &div))
-        return -1;
-    st.chip_cfg.compass_sample_rate = st.chip_cfg.sample_rate / (div + 1);
-    return 0;
-#else
-    return -1;
-#endif
-}
-
-/**
- *  @brief      Get gyro sensitivity scale factor.
- *  @param[out] sens    Conversion from hardware units to dps.
- *  @return     0 if successful.
- */
-int mpu_get_gyro_sens(float *sens)
-{
-    switch (st.chip_cfg.gyro_fsr) {
-    case INV_FSR_250DPS:
-        sens[0] = 131.f;
-        break;
-    case INV_FSR_500DPS:
-        sens[0] = 65.5f;
-        break;
-    case INV_FSR_1000DPS:
-        sens[0] = 32.8f;
-        break;
-    case INV_FSR_2000DPS:
-        sens[0] = 16.4f;
-        break;
-    default:
-        return -1;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Get accel sensitivity scale factor.
- *  @param[out] sens    Conversion from hardware units to g's.
- *  @return     0 if successful.
- */
-int mpu_get_accel_sens(unsigned short *sens)
-{
-    switch (st.chip_cfg.accel_fsr) {
-    case INV_FSR_2G:
-        sens[0] = 16384;
-        break;
-    case INV_FSR_4G:
-        sens[0] = 8092;
-        break;
-    case INV_FSR_8G:
-        sens[0] = 4096;
-        break;
-    case INV_FSR_16G:
-        sens[0] = 2048;
-        break;
-    default:
-        return -1;
-    }
-    if (st.chip_cfg.accel_half)
-        sens[0] >>= 1;
-    return 0;
-}
-
-/**
- *  @brief      Get current FIFO configuration.
- *  @e sensors can contain a combination of the following flags:
- *  \n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
- *  \n INV_XYZ_GYRO
- *  \n INV_XYZ_ACCEL
- *  @param[out] sensors Mask of sensors in FIFO.
- *  @return     0 if successful.
- */
-int mpu_get_fifo_config(unsigned char *sensors)
-{
-    sensors[0] = st.chip_cfg.fifo_enable;
-    return 0;
-}
-
-/**
- *  @brief      Select which sensors are pushed to FIFO.
- *  @e sensors can contain a combination of the following flags:
- *  \n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
- *  \n INV_XYZ_GYRO
- *  \n INV_XYZ_ACCEL
- *  @param[in]  sensors Mask of sensors to push to FIFO.
- *  @return     0 if successful.
- */
-int mpu_configure_fifo(unsigned char sensors)
-{
-    unsigned char prev;
-    int result = 0;
-
-    /* Compass data isn't going into the FIFO. Stop trying. */
-    sensors &= ~INV_XYZ_COMPASS;
-
-    if (st.chip_cfg.dmp_on)
-        return 0;
-    else {
-        if (!(st.chip_cfg.sensors))
-            return -1;
-        prev = st.chip_cfg.fifo_enable;
-        st.chip_cfg.fifo_enable = sensors & st.chip_cfg.sensors;
-        if (st.chip_cfg.fifo_enable != sensors)
-            /* You're not getting what you asked for. Some sensors are
-             * asleep.
-             */
-            result = -1;
-        else
-            result = 0;
-        if (sensors || st.chip_cfg.lp_accel_mode)
-            set_int_enable(1);
-        else
-            set_int_enable(0);
-        if (sensors) {
-            if (mpu_reset_fifo()) {
-                st.chip_cfg.fifo_enable = prev;
-                return -1;
-            }
-        }
-    }
-
-    return result;
-}
-
-/**
- *  @brief      Get current power state.
- *  @param[in]  power_on    1 if turned on, 0 if suspended.
- *  @return     0 if successful.
- */
-int mpu_get_power_state(unsigned char *power_on)
-{
-    if (st.chip_cfg.sensors)
-        power_on[0] = 1;
-    else
-        power_on[0] = 0;
-    return 0;
-}
-
-/**
- *  @brief      Turn specific sensors on/off.
- *  @e sensors can contain a combination of the following flags:
- *  \n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
- *  \n INV_XYZ_GYRO
- *  \n INV_XYZ_ACCEL
- *  \n INV_XYZ_COMPASS
- *  @param[in]  sensors    Mask of sensors to wake.
- *  @return     0 if successful.
- */
-int mpu_set_sensors(unsigned char sensors)
-{
-    unsigned char data;
-#ifdef AK89xx_SECONDARY
-    unsigned char user_ctrl;
-#endif
-
-    if (sensors & INV_XYZ_GYRO)
-        data = INV_CLK_PLL;
-    else if (sensors)
-        data = 0;
-    else
-        data = BIT_SLEEP;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, &data)) {
-        st.chip_cfg.sensors = 0;
-        return -1;
-    }
-    st.chip_cfg.clk_src = data & ~BIT_SLEEP;
-
-    data = 0;
-    if (!(sensors & INV_X_GYRO))
-        data |= BIT_STBY_XG;
-    if (!(sensors & INV_Y_GYRO))
-        data |= BIT_STBY_YG;
-    if (!(sensors & INV_Z_GYRO))
-        data |= BIT_STBY_ZG;
-    if (!(sensors & INV_XYZ_ACCEL))
-        data |= BIT_STBY_XYZA;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_2, 1, &data)) {
-        st.chip_cfg.sensors = 0;
-        return -1;
-    }
-
-    if (sensors && (sensors != INV_XYZ_ACCEL))
-        /* Latched interrupts only used in LP accel mode. */
-        mpu_set_int_latched(0);
-
-#ifdef AK89xx_SECONDARY
-#ifdef AK89xx_BYPASS
-    if (sensors & INV_XYZ_COMPASS)
-        mpu_set_bypass(1);
-    else
-        mpu_set_bypass(0);
-#else
-    if (i2c_read(st.hw->addr, st.reg->user_ctrl, 1, &user_ctrl))
-        return -1;
-    /* Handle AKM power management. */
-    if (sensors & INV_XYZ_COMPASS) {
-        data = AKM_SINGLE_MEASUREMENT;
-        user_ctrl |= BIT_AUX_IF_EN;
-    } else {
-        data = AKM_POWER_DOWN;
-        user_ctrl &= ~BIT_AUX_IF_EN;
-    }
-    if (st.chip_cfg.dmp_on)
-        user_ctrl |= BIT_DMP_EN;
-    else
-        user_ctrl &= ~BIT_DMP_EN;
-    if (i2c_write(st.hw->addr, st.reg->s1_do, 1, &data))
-        return -1;
-    /* Enable/disable I2C master mode. */
-    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &user_ctrl))
-        return -1;
-#endif
-#endif
-
-    st.chip_cfg.sensors = sensors;
-    st.chip_cfg.lp_accel_mode = 0;
-    delay_ms(50);
-    return 0;
-}
-
-/**
- *  @brief      Read the MPU interrupt status registers.
- *  @param[out] status  Mask of interrupt bits.
- *  @return     0 if successful.
- */
-int mpu_get_int_status(short *status)
-{
-    unsigned char tmp[2];
-    if (!st.chip_cfg.sensors)
-        return -1;
-    if (i2c_read(st.hw->addr, st.reg->dmp_int_status, 2, tmp))
-        return -1;
-    status[0] = (tmp[0] << 8) | tmp[1];
-    return 0;
-}
-
-/**
- *  @brief      Get one packet from the FIFO.
- *  If @e sensors does not contain a particular sensor, disregard the data
- *  returned to that pointer.
- *  \n @e sensors can contain a combination of the following flags:
- *  \n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
- *  \n INV_XYZ_GYRO
- *  \n INV_XYZ_ACCEL
- *  \n If the FIFO has no new data, @e sensors will be zero.
- *  \n If the FIFO is disabled, @e sensors will be zero and this function will
- *  return a non-zero error code.
- *  @param[out] gyro        Gyro data in hardware units.
- *  @param[out] accel       Accel data in hardware units.
- *  @param[out] timestamp   Timestamp in milliseconds.
- *  @param[out] sensors     Mask of sensors read from FIFO.
- *  @param[out] more        Number of remaining packets.
- *  @return     0 if successful.
- */
-int mpu_read_fifo(short *gyro, short *accel, unsigned long *timestamp,
-        unsigned char *sensors, unsigned char *more)
-{
-    /* Assumes maximum packet size is gyro (6) + accel (6). */
-    unsigned char data[MAX_PACKET_LENGTH];
-    unsigned char packet_size = 0;
-    unsigned short fifo_count, index = 0;
-
-    if (st.chip_cfg.dmp_on)
-        return -1;
-
-    sensors[0] = 0;
-    if (!st.chip_cfg.sensors)
-        return -1;
-    if (!st.chip_cfg.fifo_enable)
-        return -1;
-
-    if (st.chip_cfg.fifo_enable & INV_X_GYRO)
-        packet_size += 2;
-    if (st.chip_cfg.fifo_enable & INV_Y_GYRO)
-        packet_size += 2;
-    if (st.chip_cfg.fifo_enable & INV_Z_GYRO)
-        packet_size += 2;
-    if (st.chip_cfg.fifo_enable & INV_XYZ_ACCEL)
-        packet_size += 6;
-
-    if (i2c_read(st.hw->addr, st.reg->fifo_count_h, 2, data))
-        return -1;
-    fifo_count = (data[0] << 8) | data[1];
-    if (fifo_count < packet_size)
-        return 0;
-//    log_i("FIFO count: %hd\n", fifo_count);
-    if (fifo_count > (st.hw->max_fifo >> 1)) {
-        /* FIFO is 50% full, better check overflow bit. */
-        if (i2c_read(st.hw->addr, st.reg->int_status, 1, data))
-            return -1;
-        if (data[0] & BIT_FIFO_OVERFLOW) {
-            mpu_reset_fifo();
-            return -2;
-        }
-    }
-    get_ms((unsigned long*)timestamp);
-
-    if (i2c_read(st.hw->addr, st.reg->fifo_r_w, packet_size, data))
-        return -1;
-    more[0] = fifo_count / packet_size - 1;
-    sensors[0] = 0;
-
-    if ((index != packet_size) && st.chip_cfg.fifo_enable & INV_XYZ_ACCEL) {
-        accel[0] = (data[index+0] << 8) | data[index+1];
-        accel[1] = (data[index+2] << 8) | data[index+3];
-        accel[2] = (data[index+4] << 8) | data[index+5];
-        sensors[0] |= INV_XYZ_ACCEL;
-        index += 6;
-    }
-    if ((index != packet_size) && st.chip_cfg.fifo_enable & INV_X_GYRO) {
-        gyro[0] = (data[index+0] << 8) | data[index+1];
-        sensors[0] |= INV_X_GYRO;
-        index += 2;
-    }
-    if ((index != packet_size) && st.chip_cfg.fifo_enable & INV_Y_GYRO) {
-        gyro[1] = (data[index+0] << 8) | data[index+1];
-        sensors[0] |= INV_Y_GYRO;
-        index += 2;
-    }
-    if ((index != packet_size) && st.chip_cfg.fifo_enable & INV_Z_GYRO) {
-        gyro[2] = (data[index+0] << 8) | data[index+1];
-        sensors[0] |= INV_Z_GYRO;
-        index += 2;
-    }
-
-    return 0;
-}
-
-/**
- *  @brief      Get one unparsed packet from the FIFO.
- *  This function should be used if the packet is to be parsed elsewhere.
- *  @param[in]  length  Length of one FIFO packet.
- *  @param[in]  data    FIFO packet.
- *  @param[in]  more    Number of remaining packets.
- */
-int mpu_read_fifo_stream(unsigned short length, unsigned char *data,
-    unsigned char *more)
-{
-    unsigned char tmp[2];
-    unsigned short fifo_count;
-
-//    printf("addr %d, dmp_on %d, sensors %d\r\n", st.hw->addr, st.chip_cfg.dmp_on, st.chip_cfg.sensors);
-
-    if (!st.chip_cfg.dmp_on)
-        return -1;
-    if (!st.chip_cfg.sensors)
-        return -1;
-
-//    printf("----1\r\n");
-
-    if (i2c_read(st.hw->addr, st.reg->fifo_count_h, 2, tmp))
-        return -1;
-
-//    printf("----2\r\n");
-
-    fifo_count = (tmp[0] << 8) | tmp[1];
-    if (fifo_count < length) {
-        more[0] = 0;
-        return -1;
-    }
-
-//    printf("----3\r\n");
-    if (fifo_count > (st.hw->max_fifo >> 1)) {
-
-//        printf("----3.1\r\n");
-        /* FIFO is 50% full, better check overflow bit. */
-        if (i2c_read(st.hw->addr, st.reg->int_status, 1, tmp))
-            return -1;
-
-//        printf("----3.2\r\n");
-        if (tmp[0] & BIT_FIFO_OVERFLOW) {
-            mpu_reset_fifo();
-            return -2;
-        }
-    }
-
-//    printf("----4\r\n");
-    if (i2c_read(st.hw->addr, st.reg->fifo_r_w, length, data))
-        return -1;
-
-    more[0] = fifo_count / length - 1;
-    return 0;
-}
-
-/**
- *  @brief      Set device to bypass mode.
- *  @param[in]  bypass_on   1 to enable bypass mode.
- *  @return     0 if successful.
- */
-int mpu_set_bypass(unsigned char bypass_on)
-{
-    unsigned char tmp;
-
-    if (st.chip_cfg.bypass_mode == bypass_on)
-        return 0;
-
-    if (bypass_on) {
-        if (i2c_read(st.hw->addr, st.reg->user_ctrl, 1, &tmp))
-            return -1;
-        tmp &= ~BIT_AUX_IF_EN;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &tmp))
-            return -1;
-        delay_ms(3);
-        tmp = BIT_BYPASS_EN;
-        if (st.chip_cfg.active_low_int)
-            tmp |= BIT_ACTL;
-        if (st.chip_cfg.latched_int)
-            tmp |= BIT_LATCH_EN | BIT_ANY_RD_CLR;
-        if (i2c_write(st.hw->addr, st.reg->int_pin_cfg, 1, &tmp))
-            return -1;
-    } else {
-        /* Enable I2C master mode if compass is being used. */
-        if (i2c_read(st.hw->addr, st.reg->user_ctrl, 1, &tmp))
-            return -1;
-        if (st.chip_cfg.sensors & INV_XYZ_COMPASS)
-            tmp |= BIT_AUX_IF_EN;
-        else
-            tmp &= ~BIT_AUX_IF_EN;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &tmp))
-            return -1;
-        delay_ms(3);
-        if (st.chip_cfg.active_low_int)
-            tmp = BIT_ACTL;
-        else
-            tmp = 0;
-        if (st.chip_cfg.latched_int)
-            tmp |= BIT_LATCH_EN | BIT_ANY_RD_CLR;
-        if (i2c_write(st.hw->addr, st.reg->int_pin_cfg, 1, &tmp))
-            return -1;
-    }
-    st.chip_cfg.bypass_mode = bypass_on;
-    return 0;
-}
-
-/**
- *  @brief      Set interrupt level.
- *  @param[in]  active_low  1 for active low, 0 for active high.
- *  @return     0 if successful.
- */
-int mpu_set_int_level(unsigned char active_low)
-{
-    st.chip_cfg.active_low_int = active_low;
-    return 0;
-}
-
-/**
- *  @brief      Enable latched interrupts.
- *  Any MPU register will clear the interrupt.
- *  @param[in]  enable  1 to enable, 0 to disable.
- *  @return     0 if successful.
- */
-int mpu_set_int_latched(unsigned char enable)
-{
-    unsigned char tmp;
-    if (st.chip_cfg.latched_int == enable)
-        return 0;
-
-    if (enable)
-        tmp = BIT_LATCH_EN | BIT_ANY_RD_CLR;
-    else
-        tmp = 0;
-    if (st.chip_cfg.bypass_mode)
-        tmp |= BIT_BYPASS_EN;
-    if (st.chip_cfg.active_low_int)
-        tmp |= BIT_ACTL;
-    if (i2c_write(st.hw->addr, st.reg->int_pin_cfg, 1, &tmp))
-        return -1;
-    st.chip_cfg.latched_int = enable;
-    return 0;
-}
-
-#ifdef MPU6050
-static int get_accel_prod_shift(float *st_shift)
-{
-    unsigned char tmp[4], shift_code[3], ii;
-
-    if (i2c_read(st.hw->addr, 0x0D, 4, tmp))
-        return 0x07;
-
-    shift_code[0] = ((tmp[0] & 0xE0) >> 3) | ((tmp[3] & 0x30) >> 4);
-    shift_code[1] = ((tmp[1] & 0xE0) >> 3) | ((tmp[3] & 0x0C) >> 2);
-    shift_code[2] = ((tmp[2] & 0xE0) >> 3) | (tmp[3] & 0x03);
-    for (ii = 0; ii < 3; ii++) {
-        if (!shift_code[ii]) {
-            st_shift[ii] = 0.f;
-            continue;
-        }
-        /* Equivalent to..
-         * st_shift[ii] = 0.34f * powf(0.92f/0.34f, (shift_code[ii]-1) / 30.f)
-         */
-        st_shift[ii] = 0.34f;
-        while (--shift_code[ii])
-            st_shift[ii] *= 1.034f;
-    }
-    return 0;
-}
-
-static int accel_self_test(long *bias_regular, long *bias_st)
-{
-    int jj, result = 0;
-    float st_shift[3], st_shift_cust, st_shift_var;
-
-    get_accel_prod_shift(st_shift);
-    for(jj = 0; jj < 3; jj++) {
-        st_shift_cust = labs(bias_regular[jj] - bias_st[jj]) / 65536.f;
-        if (st_shift[jj]) {
-            st_shift_var = st_shift_cust / st_shift[jj] - 1.f;
-            if (fabs(st_shift_var) > test.max_accel_var)
-                result |= 1 << jj;
-        } else if ((st_shift_cust < test.min_g) ||
-            (st_shift_cust > test.max_g))
-            result |= 1 << jj;
-    }
-
-    return result;
-}
-
-static int gyro_self_test(long *bias_regular, long *bias_st)
-{
-    int jj, result = 0;
-    unsigned char tmp[3];
-    float st_shift, st_shift_cust, st_shift_var;
-
-    if (i2c_read(st.hw->addr, 0x0D, 3, tmp))
-        return 0x07;
-
-    tmp[0] &= 0x1F;
-    tmp[1] &= 0x1F;
-    tmp[2] &= 0x1F;
-
-    for (jj = 0; jj < 3; jj++) {
-        st_shift_cust = labs(bias_regular[jj] - bias_st[jj]) / 65536.f;
-        if (tmp[jj]) {
-            st_shift = 3275.f / test.gyro_sens;
-            while (--tmp[jj])
-                st_shift *= 1.046f;
-            st_shift_var = st_shift_cust / st_shift - 1.f;
-            if (fabs(st_shift_var) > test.max_gyro_var)
-                result |= 1 << jj;
-        } else if ((st_shift_cust < test.min_dps) ||
-            (st_shift_cust > test.max_dps))
-            result |= 1 << jj;
-    }
-    return result;
-}
-
-#ifdef AK89xx_SECONDARY
-static int compass_self_test(void)
-{
-    unsigned char tmp[6];
-    unsigned char tries = 10;
-    int result = 0x07;
-    short data;
-
-    mpu_set_bypass(1);
-
-    tmp[0] = AKM_POWER_DOWN;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, tmp))
-        return 0x07;
-    tmp[0] = AKM_BIT_SELF_TEST;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_ASTC, 1, tmp))
-        goto AKM_restore;
-    tmp[0] = AKM_MODE_SELF_TEST;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, tmp))
-        goto AKM_restore;
-
-    do {
-        delay_ms(10);
-        if (i2c_read(st.chip_cfg.compass_addr, AKM_REG_ST1, 1, tmp))
-            goto AKM_restore;
-        if (tmp[0] & AKM_DATA_READY)
-            break;
-    } while (tries--);
-    if (!(tmp[0] & AKM_DATA_READY))
-        goto AKM_restore;
-
-    if (i2c_read(st.chip_cfg.compass_addr, AKM_REG_HXL, 6, tmp))
-        goto AKM_restore;
-
-    result = 0;
-    data = (short)(tmp[1] << 8) | tmp[0];
-    if ((data > 100) || (data < -100))
-        result |= 0x01;
-    data = (short)(tmp[3] << 8) | tmp[2];
-    if ((data > 100) || (data < -100))
-        result |= 0x02;
-    data = (short)(tmp[5] << 8) | tmp[4];
-    if ((data > -300) || (data < -1000))
-        result |= 0x04;
-
-AKM_restore:
-    tmp[0] = 0 | SUPPORTS_AK89xx_HIGH_SENS;
-    i2c_write(st.chip_cfg.compass_addr, AKM_REG_ASTC, 1, tmp);
-    tmp[0] = SUPPORTS_AK89xx_HIGH_SENS;
-    i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, tmp);
-    mpu_set_bypass(0);
-    return result;
-}
-#endif
-#endif
-
-static int get_st_biases(long *gyro, long *accel, unsigned char hw_test)
-{
-    unsigned char data[MAX_PACKET_LENGTH];
-    unsigned char packet_count, ii;
-    unsigned short fifo_count;
-
-    data[0] = 0x01;
-    data[1] = 0;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 2, data))
-        return -1;
-    delay_ms(200);
-    data[0] = 0;
-    if (i2c_write(st.hw->addr, st.reg->int_enable, 1, data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->i2c_mst, 1, data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, data))
-        return -1;
-    data[0] = BIT_FIFO_RST | BIT_DMP_RST;
-    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, data))
-        return -1;
-    delay_ms(15);
-    data[0] = st.test->reg_lpf;
-    if (i2c_write(st.hw->addr, st.reg->lpf, 1, data))
-        return -1;
-    data[0] = st.test->reg_rate_div;
-    if (i2c_write(st.hw->addr, st.reg->rate_div, 1, data))
-        return -1;
-    if (hw_test)
-        data[0] = st.test->reg_gyro_fsr | 0xE0;
-    else
-        data[0] = st.test->reg_gyro_fsr;
-    if (i2c_write(st.hw->addr, st.reg->gyro_cfg, 1, data))
-        return -1;
-
-    if (hw_test)
-        data[0] = st.test->reg_accel_fsr | 0xE0;
-    else
-        data[0] = test.reg_accel_fsr;
-    if (i2c_write(st.hw->addr, st.reg->accel_cfg, 1, data))
-        return -1;
-    if (hw_test)
-        delay_ms(200);
-
-    /* Fill FIFO for test.wait_ms milliseconds. */
-    data[0] = BIT_FIFO_EN;
-    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, data))
-        return -1;
-
-    data[0] = INV_XYZ_GYRO | INV_XYZ_ACCEL;
-    if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, data))
-        return -1;
-    delay_ms(test.wait_ms);
-    data[0] = 0;
-    if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, data))
-        return -1;
-
-    if (i2c_read(st.hw->addr, st.reg->fifo_count_h, 2, data))
-        return -1;
-
-    fifo_count = (data[0] << 8) | data[1];
-    packet_count = fifo_count / MAX_PACKET_LENGTH;
-    gyro[0] = gyro[1] = gyro[2] = 0;
-    accel[0] = accel[1] = accel[2] = 0;
-
-    for (ii = 0; ii < packet_count; ii++) {
-        short accel_cur[3], gyro_cur[3];
-        if (i2c_read(st.hw->addr, st.reg->fifo_r_w, MAX_PACKET_LENGTH, data))
-            return -1;
-        accel_cur[0] = ((short)data[0] << 8) | data[1];
-        accel_cur[1] = ((short)data[2] << 8) | data[3];
-        accel_cur[2] = ((short)data[4] << 8) | data[5];
-        accel[0] += (long)accel_cur[0];
-        accel[1] += (long)accel_cur[1];
-        accel[2] += (long)accel_cur[2];
-        gyro_cur[0] = (((short)data[6] << 8) | data[7]);
-        gyro_cur[1] = (((short)data[8] << 8) | data[9]);
-        gyro_cur[2] = (((short)data[10] << 8) | data[11]);
-        gyro[0] += (long)gyro_cur[0];
-        gyro[1] += (long)gyro_cur[1];
-        gyro[2] += (long)gyro_cur[2];
-    }
-#ifdef EMPL_NO_64BIT
-    gyro[0] = (long)(((float)gyro[0]*65536.f) / test.gyro_sens / packet_count);
-    gyro[1] = (long)(((float)gyro[1]*65536.f) / test.gyro_sens / packet_count);
-    gyro[2] = (long)(((float)gyro[2]*65536.f) / test.gyro_sens / packet_count);
-    if (has_accel) {
-        accel[0] = (long)(((float)accel[0]*65536.f) / test.accel_sens /
-            packet_count);
-        accel[1] = (long)(((float)accel[1]*65536.f) / test.accel_sens /
-            packet_count);
-        accel[2] = (long)(((float)accel[2]*65536.f) / test.accel_sens /
-            packet_count);
-        /* Don't remove gravity! */
-        accel[2] -= 65536L;
-    }
-#else
-    gyro[0] = (long)(((long long)gyro[0]<<16) / test.gyro_sens / packet_count);
-    gyro[1] = (long)(((long long)gyro[1]<<16) / test.gyro_sens / packet_count);
-    gyro[2] = (long)(((long long)gyro[2]<<16) / test.gyro_sens / packet_count);
-    accel[0] = (long)(((long long)accel[0]<<16) / test.accel_sens /
-        packet_count);
-    accel[1] = (long)(((long long)accel[1]<<16) / test.accel_sens /
-        packet_count);
-    accel[2] = (long)(((long long)accel[2]<<16) / test.accel_sens /
-        packet_count);
-    /* Don't remove gravity! */
-    if (accel[2] > 0L)
-        accel[2] -= 65536L;
-    else
-        accel[2] += 65536L;
-#endif
-
-    return 0;
-}
-
-/**
- *  @brief      Trigger gyro/accel/compass self-test.
- *  On success/error, the self-test returns a mask representing the sensor(s)
- *  that failed. For each bit, a one (1) represents a "pass" case; conversely,
- *  a zero (0) indicates a failure.
- *
- *  \n The mask is defined as follows:
- *  \n Bit 0:   Gyro.
- *  \n Bit 1:   Accel.
- *  \n Bit 2:   Compass.
- *
- *  \n Currently, the hardware self-test is unsupported for MPU6500. However,
- *  this function can still be used to obtain the accel and gyro biases.
- *
- *  \n This function must be called with the device either face-up or face-down
- *  (z-axis is parallel to gravity).
- *  @param[out] gyro        Gyro biases in q16 format.
- *  @param[out] accel       Accel biases (if applicable) in q16 format.
- *  @return     Result mask (see above).
- */
-int mpu_run_self_test(long *gyro, long *accel)
-{
-#ifdef MPU6050
-    const unsigned char tries = 2;
-    long gyro_st[3], accel_st[3];
-    unsigned char accel_result, gyro_result;
-#ifdef AK89xx_SECONDARY
-    unsigned char compass_result;
-#endif
-    int ii;
-#endif
-    int result;
-    unsigned char accel_fsr, fifo_sensors, sensors_on;
-    unsigned short gyro_fsr, sample_rate, lpf;
-    unsigned char dmp_was_on;
-
-    if (st.chip_cfg.dmp_on) {
-        mpu_set_dmp_state(0);
-        dmp_was_on = 1;
-    } else
-        dmp_was_on = 0;
-
-    /* Get initial settings. */
-    mpu_get_gyro_fsr(&gyro_fsr);
-    mpu_get_accel_fsr(&accel_fsr);
-    mpu_get_lpf(&lpf);
-    mpu_get_sample_rate(&sample_rate);
-    sensors_on = st.chip_cfg.sensors;
-    mpu_get_fifo_config(&fifo_sensors);
-
-    /* For older chips, the self-test will be different. */
-#if defined MPU6050
-    for (ii = 0; ii < tries; ii++)
-        if (!get_st_biases(gyro, accel, 0))
-            break;
-    if (ii == tries) {
-        /* If we reach this point, we most likely encountered an I2C error.
-         * We'll just report an error for all three sensors.
-         */
-        result = 0;
-        goto restore;
-    }
-    for (ii = 0; ii < tries; ii++)
-        if (!get_st_biases(gyro_st, accel_st, 1))
-            break;
-    if (ii == tries) {
-        /* Again, probably an I2C error. */
-        result = 0;
-        goto restore;
-    }
-    accel_result = accel_self_test(accel, accel_st);
-    gyro_result = gyro_self_test(gyro, gyro_st);
-
-    result = 0;
-    if (!gyro_result)
-        result |= 0x01;
-    if (!accel_result)
-        result |= 0x02;
-
-#ifdef AK89xx_SECONDARY
-    compass_result = compass_self_test();
-    if (!compass_result)
-        result |= 0x04;
-#endif
-restore:
-#elif defined MPU6500
-    /* For now, this function will return a "pass" result for all three sensors
-     * for compatibility with current test applications.
-     */
-    get_st_biases(gyro, accel, 0);
-    result = 0x7;
-#endif
-    /* Set to invalid values to ensure no I2C writes are skipped. */
-    st.chip_cfg.gyro_fsr = 0xFF;
-    st.chip_cfg.accel_fsr = 0xFF;
-    st.chip_cfg.lpf = 0xFF;
-    st.chip_cfg.sample_rate = 0xFFFF;
-    st.chip_cfg.sensors = 0xFF;
-    st.chip_cfg.fifo_enable = 0xFF;
-    st.chip_cfg.clk_src = INV_CLK_PLL;
-    mpu_set_gyro_fsr(gyro_fsr);
-    mpu_set_accel_fsr(accel_fsr);
-    mpu_set_lpf(lpf);
-    mpu_set_sample_rate(sample_rate);
-    mpu_set_sensors(sensors_on);
-    mpu_configure_fifo(fifo_sensors);
-
-    if (dmp_was_on)
-        mpu_set_dmp_state(1);
-
-    return result;
-}
-
-/**
- *  @brief      Write to the DMP memory.
- *  This function prevents I2C writes past the bank boundaries. The DMP memory
- *  is only accessible when the chip is awake.
- *  @param[in]  mem_addr    Memory location (bank << 8 | start address)
- *  @param[in]  length      Number of bytes to write.
- *  @param[in]  data        Bytes to write to memory.
- *  @return     0 if successful.
- */
-int mpu_write_mem(unsigned short mem_addr, unsigned short length,
-        unsigned char *data)
-{
-    unsigned char tmp[2];
-
-    if (!data)
-        return -1;
-    if (!st.chip_cfg.sensors)
-        return -1;
-
-    tmp[0] = (unsigned char)(mem_addr >> 8);
-    tmp[1] = (unsigned char)(mem_addr & 0xFF);
-
-    /* Check bank boundaries. */
-    if (tmp[1] + length > st.hw->bank_size)
-        return -1;
-
-    if (i2c_write(st.hw->addr, st.reg->bank_sel, 2, tmp))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->mem_r_w, length, data))
-        return -1;
-    return 0;
-}
-
-/**
- *  @brief      Read from the DMP memory.
- *  This function prevents I2C reads past the bank boundaries. The DMP memory
- *  is only accessible when the chip is awake.
- *  @param[in]  mem_addr    Memory location (bank << 8 | start address)
- *  @param[in]  length      Number of bytes to read.
- *  @param[out] data        Bytes read from memory.
- *  @return     0 if successful.
- */
-int mpu_read_mem(unsigned short mem_addr, unsigned short length,
-        unsigned char *data)
-{
-    unsigned char tmp[2];
-
-    if (!data)
-        return -1;
-    if (!st.chip_cfg.sensors)
-        return -1;
-
-    tmp[0] = (unsigned char)(mem_addr >> 8);
-    tmp[1] = (unsigned char)(mem_addr & 0xFF);
-
-    /* Check bank boundaries. */
-    if (tmp[1] + length > st.hw->bank_size)
-        return -1;
-
-    if (i2c_write(st.hw->addr, st.reg->bank_sel, 2, tmp))
-        return -1;
-    if (i2c_read(st.hw->addr, st.reg->mem_r_w, length, data))
-        return -1;
-    return 0;
-}
-
-/**
- *  @brief      Load and verify DMP image.
- *  @param[in]  length      Length of DMP image.
- *  @param[in]  firmware    DMP code.
- *  @param[in]  start_addr  Starting address of DMP code memory.
- *  @param[in]  sample_rate Fixed sampling rate used when DMP is enabled.
- *  @return     0 if successful.
- */
-int mpu_load_firmware(unsigned short length, const unsigned char *firmware,
-    unsigned short start_addr, unsigned short sample_rate)
-{
-    unsigned short ii;
-    unsigned short this_write;
-    /* Must divide evenly into st.hw->bank_size to avoid bank crossings. */
-#define LOAD_CHUNK  (16)
-    unsigned char cur[LOAD_CHUNK], tmp[2];
-
-    if (st.chip_cfg.dmp_loaded)
-        /* DMP should only be loaded once. */
-        return -1;
-
-    if (!firmware)
-        return -1;
-    for (ii = 0; ii < length; ii += this_write) {
-        this_write = min(LOAD_CHUNK, length - ii);
-        if (mpu_write_mem(ii, this_write, (unsigned char*)&firmware[ii]))
-            return -1;
-        if (mpu_read_mem(ii, this_write, cur))
-            return -1;
-        if (memcmp(firmware+ii, cur, this_write))
-            return -2;
-    }
-
-    /* Set program start address. */
-    tmp[0] = start_addr >> 8;
-    tmp[1] = start_addr & 0xFF;
-    if (i2c_write(st.hw->addr, st.reg->prgm_start_h, 2, tmp))
-        return -1;
-
-    st.chip_cfg.dmp_loaded = 1;
-    st.chip_cfg.dmp_sample_rate = sample_rate;
-    return 0;
-}
-
-/**
- *  @brief      Enable/disable DMP support.
- *  @param[in]  enable  1 to turn on the DMP.
- *  @return     0 if successful.
- */
-int mpu_set_dmp_state(unsigned char enable)
-{
-    unsigned char tmp;
-    if (st.chip_cfg.dmp_on == enable)
-        return 0;
-
-    if (enable) {
-        if (!st.chip_cfg.dmp_loaded)
-            return -1;
-        /* Disable data ready interrupt. */
-        set_int_enable(0);
-        /* Disable bypass mode. */
-        mpu_set_bypass(0);
-        /* Keep constant sample rate, FIFO rate controlled by DMP. */
-        mpu_set_sample_rate(st.chip_cfg.dmp_sample_rate);
-        /* Remove FIFO elements. */
-        tmp = 0;
-        i2c_write(st.hw->addr, 0x23, 1, &tmp);
-        st.chip_cfg.dmp_on = 1;
-        /* Enable DMP interrupt. */
-        set_int_enable(1);
-        mpu_reset_fifo();
-    } else {
-        /* Disable DMP interrupt. */
-        set_int_enable(0);
-        /* Restore FIFO settings. */
-        tmp = st.chip_cfg.fifo_enable;
-        i2c_write(st.hw->addr, 0x23, 1, &tmp);
-        st.chip_cfg.dmp_on = 0;
-        mpu_reset_fifo();
-    }
-    return 0;
-}
-
-/**
- *  @brief      Get DMP state.
- *  @param[out] enabled 1 if enabled.
- *  @return     0 if successful.
- */
-int mpu_get_dmp_state(unsigned char *enabled)
-{
-    enabled[0] = st.chip_cfg.dmp_on;
-    return 0;
-}
-
-
-/* This initialization is similar to the one in ak8975.c. */
-static int setup_compass(void)
-{
-#ifdef AK89xx_SECONDARY
-    unsigned char data[4], akm_addr;
-
-    mpu_set_bypass(1);
-
-    /* Find compass. Possible addresses range from 0x0C to 0x0F. */
-    for (akm_addr = 0x0C; akm_addr <= 0x0F; akm_addr++) {
-        int result;
-        result = i2c_read(akm_addr, AKM_REG_WHOAMI, 1, data);
-        if (!result && (data[0] == AKM_WHOAMI))
-            break;
-    }
-
-    if (akm_addr > 0x0F) {
-        /* TODO: Handle this case in all compass-related functions. */
-        log_e("Compass not found.\n");
-        return -1;
-    }
-
-    st.chip_cfg.compass_addr = akm_addr;
-
-    data[0] = AKM_POWER_DOWN;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, data))
-        return -1;
-    delay_ms(1);
-
-    data[0] = AKM_FUSE_ROM_ACCESS;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, data))
-        return -1;
-    delay_ms(1);
-
-    /* Get sensitivity adjustment data from fuse ROM. */
-    if (i2c_read(st.chip_cfg.compass_addr, AKM_REG_ASAX, 3, data))
-        return -1;
-    st.chip_cfg.mag_sens_adj[0] = (long)data[0] + 128;
-    st.chip_cfg.mag_sens_adj[1] = (long)data[1] + 128;
-    st.chip_cfg.mag_sens_adj[2] = (long)data[2] + 128;
-
-    data[0] = AKM_POWER_DOWN;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, data))
-        return -1;
-    delay_ms(1);
-
-    mpu_set_bypass(0);
-
-    /* Set up master mode, master clock, and ES bit. */
-    data[0] = 0x40;
-    if (i2c_write(st.hw->addr, st.reg->i2c_mst, 1, data))
-        return -1;
-
-    /* Slave 0 reads from AKM data registers. */
-    data[0] = BIT_I2C_READ | st.chip_cfg.compass_addr;
-    if (i2c_write(st.hw->addr, st.reg->s0_addr, 1, data))
-        return -1;
-
-    /* Compass reads start at this register. */
-    data[0] = AKM_REG_ST1;
-    if (i2c_write(st.hw->addr, st.reg->s0_reg, 1, data))
-        return -1;
-
-    /* Enable slave 0, 8-byte reads. */
-    data[0] = BIT_SLAVE_EN | 8;
-    if (i2c_write(st.hw->addr, st.reg->s0_ctrl, 1, data))
-        return -1;
-
-    /* Slave 1 changes AKM measurement mode. */
-    data[0] = st.chip_cfg.compass_addr;
-    if (i2c_write(st.hw->addr, st.reg->s1_addr, 1, data))
-        return -1;
-
-    /* AKM measurement mode register. */
-    data[0] = AKM_REG_CNTL;
-    if (i2c_write(st.hw->addr, st.reg->s1_reg, 1, data))
-        return -1;
-
-    /* Enable slave 1, 1-byte writes. */
-    data[0] = BIT_SLAVE_EN | 1;
-    if (i2c_write(st.hw->addr, st.reg->s1_ctrl, 1, data))
-        return -1;
-
-    /* Set slave 1 data. */
-    data[0] = AKM_SINGLE_MEASUREMENT;
-    if (i2c_write(st.hw->addr, st.reg->s1_do, 1, data))
-        return -1;
-
-    /* Trigger slave 0 and slave 1 actions at each sample. */
-    data[0] = 0x03;
-    if (i2c_write(st.hw->addr, st.reg->i2c_delay_ctrl, 1, data))
-        return -1;
-
-#ifdef MPU9150
-    /* For the MPU9150, the auxiliary I2C bus needs to be set to VDD. */
-    data[0] = BIT_I2C_MST_VDDIO;
-    if (i2c_write(st.hw->addr, st.reg->yg_offs_tc, 1, data))
-        return -1;
-#endif
-
-    return 0;
-#else
-    return -1;
-#endif
-}
-
-/**
- *  @brief      Read raw compass data.
- *  @param[out] data        Raw data in hardware units.
- *  @param[out] timestamp   Timestamp in milliseconds. Null if not needed.
- *  @return     0 if successful.
- */
-int mpu_get_compass_reg(short *data, unsigned long *timestamp)
-{
-#ifdef AK89xx_SECONDARY
-    unsigned char tmp[9];
-
-    if (!(st.chip_cfg.sensors & INV_XYZ_COMPASS))
-        return -1;
-
-#ifdef AK89xx_BYPASS
-    if (i2c_read(st.chip_cfg.compass_addr, AKM_REG_ST1, 8, tmp))
-        return -1;
-    tmp[8] = AKM_SINGLE_MEASUREMENT;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, tmp+8))
-        return -1;
-#else
-    if (i2c_read(st.hw->addr, st.reg->raw_compass, 8, tmp))
-        return -1;
-#endif
-
-#if defined AK8975_SECONDARY
-    /* AK8975 doesn't have the overrun error bit. */
-    if (!(tmp[0] & AKM_DATA_READY))
-        return -2;
-    if ((tmp[7] & AKM_OVERFLOW) || (tmp[7] & AKM_DATA_ERROR))
-        return -3;
-#elif defined AK8963_SECONDARY
-    /* AK8963 doesn't have the data read error bit. */
-    if (!(tmp[0] & AKM_DATA_READY) || (tmp[0] & AKM_DATA_OVERRUN))
-        return -2;
-    if (tmp[7] & AKM_OVERFLOW)
-        return -3;
-#endif
-    data[0] = (tmp[2] << 8) | tmp[1];
-    data[1] = (tmp[4] << 8) | tmp[3];
-    data[2] = (tmp[6] << 8) | tmp[5];
-
-    data[0] = ((long)data[0] * st.chip_cfg.mag_sens_adj[0]) >> 8;
-    data[1] = ((long)data[1] * st.chip_cfg.mag_sens_adj[1]) >> 8;
-    data[2] = ((long)data[2] * st.chip_cfg.mag_sens_adj[2]) >> 8;
-
-    if (timestamp)
-        get_ms(timestamp);
-    return 0;
-#else
-    return -1;
-#endif
-}
-
-/**
- *  @brief      Get the compass full-scale range.
- *  @param[out] fsr Current full-scale range.
- *  @return     0 if successful.
- */
-int mpu_get_compass_fsr(unsigned short *fsr)
-{
-#ifdef AK89xx_SECONDARY
-    fsr[0] = st.hw->compass_fsr;
-    return 0;
-#else
-    return -1;
-#endif
-}
-
-/**
- *  @brief      Enters LP accel motion interrupt mode.
- *  The behaviour of this feature is very different between the MPU6050 and the
- *  MPU6500. Each chip's version of this feature is explained below.
- *
- *  \n The hardware motion threshold can be between 32mg and 8160mg in 32mg
- *  increments.
- *
- *  \n Low-power accel mode supports the following frequencies:
- *  \n 1.25Hz, 5Hz, 20Hz, 40Hz
- *
- *  \n MPU6500:
- *  \n Unlike the MPU6050 version, the hardware does not "lock in" a reference
- *  sample. The hardware monitors the accel data and detects any large change
- *  over a short period of time.
- *
- *  \n The hardware motion threshold can be between 4mg and 1020mg in 4mg
- *  increments.
- *
- *  \n MPU6500 Low-power accel mode supports the following frequencies:
- *  \n 1.25Hz, 2.5Hz, 5Hz, 10Hz, 20Hz, 40Hz, 80Hz, 160Hz, 320Hz, 640Hz
- *
- *  \n\n NOTES:
- *  \n The driver will round down @e thresh to the nearest supported value if
- *  an unsupported threshold is selected.
- *  \n To select a fractional wake-up frequency, round down the value passed to
- *  @e lpa_freq.
- *  \n The MPU6500 does not support a delay parameter. If this function is used
- *  for the MPU6500, the value passed to @e time will be ignored.
- *  \n To disable this mode, set @e lpa_freq to zero. The driver will restore
- *  the previous configuration.
- *
- *  @param[in]  thresh      Motion threshold in mg.
- *  @param[in]  time        Duration in milliseconds that the accel data must
- *                          exceed @e thresh before motion is reported.
- *  @param[in]  lpa_freq    Minimum sampling rate, or zero to disable.
- *  @return     0 if successful.
- */
-int mpu_lp_motion_interrupt(unsigned short thresh, unsigned char time,
-    unsigned char lpa_freq)
-{
-    unsigned char data[3];
-
-    if (lpa_freq) {
-        unsigned char thresh_hw;
-
-#if defined MPU6500
-        /* 1LSb = 4mg. */
-        if (thresh > 1020)
-            thresh_hw = 255;
-        else if (thresh < 4)
-            thresh_hw = 1;
-        else
-            thresh_hw = thresh >> 2;
-#endif
-
-        if (!time)
-            /* Minimum duration must be 1ms. */
-            time = 1;
-
-#if defined MPU6500
-        if (lpa_freq > 640)
-#endif
-            /* At this point, the chip has not been re-configured, so the
-             * function can safely exit.
-             */
-            return -1;
-
-        if (!st.chip_cfg.int_motion_only) {
-            /* Store current settings for later. */
-            if (st.chip_cfg.dmp_on) {
-                mpu_set_dmp_state(0);
-                st.chip_cfg.cache.dmp_on = 1;
-            } else
-                st.chip_cfg.cache.dmp_on = 0;
-            mpu_get_gyro_fsr(&st.chip_cfg.cache.gyro_fsr);
-            mpu_get_accel_fsr(&st.chip_cfg.cache.accel_fsr);
-            mpu_get_lpf(&st.chip_cfg.cache.lpf);
-            mpu_get_sample_rate(&st.chip_cfg.cache.sample_rate);
-            st.chip_cfg.cache.sensors_on = st.chip_cfg.sensors;
-            mpu_get_fifo_config(&st.chip_cfg.cache.fifo_sensors);
-        }
-
-#if defined MPU6500
-        /* Disable hardware interrupts. */
-        set_int_enable(0);
-
-        /* Enter full-power accel-only mode, no FIFO/DMP. */
-        data[0] = 0;
-        data[1] = 0;
-        data[2] = BIT_STBY_XYZG;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 3, data))
-            goto lp_int_restore;
-
-        /* Set motion threshold. */
-        data[0] = thresh_hw;
-        if (i2c_write(st.hw->addr, st.reg->motion_thr, 1, data))
-            goto lp_int_restore;
-
-        /* Set wake frequency. */
-        if (lpa_freq == 1)
-            data[0] = INV_LPA_1_25HZ;
-        else if (lpa_freq == 2)
-            data[0] = INV_LPA_2_5HZ;
-        else if (lpa_freq <= 5)
-            data[0] = INV_LPA_5HZ;
-        else if (lpa_freq <= 10)
-            data[0] = INV_LPA_10HZ;
-        else if (lpa_freq <= 20)
-            data[0] = INV_LPA_20HZ;
-        else if (lpa_freq <= 40)
-            data[0] = INV_LPA_40HZ;
-        else if (lpa_freq <= 80)
-            data[0] = INV_LPA_80HZ;
-        else if (lpa_freq <= 160)
-            data[0] = INV_LPA_160HZ;
-        else if (lpa_freq <= 320)
-            data[0] = INV_LPA_320HZ;
-        else
-            data[0] = INV_LPA_640HZ;
-        if (i2c_write(st.hw->addr, st.reg->lp_accel_odr, 1, data))
-            goto lp_int_restore;
-
-        /* Enable motion interrupt (MPU6500 version). */
-        data[0] = BITS_WOM_EN;
-        if (i2c_write(st.hw->addr, st.reg->accel_intel, 1, data))
-            goto lp_int_restore;
-
-        /* Enable cycle mode. */
-        data[0] = BIT_LPA_CYCLE;
-        if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, data))
-            goto lp_int_restore;
-
-        /* Enable interrupt. */
-        data[0] = BIT_MOT_INT_EN;
-        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, data))
-            goto lp_int_restore;
-
-        st.chip_cfg.int_motion_only = 1;
-        return 0;
-#endif
-    } else {
-        /* Don't "restore" the previous state if no state has been saved. */
-        int ii;
-        char *cache_ptr = (char*)&st.chip_cfg.cache;
-        for (ii = 0; ii < sizeof(st.chip_cfg.cache); ii++) {
-            if (cache_ptr[ii] != 0)
-                goto lp_int_restore;
-        }
-        /* If we reach this point, motion interrupt mode hasn't been used yet. */
-        return -1;
-    }
-lp_int_restore:
-    /* Set to invalid values to ensure no I2C writes are skipped. */
-    st.chip_cfg.gyro_fsr = 0xFF;
-    st.chip_cfg.accel_fsr = 0xFF;
-    st.chip_cfg.lpf = 0xFF;
-    st.chip_cfg.sample_rate = 0xFFFF;
-    st.chip_cfg.sensors = 0xFF;
-    st.chip_cfg.fifo_enable = 0xFF;
-    st.chip_cfg.clk_src = INV_CLK_PLL;
-    mpu_set_sensors(st.chip_cfg.cache.sensors_on);
-    mpu_set_gyro_fsr(st.chip_cfg.cache.gyro_fsr);
-    mpu_set_accel_fsr(st.chip_cfg.cache.accel_fsr);
-    mpu_set_lpf(st.chip_cfg.cache.lpf);
-    mpu_set_sample_rate(st.chip_cfg.cache.sample_rate);
-    mpu_configure_fifo(st.chip_cfg.cache.fifo_sensors);
-
-    if (st.chip_cfg.cache.dmp_on)
-        mpu_set_dmp_state(1);
-
-#ifdef MPU6500
-    /* Disable motion interrupt (MPU6500 version). */
-    data[0] = 0;
-    if (i2c_write(st.hw->addr, st.reg->accel_intel, 1, data))
-        goto lp_int_restore;
-#endif
-
-    st.chip_cfg.int_motion_only = 0;
-    return 0;
-}
-
-/**
- *  @}
- */
-

+ 0 - 132
Core备份3/imu5/inv_mpu5.h

@@ -1,132 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011-2012 InvenSense Corporation, All Rights Reserved.
-    See included License.txt for License information.
- $
- */
-/**
- *  @addtogroup  DRIVERS Sensor Driver Layer
- *  @brief       Hardware drivers to communicate with sensors via I2C.
- *
- *  @{
- *      @file       inv_mpu.h
- *      @brief      An I2C-based driver for Invensense gyroscopes.
- *      @details    This driver currently works for the following devices:
- *                  MPU6050
- *                  MPU6500
- *                  MPU9150 (or MPU6050 w/ AK8975 on the auxiliary bus)
- *                  MPU9250 (or MPU6500 w/ AK8963 on the auxiliary bus)
- */
-
-#ifndef _INV_MPU_H_
-#define _INV_MPU_H_
-
-#define MOTION_DRIVER_TARGET_STM32
-#define MPU6050
-//#define EMPL
-//#define USE_DMP
-
-#define INV_X_GYRO      (0x40)
-#define INV_Y_GYRO      (0x20)
-#define INV_Z_GYRO      (0x10)
-#define INV_XYZ_GYRO    (INV_X_GYRO | INV_Y_GYRO | INV_Z_GYRO)
-#define INV_XYZ_ACCEL   (0x08)
-#define INV_XYZ_COMPASS (0x01)
-
-struct int_param_s {
-#if defined EMPL_TARGET_MSP430 || defined MOTION_DRIVER_TARGET_MSP430 || defined MOTION_DRIVER_TARGET_STM32
-    void (*cb)(void);
-    unsigned short pin;
-    unsigned char lp_exit;
-    unsigned char active_low;
-#elif defined EMPL_TARGET_UC3L0
-    unsigned long pin;
-    void (*cb)(volatile void*);
-    void *arg;
-#endif
-};
-
-#define MPU_INT_STATUS_DATA_READY       (0x0001)
-#define MPU_INT_STATUS_DMP              (0x0002)
-#define MPU_INT_STATUS_PLL_READY        (0x0004)
-#define MPU_INT_STATUS_I2C_MST          (0x0008)
-#define MPU_INT_STATUS_FIFO_OVERFLOW    (0x0010)
-#define MPU_INT_STATUS_ZMOT             (0x0020)
-#define MPU_INT_STATUS_MOT              (0x0040)
-#define MPU_INT_STATUS_FREE_FALL        (0x0080)
-#define MPU_INT_STATUS_DMP_0            (0x0100)
-#define MPU_INT_STATUS_DMP_1            (0x0200)
-#define MPU_INT_STATUS_DMP_2            (0x0400)
-#define MPU_INT_STATUS_DMP_3            (0x0800)
-#define MPU_INT_STATUS_DMP_4            (0x1000)
-#define MPU_INT_STATUS_DMP_5            (0x2000)
-
-/* Set up APIs */
-int mpu_init(struct int_param_s *int_param);
-int mpu_init_slave(void);
-int mpu_set_bypass(unsigned char bypass_on);
-
-/* Configuration APIs */
-int mpu_lp_accel_mode(unsigned char rate);
-int mpu_lp_motion_interrupt(unsigned short thresh, unsigned char time,
-    unsigned char lpa_freq);
-int mpu_set_int_level(unsigned char active_low);
-int mpu_set_int_latched(unsigned char enable);
-
-int mpu_set_dmp_state(unsigned char enable);
-int mpu_get_dmp_state(unsigned char *enabled);
-
-int mpu_get_lpf(unsigned short *lpf);
-int mpu_set_lpf(unsigned short lpf);
-
-int mpu_get_gyro_fsr(unsigned short *fsr);
-int mpu_set_gyro_fsr(unsigned short fsr);
-
-int mpu_get_accel_fsr(unsigned char *fsr);
-int mpu_set_accel_fsr(unsigned char fsr);
-
-int mpu_get_compass_fsr(unsigned short *fsr);
-
-int mpu_get_gyro_sens(float *sens);
-int mpu_get_accel_sens(unsigned short *sens);
-
-int mpu_get_sample_rate(unsigned short *rate);
-int mpu_set_sample_rate(unsigned short rate);
-int mpu_get_compass_sample_rate(unsigned short *rate);
-int mpu_set_compass_sample_rate(unsigned short rate);
-
-int mpu_get_fifo_config(unsigned char *sensors);
-int mpu_configure_fifo(unsigned char sensors);
-
-int mpu_get_power_state(unsigned char *power_on);
-int mpu_set_sensors(unsigned char sensors);
-
-int mpu_set_accel_bias(const long *accel_bias);
-
-/* Data getter/setter APIs */
-int mpu_get_gyro_reg(short *data, unsigned long *timestamp);
-int mpu_get_accel_reg(short *data, unsigned long *timestamp);
-int mpu_get_compass_reg(short *data, unsigned long *timestamp);
-int mpu_get_temperature(long *data, unsigned long *timestamp);
-
-int mpu_get_int_status(short *status);
-int mpu_read_fifo(short *gyro, short *accel, unsigned long *timestamp,
-    unsigned char *sensors, unsigned char *more);
-int mpu_read_fifo_stream(unsigned short length, unsigned char *data,
-    unsigned char *more);
-int mpu_reset_fifo(void);
-
-int mpu_write_mem(unsigned short mem_addr, unsigned short length,
-    unsigned char *data);
-int mpu_read_mem(unsigned short mem_addr, unsigned short length,
-    unsigned char *data);
-int mpu_load_firmware(unsigned short length, const unsigned char *firmware,
-    unsigned short start_addr, unsigned short sample_rate);
-
-int mpu_reg_dump(void);
-int mpu_read_reg(unsigned char reg, unsigned char *data);
-int mpu_run_self_test(long *gyro, long *accel);
-int mpu_register_tap_cb(void (*func)(unsigned char, unsigned char));
-
-#endif  /* #ifndef _INV_MPU_H_ */
-

+ 0 - 1380
Core备份3/imu5/inv_mpu_dmp_motion_driver5.c

@@ -1,1380 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011-2012 InvenSense Corporation, All Rights Reserved.
-    See included License.txt for License information.
- $
- */
-/**
- *  @addtogroup  DRIVERS Sensor Driver Layer
- *  @brief       Hardware drivers to communicate with sensors via I2C.
- *
- *  @{
- *      @file       inv_mpu_dmp_motion_driver.c
- *      @brief      DMP image and interface functions.
- *      @details    All functions are preceded by the dmp_ prefix to
- *                  differentiate among MPL and general driver function calls.
- */
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include "inv_mpu5.h"
-#include "inv_mpu_dmp_motion_driver5.h"
-#include "dmpKey5.h"
-#include "dmpmap5.h"
-
-#include "MPU60505.h"
-
-/* The following functions must be defined for this platform:
- * i2c_write(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char const *data)
- * i2c_read(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char *data)
- * delay_ms(unsigned long num_ms)
- * get_ms(unsigned long *count)
- */
-#if defined MOTION_DRIVER_TARGET_MSP430
-#include "msp430.h"
-#include "msp430_clock.h"
-#define delay_ms    msp430_delay_ms
-#define get_ms      msp430_get_clock_ms
-#define log_i(...)     do {} while (0)
-#define log_e(...)     do {} while (0)
-
-#elif defined EMPL_TARGET_MSP430
-#include "msp430.h"
-#include "msp430_clock.h"
-#include "log.h"
-#define delay_ms    msp430_delay_ms
-#define get_ms      msp430_get_clock_ms
-#define log_i       MPL_LOGI
-#define log_e       MPL_LOGE
-
-#elif defined EMPL_TARGET_UC3L0
-/* Instead of using the standard TWI driver from the ASF library, we're using
- * a TWI driver that follows the slave address + register address convention.
- */
-#include "delay.h"
-#include "sysclk.h"
-#include "log.h"
-#include "uc3l0_clock.h"
-/* delay_ms is a function already defined in ASF. */
-#define get_ms  uc3l0_get_clock_ms
-#define log_i       MPL_LOGI
-#define log_e       MPL_LOGE
-
-#elif defined MOTION_DRIVER_TARGET_STM32
-
-#define delay_ms    HAL_Delay
-#define get_ms      get_tick_count
-
-#define log_i(...)     do {} while (0)
-#define log_e(...)     do {} while (0)
-
-#else
-#error  Gyro driver is missing the system layer implementations.
-#endif
-
-/* These defines are copied from dmpDefaultMPU6050.c in the general MPL
- * releases. These defines may change for each DMP image, so be sure to modify
- * these values when switching to a new image.
- */
-#define CFG_LP_QUAT             (2712)
-#define END_ORIENT_TEMP         (1866)
-#define CFG_27                  (2742)
-#define CFG_20                  (2224)
-#define CFG_23                  (2745)
-#define CFG_FIFO_ON_EVENT       (2690)
-#define END_PREDICTION_UPDATE   (1761)
-#define CGNOTICE_INTR           (2620)
-#define X_GRT_Y_TMP             (1358)
-#define CFG_DR_INT              (1029)
-#define CFG_AUTH                (1035)
-#define UPDATE_PROP_ROT         (1835)
-#define END_COMPARE_Y_X_TMP2    (1455)
-#define SKIP_X_GRT_Y_TMP        (1359)
-#define SKIP_END_COMPARE        (1435)
-#define FCFG_3                  (1088)
-#define FCFG_2                  (1066)
-#define FCFG_1                  (1062)
-#define END_COMPARE_Y_X_TMP3    (1434)
-#define FCFG_7                  (1073)
-#define FCFG_6                  (1106)
-#define FLAT_STATE_END          (1713)
-#define SWING_END_4             (1616)
-#define SWING_END_2             (1565)
-#define SWING_END_3             (1587)
-#define SWING_END_1             (1550)
-#define CFG_8                   (2718)
-#define CFG_15                  (2727)
-#define CFG_16                  (2746)
-#define CFG_EXT_GYRO_BIAS       (1189)
-#define END_COMPARE_Y_X_TMP     (1407)
-#define DO_NOT_UPDATE_PROP_ROT  (1839)
-#define CFG_7                   (1205)
-#define FLAT_STATE_END_TEMP     (1683)
-#define END_COMPARE_Y_X         (1484)
-#define SKIP_SWING_END_1        (1551)
-#define SKIP_SWING_END_3        (1588)
-#define SKIP_SWING_END_2        (1566)
-#define TILTG75_START           (1672)
-#define CFG_6                   (2753)
-#define TILTL75_END             (1669)
-#define END_ORIENT              (1884)
-#define CFG_FLICK_IN            (2573)
-#define TILTL75_START           (1643)
-#define CFG_MOTION_BIAS         (1208)
-#define X_GRT_Y                 (1408)
-#define TEMPLABEL               (2324)
-#define CFG_ANDROID_ORIENT_INT  (1853)
-#define CFG_GYRO_RAW_DATA       (2722)
-#define X_GRT_Y_TMP2            (1379)
-
-#define D_0_22                  (22+512)
-#define D_0_24                  (24+512)
-
-#define D_0_36                  (36)
-#define D_0_52                  (52)
-#define D_0_96                  (96)
-#define D_0_104                 (104)
-#define D_0_108                 (108)
-#define D_0_163                 (163)
-#define D_0_188                 (188)
-#define D_0_192                 (192)
-#define D_0_224                 (224)
-#define D_0_228                 (228)
-#define D_0_232                 (232)
-#define D_0_236                 (236)
-
-#define D_1_2                   (256 + 2)
-#define D_1_4                   (256 + 4)
-#define D_1_8                   (256 + 8)
-#define D_1_10                  (256 + 10)
-#define D_1_24                  (256 + 24)
-#define D_1_28                  (256 + 28)
-#define D_1_36                  (256 + 36)
-#define D_1_40                  (256 + 40)
-#define D_1_44                  (256 + 44)
-#define D_1_72                  (256 + 72)
-#define D_1_74                  (256 + 74)
-#define D_1_79                  (256 + 79)
-#define D_1_88                  (256 + 88)
-#define D_1_90                  (256 + 90)
-#define D_1_92                  (256 + 92)
-#define D_1_96                  (256 + 96)
-#define D_1_98                  (256 + 98)
-#define D_1_106                 (256 + 106)
-#define D_1_108                 (256 + 108)
-#define D_1_112                 (256 + 112)
-#define D_1_128                 (256 + 144)
-#define D_1_152                 (256 + 12)
-#define D_1_160                 (256 + 160)
-#define D_1_176                 (256 + 176)
-#define D_1_178                 (256 + 178)
-#define D_1_218                 (256 + 218)
-#define D_1_232                 (256 + 232)
-#define D_1_236                 (256 + 236)
-#define D_1_240                 (256 + 240)
-#define D_1_244                 (256 + 244)
-#define D_1_250                 (256 + 250)
-#define D_1_252                 (256 + 252)
-#define D_2_12                  (512 + 12)
-#define D_2_96                  (512 + 96)
-#define D_2_108                 (512 + 108)
-#define D_2_208                 (512 + 208)
-#define D_2_224                 (512 + 224)
-#define D_2_236                 (512 + 236)
-#define D_2_244                 (512 + 244)
-#define D_2_248                 (512 + 248)
-#define D_2_252                 (512 + 252)
-
-#define CPASS_BIAS_X            (35 * 16 + 4)
-#define CPASS_BIAS_Y            (35 * 16 + 8)
-#define CPASS_BIAS_Z            (35 * 16 + 12)
-#define CPASS_MTX_00            (36 * 16)
-#define CPASS_MTX_01            (36 * 16 + 4)
-#define CPASS_MTX_02            (36 * 16 + 8)
-#define CPASS_MTX_10            (36 * 16 + 12)
-#define CPASS_MTX_11            (37 * 16)
-#define CPASS_MTX_12            (37 * 16 + 4)
-#define CPASS_MTX_20            (37 * 16 + 8)
-#define CPASS_MTX_21            (37 * 16 + 12)
-#define CPASS_MTX_22            (43 * 16 + 12)
-#define D_EXT_GYRO_BIAS_X       (61 * 16)
-#define D_EXT_GYRO_BIAS_Y       (61 * 16) + 4
-#define D_EXT_GYRO_BIAS_Z       (61 * 16) + 8
-#define D_ACT0                  (40 * 16)
-#define D_ACSX                  (40 * 16 + 4)
-#define D_ACSY                  (40 * 16 + 8)
-#define D_ACSZ                  (40 * 16 + 12)
-
-#define FLICK_MSG               (45 * 16 + 4)
-#define FLICK_COUNTER           (45 * 16 + 8)
-#define FLICK_LOWER             (45 * 16 + 12)
-#define FLICK_UPPER             (46 * 16 + 12)
-
-#define D_AUTH_OUT              (992)
-#define D_AUTH_IN               (996)
-#define D_AUTH_A                (1000)
-#define D_AUTH_B                (1004)
-
-#define D_PEDSTD_BP_B           (768 + 0x1C)
-#define D_PEDSTD_HP_A           (768 + 0x78)
-#define D_PEDSTD_HP_B           (768 + 0x7C)
-#define D_PEDSTD_BP_A4          (768 + 0x40)
-#define D_PEDSTD_BP_A3          (768 + 0x44)
-#define D_PEDSTD_BP_A2          (768 + 0x48)
-#define D_PEDSTD_BP_A1          (768 + 0x4C)
-#define D_PEDSTD_INT_THRSH      (768 + 0x68)
-#define D_PEDSTD_CLIP           (768 + 0x6C)
-#define D_PEDSTD_SB             (768 + 0x28)
-#define D_PEDSTD_SB_TIME        (768 + 0x2C)
-#define D_PEDSTD_PEAKTHRSH      (768 + 0x98)
-#define D_PEDSTD_TIML           (768 + 0x2A)
-#define D_PEDSTD_TIMH           (768 + 0x2E)
-#define D_PEDSTD_PEAK           (768 + 0X94)
-#define D_PEDSTD_STEPCTR        (768 + 0x60)
-#define D_PEDSTD_TIMECTR        (964)
-#define D_PEDSTD_DECI           (768 + 0xA0)
-
-#define D_HOST_NO_MOT           (976)
-#define D_ACCEL_BIAS            (660)
-
-#define D_ORIENT_GAP            (76)
-
-#define D_TILT0_H               (48)
-#define D_TILT0_L               (50)
-#define D_TILT1_H               (52)
-#define D_TILT1_L               (54)
-#define D_TILT2_H               (56)
-#define D_TILT2_L               (58)
-#define D_TILT3_H               (60)
-#define D_TILT3_L               (62)
-
-#define DMP_CODE_SIZE           (3062)
-
-static const unsigned char dmp_memory[DMP_CODE_SIZE] = {
-    /* bank # 0 */
-    0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x00, 0x00,
-    0x00, 0x65, 0x00, 0x54, 0xff, 0xef, 0x00, 0x00, 0xfa, 0x80, 0x00, 0x0b, 0x12, 0x82, 0x00, 0x01,
-    0x03, 0x0c, 0x30, 0xc3, 0x0e, 0x8c, 0x8c, 0xe9, 0x14, 0xd5, 0x40, 0x02, 0x13, 0x71, 0x0f, 0x8e,
-    0x38, 0x83, 0xf8, 0x83, 0x30, 0x00, 0xf8, 0x83, 0x25, 0x8e, 0xf8, 0x83, 0x30, 0x00, 0xf8, 0x83,
-    0xff, 0xff, 0xff, 0xff, 0x0f, 0xfe, 0xa9, 0xd6, 0x24, 0x00, 0x04, 0x00, 0x1a, 0x82, 0x79, 0xa1,
-    0x00, 0x00, 0x00, 0x3c, 0xff, 0xff, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x38, 0x83, 0x6f, 0xa2,
-    0x00, 0x3e, 0x03, 0x30, 0x40, 0x00, 0x00, 0x00, 0x02, 0xca, 0xe3, 0x09, 0x3e, 0x80, 0x00, 0x00,
-    0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
-    0x00, 0x0c, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x6e, 0x00, 0x00, 0x06, 0x92, 0x0a, 0x16, 0xc0, 0xdf,
-    0xff, 0xff, 0x02, 0x56, 0xfd, 0x8c, 0xd3, 0x77, 0xff, 0xe1, 0xc4, 0x96, 0xe0, 0xc5, 0xbe, 0xaa,
-    0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0b, 0x2b, 0x00, 0x00, 0x16, 0x57, 0x00, 0x00, 0x03, 0x59,
-    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0xfa, 0x00, 0x02, 0x6c, 0x1d, 0x00, 0x00, 0x00, 0x00,
-    0x3f, 0xff, 0xdf, 0xeb, 0x00, 0x3e, 0xb3, 0xb6, 0x00, 0x0d, 0x22, 0x78, 0x00, 0x00, 0x2f, 0x3c,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x42, 0xb5, 0x00, 0x00, 0x39, 0xa2, 0x00, 0x00, 0xb3, 0x65,
-    0xd9, 0x0e, 0x9f, 0xc9, 0x1d, 0xcf, 0x4c, 0x34, 0x30, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00,
-    0x3b, 0xb6, 0x7a, 0xe8, 0x00, 0x64, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    /* bank # 1 */
-    0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0xfa, 0x92, 0x10, 0x00, 0x22, 0x5e, 0x00, 0x0d, 0x22, 0x9f,
-    0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0xff, 0x46, 0x00, 0x00, 0x63, 0xd4, 0x00, 0x00,
-    0x10, 0x00, 0x00, 0x00, 0x04, 0xd6, 0x00, 0x00, 0x04, 0xcc, 0x00, 0x00, 0x04, 0xcc, 0x00, 0x00,
-    0x00, 0x00, 0x10, 0x72, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x06, 0x00, 0x02, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x64, 0x00, 0x20, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, 0x00,
-    0x00, 0x00, 0x00, 0x32, 0xf8, 0x98, 0x00, 0x00, 0xff, 0x65, 0x00, 0x00, 0x83, 0x0f, 0x00, 0x00,
-    0xff, 0x9b, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
-    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0xb2, 0x6a, 0x00, 0x02, 0x00, 0x00,
-    0x00, 0x01, 0xfb, 0x83, 0x00, 0x68, 0x00, 0x00, 0x00, 0xd9, 0xfc, 0x00, 0x7c, 0xf1, 0xff, 0x83,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x64, 0x03, 0xe8, 0x00, 0x64, 0x00, 0x28,
-    0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x16, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
-    0x00, 0x00, 0x10, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x01, 0xf4, 0x00, 0x00, 0x10, 0x00,
-    /* bank # 2 */
-    0x00, 0x28, 0x00, 0x00, 0xff, 0xff, 0x45, 0x81, 0xff, 0xff, 0xfa, 0x72, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x05, 0x00, 0x05, 0xba, 0xc6, 0x00, 0x47, 0x78, 0xa2,
-    0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x14,
-    0x00, 0x00, 0x25, 0x4d, 0x00, 0x2f, 0x70, 0x6d, 0x00, 0x00, 0x05, 0xae, 0x00, 0x0c, 0x02, 0xd0,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x64, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x0e,
-    0x00, 0x00, 0x0a, 0xc7, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0xff, 0xff, 0xff, 0x9c,
-    0x00, 0x00, 0x0b, 0x2b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x64,
-    0xff, 0xe5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    /* bank # 3 */
-    0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x24, 0x26, 0xd3,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x96, 0x00, 0x3c,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x0c, 0x0a, 0x4e, 0x68, 0xcd, 0xcf, 0x77, 0x09, 0x50, 0x16, 0x67, 0x59, 0xc6, 0x19, 0xce, 0x82,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xd7, 0x84, 0x00, 0x03, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc7, 0x93, 0x8f, 0x9d, 0x1e, 0x1b, 0x1c, 0x19,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x18, 0x85, 0x00, 0x00, 0x40, 0x00,
-    0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x67, 0x7d, 0xdf, 0x7e, 0x72, 0x90, 0x2e, 0x55, 0x4c, 0xf6, 0xe6, 0x88,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-
-    /* bank # 4 */
-    0xd8, 0xdc, 0xb4, 0xb8, 0xb0, 0xd8, 0xb9, 0xab, 0xf3, 0xf8, 0xfa, 0xb3, 0xb7, 0xbb, 0x8e, 0x9e,
-    0xae, 0xf1, 0x32, 0xf5, 0x1b, 0xf1, 0xb4, 0xb8, 0xb0, 0x80, 0x97, 0xf1, 0xa9, 0xdf, 0xdf, 0xdf,
-    0xaa, 0xdf, 0xdf, 0xdf, 0xf2, 0xaa, 0xc5, 0xcd, 0xc7, 0xa9, 0x0c, 0xc9, 0x2c, 0x97, 0xf1, 0xa9,
-    0x89, 0x26, 0x46, 0x66, 0xb2, 0x89, 0x99, 0xa9, 0x2d, 0x55, 0x7d, 0xb0, 0xb0, 0x8a, 0xa8, 0x96,
-    0x36, 0x56, 0x76, 0xf1, 0xba, 0xa3, 0xb4, 0xb2, 0x80, 0xc0, 0xb8, 0xa8, 0x97, 0x11, 0xb2, 0x83,
-    0x98, 0xba, 0xa3, 0xf0, 0x24, 0x08, 0x44, 0x10, 0x64, 0x18, 0xb2, 0xb9, 0xb4, 0x98, 0x83, 0xf1,
-    0xa3, 0x29, 0x55, 0x7d, 0xba, 0xb5, 0xb1, 0xa3, 0x83, 0x93, 0xf0, 0x00, 0x28, 0x50, 0xf5, 0xb2,
-    0xb6, 0xaa, 0x83, 0x93, 0x28, 0x54, 0x7c, 0xf1, 0xb9, 0xa3, 0x82, 0x93, 0x61, 0xba, 0xa2, 0xda,
-    0xde, 0xdf, 0xdb, 0x81, 0x9a, 0xb9, 0xae, 0xf5, 0x60, 0x68, 0x70, 0xf1, 0xda, 0xba, 0xa2, 0xdf,
-    0xd9, 0xba, 0xa2, 0xfa, 0xb9, 0xa3, 0x82, 0x92, 0xdb, 0x31, 0xba, 0xa2, 0xd9, 0xba, 0xa2, 0xf8,
-    0xdf, 0x85, 0xa4, 0xd0, 0xc1, 0xbb, 0xad, 0x83, 0xc2, 0xc5, 0xc7, 0xb8, 0xa2, 0xdf, 0xdf, 0xdf,
-    0xba, 0xa0, 0xdf, 0xdf, 0xdf, 0xd8, 0xd8, 0xf1, 0xb8, 0xaa, 0xb3, 0x8d, 0xb4, 0x98, 0x0d, 0x35,
-    0x5d, 0xb2, 0xb6, 0xba, 0xaf, 0x8c, 0x96, 0x19, 0x8f, 0x9f, 0xa7, 0x0e, 0x16, 0x1e, 0xb4, 0x9a,
-    0xb8, 0xaa, 0x87, 0x2c, 0x54, 0x7c, 0xba, 0xa4, 0xb0, 0x8a, 0xb6, 0x91, 0x32, 0x56, 0x76, 0xb2,
-    0x84, 0x94, 0xa4, 0xc8, 0x08, 0xcd, 0xd8, 0xb8, 0xb4, 0xb0, 0xf1, 0x99, 0x82, 0xa8, 0x2d, 0x55,
-    0x7d, 0x98, 0xa8, 0x0e, 0x16, 0x1e, 0xa2, 0x2c, 0x54, 0x7c, 0x92, 0xa4, 0xf0, 0x2c, 0x50, 0x78,
-    /* bank # 5 */
-    0xf1, 0x84, 0xa8, 0x98, 0xc4, 0xcd, 0xfc, 0xd8, 0x0d, 0xdb, 0xa8, 0xfc, 0x2d, 0xf3, 0xd9, 0xba,
-    0xa6, 0xf8, 0xda, 0xba, 0xa6, 0xde, 0xd8, 0xba, 0xb2, 0xb6, 0x86, 0x96, 0xa6, 0xd0, 0xf3, 0xc8,
-    0x41, 0xda, 0xa6, 0xc8, 0xf8, 0xd8, 0xb0, 0xb4, 0xb8, 0x82, 0xa8, 0x92, 0xf5, 0x2c, 0x54, 0x88,
-    0x98, 0xf1, 0x35, 0xd9, 0xf4, 0x18, 0xd8, 0xf1, 0xa2, 0xd0, 0xf8, 0xf9, 0xa8, 0x84, 0xd9, 0xc7,
-    0xdf, 0xf8, 0xf8, 0x83, 0xc5, 0xda, 0xdf, 0x69, 0xdf, 0x83, 0xc1, 0xd8, 0xf4, 0x01, 0x14, 0xf1,
-    0xa8, 0x82, 0x4e, 0xa8, 0x84, 0xf3, 0x11, 0xd1, 0x82, 0xf5, 0xd9, 0x92, 0x28, 0x97, 0x88, 0xf1,
-    0x09, 0xf4, 0x1c, 0x1c, 0xd8, 0x84, 0xa8, 0xf3, 0xc0, 0xf9, 0xd1, 0xd9, 0x97, 0x82, 0xf1, 0x29,
-    0xf4, 0x0d, 0xd8, 0xf3, 0xf9, 0xf9, 0xd1, 0xd9, 0x82, 0xf4, 0xc2, 0x03, 0xd8, 0xde, 0xdf, 0x1a,
-    0xd8, 0xf1, 0xa2, 0xfa, 0xf9, 0xa8, 0x84, 0x98, 0xd9, 0xc7, 0xdf, 0xf8, 0xf8, 0xf8, 0x83, 0xc7,
-    0xda, 0xdf, 0x69, 0xdf, 0xf8, 0x83, 0xc3, 0xd8, 0xf4, 0x01, 0x14, 0xf1, 0x98, 0xa8, 0x82, 0x2e,
-    0xa8, 0x84, 0xf3, 0x11, 0xd1, 0x82, 0xf5, 0xd9, 0x92, 0x50, 0x97, 0x88, 0xf1, 0x09, 0xf4, 0x1c,
-    0xd8, 0x84, 0xa8, 0xf3, 0xc0, 0xf8, 0xf9, 0xd1, 0xd9, 0x97, 0x82, 0xf1, 0x49, 0xf4, 0x0d, 0xd8,
-    0xf3, 0xf9, 0xf9, 0xd1, 0xd9, 0x82, 0xf4, 0xc4, 0x03, 0xd8, 0xde, 0xdf, 0xd8, 0xf1, 0xad, 0x88,
-    0x98, 0xcc, 0xa8, 0x09, 0xf9, 0xd9, 0x82, 0x92, 0xa8, 0xf5, 0x7c, 0xf1, 0x88, 0x3a, 0xcf, 0x94,
-    0x4a, 0x6e, 0x98, 0xdb, 0x69, 0x31, 0xda, 0xad, 0xf2, 0xde, 0xf9, 0xd8, 0x87, 0x95, 0xa8, 0xf2,
-    0x21, 0xd1, 0xda, 0xa5, 0xf9, 0xf4, 0x17, 0xd9, 0xf1, 0xae, 0x8e, 0xd0, 0xc0, 0xc3, 0xae, 0x82,
-    /* bank # 6 */
-    0xc6, 0x84, 0xc3, 0xa8, 0x85, 0x95, 0xc8, 0xa5, 0x88, 0xf2, 0xc0, 0xf1, 0xf4, 0x01, 0x0e, 0xf1,
-    0x8e, 0x9e, 0xa8, 0xc6, 0x3e, 0x56, 0xf5, 0x54, 0xf1, 0x88, 0x72, 0xf4, 0x01, 0x15, 0xf1, 0x98,
-    0x45, 0x85, 0x6e, 0xf5, 0x8e, 0x9e, 0x04, 0x88, 0xf1, 0x42, 0x98, 0x5a, 0x8e, 0x9e, 0x06, 0x88,
-    0x69, 0xf4, 0x01, 0x1c, 0xf1, 0x98, 0x1e, 0x11, 0x08, 0xd0, 0xf5, 0x04, 0xf1, 0x1e, 0x97, 0x02,
-    0x02, 0x98, 0x36, 0x25, 0xdb, 0xf9, 0xd9, 0x85, 0xa5, 0xf3, 0xc1, 0xda, 0x85, 0xa5, 0xf3, 0xdf,
-    0xd8, 0x85, 0x95, 0xa8, 0xf3, 0x09, 0xda, 0xa5, 0xfa, 0xd8, 0x82, 0x92, 0xa8, 0xf5, 0x78, 0xf1,
-    0x88, 0x1a, 0x84, 0x9f, 0x26, 0x88, 0x98, 0x21, 0xda, 0xf4, 0x1d, 0xf3, 0xd8, 0x87, 0x9f, 0x39,
-    0xd1, 0xaf, 0xd9, 0xdf, 0xdf, 0xfb, 0xf9, 0xf4, 0x0c, 0xf3, 0xd8, 0xfa, 0xd0, 0xf8, 0xda, 0xf9,
-    0xf9, 0xd0, 0xdf, 0xd9, 0xf9, 0xd8, 0xf4, 0x0b, 0xd8, 0xf3, 0x87, 0x9f, 0x39, 0xd1, 0xaf, 0xd9,
-    0xdf, 0xdf, 0xf4, 0x1d, 0xf3, 0xd8, 0xfa, 0xfc, 0xa8, 0x69, 0xf9, 0xf9, 0xaf, 0xd0, 0xda, 0xde,
-    0xfa, 0xd9, 0xf8, 0x8f, 0x9f, 0xa8, 0xf1, 0xcc, 0xf3, 0x98, 0xdb, 0x45, 0xd9, 0xaf, 0xdf, 0xd0,
-    0xf8, 0xd8, 0xf1, 0x8f, 0x9f, 0xa8, 0xca, 0xf3, 0x88, 0x09, 0xda, 0xaf, 0x8f, 0xcb, 0xf8, 0xd8,
-    0xf2, 0xad, 0x97, 0x8d, 0x0c, 0xd9, 0xa5, 0xdf, 0xf9, 0xba, 0xa6, 0xf3, 0xfa, 0xf4, 0x12, 0xf2,
-    0xd8, 0x95, 0x0d, 0xd1, 0xd9, 0xba, 0xa6, 0xf3, 0xfa, 0xda, 0xa5, 0xf2, 0xc1, 0xba, 0xa6, 0xf3,
-    0xdf, 0xd8, 0xf1, 0xba, 0xb2, 0xb6, 0x86, 0x96, 0xa6, 0xd0, 0xca, 0xf3, 0x49, 0xda, 0xa6, 0xcb,
-    0xf8, 0xd8, 0xb0, 0xb4, 0xb8, 0xd8, 0xad, 0x84, 0xf2, 0xc0, 0xdf, 0xf1, 0x8f, 0xcb, 0xc3, 0xa8,
-    /* bank # 7 */
-    0xb2, 0xb6, 0x86, 0x96, 0xc8, 0xc1, 0xcb, 0xc3, 0xf3, 0xb0, 0xb4, 0x88, 0x98, 0xa8, 0x21, 0xdb,
-    0x71, 0x8d, 0x9d, 0x71, 0x85, 0x95, 0x21, 0xd9, 0xad, 0xf2, 0xfa, 0xd8, 0x85, 0x97, 0xa8, 0x28,
-    0xd9, 0xf4, 0x08, 0xd8, 0xf2, 0x8d, 0x29, 0xda, 0xf4, 0x05, 0xd9, 0xf2, 0x85, 0xa4, 0xc2, 0xf2,
-    0xd8, 0xa8, 0x8d, 0x94, 0x01, 0xd1, 0xd9, 0xf4, 0x11, 0xf2, 0xd8, 0x87, 0x21, 0xd8, 0xf4, 0x0a,
-    0xd8, 0xf2, 0x84, 0x98, 0xa8, 0xc8, 0x01, 0xd1, 0xd9, 0xf4, 0x11, 0xd8, 0xf3, 0xa4, 0xc8, 0xbb,
-    0xaf, 0xd0, 0xf2, 0xde, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xd8, 0xf1, 0xb8, 0xf6,
-    0xb5, 0xb9, 0xb0, 0x8a, 0x95, 0xa3, 0xde, 0x3c, 0xa3, 0xd9, 0xf8, 0xd8, 0x5c, 0xa3, 0xd9, 0xf8,
-    0xd8, 0x7c, 0xa3, 0xd9, 0xf8, 0xd8, 0xf8, 0xf9, 0xd1, 0xa5, 0xd9, 0xdf, 0xda, 0xfa, 0xd8, 0xb1,
-    0x85, 0x30, 0xf7, 0xd9, 0xde, 0xd8, 0xf8, 0x30, 0xad, 0xda, 0xde, 0xd8, 0xf2, 0xb4, 0x8c, 0x99,
-    0xa3, 0x2d, 0x55, 0x7d, 0xa0, 0x83, 0xdf, 0xdf, 0xdf, 0xb5, 0x91, 0xa0, 0xf6, 0x29, 0xd9, 0xfb,
-    0xd8, 0xa0, 0xfc, 0x29, 0xd9, 0xfa, 0xd8, 0xa0, 0xd0, 0x51, 0xd9, 0xf8, 0xd8, 0xfc, 0x51, 0xd9,
-    0xf9, 0xd8, 0x79, 0xd9, 0xfb, 0xd8, 0xa0, 0xd0, 0xfc, 0x79, 0xd9, 0xfa, 0xd8, 0xa1, 0xf9, 0xf9,
-    0xf9, 0xf9, 0xf9, 0xa0, 0xda, 0xdf, 0xdf, 0xdf, 0xd8, 0xa1, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xac,
-    0xde, 0xf8, 0xad, 0xde, 0x83, 0x93, 0xac, 0x2c, 0x54, 0x7c, 0xf1, 0xa8, 0xdf, 0xdf, 0xdf, 0xf6,
-    0x9d, 0x2c, 0xda, 0xa0, 0xdf, 0xd9, 0xfa, 0xdb, 0x2d, 0xf8, 0xd8, 0xa8, 0x50, 0xda, 0xa0, 0xd0,
-    0xde, 0xd9, 0xd0, 0xf8, 0xf8, 0xf8, 0xdb, 0x55, 0xf8, 0xd8, 0xa8, 0x78, 0xda, 0xa0, 0xd0, 0xdf,
-    /* bank # 8 */
-    0xd9, 0xd0, 0xfa, 0xf8, 0xf8, 0xf8, 0xf8, 0xdb, 0x7d, 0xf8, 0xd8, 0x9c, 0xa8, 0x8c, 0xf5, 0x30,
-    0xdb, 0x38, 0xd9, 0xd0, 0xde, 0xdf, 0xa0, 0xd0, 0xde, 0xdf, 0xd8, 0xa8, 0x48, 0xdb, 0x58, 0xd9,
-    0xdf, 0xd0, 0xde, 0xa0, 0xdf, 0xd0, 0xde, 0xd8, 0xa8, 0x68, 0xdb, 0x70, 0xd9, 0xdf, 0xdf, 0xa0,
-    0xdf, 0xdf, 0xd8, 0xf1, 0xa8, 0x88, 0x90, 0x2c, 0x54, 0x7c, 0x98, 0xa8, 0xd0, 0x5c, 0x38, 0xd1,
-    0xda, 0xf2, 0xae, 0x8c, 0xdf, 0xf9, 0xd8, 0xb0, 0x87, 0xa8, 0xc1, 0xc1, 0xb1, 0x88, 0xa8, 0xc6,
-    0xf9, 0xf9, 0xda, 0x36, 0xd8, 0xa8, 0xf9, 0xda, 0x36, 0xd8, 0xa8, 0xf9, 0xda, 0x36, 0xd8, 0xa8,
-    0xf9, 0xda, 0x36, 0xd8, 0xa8, 0xf9, 0xda, 0x36, 0xd8, 0xf7, 0x8d, 0x9d, 0xad, 0xf8, 0x18, 0xda,
-    0xf2, 0xae, 0xdf, 0xd8, 0xf7, 0xad, 0xfa, 0x30, 0xd9, 0xa4, 0xde, 0xf9, 0xd8, 0xf2, 0xae, 0xde,
-    0xfa, 0xf9, 0x83, 0xa7, 0xd9, 0xc3, 0xc5, 0xc7, 0xf1, 0x88, 0x9b, 0xa7, 0x7a, 0xad, 0xf7, 0xde,
-    0xdf, 0xa4, 0xf8, 0x84, 0x94, 0x08, 0xa7, 0x97, 0xf3, 0x00, 0xae, 0xf2, 0x98, 0x19, 0xa4, 0x88,
-    0xc6, 0xa3, 0x94, 0x88, 0xf6, 0x32, 0xdf, 0xf2, 0x83, 0x93, 0xdb, 0x09, 0xd9, 0xf2, 0xaa, 0xdf,
-    0xd8, 0xd8, 0xae, 0xf8, 0xf9, 0xd1, 0xda, 0xf3, 0xa4, 0xde, 0xa7, 0xf1, 0x88, 0x9b, 0x7a, 0xd8,
-    0xf3, 0x84, 0x94, 0xae, 0x19, 0xf9, 0xda, 0xaa, 0xf1, 0xdf, 0xd8, 0xa8, 0x81, 0xc0, 0xc3, 0xc5,
-    0xc7, 0xa3, 0x92, 0x83, 0xf6, 0x28, 0xad, 0xde, 0xd9, 0xf8, 0xd8, 0xa3, 0x50, 0xad, 0xd9, 0xf8,
-    0xd8, 0xa3, 0x78, 0xad, 0xd9, 0xf8, 0xd8, 0xf8, 0xf9, 0xd1, 0xa1, 0xda, 0xde, 0xc3, 0xc5, 0xc7,
-    0xd8, 0xa1, 0x81, 0x94, 0xf8, 0x18, 0xf2, 0xb0, 0x89, 0xac, 0xc3, 0xc5, 0xc7, 0xf1, 0xd8, 0xb8,
-    /* bank # 9 */
-    0xb4, 0xb0, 0x97, 0x86, 0xa8, 0x31, 0x9b, 0x06, 0x99, 0x07, 0xab, 0x97, 0x28, 0x88, 0x9b, 0xf0,
-    0x0c, 0x20, 0x14, 0x40, 0xb0, 0xb4, 0xb8, 0xf0, 0xa8, 0x8a, 0x9a, 0x28, 0x50, 0x78, 0xb7, 0x9b,
-    0xa8, 0x29, 0x51, 0x79, 0x24, 0x70, 0x59, 0x44, 0x69, 0x38, 0x64, 0x48, 0x31, 0xf1, 0xbb, 0xab,
-    0x88, 0x00, 0x2c, 0x54, 0x7c, 0xf0, 0xb3, 0x8b, 0xb8, 0xa8, 0x04, 0x28, 0x50, 0x78, 0xf1, 0xb0,
-    0x88, 0xb4, 0x97, 0x26, 0xa8, 0x59, 0x98, 0xbb, 0xab, 0xb3, 0x8b, 0x02, 0x26, 0x46, 0x66, 0xb0,
-    0xb8, 0xf0, 0x8a, 0x9c, 0xa8, 0x29, 0x51, 0x79, 0x8b, 0x29, 0x51, 0x79, 0x8a, 0x24, 0x70, 0x59,
-    0x8b, 0x20, 0x58, 0x71, 0x8a, 0x44, 0x69, 0x38, 0x8b, 0x39, 0x40, 0x68, 0x8a, 0x64, 0x48, 0x31,
-    0x8b, 0x30, 0x49, 0x60, 0x88, 0xf1, 0xac, 0x00, 0x2c, 0x54, 0x7c, 0xf0, 0x8c, 0xa8, 0x04, 0x28,
-    0x50, 0x78, 0xf1, 0x88, 0x97, 0x26, 0xa8, 0x59, 0x98, 0xac, 0x8c, 0x02, 0x26, 0x46, 0x66, 0xf0,
-    0x89, 0x9c, 0xa8, 0x29, 0x51, 0x79, 0x24, 0x70, 0x59, 0x44, 0x69, 0x38, 0x64, 0x48, 0x31, 0xa9,
-    0x88, 0x09, 0x20, 0x59, 0x70, 0xab, 0x11, 0x38, 0x40, 0x69, 0xa8, 0x19, 0x31, 0x48, 0x60, 0x8c,
-    0xa8, 0x3c, 0x41, 0x5c, 0x20, 0x7c, 0x00, 0xf1, 0x87, 0x98, 0x19, 0x86, 0xa8, 0x6e, 0x76, 0x7e,
-    0xa9, 0x99, 0x88, 0x2d, 0x55, 0x7d, 0xd8, 0xb1, 0xb5, 0xb9, 0xa3, 0xdf, 0xdf, 0xdf, 0xae, 0xd0,
-    0xdf, 0xaa, 0xd0, 0xde, 0xf2, 0xab, 0xf8, 0xf9, 0xd9, 0xb0, 0x87, 0xc4, 0xaa, 0xf1, 0xdf, 0xdf,
-    0xbb, 0xaf, 0xdf, 0xdf, 0xb9, 0xd8, 0xb1, 0xf1, 0xa3, 0x97, 0x8e, 0x60, 0xdf, 0xb0, 0x84, 0xf2,
-    0xc8, 0xf8, 0xf9, 0xd9, 0xde, 0xd8, 0x93, 0x85, 0xf1, 0x4a, 0xb1, 0x83, 0xa3, 0x08, 0xb5, 0x83,
-    /* bank # 10 */
-    0x9a, 0x08, 0x10, 0xb7, 0x9f, 0x10, 0xd8, 0xf1, 0xb0, 0xba, 0xae, 0xb0, 0x8a, 0xc2, 0xb2, 0xb6,
-    0x8e, 0x9e, 0xf1, 0xfb, 0xd9, 0xf4, 0x1d, 0xd8, 0xf9, 0xd9, 0x0c, 0xf1, 0xd8, 0xf8, 0xf8, 0xad,
-    0x61, 0xd9, 0xae, 0xfb, 0xd8, 0xf4, 0x0c, 0xf1, 0xd8, 0xf8, 0xf8, 0xad, 0x19, 0xd9, 0xae, 0xfb,
-    0xdf, 0xd8, 0xf4, 0x16, 0xf1, 0xd8, 0xf8, 0xad, 0x8d, 0x61, 0xd9, 0xf4, 0xf4, 0xac, 0xf5, 0x9c,
-    0x9c, 0x8d, 0xdf, 0x2b, 0xba, 0xb6, 0xae, 0xfa, 0xf8, 0xf4, 0x0b, 0xd8, 0xf1, 0xae, 0xd0, 0xf8,
-    0xad, 0x51, 0xda, 0xae, 0xfa, 0xf8, 0xf1, 0xd8, 0xb9, 0xb1, 0xb6, 0xa3, 0x83, 0x9c, 0x08, 0xb9,
-    0xb1, 0x83, 0x9a, 0xb5, 0xaa, 0xc0, 0xfd, 0x30, 0x83, 0xb7, 0x9f, 0x10, 0xb5, 0x8b, 0x93, 0xf2,
-    0x02, 0x02, 0xd1, 0xab, 0xda, 0xde, 0xd8, 0xf1, 0xb0, 0x80, 0xba, 0xab, 0xc0, 0xc3, 0xb2, 0x84,
-    0xc1, 0xc3, 0xd8, 0xb1, 0xb9, 0xf3, 0x8b, 0xa3, 0x91, 0xb6, 0x09, 0xb4, 0xd9, 0xab, 0xde, 0xb0,
-    0x87, 0x9c, 0xb9, 0xa3, 0xdd, 0xf1, 0xb3, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0xb0, 0x87, 0xa3, 0xa3,
-    0xa3, 0xa3, 0xb2, 0x8b, 0xb6, 0x9b, 0xf2, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3,
-    0xa3, 0xf1, 0xb0, 0x87, 0xb5, 0x9a, 0xa3, 0xf3, 0x9b, 0xa3, 0xa3, 0xdc, 0xba, 0xac, 0xdf, 0xb9,
-    0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3,
-    0xd8, 0xd8, 0xd8, 0xbb, 0xb3, 0xb7, 0xf1, 0xaa, 0xf9, 0xda, 0xff, 0xd9, 0x80, 0x9a, 0xaa, 0x28,
-    0xb4, 0x80, 0x98, 0xa7, 0x20, 0xb7, 0x97, 0x87, 0xa8, 0x66, 0x88, 0xf0, 0x79, 0x51, 0xf1, 0x90,
-    0x2c, 0x87, 0x0c, 0xa7, 0x81, 0x97, 0x62, 0x93, 0xf0, 0x71, 0x71, 0x60, 0x85, 0x94, 0x01, 0x29,
-    /* bank # 11 */
-    0x51, 0x79, 0x90, 0xa5, 0xf1, 0x28, 0x4c, 0x6c, 0x87, 0x0c, 0x95, 0x18, 0x85, 0x78, 0xa3, 0x83,
-    0x90, 0x28, 0x4c, 0x6c, 0x88, 0x6c, 0xd8, 0xf3, 0xa2, 0x82, 0x00, 0xf2, 0x10, 0xa8, 0x92, 0x19,
-    0x80, 0xa2, 0xf2, 0xd9, 0x26, 0xd8, 0xf1, 0x88, 0xa8, 0x4d, 0xd9, 0x48, 0xd8, 0x96, 0xa8, 0x39,
-    0x80, 0xd9, 0x3c, 0xd8, 0x95, 0x80, 0xa8, 0x39, 0xa6, 0x86, 0x98, 0xd9, 0x2c, 0xda, 0x87, 0xa7,
-    0x2c, 0xd8, 0xa8, 0x89, 0x95, 0x19, 0xa9, 0x80, 0xd9, 0x38, 0xd8, 0xa8, 0x89, 0x39, 0xa9, 0x80,
-    0xda, 0x3c, 0xd8, 0xa8, 0x2e, 0xa8, 0x39, 0x90, 0xd9, 0x0c, 0xd8, 0xa8, 0x95, 0x31, 0x98, 0xd9,
-    0x0c, 0xd8, 0xa8, 0x09, 0xd9, 0xff, 0xd8, 0x01, 0xda, 0xff, 0xd8, 0x95, 0x39, 0xa9, 0xda, 0x26,
-    0xff, 0xd8, 0x90, 0xa8, 0x0d, 0x89, 0x99, 0xa8, 0x10, 0x80, 0x98, 0x21, 0xda, 0x2e, 0xd8, 0x89,
-    0x99, 0xa8, 0x31, 0x80, 0xda, 0x2e, 0xd8, 0xa8, 0x86, 0x96, 0x31, 0x80, 0xda, 0x2e, 0xd8, 0xa8,
-    0x87, 0x31, 0x80, 0xda, 0x2e, 0xd8, 0xa8, 0x82, 0x92, 0xf3, 0x41, 0x80, 0xf1, 0xd9, 0x2e, 0xd8,
-    0xa8, 0x82, 0xf3, 0x19, 0x80, 0xf1, 0xd9, 0x2e, 0xd8, 0x82, 0xac, 0xf3, 0xc0, 0xa2, 0x80, 0x22,
-    0xf1, 0xa6, 0x2e, 0xa7, 0x2e, 0xa9, 0x22, 0x98, 0xa8, 0x29, 0xda, 0xac, 0xde, 0xff, 0xd8, 0xa2,
-    0xf2, 0x2a, 0xf1, 0xa9, 0x2e, 0x82, 0x92, 0xa8, 0xf2, 0x31, 0x80, 0xa6, 0x96, 0xf1, 0xd9, 0x00,
-    0xac, 0x8c, 0x9c, 0x0c, 0x30, 0xac, 0xde, 0xd0, 0xde, 0xff, 0xd8, 0x8c, 0x9c, 0xac, 0xd0, 0x10,
-    0xac, 0xde, 0x80, 0x92, 0xa2, 0xf2, 0x4c, 0x82, 0xa8, 0xf1, 0xca, 0xf2, 0x35, 0xf1, 0x96, 0x88,
-    0xa6, 0xd9, 0x00, 0xd8, 0xf1, 0xff
-};
-
-static const unsigned short sStartAddress = 0x0400;
-
-/* END OF SECTION COPIED FROM dmpDefaultMPU6050.c */
-
-#define INT_SRC_TAP             (0x01)
-#define INT_SRC_ANDROID_ORIENT  (0x08)
-
-#define DMP_FEATURE_SEND_ANY_GYRO   (DMP_FEATURE_SEND_RAW_GYRO | \
-                                     DMP_FEATURE_SEND_CAL_GYRO)
-
-#define MAX_PACKET_LENGTH   (32)
-
-#define DMP_SAMPLE_RATE     (200)
-#define GYRO_SF             (46850825LL * 200 / DMP_SAMPLE_RATE)
-
-#define FIFO_CORRUPTION_CHECK
-#ifdef FIFO_CORRUPTION_CHECK
-#define QUAT_ERROR_THRESH       (1L<<24)
-#define QUAT_MAG_SQ_NORMALIZED  (1L<<28)
-#define QUAT_MAG_SQ_MIN         (QUAT_MAG_SQ_NORMALIZED - QUAT_ERROR_THRESH)
-#define QUAT_MAG_SQ_MAX         (QUAT_MAG_SQ_NORMALIZED + QUAT_ERROR_THRESH)
-#endif
-
-struct dmp_s {
-    void (*tap_cb)(unsigned char count, unsigned char direction);
-    void (*android_orient_cb)(unsigned char orientation);
-    unsigned short orient;
-    unsigned short feature_mask;
-    unsigned short fifo_rate;
-    unsigned char packet_length;
-};
-
-static struct dmp_s dmp = {
-    .tap_cb = NULL,
-    .android_orient_cb = NULL,
-    .orient = 0,
-    .feature_mask = 0,
-    .fifo_rate = 0,
-    .packet_length = 0
-};
-
-/**
- *  @brief  Load the DMP with this image.
- *  @return 0 if successful.
- */
-int dmp_load_motion_driver_firmware(void)
-{
-    return mpu_load_firmware(DMP_CODE_SIZE, dmp_memory, sStartAddress,
-        DMP_SAMPLE_RATE);
-}
-
-/**
- *  @brief      Push gyro and accel orientation to the DMP.
- *  The orientation is represented here as the output of
- *  @e inv_orientation_matrix_to_scalar.
- *  @param[in]  orient  Gyro and accel orientation in body frame.
- *  @return     0 if successful.
- */
-int dmp_set_orientation(unsigned short orient)
-{
-    unsigned char gyro_regs[3], accel_regs[3];
-    const unsigned char gyro_axes[3] = {DINA4C, DINACD, DINA6C};
-    const unsigned char accel_axes[3] = {DINA0C, DINAC9, DINA2C};
-    const unsigned char gyro_sign[3] = {DINA36, DINA56, DINA76};
-    const unsigned char accel_sign[3] = {DINA26, DINA46, DINA66};
-
-    gyro_regs[0] = gyro_axes[orient & 3];
-    gyro_regs[1] = gyro_axes[(orient >> 3) & 3];
-    gyro_regs[2] = gyro_axes[(orient >> 6) & 3];
-    accel_regs[0] = accel_axes[orient & 3];
-    accel_regs[1] = accel_axes[(orient >> 3) & 3];
-    accel_regs[2] = accel_axes[(orient >> 6) & 3];
-
-    /* Chip-to-body, axes only. */
-    if (mpu_write_mem(FCFG_1, 3, gyro_regs))
-        return -1;
-    if (mpu_write_mem(FCFG_2, 3, accel_regs))
-        return -1;
-
-    memcpy(gyro_regs, gyro_sign, 3);
-    memcpy(accel_regs, accel_sign, 3);
-    if (orient & 4) {
-        gyro_regs[0] |= 1;
-        accel_regs[0] |= 1;
-    }
-    if (orient & 0x20) {
-        gyro_regs[1] |= 1;
-        accel_regs[1] |= 1;
-    }
-    if (orient & 0x100) {
-        gyro_regs[2] |= 1;
-        accel_regs[2] |= 1;
-    }
-
-    /* Chip-to-body, sign only. */
-    if (mpu_write_mem(FCFG_3, 3, gyro_regs))
-        return -1;
-    if (mpu_write_mem(FCFG_7, 3, accel_regs))
-        return -1;
-    dmp.orient = orient;
-    return 0;
-}
-
-/**
- *  @brief      Push gyro biases to the DMP.
- *  Because the gyro integration is handled in the DMP, any gyro biases
- *  calculated by the MPL should be pushed down to DMP memory to remove
- *  3-axis quaternion drift.
- *  \n NOTE: If the DMP-based gyro calibration is enabled, the DMP will
- *  overwrite the biases written to this location once a new one is computed.
- *  @param[in]  bias    Gyro biases in q16.
- *  @return     0 if successful.
- */
-int dmp_set_gyro_bias(long *bias)
-{
-    long gyro_bias_body[3];
-    unsigned char regs[4];
-
-    gyro_bias_body[0] = bias[dmp.orient & 3];
-    if (dmp.orient & 4)
-        gyro_bias_body[0] *= -1;
-    gyro_bias_body[1] = bias[(dmp.orient >> 3) & 3];
-    if (dmp.orient & 0x20)
-        gyro_bias_body[1] *= -1;
-    gyro_bias_body[2] = bias[(dmp.orient >> 6) & 3];
-    if (dmp.orient & 0x100)
-        gyro_bias_body[2] *= -1;
-
-#ifdef EMPL_NO_64BIT
-    gyro_bias_body[0] = (long)(((float)gyro_bias_body[0] * GYRO_SF) / 1073741824.f);
-    gyro_bias_body[1] = (long)(((float)gyro_bias_body[1] * GYRO_SF) / 1073741824.f);
-    gyro_bias_body[2] = (long)(((float)gyro_bias_body[2] * GYRO_SF) / 1073741824.f);
-#else
-    gyro_bias_body[0] = (long)(((long long)gyro_bias_body[0] * GYRO_SF) >> 30);
-    gyro_bias_body[1] = (long)(((long long)gyro_bias_body[1] * GYRO_SF) >> 30);
-    gyro_bias_body[2] = (long)(((long long)gyro_bias_body[2] * GYRO_SF) >> 30);
-#endif
-
-    regs[0] = (unsigned char)((gyro_bias_body[0] >> 24) & 0xFF);
-    regs[1] = (unsigned char)((gyro_bias_body[0] >> 16) & 0xFF);
-    regs[2] = (unsigned char)((gyro_bias_body[0] >> 8) & 0xFF);
-    regs[3] = (unsigned char)(gyro_bias_body[0] & 0xFF);
-    if (mpu_write_mem(D_EXT_GYRO_BIAS_X, 4, regs))
-        return -1;
-
-    regs[0] = (unsigned char)((gyro_bias_body[1] >> 24) & 0xFF);
-    regs[1] = (unsigned char)((gyro_bias_body[1] >> 16) & 0xFF);
-    regs[2] = (unsigned char)((gyro_bias_body[1] >> 8) & 0xFF);
-    regs[3] = (unsigned char)(gyro_bias_body[1] & 0xFF);
-    if (mpu_write_mem(D_EXT_GYRO_BIAS_Y, 4, regs))
-        return -1;
-
-    regs[0] = (unsigned char)((gyro_bias_body[2] >> 24) & 0xFF);
-    regs[1] = (unsigned char)((gyro_bias_body[2] >> 16) & 0xFF);
-    regs[2] = (unsigned char)((gyro_bias_body[2] >> 8) & 0xFF);
-    regs[3] = (unsigned char)(gyro_bias_body[2] & 0xFF);
-    return mpu_write_mem(D_EXT_GYRO_BIAS_Z, 4, regs);
-}
-
-/**
- *  @brief      Push accel biases to the DMP.
- *  These biases will be removed from the DMP 6-axis quaternion.
- *  @param[in]  bias    Accel biases in q16.
- *  @return     0 if successful.
- */
-int dmp_set_accel_bias(long *bias)
-{
-    long accel_bias_body[3];
-    unsigned char regs[12];
-    long long accel_sf;
-    unsigned short accel_sens;
-
-    mpu_get_accel_sens(&accel_sens);
-    accel_sf = (long long)accel_sens << 15;
-//    __no_operation();
-    __NOP();
-
-    accel_bias_body[0] = bias[dmp.orient & 3];
-    if (dmp.orient & 4)
-        accel_bias_body[0] *= -1;
-    accel_bias_body[1] = bias[(dmp.orient >> 3) & 3];
-    if (dmp.orient & 0x20)
-        accel_bias_body[1] *= -1;
-    accel_bias_body[2] = bias[(dmp.orient >> 6) & 3];
-    if (dmp.orient & 0x100)
-        accel_bias_body[2] *= -1;
-
-#ifdef EMPL_NO_64BIT
-    accel_bias_body[0] = (long)(((float)accel_bias_body[0] * accel_sf) / 1073741824.f);
-    accel_bias_body[1] = (long)(((float)accel_bias_body[1] * accel_sf) / 1073741824.f);
-    accel_bias_body[2] = (long)(((float)accel_bias_body[2] * accel_sf) / 1073741824.f);
-#else
-    accel_bias_body[0] = (long)(((long long)accel_bias_body[0] * accel_sf) >> 30);
-    accel_bias_body[1] = (long)(((long long)accel_bias_body[1] * accel_sf) >> 30);
-    accel_bias_body[2] = (long)(((long long)accel_bias_body[2] * accel_sf) >> 30);
-#endif
-
-    regs[0] = (unsigned char)((accel_bias_body[0] >> 24) & 0xFF);
-    regs[1] = (unsigned char)((accel_bias_body[0] >> 16) & 0xFF);
-    regs[2] = (unsigned char)((accel_bias_body[0] >> 8) & 0xFF);
-    regs[3] = (unsigned char)(accel_bias_body[0] & 0xFF);
-    regs[4] = (unsigned char)((accel_bias_body[1] >> 24) & 0xFF);
-    regs[5] = (unsigned char)((accel_bias_body[1] >> 16) & 0xFF);
-    regs[6] = (unsigned char)((accel_bias_body[1] >> 8) & 0xFF);
-    regs[7] = (unsigned char)(accel_bias_body[1] & 0xFF);
-    regs[8] = (unsigned char)((accel_bias_body[2] >> 24) & 0xFF);
-    regs[9] = (unsigned char)((accel_bias_body[2] >> 16) & 0xFF);
-    regs[10] = (unsigned char)((accel_bias_body[2] >> 8) & 0xFF);
-    regs[11] = (unsigned char)(accel_bias_body[2] & 0xFF);
-    return mpu_write_mem(D_ACCEL_BIAS, 12, regs);
-}
-
-/**
- *  @brief      Set DMP output rate.
- *  Only used when DMP is on.
- *  @param[in]  rate    Desired fifo rate (Hz).
- *  @return     0 if successful.
- */
-int dmp_set_fifo_rate(unsigned short rate)
-{
-    const unsigned char regs_end[12] = {DINAFE, DINAF2, DINAAB,
-        0xc4, DINAAA, DINAF1, DINADF, DINADF, 0xBB, 0xAF, DINADF, DINADF};
-    unsigned short div;
-    unsigned char tmp[8];
-
-    if (rate > DMP_SAMPLE_RATE)
-        return -1;
-    div = DMP_SAMPLE_RATE / rate - 1;
-    tmp[0] = (unsigned char)((div >> 8) & 0xFF);
-    tmp[1] = (unsigned char)(div & 0xFF);
-    if (mpu_write_mem(D_0_22, 2, tmp))
-        return -1;
-    if (mpu_write_mem(CFG_6, 12, (unsigned char*)regs_end))
-        return -1;
-
-    dmp.fifo_rate = rate;
-    return 0;
-}
-
-/**
- *  @brief      Get DMP output rate.
- *  @param[out] rate    Current fifo rate (Hz).
- *  @return     0 if successful.
- */
-int dmp_get_fifo_rate(unsigned short *rate)
-{
-    rate[0] = dmp.fifo_rate;
-    return 0;
-}
-
-/**
- *  @brief      Set tap threshold for a specific axis.
- *  @param[in]  axis    1, 2, and 4 for XYZ accel, respectively.
- *  @param[in]  thresh  Tap threshold, in mg/ms.
- *  @return     0 if successful.
- */
-int dmp_set_tap_thresh(unsigned char axis, unsigned short thresh)
-{
-    unsigned char tmp[4], accel_fsr;
-    float scaled_thresh;
-    unsigned short dmp_thresh, dmp_thresh_2;
-    if (!(axis & TAP_XYZ) || thresh > 1600)
-        return -1;
-
-    scaled_thresh = (float)thresh / DMP_SAMPLE_RATE;
-
-    mpu_get_accel_fsr(&accel_fsr);
-    switch (accel_fsr) {
-    case 2:
-        dmp_thresh = (unsigned short)(scaled_thresh * 16384);
-        /* dmp_thresh * 0.75 */
-        dmp_thresh_2 = (unsigned short)(scaled_thresh * 12288);
-        break;
-    case 4:
-        dmp_thresh = (unsigned short)(scaled_thresh * 8192);
-        /* dmp_thresh * 0.75 */
-        dmp_thresh_2 = (unsigned short)(scaled_thresh * 6144);
-        break;
-    case 8:
-        dmp_thresh = (unsigned short)(scaled_thresh * 4096);
-        /* dmp_thresh * 0.75 */
-        dmp_thresh_2 = (unsigned short)(scaled_thresh * 3072);
-        break;
-    case 16:
-        dmp_thresh = (unsigned short)(scaled_thresh * 2048);
-        /* dmp_thresh * 0.75 */
-        dmp_thresh_2 = (unsigned short)(scaled_thresh * 1536);
-        break;
-    default:
-        return -1;
-    }
-    tmp[0] = (unsigned char)(dmp_thresh >> 8);
-    tmp[1] = (unsigned char)(dmp_thresh & 0xFF);
-    tmp[2] = (unsigned char)(dmp_thresh_2 >> 8);
-    tmp[3] = (unsigned char)(dmp_thresh_2 & 0xFF);
-
-    if (axis & TAP_X) {
-        if (mpu_write_mem(DMP_TAP_THX, 2, tmp))
-            return -1;
-        if (mpu_write_mem(D_1_36, 2, tmp+2))
-            return -1;
-    }
-    if (axis & TAP_Y) {
-        if (mpu_write_mem(DMP_TAP_THY, 2, tmp))
-            return -1;
-        if (mpu_write_mem(D_1_40, 2, tmp+2))
-            return -1;
-    }
-    if (axis & TAP_Z) {
-        if (mpu_write_mem(DMP_TAP_THZ, 2, tmp))
-            return -1;
-        if (mpu_write_mem(D_1_44, 2, tmp+2))
-            return -1;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Set which axes will register a tap.
- *  @param[in]  axis    1, 2, and 4 for XYZ, respectively.
- *  @return     0 if successful.
- */
-int dmp_set_tap_axes(unsigned char axis)
-{
-    unsigned char tmp = 0;
-
-    if (axis & TAP_X)
-        tmp |= 0x30;
-    if (axis & TAP_Y)
-        tmp |= 0x0C;
-    if (axis & TAP_Z)
-        tmp |= 0x03;
-    return mpu_write_mem(D_1_72, 1, &tmp);
-}
-
-/**
- *  @brief      Set minimum number of taps needed for an interrupt.
- *  @param[in]  min_taps    Minimum consecutive taps (1-4).
- *  @return     0 if successful.
- */
-int dmp_set_tap_count(unsigned char min_taps)
-{
-    unsigned char tmp;
-
-    if (min_taps < 1)
-        min_taps = 1;
-    else if (min_taps > 4)
-        min_taps = 4;
-
-    tmp = min_taps - 1;
-    return mpu_write_mem(D_1_79, 1, &tmp);
-}
-
-/**
- *  @brief      Set length between valid taps.
- *  @param[in]  time    Milliseconds between taps.
- *  @return     0 if successful.
- */
-int dmp_set_tap_time(unsigned short time)
-{
-    unsigned short dmp_time;
-    unsigned char tmp[2];
-
-    dmp_time = time / (1000 / DMP_SAMPLE_RATE);
-    tmp[0] = (unsigned char)(dmp_time >> 8);
-    tmp[1] = (unsigned char)(dmp_time & 0xFF);
-    return mpu_write_mem(DMP_TAPW_MIN, 2, tmp);
-}
-
-/**
- *  @brief      Set max time between taps to register as a multi-tap.
- *  @param[in]  time    Max milliseconds between taps.
- *  @return     0 if successful.
- */
-int dmp_set_tap_time_multi(unsigned short time)
-{
-    unsigned short dmp_time;
-    unsigned char tmp[2];
-
-    dmp_time = time / (1000 / DMP_SAMPLE_RATE);
-    tmp[0] = (unsigned char)(dmp_time >> 8);
-    tmp[1] = (unsigned char)(dmp_time & 0xFF);
-    return mpu_write_mem(D_1_218, 2, tmp);
-}
-
-/**
- *  @brief      Set shake rejection threshold.
- *  If the DMP detects a gyro sample larger than @e thresh, taps are rejected.
- *  @param[in]  sf      Gyro scale factor.
- *  @param[in]  thresh  Gyro threshold in dps.
- *  @return     0 if successful.
- */
-int dmp_set_shake_reject_thresh(long sf, unsigned short thresh)
-{
-    unsigned char tmp[4];
-    long thresh_scaled = sf / 1000 * thresh;
-    tmp[0] = (unsigned char)(((long)thresh_scaled >> 24) & 0xFF);
-    tmp[1] = (unsigned char)(((long)thresh_scaled >> 16) & 0xFF);
-    tmp[2] = (unsigned char)(((long)thresh_scaled >> 8) & 0xFF);
-    tmp[3] = (unsigned char)((long)thresh_scaled & 0xFF);
-    return mpu_write_mem(D_1_92, 4, tmp);
-}
-
-/**
- *  @brief      Set shake rejection time.
- *  Sets the length of time that the gyro must be outside of the threshold set
- *  by @e gyro_set_shake_reject_thresh before taps are rejected. A mandatory
- *  60 ms is added to this parameter.
- *  @param[in]  time    Time in milliseconds.
- *  @return     0 if successful.
- */
-int dmp_set_shake_reject_time(unsigned short time)
-{
-    unsigned char tmp[2];
-
-    time /= (1000 / DMP_SAMPLE_RATE);
-    tmp[0] = time >> 8;
-    tmp[1] = time & 0xFF;
-    return mpu_write_mem(D_1_90,2,tmp);
-}
-
-/**
- *  @brief      Set shake rejection timeout.
- *  Sets the length of time after a shake rejection that the gyro must stay
- *  inside of the threshold before taps can be detected again. A mandatory
- *  60 ms is added to this parameter.
- *  @param[in]  time    Time in milliseconds.
- *  @return     0 if successful.
- */
-int dmp_set_shake_reject_timeout(unsigned short time)
-{
-    unsigned char tmp[2];
-
-    time /= (1000 / DMP_SAMPLE_RATE);
-    tmp[0] = time >> 8;
-    tmp[1] = time & 0xFF;
-    return mpu_write_mem(D_1_88,2,tmp);
-}
-
-/**
- *  @brief      Get current step count.
- *  @param[out] count   Number of steps detected.
- *  @return     0 if successful.
- */
-int dmp_get_pedometer_step_count(unsigned long *count)
-{
-    unsigned char tmp[4];
-    if (!count)
-        return -1;
-
-    if (mpu_read_mem(D_PEDSTD_STEPCTR, 4, tmp))
-        return -1;
-
-    count[0] = ((unsigned long)tmp[0] << 24) | ((unsigned long)tmp[1] << 16) |
-        ((unsigned long)tmp[2] << 8) | tmp[3];
-    return 0;
-}
-
-/**
- *  @brief      Overwrite current step count.
- *  WARNING: This function writes to DMP memory and could potentially encounter
- *  a race condition if called while the pedometer is enabled.
- *  @param[in]  count   New step count.
- *  @return     0 if successful.
- */
-int dmp_set_pedometer_step_count(unsigned long count)
-{
-    unsigned char tmp[4];
-
-    tmp[0] = (unsigned char)((count >> 24) & 0xFF);
-    tmp[1] = (unsigned char)((count >> 16) & 0xFF);
-    tmp[2] = (unsigned char)((count >> 8) & 0xFF);
-    tmp[3] = (unsigned char)(count & 0xFF);
-    return mpu_write_mem(D_PEDSTD_STEPCTR, 4, tmp);
-}
-
-/**
- *  @brief      Get duration of walking time.
- *  @param[in]  time    Walk time in milliseconds.
- *  @return     0 if successful.
- */
-int dmp_get_pedometer_walk_time(unsigned long *time)
-{
-    unsigned char tmp[4];
-    if (!time)
-        return -1;
-
-    if (mpu_read_mem(D_PEDSTD_TIMECTR, 4, tmp))
-        return -1;
-
-    time[0] = (((unsigned long)tmp[0] << 24) | ((unsigned long)tmp[1] << 16) |
-        ((unsigned long)tmp[2] << 8) | tmp[3]) * 20;
-    return 0;
-}
-
-/**
- *  @brief      Overwrite current walk time.
- *  WARNING: This function writes to DMP memory and could potentially encounter
- *  a race condition if called while the pedometer is enabled.
- *  @param[in]  time    New walk time in milliseconds.
- */
-int dmp_set_pedometer_walk_time(unsigned long time)
-{
-    unsigned char tmp[4];
-
-    time /= 20;
-
-    tmp[0] = (unsigned char)((time >> 24) & 0xFF);
-    tmp[1] = (unsigned char)((time >> 16) & 0xFF);
-    tmp[2] = (unsigned char)((time >> 8) & 0xFF);
-    tmp[3] = (unsigned char)(time & 0xFF);
-    return mpu_write_mem(D_PEDSTD_TIMECTR, 4, tmp);
-}
-
-/**
- *  @brief      Enable DMP features.
- *  The following \#define's are used in the input mask:
- *  \n DMP_FEATURE_TAP
- *  \n DMP_FEATURE_ANDROID_ORIENT
- *  \n DMP_FEATURE_LP_QUAT
- *  \n DMP_FEATURE_6X_LP_QUAT
- *  \n DMP_FEATURE_GYRO_CAL
- *  \n DMP_FEATURE_SEND_RAW_ACCEL
- *  \n DMP_FEATURE_SEND_RAW_GYRO
- *  \n NOTE: DMP_FEATURE_LP_QUAT and DMP_FEATURE_6X_LP_QUAT are mutually
- *  exclusive.
- *  \n NOTE: DMP_FEATURE_SEND_RAW_GYRO and DMP_FEATURE_SEND_CAL_GYRO are also
- *  mutually exclusive.
- *  @param[in]  mask    Mask of features to enable.
- *  @return     0 if successful.
- */
-int dmp_enable_feature(unsigned short mask)
-{
-    unsigned char tmp[10];
-
-    /* TODO: All of these settings can probably be integrated into the default
-     * DMP image.
-     */
-    /* Set integration scale factor. */
-    tmp[0] = (unsigned char)((GYRO_SF >> 24) & 0xFF);
-    tmp[1] = (unsigned char)((GYRO_SF >> 16) & 0xFF);
-    tmp[2] = (unsigned char)((GYRO_SF >> 8) & 0xFF);
-    tmp[3] = (unsigned char)(GYRO_SF & 0xFF);
-    mpu_write_mem(D_0_104, 4, tmp);
-
-    /* Send sensor data to the FIFO. */
-    tmp[0] = 0xA3;
-    if (mask & DMP_FEATURE_SEND_RAW_ACCEL) {
-        tmp[1] = 0xC0;
-        tmp[2] = 0xC8;
-        tmp[3] = 0xC2;
-    } else {
-        tmp[1] = 0xA3;
-        tmp[2] = 0xA3;
-        tmp[3] = 0xA3;
-    }
-    if (mask & DMP_FEATURE_SEND_ANY_GYRO) {
-        tmp[4] = 0xC4;
-        tmp[5] = 0xCC;
-        tmp[6] = 0xC6;
-    } else {
-        tmp[4] = 0xA3;
-        tmp[5] = 0xA3;
-        tmp[6] = 0xA3;
-    }
-    tmp[7] = 0xA3;
-    tmp[8] = 0xA3;
-    tmp[9] = 0xA3;
-    mpu_write_mem(CFG_15,10,tmp);
-
-    /* Send gesture data to the FIFO. */
-    if (mask & (DMP_FEATURE_TAP | DMP_FEATURE_ANDROID_ORIENT))
-        tmp[0] = DINA20;
-    else
-        tmp[0] = 0xD8;
-    mpu_write_mem(CFG_27,1,tmp);
-
-    if (mask & DMP_FEATURE_GYRO_CAL)
-        dmp_enable_gyro_cal(1);
-    else
-        dmp_enable_gyro_cal(0);
-
-    if (mask & DMP_FEATURE_SEND_ANY_GYRO) {
-        if (mask & DMP_FEATURE_SEND_CAL_GYRO) {
-            tmp[0] = 0xB2;
-            tmp[1] = 0x8B;
-            tmp[2] = 0xB6;
-            tmp[3] = 0x9B;
-        } else {
-            tmp[0] = DINAC0;
-            tmp[1] = DINA80;
-            tmp[2] = DINAC2;
-            tmp[3] = DINA90;
-        }
-        mpu_write_mem(CFG_GYRO_RAW_DATA, 4, tmp);
-    }
-
-    if (mask & DMP_FEATURE_TAP) {
-        /* Enable tap. */
-        tmp[0] = 0xF8;
-        mpu_write_mem(CFG_20, 1, tmp);
-        dmp_set_tap_thresh(TAP_XYZ, 250);
-        dmp_set_tap_axes(TAP_XYZ);
-        dmp_set_tap_count(1);
-        dmp_set_tap_time(100);
-        dmp_set_tap_time_multi(500);
-
-        dmp_set_shake_reject_thresh(GYRO_SF, 200);
-        dmp_set_shake_reject_time(40);
-        dmp_set_shake_reject_timeout(10);
-    } else {
-        tmp[0] = 0xD8;
-        mpu_write_mem(CFG_20, 1, tmp);
-    }
-
-    if (mask & DMP_FEATURE_ANDROID_ORIENT) {
-        tmp[0] = 0xD9;
-    } else
-        tmp[0] = 0xD8;
-    mpu_write_mem(CFG_ANDROID_ORIENT_INT, 1, tmp);
-
-    if (mask & DMP_FEATURE_LP_QUAT)
-        dmp_enable_lp_quat(1);
-    else
-        dmp_enable_lp_quat(0);
-
-    if (mask & DMP_FEATURE_6X_LP_QUAT)
-        dmp_enable_6x_lp_quat(1);
-    else
-        dmp_enable_6x_lp_quat(0);
-
-    /* Pedometer is always enabled. */
-    dmp.feature_mask = mask | DMP_FEATURE_PEDOMETER;
-    mpu_reset_fifo();
-
-    dmp.packet_length = 0;
-    if (mask & DMP_FEATURE_SEND_RAW_ACCEL)
-        dmp.packet_length += 6;
-    if (mask & DMP_FEATURE_SEND_ANY_GYRO)
-        dmp.packet_length += 6;
-    if (mask & (DMP_FEATURE_LP_QUAT | DMP_FEATURE_6X_LP_QUAT))
-        dmp.packet_length += 16;
-    if (mask & (DMP_FEATURE_TAP | DMP_FEATURE_ANDROID_ORIENT))
-        dmp.packet_length += 4;
-
-    return 0;
-}
-
-/**
- *  @brief      Get list of currently enabled DMP features.
- *  @param[out] Mask of enabled features.
- *  @return     0 if successful.
- */
-int dmp_get_enabled_features(unsigned short *mask)
-{
-    mask[0] = dmp.feature_mask;
-    return 0;
-}
-
-/**
- *  @brief      Calibrate the gyro data in the DMP.
- *  After eight seconds of no motion, the DMP will compute gyro biases and
- *  subtract them from the quaternion output. If @e dmp_enable_feature is
- *  called with @e DMP_FEATURE_SEND_CAL_GYRO, the biases will also be
- *  subtracted from the gyro output.
- *  @param[in]  enable  1 to enable gyro calibration.
- *  @return     0 if successful.
- */
-int dmp_enable_gyro_cal(unsigned char enable)
-{
-    if (enable) {
-        unsigned char regs[9] = {0xb8, 0xaa, 0xb3, 0x8d, 0xb4, 0x98, 0x0d, 0x35, 0x5d};
-        return mpu_write_mem(CFG_MOTION_BIAS, 9, regs);
-    } else {
-        unsigned char regs[9] = {0xb8, 0xaa, 0xaa, 0xaa, 0xb0, 0x88, 0xc3, 0xc5, 0xc7};
-        return mpu_write_mem(CFG_MOTION_BIAS, 9, regs);
-    }
-}
-
-/**
- *  @brief      Generate 3-axis quaternions from the DMP.
- *  In this driver, the 3-axis and 6-axis DMP quaternion features are mutually
- *  exclusive.
- *  @param[in]  enable  1 to enable 3-axis quaternion.
- *  @return     0 if successful.
- */
-int dmp_enable_lp_quat(unsigned char enable)
-{
-    unsigned char regs[4];
-    if (enable) {
-        regs[0] = DINBC0;
-        regs[1] = DINBC2;
-        regs[2] = DINBC4;
-        regs[3] = DINBC6;
-    }
-    else
-        memset(regs, 0x8B, 4);
-
-    mpu_write_mem(CFG_LP_QUAT, 4, regs);
-
-    return mpu_reset_fifo();
-}
-
-/**
- *  @brief       Generate 6-axis quaternions from the DMP.
- *  In this driver, the 3-axis and 6-axis DMP quaternion features are mutually
- *  exclusive.
- *  @param[in]   enable  1 to enable 6-axis quaternion.
- *  @return      0 if successful.
- */
-int dmp_enable_6x_lp_quat(unsigned char enable)
-{
-    unsigned char regs[4];
-    if (enable) {
-        regs[0] = DINA20;
-        regs[1] = DINA28;
-        regs[2] = DINA30;
-        regs[3] = DINA38;
-    } else
-        memset(regs, 0xA3, 4);
-
-    mpu_write_mem(CFG_8, 4, regs);
-
-    return mpu_reset_fifo();
-}
-
-/**
- *  @brief      Decode the four-byte gesture data and execute any callbacks.
- *  @param[in]  gesture Gesture data from DMP packet.
- *  @return     0 if successful.
- */
-static int decode_gesture(unsigned char *gesture)
-{
-    unsigned char tap, android_orient;
-
-    android_orient = gesture[3] & 0xC0;
-    tap = 0x3F & gesture[3];
-
-    if (gesture[1] & INT_SRC_TAP) {
-        unsigned char direction, count;
-        direction = tap >> 3;
-        count = (tap % 8) + 1;
-        if (dmp.tap_cb)
-            dmp.tap_cb(direction, count);
-    }
-
-    if (gesture[1] & INT_SRC_ANDROID_ORIENT) {
-        if (dmp.android_orient_cb)
-            dmp.android_orient_cb(android_orient >> 6);
-    }
-
-    return 0;
-}
-
-/**
- *  @brief      Specify when a DMP interrupt should occur.
- *  A DMP interrupt can be configured to trigger on either of the two
- *  conditions below:
- *  \n a. One FIFO period has elapsed (set by @e mpu_set_sample_rate).
- *  \n b. A tap event has been detected.
- *  @param[in]  mode    DMP_INT_GESTURE or DMP_INT_CONTINUOUS.
- *  @return     0 if successful.
- */
-int dmp_set_interrupt_mode(unsigned char mode)
-{
-    const unsigned char regs_continuous[11] =
-        {0xd8, 0xb1, 0xb9, 0xf3, 0x8b, 0xa3, 0x91, 0xb6, 0x09, 0xb4, 0xd9};
-    const unsigned char regs_gesture[11] =
-        {0xda, 0xb1, 0xb9, 0xf3, 0x8b, 0xa3, 0x91, 0xb6, 0xda, 0xb4, 0xda};
-
-    switch (mode) {
-    case DMP_INT_CONTINUOUS:
-        return mpu_write_mem(CFG_FIFO_ON_EVENT, 11,
-            (unsigned char*)regs_continuous);
-    case DMP_INT_GESTURE:
-        return mpu_write_mem(CFG_FIFO_ON_EVENT, 11,
-            (unsigned char*)regs_gesture);
-    default:
-        return -1;
-    }
-}
-
-/**
- *  @brief      Get one packet from the FIFO.
- *  If @e sensors does not contain a particular sensor, disregard the data
- *  returned to that pointer.
- *  \n @e sensors can contain a combination of the following flags:
- *  \n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
- *  \n INV_XYZ_GYRO
- *  \n INV_XYZ_ACCEL
- *  \n INV_WXYZ_QUAT
- *  \n If the FIFO has no new data, @e sensors will be zero.
- *  \n If the FIFO is disabled, @e sensors will be zero and this function will
- *  return a non-zero error code.
- *  @param[out] gyro        Gyro data in hardware units.
- *  @param[out] accel       Accel data in hardware units.
- *  @param[out] quat        3-axis quaternion data in hardware units.
- *  @param[out] timestamp   Timestamp in milliseconds.
- *  @param[out] sensors     Mask of sensors read from FIFO.
- *  @param[out] more        Number of remaining packets.
- *  @return     0 if successful.
- */
-int dmp_read_fifo(short *gyro, short *accel, long *quat,
-    unsigned long *timestamp, short *sensors, unsigned char *more)
-{
-    unsigned char fifo_data[MAX_PACKET_LENGTH];
-    unsigned char ii = 0;
-
-    /* TODO: sensors[0] only changes when dmp_enable_feature is called. We can
-     * cache this value and save some cycles.
-     */
-    sensors[0] = 0;
-
-    /* Get a packet. */
-    if (mpu_read_fifo_stream(dmp.packet_length, fifo_data, more))
-        return -1;
-
-    /* Parse DMP packet. */
-    if (dmp.feature_mask & (DMP_FEATURE_LP_QUAT | DMP_FEATURE_6X_LP_QUAT)) {
-#ifdef FIFO_CORRUPTION_CHECK
-        long quat_q14[4], quat_mag_sq;
-#endif
-        quat[0] = ((long)fifo_data[0] << 24) | ((long)fifo_data[1] << 16) |
-            ((long)fifo_data[2] << 8) | fifo_data[3];
-        quat[1] = ((long)fifo_data[4] << 24) | ((long)fifo_data[5] << 16) |
-            ((long)fifo_data[6] << 8) | fifo_data[7];
-        quat[2] = ((long)fifo_data[8] << 24) | ((long)fifo_data[9] << 16) |
-            ((long)fifo_data[10] << 8) | fifo_data[11];
-        quat[3] = ((long)fifo_data[12] << 24) | ((long)fifo_data[13] << 16) |
-            ((long)fifo_data[14] << 8) | fifo_data[15];
-        ii += 16;
-#ifdef FIFO_CORRUPTION_CHECK
-        /* We can detect a corrupted FIFO by monitoring the quaternion data and
-         * ensuring that the magnitude is always normalized to one. This
-         * shouldn't happen in normal operation, but if an I2C error occurs,
-         * the FIFO reads might become misaligned.
-         *
-         * Let's start by scaling down the quaternion data to avoid long long
-         * math.
-         */
-        quat_q14[0] = quat[0] >> 16;
-        quat_q14[1] = quat[1] >> 16;
-        quat_q14[2] = quat[2] >> 16;
-        quat_q14[3] = quat[3] >> 16;
-        quat_mag_sq = quat_q14[0] * quat_q14[0] + quat_q14[1] * quat_q14[1] +
-            quat_q14[2] * quat_q14[2] + quat_q14[3] * quat_q14[3];
-        if ((quat_mag_sq < QUAT_MAG_SQ_MIN) ||
-            (quat_mag_sq > QUAT_MAG_SQ_MAX)) {
-            /* Quaternion is outside of the acceptable threshold. */
-            mpu_reset_fifo();
-            sensors[0] = 0;
-            return -1;
-        }
-        sensors[0] |= INV_WXYZ_QUAT;
-#endif
-    }
-
-    if (dmp.feature_mask & DMP_FEATURE_SEND_RAW_ACCEL) {
-        accel[0] = ((short)fifo_data[ii+0] << 8) | fifo_data[ii+1];
-        accel[1] = ((short)fifo_data[ii+2] << 8) | fifo_data[ii+3];
-        accel[2] = ((short)fifo_data[ii+4] << 8) | fifo_data[ii+5];
-        ii += 6;
-        sensors[0] |= INV_XYZ_ACCEL;
-    }
-
-    if (dmp.feature_mask & DMP_FEATURE_SEND_ANY_GYRO) {
-        gyro[0] = ((short)fifo_data[ii+0] << 8) | fifo_data[ii+1];
-        gyro[1] = ((short)fifo_data[ii+2] << 8) | fifo_data[ii+3];
-        gyro[2] = ((short)fifo_data[ii+4] << 8) | fifo_data[ii+5];
-        ii += 6;
-        sensors[0] |= INV_XYZ_GYRO;
-    }
-
-    /* Gesture data is at the end of the DMP packet. Parse it and call
-     * the gesture callbacks (if registered).
-     */
-    if (dmp.feature_mask & (DMP_FEATURE_TAP | DMP_FEATURE_ANDROID_ORIENT))
-        decode_gesture(fifo_data + ii);
-
-    get_ms(timestamp);
-    return 0;
-}
-
-/**
- *  @brief      Register a function to be executed on a tap event.
- *  The tap direction is represented by one of the following:
- *  \n TAP_X_UP
- *  \n TAP_X_DOWN
- *  \n TAP_Y_UP
- *  \n TAP_Y_DOWN
- *  \n TAP_Z_UP
- *  \n TAP_Z_DOWN
- *  @param[in]  func    Callback function.
- *  @return     0 if successful.
- */
-int dmp_register_tap_cb(void (*func)(unsigned char, unsigned char))
-{
-    dmp.tap_cb = func;
-    return 0;
-}
-
-/**
- *  @brief      Register a function to be executed on a android orientation event.
- *  @param[in]  func    Callback function.
- *  @return     0 if successful.
- */
-int dmp_register_android_orient_cb(void (*func)(unsigned char))
-{
-    dmp.android_orient_cb = func;
-    return 0;
-}
-
-/**
- *  @}
- */
-

+ 0 - 97
Core备份3/imu5/inv_mpu_dmp_motion_driver5.h

@@ -1,97 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011-2012 InvenSense Corporation, All Rights Reserved.
-    See included License.txt for License information.
- $
- */
-/**
- *  @addtogroup  DRIVERS Sensor Driver Layer
- *  @brief       Hardware drivers to communicate with sensors via I2C.
- *
- *  @{
- *      @file       inv_mpu_dmp_motion_driver.h
- *      @brief      DMP image and interface functions.
- *      @details    All functions are preceded by the dmp_ prefix to
- *                  differentiate among MPL and general driver function calls.
- */
-#ifndef _INV_MPU_DMP_MOTION_DRIVER_H_
-#define _INV_MPU_DMP_MOTION_DRIVER_H_
-
-#define TAP_X               (0x01)
-#define TAP_Y               (0x02)
-#define TAP_Z               (0x04)
-#define TAP_XYZ             (0x07)
-
-#define TAP_X_UP            (0x01)
-#define TAP_X_DOWN          (0x02)
-#define TAP_Y_UP            (0x03)
-#define TAP_Y_DOWN          (0x04)
-#define TAP_Z_UP            (0x05)
-#define TAP_Z_DOWN          (0x06)
-
-#define ANDROID_ORIENT_PORTRAIT             (0x00)
-#define ANDROID_ORIENT_LANDSCAPE            (0x01)
-#define ANDROID_ORIENT_REVERSE_PORTRAIT     (0x02)
-#define ANDROID_ORIENT_REVERSE_LANDSCAPE    (0x03)
-
-#define DMP_INT_GESTURE     (0x01)
-#define DMP_INT_CONTINUOUS  (0x02)
-
-#define DMP_FEATURE_TAP             (0x001)
-#define DMP_FEATURE_ANDROID_ORIENT  (0x002)
-#define DMP_FEATURE_LP_QUAT         (0x004)
-#define DMP_FEATURE_PEDOMETER       (0x008)
-#define DMP_FEATURE_6X_LP_QUAT      (0x010)
-#define DMP_FEATURE_GYRO_CAL        (0x020)
-#define DMP_FEATURE_SEND_RAW_ACCEL  (0x040)
-#define DMP_FEATURE_SEND_RAW_GYRO   (0x080)
-#define DMP_FEATURE_SEND_CAL_GYRO   (0x100)
-
-#define INV_WXYZ_QUAT       (0x100)
-
-/* Set up functions. */
-int dmp_load_motion_driver_firmware(void);
-int dmp_set_fifo_rate(unsigned short rate);
-int dmp_get_fifo_rate(unsigned short *rate);
-int dmp_enable_feature(unsigned short mask);
-int dmp_get_enabled_features(unsigned short *mask);
-int dmp_set_interrupt_mode(unsigned char mode);
-int dmp_set_orientation(unsigned short orient);
-int dmp_set_gyro_bias(long *bias);
-int dmp_set_accel_bias(long *bias);
-
-/* Tap functions. */
-int dmp_register_tap_cb(void (*func)(unsigned char, unsigned char));
-int dmp_set_tap_thresh(unsigned char axis, unsigned short thresh);
-int dmp_set_tap_axes(unsigned char axis);
-int dmp_set_tap_count(unsigned char min_taps);
-int dmp_set_tap_time(unsigned short time);
-int dmp_set_tap_time_multi(unsigned short time);
-int dmp_set_shake_reject_thresh(long sf, unsigned short thresh);
-int dmp_set_shake_reject_time(unsigned short time);
-int dmp_set_shake_reject_timeout(unsigned short time);
-
-/* Android orientation functions. */
-int dmp_register_android_orient_cb(void (*func)(unsigned char));
-
-/* LP quaternion functions. */
-int dmp_enable_lp_quat(unsigned char enable);
-int dmp_enable_6x_lp_quat(unsigned char enable);
-
-/* Pedometer functions. */
-int dmp_get_pedometer_step_count(unsigned long *count);
-int dmp_set_pedometer_step_count(unsigned long count);
-int dmp_get_pedometer_walk_time(unsigned long *time);
-int dmp_set_pedometer_walk_time(unsigned long time);
-
-/* DMP gyro calibration functions. */
-int dmp_enable_gyro_cal(unsigned char enable);
-
-/* Read function. This function should be called whenever the MPU interrupt is
- * detected.
- */
-int dmp_read_fifo(short *gyro, short *accel, long *quat,
-    unsigned long *timestamp, short *sensors, unsigned char *more);
-
-#endif  /* #ifndef _INV_MPU_DMP_MOTION_DRIVER_H_ */
-

+ 0 - 542
Core备份3/imu6/MPU60506.c

@@ -1,542 +0,0 @@
-/*
- * MPU6050.c
- *
- *  Created on: Oct 26, 2021
- *      Author: Administrator
- */
-
-#include "MPU60506.h"
-
-#include <stdio.h>
-
- u8 IIC_Write_Byte(u8 reg, u8 value)
- {
-	 return IIC_Write_Len(MPU_ADDR, reg, 1, &value);
- }
-
- u8 IIC_Read_Byte(u8 reg)
- {
-	 u8 value = 0;
-
-	 IIC_Read_Len(MPU_ADDR, reg, 1, &value);
-
-	 return value;
- }
-
- //IIC连续写
- u8 IIC_Write_Len(u8 addr,u8 reg, u8 len, u8 *buf)
- {
-	 addr = (addr << 1) | 0;
-
-	 u8 data[10] = {0};
-	 data[0] = reg;
-	 for(int i = 0; i < len; i++)
-	 {
-		 data[1 + i] = buf[i];
-	 }
-
-	 if(HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)addr, (uint8_t*)data, len + 1, 10000)!= HAL_OK)
-	 {
-		 printf("++write len byte fail\r\n");
-		 return 1;
-	 }
-
-	 return 0;
- }
-
- //IIC连续读
- u8 IIC_Read_Len(u8 addr,u8 reg,u8 len,u8 *buf)
- {
-	 u8 tmp  = (addr << 1) | 0;
-	 if(HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)tmp, (uint8_t*)&reg, 1, 10000)!= HAL_OK)
-	 {
-		 printf("++write byte fail\r\n");
-		 return 1;
-	 }
-
-	 tmp  = (addr << 1) | 1;
-	 if(HAL_I2C_Master_Receive(&hi2c1, (uint16_t)tmp, (uint8_t *)buf, len, 10000) != HAL_OK)
-	 {
-		 printf("--read byte fail\r\n");
-	 }
-
- }
-
-
-//初始化MPU6050
-//返回值: 0,成功
-//        其他,错误代码
-u8 MPU_Init(void)
-{
-    u8 res = 0;
-
-    IIC_Write_Byte(MPU_PWR_MGMT1_REG,0X80);//复位MPU6050
-
-    HAL_Delay(100);
-
-    IIC_Write_Byte(MPU_PWR_MGMT1_REG,0X00);//唤醒MPU6050
-
-    MPU_Set_Gyro_Fsr(3); //陀螺仪传感器,±2000dps
-    MPU_Set_Accel_Fsr(0); //加速度传感器 ±2g
-    MPU_Set_Rate(50); //设置采样率50HZ
-    IIC_Write_Byte(MPU_INT_EN_REG,0X00); //关闭所有中断
-    IIC_Write_Byte(MPU_USER_CTRL_REG,0X00);//I2C主模式关闭
-    IIC_Write_Byte(MPU_FIFO_EN_REG,0X00);//关闭FIFO
-    IIC_Write_Byte(MPU_INTBP_CFG_REG,0X80);//INT引脚低电平有效
-
-    res=IIC_Read_Byte(MPU_DEVICE_ID_REG);
-
-    printf("the addr is:%d\r\n", res);
-
-    if(res==MPU_ADDR)//器件ID正确
-    {
-        IIC_Write_Byte(MPU_PWR_MGMT1_REG,0X01);//设置CLKSEL,PLL X 轴为参考
-        IIC_Write_Byte(MPU_PWR_MGMT2_REG,0X00);//加速度陀螺仪都工作
-        MPU_Set_Rate(50); //设置采样率为50HZ
-    }
-    else
-    {
-    	return 1;
-    }
-
-    return 0;
-}
-
-//设置MPU6050陀螺仪传感器满量程范围
-//fsr:0,±250dps;1,±500dps;2,±1000dps;3,±2000dps
-//返回值:0,设置成功
-//    其他,设置失败
-u8 MPU_Set_Gyro_Fsr(u8 fsr)
-{
-    return IIC_Write_Byte(MPU_GYRO_CFG_REG, fsr<<3);//设置陀螺仪满量程范围
-}
-
-//设置MPU6050加速度传感器满量程范围
-//fsr:0,±2g;1,±4g;2,±8g;3,±16g
-//返回值:0,设置成功
-//    其他,设置失败
-u8 MPU_Set_Accel_Fsr(u8 fsr)
-{
-    return IIC_Write_Byte(MPU_ACCEL_CFG_REG, fsr<<3);//设置加速度传感器满量程范围
-}
-
-//设置MPU6050的数字低通滤波器
-//lpf:数字低通滤波频率(Hz)
-//返回值:0,设置成功
-//    其他,设置失败
-u8 MPU_Set_LPF(u16 lpf)
-{
-    u8 data=0;
-    if(lpf>=188) data=1;
-    else if(lpf>=98) data=2;
-    else if(lpf>=42) data=2;
-    else if(lpf>=42) data=3;
-    else if(lpf>=20) data=4;
-    else if(lpf>=10) data=5;
-    else data=6;
-    return IIC_Write_Byte(MPU_CFG_REG,data);//设置数字低通滤波器
-}
-
-//设置MPU6050的采样率(假定Fs=1KHz)
-//rate:4~1000(Hz)
-//返回值:0,设置成功
-//    其他,设置失败
-u8 MPU_Set_Rate(u16 rate)
-{
-    u8 data;
-    if(rate>1000)rate=1000;
-    if(rate<4)rate=4;
-    data=1000/rate-1;
-    data=IIC_Write_Byte(MPU_SAMPLE_RATE_REG, data);  //设置数字低通滤波器
-    return MPU_Set_LPF(rate/2); //自动设置LPF为采样率的一半
-}
-
-//得到温度值
-//返回值:温度值(扩大了100倍)
-short MPU_Get_Temperature(void)
-{
-    u8 buf[2];
-    short raw;
-    float temp;
-    IIC_Read_Len(MPU_ADDR, MPU_TEMP_OUTH_REG, 2, buf);
-    raw=((u16)buf[0]<<8)|buf[1];
-    temp=36.53+((double)raw)/340;
-
-    return temp*100;;
-}
-
-//得到陀螺仪值(原始值)
-//gx,gy,gz:陀螺仪x,y,z轴的原始读数(带符号)
-//返回值:0,成功
-// 其他,错误代码
-u8 MPU_Get_Gyroscope(short *gx,short *gy,short *gz)
-{
-    u8 buf[6],res;
-    res=IIC_Read_Len(MPU_ADDR,MPU_GYRO_XOUTH_REG,6,buf);
-    if(res==0)
-    {
-        *gx=((u16)buf[0]<<8)|buf[1];
-        *gy=((u16)buf[2]<<8)|buf[3];
-        *gz=((u16)buf[4]<<8)|buf[5];
-    }
-    return res;
-}
-
-//得到加速度值(原始值)
-//ax,ay,az:陀螺仪x,y,z轴的原始读数(带符号)
-//返回值:0,成功
-//    其他,错误代码
-u8 MPU_Get_Accelerometer(short *ax,short *ay,short *az)
-{
-    u8 buf[6],res;
-    res=IIC_Read_Len(MPU_ADDR,MPU_ACCEL_XOUTH_REG,6,buf);
-    if(res==0)
-    {
-        *ax=((u16)buf[0]<<8)|buf[1];
-        *ay=((u16)buf[2]<<8)|buf[3];
-        *az=((u16)buf[4]<<8)|buf[5];
-    }
-    return res;;
-}
-
-/*--------------------以下为使用板载固件DMP的相关代码,这个融合得到的姿态角效果很好*/
-
-
-/**
-  * @brief  获取当前毫秒值
-  * @param  存储最新毫秒值的变量
-  * @retval 无
-  */
-int get_tick_count(unsigned long *count)
-{
-   count[0] = HAL_GetTick();
-	return 0;
-}
-
-
-#include "inv_mpu6.h"
-#include "inv_mpu_dmp_motion_driver6.h"
-
-/* Data requested by client. */
-#define PRINT_ACCEL     (0x01)
-#define PRINT_GYRO      (0x02)
-#define PRINT_QUAT      (0x04)
-
-#define ACCEL_ON        (0x01)
-#define GYRO_ON         (0x02)
-
-#define MOTION          (0)
-#define NO_MOTION       (1)
-
-/* Starting sampling rate. */ //100
-#define DEFAULT_MPU_HZ  (50)
-
-struct rx_s {
-    unsigned char header[3];
-    unsigned char cmd;
-};
-struct hal_s {
-    unsigned char sensors;
-    unsigned char dmp_on;
-    unsigned char wait_for_tap;
-    volatile unsigned char new_gyro;
-    unsigned short report;
-    unsigned short dmp_features;
-    unsigned char motion_int_mode;
-    struct rx_s rx;
-};
-static struct hal_s hal = {0};
-
-/* USB RX binary semaphore. Actually, it's just a flag. Not included in struct
- * because it's declared extern elsewhere.
- */
-volatile unsigned char rx_new;
-
-/* The sensors can be mounted onto the board in any orientation. The mounting
- * matrix seen below tells the MPL how to rotate the raw data from thei
- * driver(s).
- * TODO: The following matrices refer to the configuration on an internal test
- * board at Invensense. If needed, please modify the matrices to match the
- * chip-to-body matrix for your particular set up.
- */
-static signed char gyro_orientation[9] = {-1, 0, 0,
-                                           0,-1, 0,
-                                           0, 0, 1};
-
-/* Every time new gyro data is available, this function is called in an
- * ISR context. In this example, it sets a flag protecting the FIFO read
- * function.
- */
-static void gyro_data_ready_cb(void)
-{
-    hal.new_gyro = 1;
-}
-
-enum packet_type_e {
-    PACKET_TYPE_ACCEL,
-    PACKET_TYPE_GYRO,
-    PACKET_TYPE_QUAT,
-    PACKET_TYPE_TAP,
-    PACKET_TYPE_ANDROID_ORIENT,
-    PACKET_TYPE_PEDO,
-    PACKET_TYPE_MISC
-};
-
-#define BYTE u_char
-/* Send data to the Python client application.
- * Data is formatted as follows:
- * packet[0]    = $
- * packet[1]    = packet type (see packet_type_e)
- * packet[2+]   = data
- */
-void send_packet(char packet_type, void *data)
-{
-
-	#define MAX_BUF_LENGTH  (18)
-    char buf[MAX_BUF_LENGTH], length;
-
-    memset(buf, 0, MAX_BUF_LENGTH);
-    buf[0] = '$';
-    buf[1] = packet_type;
-
-    if (packet_type == PACKET_TYPE_ACCEL || packet_type == PACKET_TYPE_GYRO) {
-        short *sdata = (short*)data;
-        buf[2] = (char)(sdata[0] >> 8);
-        buf[3] = (char)sdata[0];
-        buf[4] = (char)(sdata[1] >> 8);
-        buf[5] = (char)sdata[1];
-        buf[6] = (char)(sdata[2] >> 8);
-        buf[7] = (char)sdata[2];
-        length = 8;
-    } else if (packet_type == PACKET_TYPE_QUAT) {
-        long *ldata = (long*)data;
-        buf[2] = (char)(ldata[0] >> 24);
-        buf[3] = (char)(ldata[0] >> 16);
-        buf[4] = (char)(ldata[0] >> 8);
-        buf[5] = (char)ldata[0];
-        buf[6] = (char)(ldata[1] >> 24);
-        buf[7] = (char)(ldata[1] >> 16);
-        buf[8] = (char)(ldata[1] >> 8);
-        buf[9] = (char)ldata[1];
-        buf[10] = (char)(ldata[2] >> 24);
-        buf[11] = (char)(ldata[2] >> 16);
-        buf[12] = (char)(ldata[2] >> 8);
-        buf[13] = (char)ldata[2];
-        buf[14] = (char)(ldata[3] >> 24);
-        buf[15] = (char)(ldata[3] >> 16);
-        buf[16] = (char)(ldata[3] >> 8);
-        buf[17] = (char)ldata[3];
-        length = 18;
-    } else if (packet_type == PACKET_TYPE_TAP) {
-        buf[2] = ((char*)data)[0];
-        buf[3] = ((char*)data)[1];
-        length = 4;
-    } else if (packet_type == PACKET_TYPE_ANDROID_ORIENT) {
-        buf[2] = ((char*)data)[0];
-        length = 3;
-    } else if (packet_type == PACKET_TYPE_PEDO) {
-        long *ldata = (long*)data;
-        buf[2] = (char)(ldata[0] >> 24);
-        buf[3] = (char)(ldata[0] >> 16);
-        buf[4] = (char)(ldata[0] >> 8);
-        buf[5] = (char)ldata[0];
-        buf[6] = (char)(ldata[1] >> 24);
-        buf[7] = (char)(ldata[1] >> 16);
-        buf[8] = (char)(ldata[1] >> 8);
-        buf[9] = (char)ldata[1];
-        length = 10;
-    } else if (packet_type == PACKET_TYPE_MISC) {
-        buf[2] = ((char*)data)[0];
-        buf[3] = ((char*)data)[1];
-        buf[4] = ((char*)data)[2];
-        buf[5] = ((char*)data)[3];
-        length = 6;
-    }
-
-//    cdcSendDataWaitTilDone((BYTE*)buf, length, CDC0_INTFNUM, 100);
-}
-
-/* These next two functions converts the orientation matrix (see
- * gyro_orientation) to a scalar representation for use by the DMP.
- * NOTE: These functions are borrowed from Invensense's MPL.
- */
-static inline unsigned short inv_row_2_scale(const signed char *row)
-{
-    unsigned short b;
-
-    if (row[0] > 0)
-        b = 0;
-    else if (row[0] < 0)
-        b = 4;
-    else if (row[1] > 0)
-        b = 1;
-    else if (row[1] < 0)
-        b = 5;
-    else if (row[2] > 0)
-        b = 2;
-    else if (row[2] < 0)
-        b = 6;
-    else
-        b = 7;      // error
-    return b;
-}
-static inline unsigned short inv_orientation_matrix_to_scalar(
-    const signed char *mtx)
-{
-    unsigned short scalar;
-
-    /*
-       XYZ  010_001_000 Identity Matrix
-       XZY  001_010_000
-       YXZ  010_000_001
-       YZX  000_010_001
-       ZXY  001_000_010
-       ZYX  000_001_010
-     */
-
-    scalar = inv_row_2_scale(mtx);
-    scalar |= inv_row_2_scale(mtx + 3) << 3;
-    scalar |= inv_row_2_scale(mtx + 6) << 6;
-
-
-    return scalar;
-}
-
-static inline void run_self_test(void)
-{
-    int result;
-    char test_packet[4] = {0};
-    long gyro[3], accel[3];
-
-    result = mpu_run_self_test(gyro, accel);
-    if (result == 0x7) {
-        /* Test passed. We can trust the gyro data here, so let's push it down
-         * to the DMP.
-         */
-        float sens;
-        unsigned short accel_sens;
-        mpu_get_gyro_sens(&sens);
-        gyro[0] = (long)(gyro[0] * sens);
-        gyro[1] = (long)(gyro[1] * sens);
-        gyro[2] = (long)(gyro[2] * sens);
-        dmp_set_gyro_bias(gyro);
-        mpu_get_accel_sens(&accel_sens);
-        accel[0] *= accel_sens;
-        accel[1] *= accel_sens;
-        accel[2] *= accel_sens;
-        dmp_set_accel_bias(accel);
-    }
-
-    /* Report results. */
-    test_packet[0] = 't';
-    test_packet[1] = result;
-    send_packet(PACKET_TYPE_MISC, test_packet);
-}
-
-
-#define INT_EXIT_LPM0 12
-
-void DMP_Init(void)
-{
-    struct int_param_s int_param;
-
-	/* Set up gyro.
-	 * Every function preceded by mpu_ is a driver function and can be found
-	 * in inv_mpu.h.
-	 */
-	int_param.cb = gyro_data_ready_cb;
-	int_param.pin = 16;
-	int_param.lp_exit = INT_EXIT_LPM0;
-	int_param.active_low = 1;
-
-	int result = mpu_init(&int_param);
-
-	printf("mpu_init, %d\r\n", result);
-
-	if(result == 0)     //mpu初始化
-	{
-		if(!mpu_set_sensors(INV_XYZ_GYRO | INV_XYZ_ACCEL))    //设置需要的传感器
-			printf("mpu_set_sensor complete ......\r\n");
-
-		if(!mpu_configure_fifo(INV_XYZ_GYRO | INV_XYZ_ACCEL)) //设置fifo
-			printf("mpu_configure_fifo complete ......\r\n");
-
-		if(!mpu_set_sample_rate(DEFAULT_MPU_HZ))              //设置采集样率
-			printf("mpu_set_sample_rate complete ......\r\n");
-
-
-		unsigned short gyro_rate = 0, gyro_fsr = 0;
-		unsigned char accel_fsr = 0;
-
-	    mpu_get_sample_rate(&gyro_rate);
-	    mpu_get_gyro_fsr(&gyro_fsr);
-	    mpu_get_accel_fsr(&accel_fsr);
-
-	    printf("gyro_rate %d, gyro_fsr %d, accel_fsr %d\r\n", gyro_rate, gyro_fsr, accel_fsr);
-
-
-
-		if(!dmp_load_motion_driver_firmware())                //加载dmp固件
-			printf("dmp_load_motion_driver_firmware complete ......\r\n");
-
-		if(!dmp_set_orientation(inv_orientation_matrix_to_scalar(gyro_orientation)))
-			printf("dmp_set_orientation complete ......\r\n"); //设置陀螺仪方向
-
-		if(!dmp_enable_feature(DMP_FEATURE_6X_LP_QUAT | DMP_FEATURE_TAP |
-				DMP_FEATURE_ANDROID_ORIENT | DMP_FEATURE_SEND_RAW_ACCEL | DMP_FEATURE_SEND_CAL_GYRO |
-				DMP_FEATURE_GYRO_CAL))
-			printf("dmp_enable_feature complete ......\r\n");
-
-		if(!dmp_set_fifo_rate(DEFAULT_MPU_HZ))    //设置速率
-			printf("dmp_set_fifo_rate complete ......\r\n");
-
-		run_self_test();                          //自检(非必要)
-
-		if(!mpu_set_dmp_state(1))                 //使能
-			printf("mpu_set_dmp_state complete ......\r\n");
-	}
-
-}
-
-#define q30 1073741824.0
-
-uint8_t Read_DMP(float* Pitch,float* Roll,float* Yaw)
-{
-	short gyro[3], accel[3], sensors;
-	float q0=1.0f,q1=0.0f,q2=0.0f,q3=0.0f;
-	unsigned long sensor_timestamp;
-	unsigned char more;
-	long quat[4];
-
-	int ret = dmp_read_fifo(gyro, accel, quat, &sensor_timestamp, &sensors, &more);
-
-//	printf("dmp_read_fifo, %d\r\n", ret);
-
-	if(ret)
-	{
-		return 1;
-	}
-
-	if (sensors & INV_WXYZ_QUAT)
-	{
-		q0=quat[0] / q30;
-		q1=quat[1] / q30;
-		q2=quat[2] / q30;
-		q3=quat[3] / q30;
-		*Pitch = (float)asin(-2 * q1 * q3 + 2 * q0* q2)* 57.3;
-		*Roll =  (float)atan2(2 * q2 * q3 + 2 * q0 * q1, -2 * q1 * q1 - 2 * q2* q2 + 1)* 57.3; // roll
-		*Yaw =   (float)atan2(2*(q1*q2 + q0*q3),q0*q0+q1*q1-q2*q2-q3*q3) * 57.3;
-		return 0;
-	}
-	else
-	{
-		return 2;
-	}
-
-}
-
-
-
-
-
-

+ 0 - 117
Core备份3/imu6/MPU60506.h

@@ -1,117 +0,0 @@
-/*
- * MPU6050.h
- *
- *  Created on: Oct 26, 2021
- *      Author: Administrator
- */
-
-#ifndef INC_MPU6050_H_
-#define INC_MPU6050_H_
-
-#include "i2c.h"
-#include "inv_mpu6.h"
-
-//#define MPU_ACCEL_OFFS_REG		0X06	//accel_offs寄存器,可读取版本号,寄存器手册未提到
-//#define MPU_PROD_ID_REG			0X0C	//prod id寄存器,在寄存器手册未提到
-#define MPU_SELF_TESTX_REG		0X0D	//自检寄存器X
-#define MPU_SELF_TESTY_REG		0X0E	//自检寄存器Y
-#define MPU_SELF_TESTZ_REG		0X0F	//自检寄存器Z
-#define MPU_SELF_TESTA_REG		0X10	//自检寄存器A
-#define MPU_SAMPLE_RATE_REG		0X19	//采样频率分频器
-#define MPU_CFG_REG				0X1A	//配置寄存器
-#define MPU_GYRO_CFG_REG		0X1B	//陀螺仪配置寄存器
-#define MPU_ACCEL_CFG_REG		0X1C	//加速度计配置寄存器
-#define MPU_MOTION_DET_REG		0X1F	//运动检测阀值设置寄存器
-#define MPU_FIFO_EN_REG			0X23	//FIFO使能寄存器
-#define MPU_I2CMST_CTRL_REG		0X24	//IIC主机控制寄存器
-#define MPU_I2CSLV0_ADDR_REG	0X25	//IIC从机0器件地址寄存器
-#define MPU_I2CSLV0_REG			0X26	//IIC从机0数据地址寄存器
-#define MPU_I2CSLV0_CTRL_REG	0X27	//IIC从机0控制寄存器
-#define MPU_I2CSLV1_ADDR_REG	0X28	//IIC从机1器件地址寄存器
-#define MPU_I2CSLV1_REG			0X29	//IIC从机1数据地址寄存器
-#define MPU_I2CSLV1_CTRL_REG	0X2A	//IIC从机1控制寄存器
-#define MPU_I2CSLV2_ADDR_REG	0X2B	//IIC从机2器件地址寄存器
-#define MPU_I2CSLV2_REG			0X2C	//IIC从机2数据地址寄存器
-#define MPU_I2CSLV2_CTRL_REG	0X2D	//IIC从机2控制寄存器
-#define MPU_I2CSLV3_ADDR_REG	0X2E	//IIC从机3器件地址寄存器
-#define MPU_I2CSLV3_REG			0X2F	//IIC从机3数据地址寄存器
-#define MPU_I2CSLV3_CTRL_REG	0X30	//IIC从机3控制寄存器
-#define MPU_I2CSLV4_ADDR_REG	0X31	//IIC从机4器件地址寄存器
-#define MPU_I2CSLV4_REG			0X32	//IIC从机4数据地址寄存器
-#define MPU_I2CSLV4_DO_REG		0X33	//IIC从机4写数据寄存器
-#define MPU_I2CSLV4_CTRL_REG	0X34	//IIC从机4控制寄存器
-#define MPU_I2CSLV4_DI_REG		0X35	//IIC从机4读数据寄存器
-
-#define MPU_I2CMST_STA_REG		0X36	//IIC主机状态寄存器
-#define MPU_INTBP_CFG_REG		0X37	//中断/旁路设置寄存器
-#define MPU_INT_EN_REG			0X38	//中断使能寄存器
-#define MPU_INT_STA_REG			0X3A	//中断状态寄存器
-
-#define MPU_ACCEL_XOUTH_REG		0X3B	//加速度值,X轴高8位寄存器
-#define MPU_ACCEL_XOUTL_REG		0X3C	//加速度值,X轴低8位寄存器
-#define MPU_ACCEL_YOUTH_REG		0X3D	//加速度值,Y轴高8位寄存器
-#define MPU_ACCEL_YOUTL_REG		0X3E	//加速度值,Y轴低8位寄存器
-#define MPU_ACCEL_ZOUTH_REG		0X3F	//加速度值,Z轴高8位寄存器
-#define MPU_ACCEL_ZOUTL_REG		0X40	//加速度值,Z轴低8位寄存器
-
-#define MPU_TEMP_OUTH_REG		0X41	//温度值高八位寄存器
-#define MPU_TEMP_OUTL_REG		0X42	//温度值低8位寄存器
-
-#define MPU_GYRO_XOUTH_REG		0X43	//陀螺仪值,X轴高8位寄存器
-#define MPU_GYRO_XOUTL_REG		0X44	//陀螺仪值,X轴低8位寄存器
-#define MPU_GYRO_YOUTH_REG		0X45	//陀螺仪值,Y轴高8位寄存器
-#define MPU_GYRO_YOUTL_REG		0X46	//陀螺仪值,Y轴低8位寄存器
-#define MPU_GYRO_ZOUTH_REG		0X47	//陀螺仪值,Z轴高8位寄存器
-#define MPU_GYRO_ZOUTL_REG		0X48	//陀螺仪值,Z轴低8位寄存器
-
-#define MPU_I2CSLV0_DO_REG		0X63	//IIC从机0数据寄存器
-#define MPU_I2CSLV1_DO_REG		0X64	//IIC从机1数据寄存器
-#define MPU_I2CSLV2_DO_REG		0X65	//IIC从机2数据寄存器
-#define MPU_I2CSLV3_DO_REG		0X66	//IIC从机3数据寄存器
-
-#define MPU_I2CMST_DELAY_REG	0X67	//IIC主机延时管理寄存器
-#define MPU_SIGPATH_RST_REG		0X68	//信号通道复位寄存器
-#define MPU_MDETECT_CTRL_REG	0X69	//运动检测控制寄存器
-#define MPU_USER_CTRL_REG		0X6A	//用户控制寄存器
-#define MPU_PWR_MGMT1_REG		0X6B	//电源管理寄存器1
-#define MPU_PWR_MGMT2_REG		0X6C	//电源管理寄存器2
-#define MPU_FIFO_CNTH_REG		0X72	//FIFO计数寄存器高八位
-#define MPU_FIFO_CNTL_REG		0X73	//FIFO计数寄存器低八位
-#define MPU_FIFO_RW_REG			0X74	//FIFO读写寄存器
-#define MPU_DEVICE_ID_REG		0X75	//器件ID寄存器
-
-//如果AD0脚接地,IIC地址为0X68(不包含最低位).
-//如果接V3.3,则IIC地址为0X69(不包含最低位).
-#define MPU_ADDR				0X68
-
-
-//因为模块AD0默认接GND,所以转为读写地址后,为0XD1和0XD0(如果接VCC,则为0XD3和0XD2)
-#define MPU_READ    0XD1
-#define MPU_WRITE   0XD0
-
-#define u8 uint8_t
-#define u16 uint16_t
-
-u8 MPU_Init(void); 								//初始化MPU6050
-u8 IIC_Write_Len(u8 addr,u8 reg,u8 len,u8 *buf);//IIC连续写
-u8 IIC_Read_Len(u8 addr,u8 reg,u8 len,u8 *buf); //IIC连续读
-u8 IIC_Write_Byte(u8 reg,u8 data);				//IIC写一个字节
-u8 IIC_Read_Byte(u8 reg);						//IIC读一个字节
-
-u8 MPU_Set_Gyro_Fsr(u8 fsr);
-u8 MPU_Set_Accel_Fsr(u8 fsr);
-u8 MPU_Set_LPF(u16 lpf);
-u8 MPU_Set_Rate(u16 rate);
-u8 MPU_Set_Fifo(u8 sens);
-
-
-short MPU_Get_Temperature(void);
-u8 MPU_Get_Gyroscope(short *gx,short *gy,short *gz);
-u8 MPU_Get_Accelerometer(short *ax,short *ay,short *az);
-
-//----------------------DMP-------------------------------
-void DMP_Init(void);
-uint8_t Read_DMP(float* Pitch,float* Roll,float* Yaw);
-int get_tick_count(unsigned long *count);
-
-#endif /* INC_MPU6050_H_ */

+ 0 - 494
Core备份3/imu6/dmpKey6.h

@@ -1,494 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011 InvenSense Corporation, All Rights Reserved.
- $
- */
-#ifndef DMPKEY_H__
-#define DMPKEY_H__
-
-#define KEY_CFG_25                  (0)
-#define KEY_CFG_24                  (KEY_CFG_25 + 1)
-#define KEY_CFG_26                  (KEY_CFG_24 + 1)
-#define KEY_CFG_27                  (KEY_CFG_26 + 1)
-#define KEY_CFG_21                  (KEY_CFG_27 + 1)
-#define KEY_CFG_20                  (KEY_CFG_21 + 1)
-#define KEY_CFG_TAP4                (KEY_CFG_20 + 1)
-#define KEY_CFG_TAP5                (KEY_CFG_TAP4 + 1)
-#define KEY_CFG_TAP6                (KEY_CFG_TAP5 + 1)
-#define KEY_CFG_TAP7                (KEY_CFG_TAP6 + 1)
-#define KEY_CFG_TAP0                (KEY_CFG_TAP7 + 1)
-#define KEY_CFG_TAP1                (KEY_CFG_TAP0 + 1)
-#define KEY_CFG_TAP2                (KEY_CFG_TAP1 + 1)
-#define KEY_CFG_TAP3                (KEY_CFG_TAP2 + 1)
-#define KEY_CFG_TAP_QUANTIZE        (KEY_CFG_TAP3 + 1)
-#define KEY_CFG_TAP_JERK            (KEY_CFG_TAP_QUANTIZE + 1)
-#define KEY_CFG_DR_INT              (KEY_CFG_TAP_JERK + 1)
-#define KEY_CFG_AUTH                (KEY_CFG_DR_INT + 1)
-#define KEY_CFG_TAP_SAVE_ACCB       (KEY_CFG_AUTH + 1)
-#define KEY_CFG_TAP_CLEAR_STICKY    (KEY_CFG_TAP_SAVE_ACCB + 1)
-#define KEY_CFG_FIFO_ON_EVENT       (KEY_CFG_TAP_CLEAR_STICKY + 1)
-#define KEY_FCFG_ACCEL_INPUT        (KEY_CFG_FIFO_ON_EVENT + 1)
-#define KEY_FCFG_ACCEL_INIT         (KEY_FCFG_ACCEL_INPUT + 1)
-#define KEY_CFG_23                  (KEY_FCFG_ACCEL_INIT + 1)
-#define KEY_FCFG_1                  (KEY_CFG_23 + 1)
-#define KEY_FCFG_3                  (KEY_FCFG_1 + 1)
-#define KEY_FCFG_2                  (KEY_FCFG_3 + 1)
-#define KEY_CFG_3D                  (KEY_FCFG_2 + 1)
-#define KEY_CFG_3B                  (KEY_CFG_3D + 1)
-#define KEY_CFG_3C                  (KEY_CFG_3B + 1)
-#define KEY_FCFG_5                  (KEY_CFG_3C + 1)
-#define KEY_FCFG_4                  (KEY_FCFG_5 + 1)
-#define KEY_FCFG_7                  (KEY_FCFG_4 + 1)
-#define KEY_FCFG_FSCALE             (KEY_FCFG_7 + 1)
-#define KEY_FCFG_AZ                 (KEY_FCFG_FSCALE + 1)
-#define KEY_FCFG_6                  (KEY_FCFG_AZ + 1)
-#define KEY_FCFG_LSB4               (KEY_FCFG_6 + 1)
-#define KEY_CFG_12                  (KEY_FCFG_LSB4 + 1)
-#define KEY_CFG_14                  (KEY_CFG_12 + 1)
-#define KEY_CFG_15                  (KEY_CFG_14 + 1)
-#define KEY_CFG_16                  (KEY_CFG_15 + 1)
-#define KEY_CFG_18                  (KEY_CFG_16 + 1)
-#define KEY_CFG_6                   (KEY_CFG_18 + 1)
-#define KEY_CFG_7                   (KEY_CFG_6 + 1)
-#define KEY_CFG_4                   (KEY_CFG_7 + 1)
-#define KEY_CFG_5                   (KEY_CFG_4 + 1)
-#define KEY_CFG_2                   (KEY_CFG_5 + 1)
-#define KEY_CFG_3                   (KEY_CFG_2 + 1)
-#define KEY_CFG_1                   (KEY_CFG_3 + 1)
-#define KEY_CFG_EXTERNAL            (KEY_CFG_1 + 1)
-#define KEY_CFG_8                   (KEY_CFG_EXTERNAL + 1)
-#define KEY_CFG_9                   (KEY_CFG_8 + 1)
-#define KEY_CFG_ORIENT_3            (KEY_CFG_9 + 1)
-#define KEY_CFG_ORIENT_2            (KEY_CFG_ORIENT_3 + 1)
-#define KEY_CFG_ORIENT_1            (KEY_CFG_ORIENT_2 + 1)
-#define KEY_CFG_GYRO_SOURCE         (KEY_CFG_ORIENT_1 + 1)
-#define KEY_CFG_ORIENT_IRQ_1        (KEY_CFG_GYRO_SOURCE + 1)
-#define KEY_CFG_ORIENT_IRQ_2        (KEY_CFG_ORIENT_IRQ_1 + 1)
-#define KEY_CFG_ORIENT_IRQ_3        (KEY_CFG_ORIENT_IRQ_2 + 1)
-#define KEY_FCFG_MAG_VAL            (KEY_CFG_ORIENT_IRQ_3 + 1)
-#define KEY_FCFG_MAG_MOV            (KEY_FCFG_MAG_VAL + 1)
-#define KEY_CFG_LP_QUAT             (KEY_FCFG_MAG_MOV + 1)
-
-/* MPU6050 keys */
-#define KEY_CFG_ACCEL_FILTER        (KEY_CFG_LP_QUAT + 1)
-#define KEY_CFG_MOTION_BIAS         (KEY_CFG_ACCEL_FILTER + 1)
-#define KEY_TEMPLABEL               (KEY_CFG_MOTION_BIAS + 1)
-
-#define KEY_D_0_22                  (KEY_TEMPLABEL + 1)
-#define KEY_D_0_24                  (KEY_D_0_22 + 1)
-#define KEY_D_0_36                  (KEY_D_0_24 + 1)
-#define KEY_D_0_52                  (KEY_D_0_36 + 1)
-#define KEY_D_0_96                  (KEY_D_0_52 + 1)
-#define KEY_D_0_104                 (KEY_D_0_96 + 1)
-#define KEY_D_0_108                 (KEY_D_0_104 + 1)
-#define KEY_D_0_163                 (KEY_D_0_108 + 1)
-#define KEY_D_0_188                 (KEY_D_0_163 + 1)
-#define KEY_D_0_192                 (KEY_D_0_188 + 1)
-#define KEY_D_0_224                 (KEY_D_0_192 + 1)
-#define KEY_D_0_228                 (KEY_D_0_224 + 1)
-#define KEY_D_0_232                 (KEY_D_0_228 + 1)
-#define KEY_D_0_236                 (KEY_D_0_232 + 1)
-
-#define KEY_DMP_PREVPTAT            (KEY_D_0_236 + 1)
-#define KEY_D_1_2                   (KEY_DMP_PREVPTAT + 1)
-#define KEY_D_1_4                   (KEY_D_1_2 + 1)
-#define KEY_D_1_8                   (KEY_D_1_4 + 1)
-#define KEY_D_1_10                  (KEY_D_1_8 + 1)
-#define KEY_D_1_24                  (KEY_D_1_10 + 1)
-#define KEY_D_1_28                  (KEY_D_1_24 + 1)
-#define KEY_D_1_36                  (KEY_D_1_28 + 1)
-#define KEY_D_1_40                  (KEY_D_1_36 + 1)
-#define KEY_D_1_44                  (KEY_D_1_40 + 1)
-#define KEY_D_1_72                  (KEY_D_1_44 + 1)
-#define KEY_D_1_74                  (KEY_D_1_72 + 1)
-#define KEY_D_1_79                  (KEY_D_1_74 + 1)
-#define KEY_D_1_88                  (KEY_D_1_79 + 1)
-#define KEY_D_1_90                  (KEY_D_1_88 + 1)
-#define KEY_D_1_92                  (KEY_D_1_90 + 1)
-#define KEY_D_1_96                  (KEY_D_1_92 + 1)
-#define KEY_D_1_98                  (KEY_D_1_96 + 1)
-#define KEY_D_1_100                 (KEY_D_1_98 + 1)
-#define KEY_D_1_106                 (KEY_D_1_100 + 1)
-#define KEY_D_1_108                 (KEY_D_1_106 + 1)
-#define KEY_D_1_112                 (KEY_D_1_108 + 1)
-#define KEY_D_1_128                 (KEY_D_1_112 + 1)
-#define KEY_D_1_152                 (KEY_D_1_128 + 1)
-#define KEY_D_1_160                 (KEY_D_1_152 + 1)
-#define KEY_D_1_168                 (KEY_D_1_160 + 1)
-#define KEY_D_1_175                 (KEY_D_1_168 + 1)
-#define KEY_D_1_176                 (KEY_D_1_175 + 1)
-#define KEY_D_1_178                 (KEY_D_1_176 + 1)
-#define KEY_D_1_179                 (KEY_D_1_178 + 1)
-#define KEY_D_1_218                 (KEY_D_1_179 + 1)
-#define KEY_D_1_232                 (KEY_D_1_218 + 1)
-#define KEY_D_1_236                 (KEY_D_1_232 + 1)
-#define KEY_D_1_240                 (KEY_D_1_236 + 1)
-#define KEY_D_1_244                 (KEY_D_1_240 + 1)
-#define KEY_D_1_250                 (KEY_D_1_244 + 1)
-#define KEY_D_1_252                 (KEY_D_1_250 + 1)
-#define KEY_D_2_12                  (KEY_D_1_252 + 1)
-#define KEY_D_2_96                  (KEY_D_2_12 + 1)
-#define KEY_D_2_108                 (KEY_D_2_96 + 1)
-#define KEY_D_2_208                 (KEY_D_2_108 + 1)
-#define KEY_FLICK_MSG               (KEY_D_2_208 + 1)
-#define KEY_FLICK_COUNTER           (KEY_FLICK_MSG + 1)
-#define KEY_FLICK_LOWER             (KEY_FLICK_COUNTER + 1)
-#define KEY_CFG_FLICK_IN            (KEY_FLICK_LOWER + 1)
-#define KEY_FLICK_UPPER             (KEY_CFG_FLICK_IN + 1)
-#define KEY_CGNOTICE_INTR           (KEY_FLICK_UPPER + 1)
-#define KEY_D_2_224                 (KEY_CGNOTICE_INTR + 1)
-#define KEY_D_2_244                 (KEY_D_2_224 + 1)
-#define KEY_D_2_248                 (KEY_D_2_244 + 1)
-#define KEY_D_2_252                 (KEY_D_2_248 + 1)
-
-#define KEY_D_GYRO_BIAS_X               (KEY_D_2_252 + 1)
-#define KEY_D_GYRO_BIAS_Y               (KEY_D_GYRO_BIAS_X + 1)
-#define KEY_D_GYRO_BIAS_Z               (KEY_D_GYRO_BIAS_Y + 1)
-#define KEY_D_ACC_BIAS_X                (KEY_D_GYRO_BIAS_Z + 1)
-#define KEY_D_ACC_BIAS_Y                (KEY_D_ACC_BIAS_X + 1)
-#define KEY_D_ACC_BIAS_Z                (KEY_D_ACC_BIAS_Y + 1)
-#define KEY_D_GYRO_ENABLE               (KEY_D_ACC_BIAS_Z + 1)
-#define KEY_D_ACCEL_ENABLE              (KEY_D_GYRO_ENABLE + 1)
-#define KEY_D_QUAT_ENABLE               (KEY_D_ACCEL_ENABLE +1)
-#define KEY_D_OUTPUT_ENABLE             (KEY_D_QUAT_ENABLE + 1)
-#define KEY_D_CR_TIME_G                 (KEY_D_OUTPUT_ENABLE + 1)
-#define KEY_D_CR_TIME_A                 (KEY_D_CR_TIME_G + 1)
-#define KEY_D_CR_TIME_Q                 (KEY_D_CR_TIME_A + 1)
-#define KEY_D_CS_TAX                    (KEY_D_CR_TIME_Q + 1)
-#define KEY_D_CS_TAY                    (KEY_D_CS_TAX + 1)
-#define KEY_D_CS_TAZ                    (KEY_D_CS_TAY + 1)
-#define KEY_D_CS_TGX                    (KEY_D_CS_TAZ + 1)
-#define KEY_D_CS_TGY                    (KEY_D_CS_TGX + 1)
-#define KEY_D_CS_TGZ                    (KEY_D_CS_TGY + 1)
-#define KEY_D_CS_TQ0                    (KEY_D_CS_TGZ + 1)
-#define KEY_D_CS_TQ1                    (KEY_D_CS_TQ0 + 1)
-#define KEY_D_CS_TQ2                    (KEY_D_CS_TQ1 + 1)
-#define KEY_D_CS_TQ3                    (KEY_D_CS_TQ2 + 1)
-
-/* Compass keys */
-#define KEY_CPASS_BIAS_X            (KEY_D_CS_TQ3 + 1)
-#define KEY_CPASS_BIAS_Y            (KEY_CPASS_BIAS_X + 1)
-#define KEY_CPASS_BIAS_Z            (KEY_CPASS_BIAS_Y + 1)
-#define KEY_CPASS_MTX_00            (KEY_CPASS_BIAS_Z + 1)
-#define KEY_CPASS_MTX_01            (KEY_CPASS_MTX_00 + 1)
-#define KEY_CPASS_MTX_02            (KEY_CPASS_MTX_01 + 1)
-#define KEY_CPASS_MTX_10            (KEY_CPASS_MTX_02 + 1)
-#define KEY_CPASS_MTX_11            (KEY_CPASS_MTX_10 + 1)
-#define KEY_CPASS_MTX_12            (KEY_CPASS_MTX_11 + 1)
-#define KEY_CPASS_MTX_20            (KEY_CPASS_MTX_12 + 1)
-#define KEY_CPASS_MTX_21            (KEY_CPASS_MTX_20 + 1)
-#define KEY_CPASS_MTX_22            (KEY_CPASS_MTX_21 + 1)
-
-/* Gesture Keys */
-#define KEY_DMP_TAPW_MIN            (KEY_CPASS_MTX_22 + 1)
-#define KEY_DMP_TAP_THR_X           (KEY_DMP_TAPW_MIN + 1)
-#define KEY_DMP_TAP_THR_Y           (KEY_DMP_TAP_THR_X + 1)
-#define KEY_DMP_TAP_THR_Z           (KEY_DMP_TAP_THR_Y + 1)
-#define KEY_DMP_SH_TH_Y             (KEY_DMP_TAP_THR_Z + 1)
-#define KEY_DMP_SH_TH_X             (KEY_DMP_SH_TH_Y + 1)
-#define KEY_DMP_SH_TH_Z             (KEY_DMP_SH_TH_X + 1)
-#define KEY_DMP_ORIENT              (KEY_DMP_SH_TH_Z + 1)
-#define KEY_D_ACT0                  (KEY_DMP_ORIENT + 1)
-#define KEY_D_ACSX                  (KEY_D_ACT0 + 1)
-#define KEY_D_ACSY                  (KEY_D_ACSX + 1)
-#define KEY_D_ACSZ                  (KEY_D_ACSY + 1)
-
-#define KEY_X_GRT_Y_TMP             (KEY_D_ACSZ + 1)
-#define KEY_SKIP_X_GRT_Y_TMP        (KEY_X_GRT_Y_TMP + 1)
-#define KEY_SKIP_END_COMPARE        (KEY_SKIP_X_GRT_Y_TMP + 1)
-#define KEY_END_COMPARE_Y_X_TMP2    (KEY_SKIP_END_COMPARE + 1)       
-#define KEY_CFG_ANDROID_ORIENT_INT  (KEY_END_COMPARE_Y_X_TMP2 + 1)
-#define KEY_NO_ORIENT_INTERRUPT     (KEY_CFG_ANDROID_ORIENT_INT + 1)
-#define KEY_END_COMPARE_Y_X_TMP     (KEY_NO_ORIENT_INTERRUPT + 1)
-#define KEY_END_ORIENT_1            (KEY_END_COMPARE_Y_X_TMP + 1)
-#define KEY_END_COMPARE_Y_X         (KEY_END_ORIENT_1 + 1) 
-#define KEY_END_ORIENT              (KEY_END_COMPARE_Y_X + 1)
-#define KEY_X_GRT_Y                 (KEY_END_ORIENT + 1)
-#define KEY_NOT_TIME_MINUS_1        (KEY_X_GRT_Y + 1)       
-#define KEY_END_COMPARE_Y_X_TMP3    (KEY_NOT_TIME_MINUS_1 + 1) 
-#define KEY_X_GRT_Y_TMP2            (KEY_END_COMPARE_Y_X_TMP3 + 1)
-
-/* Authenticate Keys */
-#define KEY_D_AUTH_OUT              (KEY_X_GRT_Y_TMP2 + 1)
-#define KEY_D_AUTH_IN               (KEY_D_AUTH_OUT + 1)
-#define KEY_D_AUTH_A                (KEY_D_AUTH_IN + 1)
-#define KEY_D_AUTH_B                (KEY_D_AUTH_A + 1)
-
-/* Pedometer standalone only keys */
-#define KEY_D_PEDSTD_BP_B           (KEY_D_AUTH_B + 1)
-#define KEY_D_PEDSTD_HP_A           (KEY_D_PEDSTD_BP_B + 1)
-#define KEY_D_PEDSTD_HP_B           (KEY_D_PEDSTD_HP_A + 1)
-#define KEY_D_PEDSTD_BP_A4          (KEY_D_PEDSTD_HP_B + 1)
-#define KEY_D_PEDSTD_BP_A3          (KEY_D_PEDSTD_BP_A4 + 1)
-#define KEY_D_PEDSTD_BP_A2          (KEY_D_PEDSTD_BP_A3 + 1)
-#define KEY_D_PEDSTD_BP_A1          (KEY_D_PEDSTD_BP_A2 + 1)
-#define KEY_D_PEDSTD_INT_THRSH      (KEY_D_PEDSTD_BP_A1 + 1)
-#define KEY_D_PEDSTD_CLIP           (KEY_D_PEDSTD_INT_THRSH + 1)
-#define KEY_D_PEDSTD_SB             (KEY_D_PEDSTD_CLIP + 1)
-#define KEY_D_PEDSTD_SB_TIME        (KEY_D_PEDSTD_SB + 1)
-#define KEY_D_PEDSTD_PEAKTHRSH      (KEY_D_PEDSTD_SB_TIME + 1)
-#define KEY_D_PEDSTD_TIML           (KEY_D_PEDSTD_PEAKTHRSH + 1)
-#define KEY_D_PEDSTD_TIMH           (KEY_D_PEDSTD_TIML + 1)
-#define KEY_D_PEDSTD_PEAK           (KEY_D_PEDSTD_TIMH + 1)
-#define KEY_D_PEDSTD_TIMECTR        (KEY_D_PEDSTD_PEAK + 1)
-#define KEY_D_PEDSTD_STEPCTR        (KEY_D_PEDSTD_TIMECTR + 1)
-#define KEY_D_PEDSTD_WALKTIME       (KEY_D_PEDSTD_STEPCTR + 1)
-#define KEY_D_PEDSTD_DECI           (KEY_D_PEDSTD_WALKTIME + 1)
-
-/*Host Based No Motion*/
-#define KEY_D_HOST_NO_MOT           (KEY_D_PEDSTD_DECI + 1)
-
-/* EIS keys */
-#define KEY_P_EIS_FIFO_FOOTER       (KEY_D_HOST_NO_MOT + 1)
-#define KEY_P_EIS_FIFO_YSHIFT       (KEY_P_EIS_FIFO_FOOTER + 1)
-#define KEY_P_EIS_DATA_RATE         (KEY_P_EIS_FIFO_YSHIFT + 1)
-#define KEY_P_EIS_FIFO_XSHIFT       (KEY_P_EIS_DATA_RATE + 1)
-#define KEY_P_EIS_FIFO_SYNC         (KEY_P_EIS_FIFO_XSHIFT + 1)
-#define KEY_P_EIS_FIFO_ZSHIFT       (KEY_P_EIS_FIFO_SYNC + 1)
-#define KEY_P_EIS_FIFO_READY        (KEY_P_EIS_FIFO_ZSHIFT + 1)
-#define KEY_DMP_FOOTER              (KEY_P_EIS_FIFO_READY + 1)
-#define KEY_DMP_INTX_HC             (KEY_DMP_FOOTER + 1)
-#define KEY_DMP_INTX_PH             (KEY_DMP_INTX_HC + 1)
-#define KEY_DMP_INTX_SH             (KEY_DMP_INTX_PH + 1)
-#define KEY_DMP_AINV_SH             (KEY_DMP_INTX_SH + 1)
-#define KEY_DMP_A_INV_XH            (KEY_DMP_AINV_SH + 1)
-#define KEY_DMP_AINV_PH             (KEY_DMP_A_INV_XH + 1)
-#define KEY_DMP_CTHX_H              (KEY_DMP_AINV_PH + 1)
-#define KEY_DMP_CTHY_H              (KEY_DMP_CTHX_H + 1)
-#define KEY_DMP_CTHZ_H              (KEY_DMP_CTHY_H + 1)
-#define KEY_DMP_NCTHX_H             (KEY_DMP_CTHZ_H + 1)
-#define KEY_DMP_NCTHY_H             (KEY_DMP_NCTHX_H + 1)
-#define KEY_DMP_NCTHZ_H             (KEY_DMP_NCTHY_H + 1)
-#define KEY_DMP_CTSQ_XH             (KEY_DMP_NCTHZ_H + 1)
-#define KEY_DMP_CTSQ_YH             (KEY_DMP_CTSQ_XH + 1)
-#define KEY_DMP_CTSQ_ZH             (KEY_DMP_CTSQ_YH + 1)
-#define KEY_DMP_INTX_H              (KEY_DMP_CTSQ_ZH + 1)
-#define KEY_DMP_INTY_H              (KEY_DMP_INTX_H + 1)
-#define KEY_DMP_INTZ_H              (KEY_DMP_INTY_H + 1)
-//#define KEY_DMP_HPX_H               (KEY_DMP_INTZ_H + 1)
-//#define KEY_DMP_HPY_H               (KEY_DMP_HPX_H + 1)
-//#define KEY_DMP_HPZ_H               (KEY_DMP_HPY_H + 1)
-
-/* Stream keys */
-#define KEY_STREAM_P_GYRO_Z         (KEY_DMP_INTZ_H + 1)
-#define KEY_STREAM_P_GYRO_Y         (KEY_STREAM_P_GYRO_Z + 1)
-#define KEY_STREAM_P_GYRO_X         (KEY_STREAM_P_GYRO_Y + 1)
-#define KEY_STREAM_P_TEMP           (KEY_STREAM_P_GYRO_X + 1)
-#define KEY_STREAM_P_AUX_Y          (KEY_STREAM_P_TEMP + 1)
-#define KEY_STREAM_P_AUX_X          (KEY_STREAM_P_AUX_Y + 1)
-#define KEY_STREAM_P_AUX_Z          (KEY_STREAM_P_AUX_X + 1)
-#define KEY_STREAM_P_ACCEL_Y        (KEY_STREAM_P_AUX_Z + 1)
-#define KEY_STREAM_P_ACCEL_X        (KEY_STREAM_P_ACCEL_Y + 1)
-#define KEY_STREAM_P_FOOTER         (KEY_STREAM_P_ACCEL_X + 1)
-#define KEY_STREAM_P_ACCEL_Z        (KEY_STREAM_P_FOOTER + 1)
-
-#define NUM_KEYS                    (KEY_STREAM_P_ACCEL_Z + 1)
-
-typedef struct {
-    unsigned short key;
-    unsigned short addr;
-} tKeyLabel;
-
-#define DINA0A 0x0a
-#define DINA22 0x22
-#define DINA42 0x42
-#define DINA5A 0x5a
-
-#define DINA06 0x06
-#define DINA0E 0x0e
-#define DINA16 0x16
-#define DINA1E 0x1e
-#define DINA26 0x26
-#define DINA2E 0x2e
-#define DINA36 0x36
-#define DINA3E 0x3e
-#define DINA46 0x46
-#define DINA4E 0x4e
-#define DINA56 0x56
-#define DINA5E 0x5e
-#define DINA66 0x66
-#define DINA6E 0x6e
-#define DINA76 0x76
-#define DINA7E 0x7e
-
-#define DINA00 0x00
-#define DINA08 0x08
-#define DINA10 0x10
-#define DINA18 0x18
-#define DINA20 0x20
-#define DINA28 0x28
-#define DINA30 0x30
-#define DINA38 0x38
-#define DINA40 0x40
-#define DINA48 0x48
-#define DINA50 0x50
-#define DINA58 0x58
-#define DINA60 0x60
-#define DINA68 0x68
-#define DINA70 0x70
-#define DINA78 0x78
-
-#define DINA04 0x04
-#define DINA0C 0x0c
-#define DINA14 0x14
-#define DINA1C 0x1C
-#define DINA24 0x24
-#define DINA2C 0x2c
-#define DINA34 0x34
-#define DINA3C 0x3c
-#define DINA44 0x44
-#define DINA4C 0x4c
-#define DINA54 0x54
-#define DINA5C 0x5c
-#define DINA64 0x64
-#define DINA6C 0x6c
-#define DINA74 0x74
-#define DINA7C 0x7c
-
-#define DINA01 0x01
-#define DINA09 0x09
-#define DINA11 0x11
-#define DINA19 0x19
-#define DINA21 0x21
-#define DINA29 0x29
-#define DINA31 0x31
-#define DINA39 0x39
-#define DINA41 0x41
-#define DINA49 0x49
-#define DINA51 0x51
-#define DINA59 0x59
-#define DINA61 0x61
-#define DINA69 0x69
-#define DINA71 0x71
-#define DINA79 0x79
-
-#define DINA25 0x25
-#define DINA2D 0x2d
-#define DINA35 0x35
-#define DINA3D 0x3d
-#define DINA4D 0x4d
-#define DINA55 0x55
-#define DINA5D 0x5D
-#define DINA6D 0x6d
-#define DINA75 0x75
-#define DINA7D 0x7d
-
-#define DINADC 0xdc
-#define DINAF2 0xf2
-#define DINAAB 0xab
-#define DINAAA 0xaa
-#define DINAF1 0xf1
-#define DINADF 0xdf
-#define DINADA 0xda
-#define DINAB1 0xb1
-#define DINAB9 0xb9
-#define DINAF3 0xf3
-#define DINA8B 0x8b
-#define DINAA3 0xa3
-#define DINA91 0x91
-#define DINAB6 0xb6
-#define DINAB4 0xb4
-
-
-#define DINC00 0x00
-#define DINC01 0x01
-#define DINC02 0x02
-#define DINC03 0x03
-#define DINC08 0x08
-#define DINC09 0x09
-#define DINC0A 0x0a
-#define DINC0B 0x0b
-#define DINC10 0x10
-#define DINC11 0x11
-#define DINC12 0x12
-#define DINC13 0x13
-#define DINC18 0x18
-#define DINC19 0x19
-#define DINC1A 0x1a
-#define DINC1B 0x1b
-
-#define DINC20 0x20
-#define DINC21 0x21
-#define DINC22 0x22
-#define DINC23 0x23
-#define DINC28 0x28
-#define DINC29 0x29
-#define DINC2A 0x2a
-#define DINC2B 0x2b
-#define DINC30 0x30
-#define DINC31 0x31
-#define DINC32 0x32
-#define DINC33 0x33
-#define DINC38 0x38
-#define DINC39 0x39
-#define DINC3A 0x3a
-#define DINC3B 0x3b
-
-#define DINC40 0x40
-#define DINC41 0x41
-#define DINC42 0x42
-#define DINC43 0x43
-#define DINC48 0x48
-#define DINC49 0x49
-#define DINC4A 0x4a
-#define DINC4B 0x4b
-#define DINC50 0x50
-#define DINC51 0x51
-#define DINC52 0x52
-#define DINC53 0x53
-#define DINC58 0x58
-#define DINC59 0x59
-#define DINC5A 0x5a
-#define DINC5B 0x5b
-
-#define DINC60 0x60
-#define DINC61 0x61
-#define DINC62 0x62
-#define DINC63 0x63
-#define DINC68 0x68
-#define DINC69 0x69
-#define DINC6A 0x6a
-#define DINC6B 0x6b
-#define DINC70 0x70
-#define DINC71 0x71
-#define DINC72 0x72
-#define DINC73 0x73
-#define DINC78 0x78
-#define DINC79 0x79
-#define DINC7A 0x7a
-#define DINC7B 0x7b
-
-#define DIND40 0x40
-
-
-#define DINA80 0x80
-#define DINA90 0x90
-#define DINAA0 0xa0
-#define DINAC9 0xc9
-#define DINACB 0xcb
-#define DINACD 0xcd
-#define DINACF 0xcf
-#define DINAC8 0xc8
-#define DINACA 0xca
-#define DINACC 0xcc
-#define DINACE 0xce
-#define DINAD8 0xd8
-#define DINADD 0xdd
-#define DINAF8 0xf0
-#define DINAFE 0xfe
-
-#define DINBF8 0xf8
-#define DINAC0 0xb0
-#define DINAC1 0xb1
-#define DINAC2 0xb4
-#define DINAC3 0xb5
-#define DINAC4 0xb8
-#define DINAC5 0xb9
-#define DINBC0 0xc0
-#define DINBC2 0xc2
-#define DINBC4 0xc4
-#define DINBC6 0xc6
-
-
-
-#endif // DMPKEY_H__

+ 0 - 264
Core备份3/imu6/dmpmap6.h

@@ -1,264 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011 InvenSense Corporation, All Rights Reserved.
- $
- */
-#ifndef DMPMAP_H
-#define DMPMAP_H
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#define DMP_PTAT    0
-#define DMP_XGYR    2
-#define DMP_YGYR    4
-#define DMP_ZGYR    6
-#define DMP_XACC    8
-#define DMP_YACC    10
-#define DMP_ZACC    12
-#define DMP_ADC1    14
-#define DMP_ADC2    16
-#define DMP_ADC3    18
-#define DMP_BIASUNC    20
-#define DMP_FIFORT    22
-#define DMP_INVGSFH    24
-#define DMP_INVGSFL    26
-#define DMP_1H    28
-#define DMP_1L    30
-#define DMP_BLPFSTCH    32
-#define DMP_BLPFSTCL    34
-#define DMP_BLPFSXH    36
-#define DMP_BLPFSXL    38
-#define DMP_BLPFSYH    40
-#define DMP_BLPFSYL    42
-#define DMP_BLPFSZH    44
-#define DMP_BLPFSZL    46
-#define DMP_BLPFMTC    48
-#define DMP_SMC    50
-#define DMP_BLPFMXH    52
-#define DMP_BLPFMXL    54
-#define DMP_BLPFMYH    56
-#define DMP_BLPFMYL    58
-#define DMP_BLPFMZH    60
-#define DMP_BLPFMZL    62
-#define DMP_BLPFC    64
-#define DMP_SMCTH    66
-#define DMP_0H2    68
-#define DMP_0L2    70
-#define DMP_BERR2H    72
-#define DMP_BERR2L    74
-#define DMP_BERR2NH    76
-#define DMP_SMCINC    78
-#define DMP_ANGVBXH    80
-#define DMP_ANGVBXL    82
-#define DMP_ANGVBYH    84
-#define DMP_ANGVBYL    86
-#define DMP_ANGVBZH    88
-#define DMP_ANGVBZL    90
-#define DMP_BERR1H    92
-#define DMP_BERR1L    94
-#define DMP_ATCH    96
-#define DMP_BIASUNCSF    98
-#define DMP_ACT2H    100
-#define DMP_ACT2L    102
-#define DMP_GSFH    104
-#define DMP_GSFL    106
-#define DMP_GH    108
-#define DMP_GL    110
-#define DMP_0_5H    112
-#define DMP_0_5L    114
-#define DMP_0_0H    116
-#define DMP_0_0L    118
-#define DMP_1_0H    120
-#define DMP_1_0L    122
-#define DMP_1_5H    124
-#define DMP_1_5L    126
-#define DMP_TMP1AH    128
-#define DMP_TMP1AL    130
-#define DMP_TMP2AH    132
-#define DMP_TMP2AL    134
-#define DMP_TMP3AH    136
-#define DMP_TMP3AL    138
-#define DMP_TMP4AH    140
-#define DMP_TMP4AL    142
-#define DMP_XACCW    144
-#define DMP_TMP5    146
-#define DMP_XACCB    148
-#define DMP_TMP8    150
-#define DMP_YACCB    152
-#define DMP_TMP9    154
-#define DMP_ZACCB    156
-#define DMP_TMP10    158
-#define DMP_DZH    160
-#define DMP_DZL    162
-#define DMP_XGCH    164
-#define DMP_XGCL    166
-#define DMP_YGCH    168
-#define DMP_YGCL    170
-#define DMP_ZGCH    172
-#define DMP_ZGCL    174
-#define DMP_YACCW    176
-#define DMP_TMP7    178
-#define DMP_AFB1H    180
-#define DMP_AFB1L    182
-#define DMP_AFB2H    184
-#define DMP_AFB2L    186
-#define DMP_MAGFBH    188
-#define DMP_MAGFBL    190
-#define DMP_QT1H    192
-#define DMP_QT1L    194
-#define DMP_QT2H    196
-#define DMP_QT2L    198
-#define DMP_QT3H    200
-#define DMP_QT3L    202
-#define DMP_QT4H    204
-#define DMP_QT4L    206
-#define DMP_CTRL1H    208
-#define DMP_CTRL1L    210
-#define DMP_CTRL2H    212
-#define DMP_CTRL2L    214
-#define DMP_CTRL3H    216
-#define DMP_CTRL3L    218
-#define DMP_CTRL4H    220
-#define DMP_CTRL4L    222
-#define DMP_CTRLS1    224
-#define DMP_CTRLSF1    226
-#define DMP_CTRLS2    228
-#define DMP_CTRLSF2    230
-#define DMP_CTRLS3    232
-#define DMP_CTRLSFNLL    234
-#define DMP_CTRLS4    236
-#define DMP_CTRLSFNL2    238
-#define DMP_CTRLSFNL    240
-#define DMP_TMP30    242
-#define DMP_CTRLSFJT    244
-#define DMP_TMP31    246
-#define DMP_TMP11    248
-#define DMP_CTRLSF2_2    250
-#define DMP_TMP12    252
-#define DMP_CTRLSF1_2    254
-#define DMP_PREVPTAT    256
-#define DMP_ACCZB    258
-#define DMP_ACCXB    264
-#define DMP_ACCYB    266
-#define DMP_1HB    272
-#define DMP_1LB    274
-#define DMP_0H    276
-#define DMP_0L    278
-#define DMP_ASR22H    280
-#define DMP_ASR22L    282
-#define DMP_ASR6H    284
-#define DMP_ASR6L    286
-#define DMP_TMP13    288
-#define DMP_TMP14    290
-#define DMP_FINTXH    292
-#define DMP_FINTXL    294
-#define DMP_FINTYH    296
-#define DMP_FINTYL    298
-#define DMP_FINTZH    300
-#define DMP_FINTZL    302
-#define DMP_TMP1BH    304
-#define DMP_TMP1BL    306
-#define DMP_TMP2BH    308
-#define DMP_TMP2BL    310
-#define DMP_TMP3BH    312
-#define DMP_TMP3BL    314
-#define DMP_TMP4BH    316
-#define DMP_TMP4BL    318
-#define DMP_STXG    320
-#define DMP_ZCTXG    322
-#define DMP_STYG    324
-#define DMP_ZCTYG    326
-#define DMP_STZG    328
-#define DMP_ZCTZG    330
-#define DMP_CTRLSFJT2    332
-#define DMP_CTRLSFJTCNT    334
-#define DMP_PVXG    336
-#define DMP_TMP15    338
-#define DMP_PVYG    340
-#define DMP_TMP16    342
-#define DMP_PVZG    344
-#define DMP_TMP17    346
-#define DMP_MNMFLAGH    352
-#define DMP_MNMFLAGL    354
-#define DMP_MNMTMH    356
-#define DMP_MNMTML    358
-#define DMP_MNMTMTHRH    360
-#define DMP_MNMTMTHRL    362
-#define DMP_MNMTHRH    364
-#define DMP_MNMTHRL    366
-#define DMP_ACCQD4H    368
-#define DMP_ACCQD4L    370
-#define DMP_ACCQD5H    372
-#define DMP_ACCQD5L    374
-#define DMP_ACCQD6H    376
-#define DMP_ACCQD6L    378
-#define DMP_ACCQD7H    380
-#define DMP_ACCQD7L    382
-#define DMP_ACCQD0H    384
-#define DMP_ACCQD0L    386
-#define DMP_ACCQD1H    388
-#define DMP_ACCQD1L    390
-#define DMP_ACCQD2H    392
-#define DMP_ACCQD2L    394
-#define DMP_ACCQD3H    396
-#define DMP_ACCQD3L    398
-#define DMP_XN2H    400
-#define DMP_XN2L    402
-#define DMP_XN1H    404
-#define DMP_XN1L    406
-#define DMP_YN2H    408
-#define DMP_YN2L    410
-#define DMP_YN1H    412
-#define DMP_YN1L    414
-#define DMP_YH    416
-#define DMP_YL    418
-#define DMP_B0H    420
-#define DMP_B0L    422
-#define DMP_A1H    424
-#define DMP_A1L    426
-#define DMP_A2H    428
-#define DMP_A2L    430
-#define DMP_SEM1    432
-#define DMP_FIFOCNT    434
-#define DMP_SH_TH_X    436
-#define DMP_PACKET    438
-#define DMP_SH_TH_Y    440
-#define DMP_FOOTER    442
-#define DMP_SH_TH_Z    444
-#define DMP_TEMP29    448
-#define DMP_TEMP30    450
-#define DMP_XACCB_PRE    452
-#define DMP_XACCB_PREL    454
-#define DMP_YACCB_PRE    456
-#define DMP_YACCB_PREL    458
-#define DMP_ZACCB_PRE    460
-#define DMP_ZACCB_PREL    462
-#define DMP_TMP22    464
-#define DMP_TAP_TIMER    466
-#define DMP_TAP_THX    468
-#define DMP_TAP_THY    472
-#define DMP_TAP_THZ    476
-#define DMP_TAPW_MIN    478
-#define DMP_TMP25    480
-#define DMP_TMP26    482
-#define DMP_TMP27    484
-#define DMP_TMP28    486
-#define DMP_ORIENT    488
-#define DMP_THRSH    490
-#define DMP_ENDIANH    492
-#define DMP_ENDIANL    494
-#define DMP_BLPFNMTCH    496
-#define DMP_BLPFNMTCL    498
-#define DMP_BLPFNMXH    500
-#define DMP_BLPFNMXL    502
-#define DMP_BLPFNMYH    504
-#define DMP_BLPFNMYL    506
-#define DMP_BLPFNMZH    508
-#define DMP_BLPFNMZL    510
-#ifdef __cplusplus
-}
-#endif
-#endif // DMPMAP_H

+ 0 - 2774
Core备份3/imu6/inv_mpu6.c

@@ -1,2774 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011-2012 InvenSense Corporation, All Rights Reserved.
-    See included License.txt for License information.
- $
- */
-/**
- *  @addtogroup  DRIVERS Sensor Driver Layer
- *  @brief       Hardware drivers to communicate with sensors via I2C.
- *
- *  @{
- *      @file       inv_mpu.c
- *      @brief      An I2C-based driver for Invensense gyroscopes.
- *      @details    This driver currently works for the following devices:
- *                  MPU6050
- *                  MPU6500
- *                  MPU9150 (or MPU6050 w/ AK8975 on the auxiliary bus)
- *                  MPU9250 (or MPU6500 w/ AK8963 on the auxiliary bus)
- */
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include "inv_mpu6.h"
-
-#include "MPU60506.h"
-
-
-/* The following functions must be defined for this platform:
- * i2c_write(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char const *data)
- * i2c_read(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char *data)
- * delay_ms(unsigned long num_ms)
- * get_ms(unsigned long *count)
- * reg_int_cb(void (*cb)(void), unsigned char port, unsigned char pin)
- * labs(long x)
- * fabsf(float x)
- * min(int a, int b)
- */
-#if defined MOTION_DRIVER_TARGET_MSP430
-#include "msp430.h"
-#include "msp430_i2c.h"
-#include "msp430_clock.h"
-#include "msp430_interrupt.h"
-#define i2c_write   msp430_i2c_write
-#define i2c_read    msp430_i2c_read
-#define delay_ms    msp430_delay_ms
-#define get_ms      msp430_get_clock_ms
-static inline int reg_int_cb(struct int_param_s *int_param)
-{
-    return msp430_reg_int_cb(int_param->cb, int_param->pin, int_param->lp_exit,
-        int_param->active_low);
-}
-#define log_i(...)     do {} while (0)
-#define log_e(...)     do {} while (0)
-/* labs is already defined by TI's toolchain. */
-/* fabs is for doubles. fabsf is for floats. */
-#define fabs        fabsf
-#define min(a,b) ((a<b)?a:b)
-#elif defined EMPL_TARGET_MSP430
-#include "msp430.h"
-#include "msp430_i2c.h"
-#include "msp430_clock.h"
-#include "msp430_interrupt.h"
-#include "log.h"
-#define i2c_write   msp430_i2c_write
-#define i2c_read    msp430_i2c_read
-#define delay_ms    msp430_delay_ms
-#define get_ms      msp430_get_clock_ms
-static inline int reg_int_cb(struct int_param_s *int_param)
-{
-    return msp430_reg_int_cb(int_param->cb, int_param->pin, int_param->lp_exit,
-        int_param->active_low);
-}
-#define log_i       MPL_LOGI
-#define log_e       MPL_LOGE
-/* labs is already defined by TI's toolchain. */
-/* fabs is for doubles. fabsf is for floats. */
-#define fabs        fabsf
-#define min(a,b) ((a<b)?a:b)
-#elif defined EMPL_TARGET_UC3L0
-/* Instead of using the standard TWI driver from the ASF library, we're using
- * a TWI driver that follows the slave address + register address convention.
- */
-#include "twi.h"
-#include "delay.h"
-#include "sysclk.h"
-#include "log.h"
-#include "sensors_xplained.h"
-#include "uc3l0_clock.h"
-#define i2c_write(a, b, c, d)   twi_write(a, b, d, c)
-#define i2c_read(a, b, c, d)    twi_read(a, b, d, c)
-/* delay_ms is a function already defined in ASF. */
-#define get_ms  uc3l0_get_clock_ms
-static inline int reg_int_cb(struct int_param_s *int_param)
-{
-    sensor_board_irq_connect(int_param->pin, int_param->cb, int_param->arg);
-    return 0;
-}
-#define log_i       MPL_LOGI
-#define log_e       MPL_LOGE
-/* UC3 is a 32-bit processor, so abs and labs are equivalent. */
-#define labs        abs
-#define fabs(x)     (((x)>0)?(x):-(x))
-#elif defined MOTION_DRIVER_TARGET_STM32
-
-/* The following functions must be defined for this platform:
- * i2c_write(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char const *data)
- * i2c_read(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char *data)
- * delay_ms(unsigned long num_ms)
- * get_ms(unsigned long *count)
- * reg_int_cb(void (*cb)(void), unsigned char port, unsigned char pin)
- * labs(long x)
- * fabsf(float x)
- * min(int a, int b)
- */
-
-#define i2c_write   IIC_Write_Len
-#define i2c_read    IIC_Read_Len
-#define delay_ms    HAL_Delay
-#define get_ms      get_tick_count
-//static inline int reg_int_cb(struct int_param_s *int_param)
-//{
-////    return msp430_reg_int_cb(int_param->cb, int_param->pin, int_param->lp_exit,
-////        int_param->active_low);
-//}
-//#define log_i(...)     do {} while (0)
-//#define log_e(...)     do {} while (0)
-
-#define log_i     printf
-#define log_e     printf
-
-/* labs is already defined by TI's toolchain. */
-/* fabs is for doubles. fabsf is for floats. */
-#define fabs        fabsf
-#define min(a,b) ((a<b)?a:b)
-
-#else
-#error  Gyro driver is missing the system layer implementations.
-#endif
-
-#if !defined MPU6050 && !defined MPU9150 && !defined MPU6500 && !defined MPU9250
-#error  Which gyro are you using? Define MPUxxxx in your compiler options.
-#endif
-
-/* Time for some messy macro work. =]
- * #define MPU9150
- * is equivalent to..
- * #define MPU6050
- * #define AK8975_SECONDARY
- *
- * #define MPU9250
- * is equivalent to..
- * #define MPU6500
- * #define AK8963_SECONDARY
- */
-#if defined MPU9150
-#ifndef MPU6050
-#define MPU6050
-#endif                          /* #ifndef MPU6050 */
-#if defined AK8963_SECONDARY
-#error "MPU9150 and AK8963_SECONDARY cannot both be defined."
-#elif !defined AK8975_SECONDARY /* #if defined AK8963_SECONDARY */
-#define AK8975_SECONDARY
-#endif                          /* #if defined AK8963_SECONDARY */
-#elif defined MPU9250           /* #if defined MPU9150 */
-#ifndef MPU6500
-#define MPU6500
-#endif                          /* #ifndef MPU6500 */
-#if defined AK8975_SECONDARY
-#error "MPU9250 and AK8975_SECONDARY cannot both be defined."
-#elif !defined AK8963_SECONDARY /* #if defined AK8975_SECONDARY */
-#define AK8963_SECONDARY
-#endif                          /* #if defined AK8975_SECONDARY */
-#endif                          /* #if defined MPU9150 */
-
-#if defined AK8975_SECONDARY || defined AK8963_SECONDARY
-#define AK89xx_SECONDARY
-#else
-/* #warning "No compass = less profit for Invensense. Lame." */
-#endif
-
-static int set_int_enable(unsigned char enable);
-
-/* Hardware registers needed by driver. */
-struct gyro_reg_s {
-    unsigned char who_am_i;
-    unsigned char rate_div;
-    unsigned char lpf;
-    unsigned char prod_id;
-    unsigned char user_ctrl;
-    unsigned char fifo_en;
-    unsigned char gyro_cfg;
-    unsigned char accel_cfg;
-    unsigned char accel_cfg2;
-    unsigned char lp_accel_odr;
-    unsigned char motion_thr;
-    unsigned char motion_dur;
-    unsigned char fifo_count_h;
-    unsigned char fifo_r_w;
-    unsigned char raw_gyro;
-    unsigned char raw_accel;
-    unsigned char temp;
-    unsigned char int_enable;
-    unsigned char dmp_int_status;
-    unsigned char int_status;
-    unsigned char accel_intel;
-    unsigned char pwr_mgmt_1;
-    unsigned char pwr_mgmt_2;
-    unsigned char int_pin_cfg;
-    unsigned char mem_r_w;
-    unsigned char accel_offs;
-    unsigned char i2c_mst;
-    unsigned char bank_sel;
-    unsigned char mem_start_addr;
-    unsigned char prgm_start_h;
-#if defined AK89xx_SECONDARY
-    unsigned char s0_addr;
-    unsigned char s0_reg;
-    unsigned char s0_ctrl;
-    unsigned char s1_addr;
-    unsigned char s1_reg;
-    unsigned char s1_ctrl;
-    unsigned char s4_ctrl;
-    unsigned char s0_do;
-    unsigned char s1_do;
-    unsigned char i2c_delay_ctrl;
-    unsigned char raw_compass;
-    /* The I2C_MST_VDDIO bit is in this register. */
-    unsigned char yg_offs_tc;
-#endif
-};
-
-/* Information specific to a particular device. */
-struct hw_s {
-    unsigned char addr;
-    unsigned short max_fifo;
-    unsigned char num_reg;
-    unsigned short temp_sens;
-    short temp_offset;
-    unsigned short bank_size;
-#if defined AK89xx_SECONDARY
-    unsigned short compass_fsr;
-#endif
-};
-
-/* When entering motion interrupt mode, the driver keeps track of the
- * previous state so that it can be restored at a later time.
- * TODO: This is tacky. Fix it.
- */
-struct motion_int_cache_s {
-    unsigned short gyro_fsr;
-    unsigned char accel_fsr;
-    unsigned short lpf;
-    unsigned short sample_rate;
-    unsigned char sensors_on;
-    unsigned char fifo_sensors;
-    unsigned char dmp_on;
-};
-
-/* Cached chip configuration data.
- * TODO: A lot of these can be handled with a bitmask.
- */
-struct chip_cfg_s {
-    /* Matches gyro_cfg >> 3 & 0x03 */
-    unsigned char gyro_fsr;
-    /* Matches accel_cfg >> 3 & 0x03 */
-    unsigned char accel_fsr;
-    /* Enabled sensors. Uses same masks as fifo_en, NOT pwr_mgmt_2. */
-    unsigned char sensors;
-    /* Matches config register. */
-    unsigned char lpf;
-    unsigned char clk_src;
-    /* Sample rate, NOT rate divider. */
-    unsigned short sample_rate;
-    /* Matches fifo_en register. */
-    unsigned char fifo_enable;
-    /* Matches int enable register. */
-    unsigned char int_enable;
-    /* 1 if devices on auxiliary I2C bus appear on the primary. */
-    unsigned char bypass_mode;
-    /* 1 if half-sensitivity.
-     * NOTE: This doesn't belong here, but everything else in hw_s is const,
-     * and this allows us to save some precious RAM.
-     */
-    unsigned char accel_half;
-    /* 1 if device in low-power accel-only mode. */
-    unsigned char lp_accel_mode;
-    /* 1 if interrupts are only triggered on motion events. */
-    unsigned char int_motion_only;
-    struct motion_int_cache_s cache;
-    /* 1 for active low interrupts. */
-    unsigned char active_low_int;
-    /* 1 for latched interrupts. */
-    unsigned char latched_int;
-    /* 1 if DMP is enabled. */
-    unsigned char dmp_on;
-    /* Ensures that DMP will only be loaded once. */
-    unsigned char dmp_loaded;
-    /* Sampling rate used when DMP is enabled. */
-    unsigned short dmp_sample_rate;
-#ifdef AK89xx_SECONDARY
-    /* Compass sample rate. */
-    unsigned short compass_sample_rate;
-    unsigned char compass_addr;
-    short mag_sens_adj[3];
-#endif
-};
-
-/* Information for self-test. */
-struct test_s {
-    unsigned long gyro_sens;
-    unsigned long accel_sens;
-    unsigned char reg_rate_div;
-    unsigned char reg_lpf;
-    unsigned char reg_gyro_fsr;
-    unsigned char reg_accel_fsr;
-    unsigned short wait_ms;
-    unsigned char packet_thresh;
-    float min_dps;
-    float max_dps;
-    float max_gyro_var;
-    float min_g;
-    float max_g;
-    float max_accel_var;
-};
-
-/* Gyro driver state variables. */
-struct gyro_state_s {
-    const struct gyro_reg_s *reg;
-    const struct hw_s *hw;
-    struct chip_cfg_s chip_cfg;
-    const struct test_s *test;
-};
-
-/* Filter configurations. */
-enum lpf_e {
-    INV_FILTER_256HZ_NOLPF2 = 0,
-    INV_FILTER_188HZ,
-    INV_FILTER_98HZ,
-    INV_FILTER_42HZ,
-    INV_FILTER_20HZ,
-    INV_FILTER_10HZ,
-    INV_FILTER_5HZ,
-    INV_FILTER_2100HZ_NOLPF,
-    NUM_FILTER
-};
-
-/* Full scale ranges. */
-enum gyro_fsr_e {
-    INV_FSR_250DPS = 0,
-    INV_FSR_500DPS,
-    INV_FSR_1000DPS,
-    INV_FSR_2000DPS,
-    NUM_GYRO_FSR
-};
-
-/* Full scale ranges. */
-enum accel_fsr_e {
-    INV_FSR_2G = 0,
-    INV_FSR_4G,
-    INV_FSR_8G,
-    INV_FSR_16G,
-    NUM_ACCEL_FSR
-};
-
-/* Clock sources. */
-enum clock_sel_e {
-    INV_CLK_INTERNAL = 0,
-    INV_CLK_PLL,
-    NUM_CLK
-};
-
-/* Low-power accel wakeup rates. */
-enum lp_accel_rate_e {
-#if defined MPU6050
-    INV_LPA_1_25HZ,
-    INV_LPA_5HZ,
-    INV_LPA_20HZ,
-    INV_LPA_40HZ
-#elif defined MPU6500
-    INV_LPA_0_3125HZ,
-    INV_LPA_0_625HZ,
-    INV_LPA_1_25HZ,
-    INV_LPA_2_5HZ,
-    INV_LPA_5HZ,
-    INV_LPA_10HZ,
-    INV_LPA_20HZ,
-    INV_LPA_40HZ,
-    INV_LPA_80HZ,
-    INV_LPA_160HZ,
-    INV_LPA_320HZ,
-    INV_LPA_640HZ
-#endif
-};
-
-#define BIT_I2C_MST_VDDIO   (0x80)
-#define BIT_FIFO_EN         (0x40)
-#define BIT_DMP_EN          (0x80)
-#define BIT_FIFO_RST        (0x04)
-#define BIT_DMP_RST         (0x08)
-#define BIT_FIFO_OVERFLOW   (0x10)
-#define BIT_DATA_RDY_EN     (0x01)
-#define BIT_DMP_INT_EN      (0x02)
-#define BIT_MOT_INT_EN      (0x40)
-#define BITS_FSR            (0x18)
-#define BITS_LPF            (0x07)
-#define BITS_HPF            (0x07)
-#define BITS_CLK            (0x07)
-#define BIT_FIFO_SIZE_1024  (0x40)
-#define BIT_FIFO_SIZE_2048  (0x80)
-#define BIT_FIFO_SIZE_4096  (0xC0)
-#define BIT_RESET           (0x80)
-#define BIT_SLEEP           (0x40)
-#define BIT_S0_DELAY_EN     (0x01)
-#define BIT_S2_DELAY_EN     (0x04)
-#define BITS_SLAVE_LENGTH   (0x0F)
-#define BIT_SLAVE_BYTE_SW   (0x40)
-#define BIT_SLAVE_GROUP     (0x10)
-#define BIT_SLAVE_EN        (0x80)
-#define BIT_I2C_READ        (0x80)
-#define BITS_I2C_MASTER_DLY (0x1F)
-#define BIT_AUX_IF_EN       (0x20)
-#define BIT_ACTL            (0x80)
-#define BIT_LATCH_EN        (0x20)
-#define BIT_ANY_RD_CLR      (0x10)
-#define BIT_BYPASS_EN       (0x02)
-#define BITS_WOM_EN         (0xC0)
-#define BIT_LPA_CYCLE       (0x20)
-#define BIT_STBY_XA         (0x20)
-#define BIT_STBY_YA         (0x10)
-#define BIT_STBY_ZA         (0x08)
-#define BIT_STBY_XG         (0x04)
-#define BIT_STBY_YG         (0x02)
-#define BIT_STBY_ZG         (0x01)
-#define BIT_STBY_XYZA       (BIT_STBY_XA | BIT_STBY_YA | BIT_STBY_ZA)
-#define BIT_STBY_XYZG       (BIT_STBY_XG | BIT_STBY_YG | BIT_STBY_ZG)
-
-#if defined AK8975_SECONDARY
-#define SUPPORTS_AK89xx_HIGH_SENS   (0x00)
-#define AK89xx_FSR                  (9830)
-#elif defined AK8963_SECONDARY
-#define SUPPORTS_AK89xx_HIGH_SENS   (0x10)
-#define AK89xx_FSR                  (4915)
-#endif
-
-#ifdef AK89xx_SECONDARY
-#define AKM_REG_WHOAMI      (0x00)
-
-#define AKM_REG_ST1         (0x02)
-#define AKM_REG_HXL         (0x03)
-#define AKM_REG_ST2         (0x09)
-
-#define AKM_REG_CNTL        (0x0A)
-#define AKM_REG_ASTC        (0x0C)
-#define AKM_REG_ASAX        (0x10)
-#define AKM_REG_ASAY        (0x11)
-#define AKM_REG_ASAZ        (0x12)
-
-#define AKM_DATA_READY      (0x01)
-#define AKM_DATA_OVERRUN    (0x02)
-#define AKM_OVERFLOW        (0x80)
-#define AKM_DATA_ERROR      (0x40)
-
-#define AKM_BIT_SELF_TEST   (0x40)
-
-#define AKM_POWER_DOWN          (0x00 | SUPPORTS_AK89xx_HIGH_SENS)
-#define AKM_SINGLE_MEASUREMENT  (0x01 | SUPPORTS_AK89xx_HIGH_SENS)
-#define AKM_FUSE_ROM_ACCESS     (0x0F | SUPPORTS_AK89xx_HIGH_SENS)
-#define AKM_MODE_SELF_TEST      (0x08 | SUPPORTS_AK89xx_HIGH_SENS)
-
-#define AKM_WHOAMI      (0x48)
-#endif
-
-#if defined MPU6050
-const struct gyro_reg_s reg = {
-    .who_am_i       = 0x75,
-    .rate_div       = 0x19,
-    .lpf            = 0x1A,
-    .prod_id        = 0x0C,
-    .user_ctrl      = 0x6A,
-    .fifo_en        = 0x23,
-    .gyro_cfg       = 0x1B,
-    .accel_cfg      = 0x1C,
-    .motion_thr     = 0x1F,
-    .motion_dur     = 0x20,
-    .fifo_count_h   = 0x72,
-    .fifo_r_w       = 0x74,
-    .raw_gyro       = 0x43,
-    .raw_accel      = 0x3B,
-    .temp           = 0x41,
-    .int_enable     = 0x38,
-    .dmp_int_status = 0x39,
-    .int_status     = 0x3A,
-    .pwr_mgmt_1     = 0x6B,
-    .pwr_mgmt_2     = 0x6C,
-    .int_pin_cfg    = 0x37,
-    .mem_r_w        = 0x6F,
-    .accel_offs     = 0x06,
-    .i2c_mst        = 0x24,
-    .bank_sel       = 0x6D,
-    .mem_start_addr = 0x6E,
-    .prgm_start_h   = 0x70
-#ifdef AK89xx_SECONDARY
-    ,.raw_compass   = 0x49,
-    .yg_offs_tc     = 0x01,
-    .s0_addr        = 0x25,
-    .s0_reg         = 0x26,
-    .s0_ctrl        = 0x27,
-    .s1_addr        = 0x28,
-    .s1_reg         = 0x29,
-    .s1_ctrl        = 0x2A,
-    .s4_ctrl        = 0x34,
-    .s0_do          = 0x63,
-    .s1_do          = 0x64,
-    .i2c_delay_ctrl = 0x67
-#endif
-};
-const struct hw_s hw = {
-    .addr           = 0x68,
-    .max_fifo       = 1024,
-    .num_reg        = 118,
-    .temp_sens      = 340,
-    .temp_offset    = -521,
-    .bank_size      = 256
-#if defined AK89xx_SECONDARY
-    ,.compass_fsr    = AK89xx_FSR
-#endif
-};
-
-const struct test_s test = {
-    .gyro_sens      = 32768/250,
-    .accel_sens     = 32768/16,
-    .reg_rate_div   = 0,    /* 1kHz. */
-    .reg_lpf        = 1,    /* 188Hz. */
-    .reg_gyro_fsr   = 0,    /* 250dps. */
-    .reg_accel_fsr  = 0x18, /* 16g. */
-    .wait_ms        = 50,
-    .packet_thresh  = 5,    /* 5% */
-    .min_dps        = 10.f,
-    .max_dps        = 105.f,
-    .max_gyro_var   = 0.14f,
-    .min_g          = 0.3f,
-    .max_g          = 0.95f,
-    .max_accel_var  = 0.14f
-};
-
-static struct gyro_state_s st = {
-    .reg = &reg,
-    .hw = &hw,
-    .test = &test
-};
-#elif defined MPU6500
-const struct gyro_reg_s reg = {
-    .who_am_i       = 0x75,
-    .rate_div       = 0x19,
-    .lpf            = 0x1A,
-    .prod_id        = 0x0C,
-    .user_ctrl      = 0x6A,
-    .fifo_en        = 0x23,
-    .gyro_cfg       = 0x1B,
-    .accel_cfg      = 0x1C,
-    .accel_cfg2     = 0x1D,
-    .lp_accel_odr   = 0x1E,
-    .motion_thr     = 0x1F,
-    .motion_dur     = 0x20,
-    .fifo_count_h   = 0x72,
-    .fifo_r_w       = 0x74,
-    .raw_gyro       = 0x43,
-    .raw_accel      = 0x3B,
-    .temp           = 0x41,
-    .int_enable     = 0x38,
-    .dmp_int_status = 0x39,
-    .int_status     = 0x3A,
-    .accel_intel    = 0x69,
-    .pwr_mgmt_1     = 0x6B,
-    .pwr_mgmt_2     = 0x6C,
-    .int_pin_cfg    = 0x37,
-    .mem_r_w        = 0x6F,
-    .accel_offs     = 0x77,
-    .i2c_mst        = 0x24,
-    .bank_sel       = 0x6D,
-    .mem_start_addr = 0x6E,
-    .prgm_start_h   = 0x70
-#ifdef AK89xx_SECONDARY
-    ,.raw_compass   = 0x49,
-    .s0_addr        = 0x25,
-    .s0_reg         = 0x26,
-    .s0_ctrl        = 0x27,
-    .s1_addr        = 0x28,
-    .s1_reg         = 0x29,
-    .s1_ctrl        = 0x2A,
-    .s4_ctrl        = 0x34,
-    .s0_do          = 0x63,
-    .s1_do          = 0x64,
-    .i2c_delay_ctrl = 0x67
-#endif
-};
-const struct hw_s hw = {
-    .addr           = 0x68,
-    .max_fifo       = 1024,
-    .num_reg        = 128,
-    .temp_sens      = 321,
-    .temp_offset    = 0,
-    .bank_size      = 256
-#if defined AK89xx_SECONDARY
-    ,.compass_fsr    = AK89xx_FSR
-#endif
-};
-
-const struct test_s test = {
-    .gyro_sens      = 32768/250,
-    .accel_sens     = 32768/16,
-    .reg_rate_div   = 0,    /* 1kHz. */
-    .reg_lpf        = 1,    /* 188Hz. */
-    .reg_gyro_fsr   = 0,    /* 250dps. */
-    .reg_accel_fsr  = 0x18, /* 16g. */
-    .wait_ms        = 50,
-    .packet_thresh  = 5,    /* 5% */
-    .min_dps        = 10.f,
-    .max_dps        = 105.f,
-    .max_gyro_var   = 0.14f,
-    .min_g          = 0.3f,
-    .max_g          = 0.95f,
-    .max_accel_var  = 0.14f
-};
-
-static struct gyro_state_s st = {
-    .reg = &reg,
-    .hw = &hw,
-    .test = &test
-};
-#endif
-
-#define MAX_PACKET_LENGTH (12)
-
-#ifdef AK89xx_SECONDARY
-static int setup_compass(void);
-#define MAX_COMPASS_SAMPLE_RATE (100)
-#endif
-
-/**
- *  @brief      Enable/disable data ready interrupt.
- *  If the DMP is on, the DMP interrupt is enabled. Otherwise, the data ready
- *  interrupt is used.
- *  @param[in]  enable      1 to enable interrupt.
- *  @return     0 if successful.
- */
-static int set_int_enable(unsigned char enable)
-{
-    unsigned char tmp;
-
-    if (st.chip_cfg.dmp_on) {
-        if (enable)
-            tmp = BIT_DMP_INT_EN;
-        else
-            tmp = 0x00;
-        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &tmp))
-            return -1;
-        st.chip_cfg.int_enable = tmp;
-    } else {
-        if (!st.chip_cfg.sensors)
-            return -1;
-        if (enable && st.chip_cfg.int_enable)
-            return 0;
-        if (enable)
-            tmp = BIT_DATA_RDY_EN;
-        else
-            tmp = 0x00;
-        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &tmp))
-            return -1;
-        st.chip_cfg.int_enable = tmp;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Register dump for testing.
- *  @return     0 if successful.
- */
-int mpu_reg_dump(void)
-{
-    unsigned char ii;
-    unsigned char data;
-
-    for (ii = 0; ii < st.hw->num_reg; ii++) {
-        if (ii == st.reg->fifo_r_w || ii == st.reg->mem_r_w)
-            continue;
-        if (i2c_read(st.hw->addr, ii, 1, &data))
-            return -1;
-        log_i("%#5x: %#5x\r\n", ii, data);
-    }
-    return 0;
-}
-
-/**
- *  @brief      Read from a single register.
- *  NOTE: The memory and FIFO read/write registers cannot be accessed.
- *  @param[in]  reg     Register address.
- *  @param[out] data    Register data.
- *  @return     0 if successful.
- */
-int mpu_read_reg(unsigned char reg, unsigned char *data)
-{
-    if (reg == st.reg->fifo_r_w || reg == st.reg->mem_r_w)
-        return -1;
-    if (reg >= st.hw->num_reg)
-        return -1;
-    return i2c_read(st.hw->addr, reg, 1, data);
-}
-
-/**
- *  @brief      Initialize hardware.
- *  Initial configuration:\n
- *  Gyro FSR: +/- 2000DPS\n
- *  Accel FSR +/- 2G\n
- *  DLPF: 42Hz\n
- *  FIFO rate: 50Hz\n
- *  Clock source: Gyro PLL\n
- *  FIFO: Disabled.\n
- *  Data ready interrupt: Disabled, active low, unlatched.
- *  @param[in]  int_param   Platform-specific parameters to interrupt API.
- *  @return     0 if successful.
- */
-int mpu_init(struct int_param_s *int_param)
-{
-    unsigned char data[6], rev;
-
-    /* Reset device. */
-    data[0] = BIT_RESET;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, data))
-        return -1;
-    delay_ms(100);
-
-    /* Wake up chip. */
-    data[0] = 0x00;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, data))
-        return -1;
-
-#if defined MPU6050
-    /* Check product revision. */
-    if (i2c_read(st.hw->addr, st.reg->accel_offs, 6, data))
-        return -1;
-    rev = ((data[5] & 0x01) << 2) | ((data[3] & 0x01) << 1) |
-        (data[1] & 0x01);
-
-    if (rev) {
-        /* Congrats, these parts are better. */
-        if (rev == 1)
-            st.chip_cfg.accel_half = 1;
-        else if (rev == 2)
-            st.chip_cfg.accel_half = 0;
-        else {
-            log_e("Unsupported software product rev %d.\n", rev);
-            return -1;
-        }
-    } else {
-        if (i2c_read(st.hw->addr, st.reg->prod_id, 1, data))
-            return -1;
-        rev = data[0] & 0x0F;
-        if (!rev) {
-            log_e("Product ID read as 0 indicates device is either "
-                "incompatible or an MPU3050.\n");
-            return -1;
-        } else if (rev == 4) {
-            log_i("Half sensitivity part found.\n");
-            st.chip_cfg.accel_half = 1;
-        } else
-            st.chip_cfg.accel_half = 0;
-    }
-#elif defined MPU6500
-#define MPU6500_MEM_REV_ADDR    (0x17)
-    if (mpu_read_mem(MPU6500_MEM_REV_ADDR, 1, &rev))
-        return -1;
-    if (rev == 0x1)
-        st.chip_cfg.accel_half = 0;
-    else {
-        log_e("Unsupported software product rev %d.\n", rev);
-        return -1;
-    }
-
-    /* MPU6500 shares 4kB of memory between the DMP and the FIFO. Since the
-     * first 3kB are needed by the DMP, we'll use the last 1kB for the FIFO.
-     */
-    data[0] = BIT_FIFO_SIZE_1024 | 0x8;
-    if (i2c_write(st.hw->addr, st.reg->accel_cfg2, 1, data))
-        return -1;
-#endif
-
-    /* Set to invalid values to ensure no I2C writes are skipped. */
-    st.chip_cfg.sensors = 0xFF;
-    st.chip_cfg.gyro_fsr = 0xFF;
-    st.chip_cfg.accel_fsr = 0xFF;
-    st.chip_cfg.lpf = 0xFF;
-    st.chip_cfg.sample_rate = 0xFFFF;
-    st.chip_cfg.fifo_enable = 0xFF;
-    st.chip_cfg.bypass_mode = 0xFF;
-#ifdef AK89xx_SECONDARY
-    st.chip_cfg.compass_sample_rate = 0xFFFF;
-#endif
-    /* mpu_set_sensors always preserves this setting. */
-    st.chip_cfg.clk_src = INV_CLK_PLL;
-    /* Handled in next call to mpu_set_bypass. */
-    st.chip_cfg.active_low_int = 1;
-    st.chip_cfg.latched_int = 0;
-    st.chip_cfg.int_motion_only = 0;
-    st.chip_cfg.lp_accel_mode = 0;
-    memset(&st.chip_cfg.cache, 0, sizeof(st.chip_cfg.cache));
-    st.chip_cfg.dmp_on = 0;
-    st.chip_cfg.dmp_loaded = 0;
-    st.chip_cfg.dmp_sample_rate = 0;
-
-    if (mpu_set_gyro_fsr(2000))
-        return -1;
-    if (mpu_set_accel_fsr(2))
-        return -1;
-    if (mpu_set_lpf(42))
-        return -1;
-    if (mpu_set_sample_rate(50))
-        return -1;
-    if (mpu_configure_fifo(0))
-        return -1;
-
-#ifndef MOTION_DRIVER_TARGET_STM32
-    if (int_param)
-        reg_int_cb(int_param);
-#endif
-
-#ifdef AK89xx_SECONDARY
-    setup_compass();
-    if (mpu_set_compass_sample_rate(10))
-        return -1;
-#else
-    /* Already disabled by setup_compass. */
-    if (mpu_set_bypass(0))
-        return -1;
-#endif
-
-    mpu_set_sensors(0);
-    return 0;
-}
-
-/**
- *  @brief      Enter low-power accel-only mode.
- *  In low-power accel mode, the chip goes to sleep and only wakes up to sample
- *  the accelerometer at one of the following frequencies:
- *  \n MPU6050: 1.25Hz, 5Hz, 20Hz, 40Hz
- *  \n MPU6500: 1.25Hz, 2.5Hz, 5Hz, 10Hz, 20Hz, 40Hz, 80Hz, 160Hz, 320Hz, 640Hz
- *  \n If the requested rate is not one listed above, the device will be set to
- *  the next highest rate. Requesting a rate above the maximum supported
- *  frequency will result in an error.
- *  \n To select a fractional wake-up frequency, round down the value passed to
- *  @e rate.
- *  @param[in]  rate        Minimum sampling rate, or zero to disable LP
- *                          accel mode.
- *  @return     0 if successful.
- */
-int mpu_lp_accel_mode(unsigned char rate)
-{
-    unsigned char tmp[2];
-
-    if (rate > 40)
-        return -1;
-
-    if (!rate) {
-        mpu_set_int_latched(0);
-        tmp[0] = 0;
-        tmp[1] = BIT_STBY_XYZG;
-        if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 2, tmp))
-            return -1;
-        st.chip_cfg.lp_accel_mode = 0;
-        return 0;
-    }
-    /* For LP accel, we automatically configure the hardware to produce latched
-     * interrupts. In LP accel mode, the hardware cycles into sleep mode before
-     * it gets a chance to deassert the interrupt pin; therefore, we shift this
-     * responsibility over to the MCU.
-     *
-     * Any register read will clear the interrupt.
-     */
-    mpu_set_int_latched(1);
-#if defined MPU6050
-    tmp[0] = BIT_LPA_CYCLE;
-    if (rate == 1) {
-        tmp[1] = INV_LPA_1_25HZ;
-        mpu_set_lpf(5);
-    } else if (rate <= 5) {
-        tmp[1] = INV_LPA_5HZ;
-        mpu_set_lpf(5);
-    } else if (rate <= 20) {
-        tmp[1] = INV_LPA_20HZ;
-        mpu_set_lpf(10);
-    } else {
-        tmp[1] = INV_LPA_40HZ;
-        mpu_set_lpf(20);
-    }
-    tmp[1] = (tmp[1] << 6) | BIT_STBY_XYZG;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 2, tmp))
-        return -1;
-#elif defined MPU6500
-    /* Set wake frequency. */
-    if (rate == 1)
-        tmp[0] = INV_LPA_1_25HZ;
-    else if (rate == 2)
-        tmp[0] = INV_LPA_2_5HZ;
-    else if (rate <= 5)
-        tmp[0] = INV_LPA_5HZ;
-    else if (rate <= 10)
-        tmp[0] = INV_LPA_10HZ;
-    else if (rate <= 20)
-        tmp[0] = INV_LPA_20HZ;
-    else if (rate <= 40)
-        tmp[0] = INV_LPA_40HZ;
-    else if (rate <= 80)
-        tmp[0] = INV_LPA_80HZ;
-    else if (rate <= 160)
-        tmp[0] = INV_LPA_160HZ;
-    else if (rate <= 320)
-        tmp[0] = INV_LPA_320HZ;
-    else
-        tmp[0] = INV_LPA_640HZ;
-    if (i2c_write(st.hw->addr, st.reg->lp_accel_odr, 1, tmp))
-        return -1;
-    tmp[0] = BIT_LPA_CYCLE;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, tmp))
-        return -1;
-#endif
-    st.chip_cfg.sensors = INV_XYZ_ACCEL;
-    st.chip_cfg.clk_src = 0;
-    st.chip_cfg.lp_accel_mode = 1;
-    mpu_configure_fifo(0);
-
-    return 0;
-}
-
-/**
- *  @brief      Read raw gyro data directly from the registers.
- *  @param[out] data        Raw data in hardware units.
- *  @param[out] timestamp   Timestamp in milliseconds. Null if not needed.
- *  @return     0 if successful.
- */
-int mpu_get_gyro_reg(short *data, unsigned long *timestamp)
-{
-    unsigned char tmp[6];
-
-    if (!(st.chip_cfg.sensors & INV_XYZ_GYRO))
-        return -1;
-
-    if (i2c_read(st.hw->addr, st.reg->raw_gyro, 6, tmp))
-        return -1;
-    data[0] = (tmp[0] << 8) | tmp[1];
-    data[1] = (tmp[2] << 8) | tmp[3];
-    data[2] = (tmp[4] << 8) | tmp[5];
-    if (timestamp)
-        get_ms(timestamp);
-    return 0;
-}
-
-/**
- *  @brief      Read raw accel data directly from the registers.
- *  @param[out] data        Raw data in hardware units.
- *  @param[out] timestamp   Timestamp in milliseconds. Null if not needed.
- *  @return     0 if successful.
- */
-int mpu_get_accel_reg(short *data, unsigned long *timestamp)
-{
-    unsigned char tmp[6];
-
-    if (!(st.chip_cfg.sensors & INV_XYZ_ACCEL))
-        return -1;
-
-    if (i2c_read(st.hw->addr, st.reg->raw_accel, 6, tmp))
-        return -1;
-    data[0] = (tmp[0] << 8) | tmp[1];
-    data[1] = (tmp[2] << 8) | tmp[3];
-    data[2] = (tmp[4] << 8) | tmp[5];
-    if (timestamp)
-        get_ms(timestamp);
-    return 0;
-}
-
-/**
- *  @brief      Read temperature data directly from the registers.
- *  @param[out] data        Data in q16 format.
- *  @param[out] timestamp   Timestamp in milliseconds. Null if not needed.
- *  @return     0 if successful.
- */
-int mpu_get_temperature(long *data, unsigned long *timestamp)
-{
-    unsigned char tmp[2];
-    short raw;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    if (i2c_read(st.hw->addr, st.reg->temp, 2, tmp))
-        return -1;
-    raw = (tmp[0] << 8) | tmp[1];
-    if (timestamp)
-        get_ms(timestamp);
-
-    data[0] = (long)((35 + ((raw - (float)st.hw->temp_offset) / st.hw->temp_sens)) * 65536L);
-    return 0;
-}
-
-/**
- *  @brief      Push biases to the accel bias registers.
- *  This function expects biases relative to the current sensor output, and
- *  these biases will be added to the factory-supplied values.
- *  @param[in]  accel_bias  New biases.
- *  @return     0 if successful.
- */
-int mpu_set_accel_bias(const long *accel_bias)
-{
-    unsigned char data[6];
-    short accel_hw[3];
-    short got_accel[3];
-    short fg[3];
-
-    if (!accel_bias)
-        return -1;
-    if (!accel_bias[0] && !accel_bias[1] && !accel_bias[2])
-        return 0;
-
-    if (i2c_read(st.hw->addr, 3, 3, data))
-        return -1;
-    fg[0] = ((data[0] >> 4) + 8) & 0xf;
-    fg[1] = ((data[1] >> 4) + 8) & 0xf;
-    fg[2] = ((data[2] >> 4) + 8) & 0xf;
-
-    accel_hw[0] = (short)(accel_bias[0] * 2 / (64 + fg[0]));
-    accel_hw[1] = (short)(accel_bias[1] * 2 / (64 + fg[1]));
-    accel_hw[2] = (short)(accel_bias[2] * 2 / (64 + fg[2]));
-
-    if (i2c_read(st.hw->addr, 0x06, 6, data))
-        return -1;
-
-    got_accel[0] = ((short)data[0] << 8) | data[1];
-    got_accel[1] = ((short)data[2] << 8) | data[3];
-    got_accel[2] = ((short)data[4] << 8) | data[5];
-
-    accel_hw[0] += got_accel[0];
-    accel_hw[1] += got_accel[1];
-    accel_hw[2] += got_accel[2];
-
-    data[0] = (accel_hw[0] >> 8) & 0xff;
-    data[1] = (accel_hw[0]) & 0xff;
-    data[2] = (accel_hw[1] >> 8) & 0xff;
-    data[3] = (accel_hw[1]) & 0xff;
-    data[4] = (accel_hw[2] >> 8) & 0xff;
-    data[5] = (accel_hw[2]) & 0xff;
-
-    if (i2c_write(st.hw->addr, 0x06, 6, data))
-        return -1;
-    return 0;
-}
-
-/**
- *  @brief  Reset FIFO read/write pointers.
- *  @return 0 if successful.
- */
-int mpu_reset_fifo(void)
-{
-    unsigned char data;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    data = 0;
-    if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, &data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
-        return -1;
-
-    if (st.chip_cfg.dmp_on) {
-        data = BIT_FIFO_RST | BIT_DMP_RST;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
-            return -1;
-        delay_ms(50);
-        data = BIT_DMP_EN | BIT_FIFO_EN;
-        if (st.chip_cfg.sensors & INV_XYZ_COMPASS)
-            data |= BIT_AUX_IF_EN;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
-            return -1;
-        if (st.chip_cfg.int_enable)
-            data = BIT_DMP_INT_EN;
-        else
-            data = 0;
-        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &data))
-            return -1;
-        data = 0;
-        if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, &data))
-            return -1;
-    } else {
-        data = BIT_FIFO_RST;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
-            return -1;
-        if (st.chip_cfg.bypass_mode || !(st.chip_cfg.sensors & INV_XYZ_COMPASS))
-            data = BIT_FIFO_EN;
-        else
-            data = BIT_FIFO_EN | BIT_AUX_IF_EN;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
-            return -1;
-        delay_ms(50);
-        if (st.chip_cfg.int_enable)
-            data = BIT_DATA_RDY_EN;
-        else
-            data = 0;
-        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &data))
-            return -1;
-        if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, &st.chip_cfg.fifo_enable))
-            return -1;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Get the gyro full-scale range.
- *  @param[out] fsr Current full-scale range.
- *  @return     0 if successful.
- */
-int mpu_get_gyro_fsr(unsigned short *fsr)
-{
-    switch (st.chip_cfg.gyro_fsr) {
-    case INV_FSR_250DPS:
-        fsr[0] = 250;
-        break;
-    case INV_FSR_500DPS:
-        fsr[0] = 500;
-        break;
-    case INV_FSR_1000DPS:
-        fsr[0] = 1000;
-        break;
-    case INV_FSR_2000DPS:
-        fsr[0] = 2000;
-        break;
-    default:
-        fsr[0] = 0;
-        break;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Set the gyro full-scale range.
- *  @param[in]  fsr Desired full-scale range.
- *  @return     0 if successful.
- */
-int mpu_set_gyro_fsr(unsigned short fsr)
-{
-    unsigned char data;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    switch (fsr) {
-    case 250:
-        data = INV_FSR_250DPS << 3;
-        break;
-    case 500:
-        data = INV_FSR_500DPS << 3;
-        break;
-    case 1000:
-        data = INV_FSR_1000DPS << 3;
-        break;
-    case 2000:
-        data = INV_FSR_2000DPS << 3;
-        break;
-    default:
-        return -1;
-    }
-
-    if (st.chip_cfg.gyro_fsr == (data >> 3))
-        return 0;
-    if (i2c_write(st.hw->addr, st.reg->gyro_cfg, 1, &data))
-        return -1;
-    st.chip_cfg.gyro_fsr = data >> 3;
-    return 0;
-}
-
-/**
- *  @brief      Get the accel full-scale range.
- *  @param[out] fsr Current full-scale range.
- *  @return     0 if successful.
- */
-int mpu_get_accel_fsr(unsigned char *fsr)
-{
-    switch (st.chip_cfg.accel_fsr) {
-    case INV_FSR_2G:
-        fsr[0] = 2;
-        break;
-    case INV_FSR_4G:
-        fsr[0] = 4;
-        break;
-    case INV_FSR_8G:
-        fsr[0] = 8;
-        break;
-    case INV_FSR_16G:
-        fsr[0] = 16;
-        break;
-    default:
-        return -1;
-    }
-    if (st.chip_cfg.accel_half)
-        fsr[0] <<= 1;
-    return 0;
-}
-
-/**
- *  @brief      Set the accel full-scale range.
- *  @param[in]  fsr Desired full-scale range.
- *  @return     0 if successful.
- */
-int mpu_set_accel_fsr(unsigned char fsr)
-{
-    unsigned char data;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    switch (fsr) {
-    case 2:
-        data = INV_FSR_2G << 3;
-        break;
-    case 4:
-        data = INV_FSR_4G << 3;
-        break;
-    case 8:
-        data = INV_FSR_8G << 3;
-        break;
-    case 16:
-        data = INV_FSR_16G << 3;
-        break;
-    default:
-        return -1;
-    }
-
-    if (st.chip_cfg.accel_fsr == (data >> 3))
-        return 0;
-    if (i2c_write(st.hw->addr, st.reg->accel_cfg, 1, &data))
-        return -1;
-    st.chip_cfg.accel_fsr = data >> 3;
-    return 0;
-}
-
-/**
- *  @brief      Get the current DLPF setting.
- *  @param[out] lpf Current LPF setting.
- *  0 if successful.
- */
-int mpu_get_lpf(unsigned short *lpf)
-{
-    switch (st.chip_cfg.lpf) {
-    case INV_FILTER_188HZ:
-        lpf[0] = 188;
-        break;
-    case INV_FILTER_98HZ:
-        lpf[0] = 98;
-        break;
-    case INV_FILTER_42HZ:
-        lpf[0] = 42;
-        break;
-    case INV_FILTER_20HZ:
-        lpf[0] = 20;
-        break;
-    case INV_FILTER_10HZ:
-        lpf[0] = 10;
-        break;
-    case INV_FILTER_5HZ:
-        lpf[0] = 5;
-        break;
-    case INV_FILTER_256HZ_NOLPF2:
-    case INV_FILTER_2100HZ_NOLPF:
-    default:
-        lpf[0] = 0;
-        break;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Set digital low pass filter.
- *  The following LPF settings are supported: 188, 98, 42, 20, 10, 5.
- *  @param[in]  lpf Desired LPF setting.
- *  @return     0 if successful.
- */
-int mpu_set_lpf(unsigned short lpf)
-{
-    unsigned char data;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    if (lpf >= 188)
-        data = INV_FILTER_188HZ;
-    else if (lpf >= 98)
-        data = INV_FILTER_98HZ;
-    else if (lpf >= 42)
-        data = INV_FILTER_42HZ;
-    else if (lpf >= 20)
-        data = INV_FILTER_20HZ;
-    else if (lpf >= 10)
-        data = INV_FILTER_10HZ;
-    else
-        data = INV_FILTER_5HZ;
-
-    if (st.chip_cfg.lpf == data)
-        return 0;
-    if (i2c_write(st.hw->addr, st.reg->lpf, 1, &data))
-        return -1;
-    st.chip_cfg.lpf = data;
-    return 0;
-}
-
-/**
- *  @brief      Get sampling rate.
- *  @param[out] rate    Current sampling rate (Hz).
- *  @return     0 if successful.
- */
-int mpu_get_sample_rate(unsigned short *rate)
-{
-    if (st.chip_cfg.dmp_on)
-        return -1;
-    else
-        rate[0] = st.chip_cfg.sample_rate;
-
-    return 0;
-}
-
-/**
- *  @brief      Set sampling rate.
- *  Sampling rate must be between 4Hz and 1kHz.
- *  @param[in]  rate    Desired sampling rate (Hz).
- *  @return     0 if successful.
- */
-int mpu_set_sample_rate(unsigned short rate)
-{
-    unsigned char data;
-
-    if (!(st.chip_cfg.sensors))
-        return -1;
-
-    if (st.chip_cfg.dmp_on)
-        return -1;
-    else {
-        if (st.chip_cfg.lp_accel_mode) {
-            if (rate && (rate <= 40)) {
-                /* Just stay in low-power accel mode. */
-                mpu_lp_accel_mode(rate);
-                return 0;
-            }
-            /* Requested rate exceeds the allowed frequencies in LP accel mode,
-             * switch back to full-power mode.
-             */
-            mpu_lp_accel_mode(0);
-        }
-        if (rate < 4)
-            rate = 4;
-        else if (rate > 1000)
-            rate = 1000;
-
-        data = 1000 / rate - 1;
-        if (i2c_write(st.hw->addr, st.reg->rate_div, 1, &data))
-            return -1;
-
-        st.chip_cfg.sample_rate = 1000 / (1 + data);
-
-#ifdef AK89xx_SECONDARY
-        mpu_set_compass_sample_rate(min(st.chip_cfg.compass_sample_rate, MAX_COMPASS_SAMPLE_RATE));
-#endif
-
-        /* Automatically set LPF to 1/2 sampling rate. */
-        mpu_set_lpf(st.chip_cfg.sample_rate >> 1);
-        return 0;
-    }
-}
-
-/**
- *  @brief      Get compass sampling rate.
- *  @param[out] rate    Current compass sampling rate (Hz).
- *  @return     0 if successful.
- */
-int mpu_get_compass_sample_rate(unsigned short *rate)
-{
-#ifdef AK89xx_SECONDARY
-    rate[0] = st.chip_cfg.compass_sample_rate;
-    return 0;
-#else
-    rate[0] = 0;
-    return -1;
-#endif
-}
-
-/**
- *  @brief      Set compass sampling rate.
- *  The compass on the auxiliary I2C bus is read by the MPU hardware at a
- *  maximum of 100Hz. The actual rate can be set to a fraction of the gyro
- *  sampling rate.
- *
- *  \n WARNING: The new rate may be different than what was requested. Call
- *  mpu_get_compass_sample_rate to check the actual setting.
- *  @param[in]  rate    Desired compass sampling rate (Hz).
- *  @return     0 if successful.
- */
-int mpu_set_compass_sample_rate(unsigned short rate)
-{
-#ifdef AK89xx_SECONDARY
-    unsigned char div;
-    if (!rate || rate > st.chip_cfg.sample_rate || rate > MAX_COMPASS_SAMPLE_RATE)
-        return -1;
-
-    div = st.chip_cfg.sample_rate / rate - 1;
-    if (i2c_write(st.hw->addr, st.reg->s4_ctrl, 1, &div))
-        return -1;
-    st.chip_cfg.compass_sample_rate = st.chip_cfg.sample_rate / (div + 1);
-    return 0;
-#else
-    return -1;
-#endif
-}
-
-/**
- *  @brief      Get gyro sensitivity scale factor.
- *  @param[out] sens    Conversion from hardware units to dps.
- *  @return     0 if successful.
- */
-int mpu_get_gyro_sens(float *sens)
-{
-    switch (st.chip_cfg.gyro_fsr) {
-    case INV_FSR_250DPS:
-        sens[0] = 131.f;
-        break;
-    case INV_FSR_500DPS:
-        sens[0] = 65.5f;
-        break;
-    case INV_FSR_1000DPS:
-        sens[0] = 32.8f;
-        break;
-    case INV_FSR_2000DPS:
-        sens[0] = 16.4f;
-        break;
-    default:
-        return -1;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Get accel sensitivity scale factor.
- *  @param[out] sens    Conversion from hardware units to g's.
- *  @return     0 if successful.
- */
-int mpu_get_accel_sens(unsigned short *sens)
-{
-    switch (st.chip_cfg.accel_fsr) {
-    case INV_FSR_2G:
-        sens[0] = 16384;
-        break;
-    case INV_FSR_4G:
-        sens[0] = 8092;
-        break;
-    case INV_FSR_8G:
-        sens[0] = 4096;
-        break;
-    case INV_FSR_16G:
-        sens[0] = 2048;
-        break;
-    default:
-        return -1;
-    }
-    if (st.chip_cfg.accel_half)
-        sens[0] >>= 1;
-    return 0;
-}
-
-/**
- *  @brief      Get current FIFO configuration.
- *  @e sensors can contain a combination of the following flags:
- *  \n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
- *  \n INV_XYZ_GYRO
- *  \n INV_XYZ_ACCEL
- *  @param[out] sensors Mask of sensors in FIFO.
- *  @return     0 if successful.
- */
-int mpu_get_fifo_config(unsigned char *sensors)
-{
-    sensors[0] = st.chip_cfg.fifo_enable;
-    return 0;
-}
-
-/**
- *  @brief      Select which sensors are pushed to FIFO.
- *  @e sensors can contain a combination of the following flags:
- *  \n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
- *  \n INV_XYZ_GYRO
- *  \n INV_XYZ_ACCEL
- *  @param[in]  sensors Mask of sensors to push to FIFO.
- *  @return     0 if successful.
- */
-int mpu_configure_fifo(unsigned char sensors)
-{
-    unsigned char prev;
-    int result = 0;
-
-    /* Compass data isn't going into the FIFO. Stop trying. */
-    sensors &= ~INV_XYZ_COMPASS;
-
-    if (st.chip_cfg.dmp_on)
-        return 0;
-    else {
-        if (!(st.chip_cfg.sensors))
-            return -1;
-        prev = st.chip_cfg.fifo_enable;
-        st.chip_cfg.fifo_enable = sensors & st.chip_cfg.sensors;
-        if (st.chip_cfg.fifo_enable != sensors)
-            /* You're not getting what you asked for. Some sensors are
-             * asleep.
-             */
-            result = -1;
-        else
-            result = 0;
-        if (sensors || st.chip_cfg.lp_accel_mode)
-            set_int_enable(1);
-        else
-            set_int_enable(0);
-        if (sensors) {
-            if (mpu_reset_fifo()) {
-                st.chip_cfg.fifo_enable = prev;
-                return -1;
-            }
-        }
-    }
-
-    return result;
-}
-
-/**
- *  @brief      Get current power state.
- *  @param[in]  power_on    1 if turned on, 0 if suspended.
- *  @return     0 if successful.
- */
-int mpu_get_power_state(unsigned char *power_on)
-{
-    if (st.chip_cfg.sensors)
-        power_on[0] = 1;
-    else
-        power_on[0] = 0;
-    return 0;
-}
-
-/**
- *  @brief      Turn specific sensors on/off.
- *  @e sensors can contain a combination of the following flags:
- *  \n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
- *  \n INV_XYZ_GYRO
- *  \n INV_XYZ_ACCEL
- *  \n INV_XYZ_COMPASS
- *  @param[in]  sensors    Mask of sensors to wake.
- *  @return     0 if successful.
- */
-int mpu_set_sensors(unsigned char sensors)
-{
-    unsigned char data;
-#ifdef AK89xx_SECONDARY
-    unsigned char user_ctrl;
-#endif
-
-    if (sensors & INV_XYZ_GYRO)
-        data = INV_CLK_PLL;
-    else if (sensors)
-        data = 0;
-    else
-        data = BIT_SLEEP;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, &data)) {
-        st.chip_cfg.sensors = 0;
-        return -1;
-    }
-    st.chip_cfg.clk_src = data & ~BIT_SLEEP;
-
-    data = 0;
-    if (!(sensors & INV_X_GYRO))
-        data |= BIT_STBY_XG;
-    if (!(sensors & INV_Y_GYRO))
-        data |= BIT_STBY_YG;
-    if (!(sensors & INV_Z_GYRO))
-        data |= BIT_STBY_ZG;
-    if (!(sensors & INV_XYZ_ACCEL))
-        data |= BIT_STBY_XYZA;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_2, 1, &data)) {
-        st.chip_cfg.sensors = 0;
-        return -1;
-    }
-
-    if (sensors && (sensors != INV_XYZ_ACCEL))
-        /* Latched interrupts only used in LP accel mode. */
-        mpu_set_int_latched(0);
-
-#ifdef AK89xx_SECONDARY
-#ifdef AK89xx_BYPASS
-    if (sensors & INV_XYZ_COMPASS)
-        mpu_set_bypass(1);
-    else
-        mpu_set_bypass(0);
-#else
-    if (i2c_read(st.hw->addr, st.reg->user_ctrl, 1, &user_ctrl))
-        return -1;
-    /* Handle AKM power management. */
-    if (sensors & INV_XYZ_COMPASS) {
-        data = AKM_SINGLE_MEASUREMENT;
-        user_ctrl |= BIT_AUX_IF_EN;
-    } else {
-        data = AKM_POWER_DOWN;
-        user_ctrl &= ~BIT_AUX_IF_EN;
-    }
-    if (st.chip_cfg.dmp_on)
-        user_ctrl |= BIT_DMP_EN;
-    else
-        user_ctrl &= ~BIT_DMP_EN;
-    if (i2c_write(st.hw->addr, st.reg->s1_do, 1, &data))
-        return -1;
-    /* Enable/disable I2C master mode. */
-    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &user_ctrl))
-        return -1;
-#endif
-#endif
-
-    st.chip_cfg.sensors = sensors;
-    st.chip_cfg.lp_accel_mode = 0;
-    delay_ms(50);
-    return 0;
-}
-
-/**
- *  @brief      Read the MPU interrupt status registers.
- *  @param[out] status  Mask of interrupt bits.
- *  @return     0 if successful.
- */
-int mpu_get_int_status(short *status)
-{
-    unsigned char tmp[2];
-    if (!st.chip_cfg.sensors)
-        return -1;
-    if (i2c_read(st.hw->addr, st.reg->dmp_int_status, 2, tmp))
-        return -1;
-    status[0] = (tmp[0] << 8) | tmp[1];
-    return 0;
-}
-
-/**
- *  @brief      Get one packet from the FIFO.
- *  If @e sensors does not contain a particular sensor, disregard the data
- *  returned to that pointer.
- *  \n @e sensors can contain a combination of the following flags:
- *  \n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
- *  \n INV_XYZ_GYRO
- *  \n INV_XYZ_ACCEL
- *  \n If the FIFO has no new data, @e sensors will be zero.
- *  \n If the FIFO is disabled, @e sensors will be zero and this function will
- *  return a non-zero error code.
- *  @param[out] gyro        Gyro data in hardware units.
- *  @param[out] accel       Accel data in hardware units.
- *  @param[out] timestamp   Timestamp in milliseconds.
- *  @param[out] sensors     Mask of sensors read from FIFO.
- *  @param[out] more        Number of remaining packets.
- *  @return     0 if successful.
- */
-int mpu_read_fifo(short *gyro, short *accel, unsigned long *timestamp,
-        unsigned char *sensors, unsigned char *more)
-{
-    /* Assumes maximum packet size is gyro (6) + accel (6). */
-    unsigned char data[MAX_PACKET_LENGTH];
-    unsigned char packet_size = 0;
-    unsigned short fifo_count, index = 0;
-
-    if (st.chip_cfg.dmp_on)
-        return -1;
-
-    sensors[0] = 0;
-    if (!st.chip_cfg.sensors)
-        return -1;
-    if (!st.chip_cfg.fifo_enable)
-        return -1;
-
-    if (st.chip_cfg.fifo_enable & INV_X_GYRO)
-        packet_size += 2;
-    if (st.chip_cfg.fifo_enable & INV_Y_GYRO)
-        packet_size += 2;
-    if (st.chip_cfg.fifo_enable & INV_Z_GYRO)
-        packet_size += 2;
-    if (st.chip_cfg.fifo_enable & INV_XYZ_ACCEL)
-        packet_size += 6;
-
-    if (i2c_read(st.hw->addr, st.reg->fifo_count_h, 2, data))
-        return -1;
-    fifo_count = (data[0] << 8) | data[1];
-    if (fifo_count < packet_size)
-        return 0;
-//    log_i("FIFO count: %hd\n", fifo_count);
-    if (fifo_count > (st.hw->max_fifo >> 1)) {
-        /* FIFO is 50% full, better check overflow bit. */
-        if (i2c_read(st.hw->addr, st.reg->int_status, 1, data))
-            return -1;
-        if (data[0] & BIT_FIFO_OVERFLOW) {
-            mpu_reset_fifo();
-            return -2;
-        }
-    }
-    get_ms((unsigned long*)timestamp);
-
-    if (i2c_read(st.hw->addr, st.reg->fifo_r_w, packet_size, data))
-        return -1;
-    more[0] = fifo_count / packet_size - 1;
-    sensors[0] = 0;
-
-    if ((index != packet_size) && st.chip_cfg.fifo_enable & INV_XYZ_ACCEL) {
-        accel[0] = (data[index+0] << 8) | data[index+1];
-        accel[1] = (data[index+2] << 8) | data[index+3];
-        accel[2] = (data[index+4] << 8) | data[index+5];
-        sensors[0] |= INV_XYZ_ACCEL;
-        index += 6;
-    }
-    if ((index != packet_size) && st.chip_cfg.fifo_enable & INV_X_GYRO) {
-        gyro[0] = (data[index+0] << 8) | data[index+1];
-        sensors[0] |= INV_X_GYRO;
-        index += 2;
-    }
-    if ((index != packet_size) && st.chip_cfg.fifo_enable & INV_Y_GYRO) {
-        gyro[1] = (data[index+0] << 8) | data[index+1];
-        sensors[0] |= INV_Y_GYRO;
-        index += 2;
-    }
-    if ((index != packet_size) && st.chip_cfg.fifo_enable & INV_Z_GYRO) {
-        gyro[2] = (data[index+0] << 8) | data[index+1];
-        sensors[0] |= INV_Z_GYRO;
-        index += 2;
-    }
-
-    return 0;
-}
-
-/**
- *  @brief      Get one unparsed packet from the FIFO.
- *  This function should be used if the packet is to be parsed elsewhere.
- *  @param[in]  length  Length of one FIFO packet.
- *  @param[in]  data    FIFO packet.
- *  @param[in]  more    Number of remaining packets.
- */
-int mpu_read_fifo_stream(unsigned short length, unsigned char *data,
-    unsigned char *more)
-{
-    unsigned char tmp[2];
-    unsigned short fifo_count;
-
-//    printf("addr %d, dmp_on %d, sensors %d\r\n", st.hw->addr, st.chip_cfg.dmp_on, st.chip_cfg.sensors);
-
-    if (!st.chip_cfg.dmp_on)
-        return -1;
-    if (!st.chip_cfg.sensors)
-        return -1;
-
-//    printf("----1\r\n");
-
-    if (i2c_read(st.hw->addr, st.reg->fifo_count_h, 2, tmp))
-        return -1;
-
-//    printf("----2\r\n");
-
-    fifo_count = (tmp[0] << 8) | tmp[1];
-    if (fifo_count < length) {
-        more[0] = 0;
-        return -1;
-    }
-
-//    printf("----3\r\n");
-    if (fifo_count > (st.hw->max_fifo >> 1)) {
-
-//        printf("----3.1\r\n");
-        /* FIFO is 50% full, better check overflow bit. */
-        if (i2c_read(st.hw->addr, st.reg->int_status, 1, tmp))
-            return -1;
-
-//        printf("----3.2\r\n");
-        if (tmp[0] & BIT_FIFO_OVERFLOW) {
-            mpu_reset_fifo();
-            return -2;
-        }
-    }
-
-//    printf("----4\r\n");
-    if (i2c_read(st.hw->addr, st.reg->fifo_r_w, length, data))
-        return -1;
-
-    more[0] = fifo_count / length - 1;
-    return 0;
-}
-
-/**
- *  @brief      Set device to bypass mode.
- *  @param[in]  bypass_on   1 to enable bypass mode.
- *  @return     0 if successful.
- */
-int mpu_set_bypass(unsigned char bypass_on)
-{
-    unsigned char tmp;
-
-    if (st.chip_cfg.bypass_mode == bypass_on)
-        return 0;
-
-    if (bypass_on) {
-        if (i2c_read(st.hw->addr, st.reg->user_ctrl, 1, &tmp))
-            return -1;
-        tmp &= ~BIT_AUX_IF_EN;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &tmp))
-            return -1;
-        delay_ms(3);
-        tmp = BIT_BYPASS_EN;
-        if (st.chip_cfg.active_low_int)
-            tmp |= BIT_ACTL;
-        if (st.chip_cfg.latched_int)
-            tmp |= BIT_LATCH_EN | BIT_ANY_RD_CLR;
-        if (i2c_write(st.hw->addr, st.reg->int_pin_cfg, 1, &tmp))
-            return -1;
-    } else {
-        /* Enable I2C master mode if compass is being used. */
-        if (i2c_read(st.hw->addr, st.reg->user_ctrl, 1, &tmp))
-            return -1;
-        if (st.chip_cfg.sensors & INV_XYZ_COMPASS)
-            tmp |= BIT_AUX_IF_EN;
-        else
-            tmp &= ~BIT_AUX_IF_EN;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &tmp))
-            return -1;
-        delay_ms(3);
-        if (st.chip_cfg.active_low_int)
-            tmp = BIT_ACTL;
-        else
-            tmp = 0;
-        if (st.chip_cfg.latched_int)
-            tmp |= BIT_LATCH_EN | BIT_ANY_RD_CLR;
-        if (i2c_write(st.hw->addr, st.reg->int_pin_cfg, 1, &tmp))
-            return -1;
-    }
-    st.chip_cfg.bypass_mode = bypass_on;
-    return 0;
-}
-
-/**
- *  @brief      Set interrupt level.
- *  @param[in]  active_low  1 for active low, 0 for active high.
- *  @return     0 if successful.
- */
-int mpu_set_int_level(unsigned char active_low)
-{
-    st.chip_cfg.active_low_int = active_low;
-    return 0;
-}
-
-/**
- *  @brief      Enable latched interrupts.
- *  Any MPU register will clear the interrupt.
- *  @param[in]  enable  1 to enable, 0 to disable.
- *  @return     0 if successful.
- */
-int mpu_set_int_latched(unsigned char enable)
-{
-    unsigned char tmp;
-    if (st.chip_cfg.latched_int == enable)
-        return 0;
-
-    if (enable)
-        tmp = BIT_LATCH_EN | BIT_ANY_RD_CLR;
-    else
-        tmp = 0;
-    if (st.chip_cfg.bypass_mode)
-        tmp |= BIT_BYPASS_EN;
-    if (st.chip_cfg.active_low_int)
-        tmp |= BIT_ACTL;
-    if (i2c_write(st.hw->addr, st.reg->int_pin_cfg, 1, &tmp))
-        return -1;
-    st.chip_cfg.latched_int = enable;
-    return 0;
-}
-
-#ifdef MPU6050
-static int get_accel_prod_shift(float *st_shift)
-{
-    unsigned char tmp[4], shift_code[3], ii;
-
-    if (i2c_read(st.hw->addr, 0x0D, 4, tmp))
-        return 0x07;
-
-    shift_code[0] = ((tmp[0] & 0xE0) >> 3) | ((tmp[3] & 0x30) >> 4);
-    shift_code[1] = ((tmp[1] & 0xE0) >> 3) | ((tmp[3] & 0x0C) >> 2);
-    shift_code[2] = ((tmp[2] & 0xE0) >> 3) | (tmp[3] & 0x03);
-    for (ii = 0; ii < 3; ii++) {
-        if (!shift_code[ii]) {
-            st_shift[ii] = 0.f;
-            continue;
-        }
-        /* Equivalent to..
-         * st_shift[ii] = 0.34f * powf(0.92f/0.34f, (shift_code[ii]-1) / 30.f)
-         */
-        st_shift[ii] = 0.34f;
-        while (--shift_code[ii])
-            st_shift[ii] *= 1.034f;
-    }
-    return 0;
-}
-
-static int accel_self_test(long *bias_regular, long *bias_st)
-{
-    int jj, result = 0;
-    float st_shift[3], st_shift_cust, st_shift_var;
-
-    get_accel_prod_shift(st_shift);
-    for(jj = 0; jj < 3; jj++) {
-        st_shift_cust = labs(bias_regular[jj] - bias_st[jj]) / 65536.f;
-        if (st_shift[jj]) {
-            st_shift_var = st_shift_cust / st_shift[jj] - 1.f;
-            if (fabs(st_shift_var) > test.max_accel_var)
-                result |= 1 << jj;
-        } else if ((st_shift_cust < test.min_g) ||
-            (st_shift_cust > test.max_g))
-            result |= 1 << jj;
-    }
-
-    return result;
-}
-
-static int gyro_self_test(long *bias_regular, long *bias_st)
-{
-    int jj, result = 0;
-    unsigned char tmp[3];
-    float st_shift, st_shift_cust, st_shift_var;
-
-    if (i2c_read(st.hw->addr, 0x0D, 3, tmp))
-        return 0x07;
-
-    tmp[0] &= 0x1F;
-    tmp[1] &= 0x1F;
-    tmp[2] &= 0x1F;
-
-    for (jj = 0; jj < 3; jj++) {
-        st_shift_cust = labs(bias_regular[jj] - bias_st[jj]) / 65536.f;
-        if (tmp[jj]) {
-            st_shift = 3275.f / test.gyro_sens;
-            while (--tmp[jj])
-                st_shift *= 1.046f;
-            st_shift_var = st_shift_cust / st_shift - 1.f;
-            if (fabs(st_shift_var) > test.max_gyro_var)
-                result |= 1 << jj;
-        } else if ((st_shift_cust < test.min_dps) ||
-            (st_shift_cust > test.max_dps))
-            result |= 1 << jj;
-    }
-    return result;
-}
-
-#ifdef AK89xx_SECONDARY
-static int compass_self_test(void)
-{
-    unsigned char tmp[6];
-    unsigned char tries = 10;
-    int result = 0x07;
-    short data;
-
-    mpu_set_bypass(1);
-
-    tmp[0] = AKM_POWER_DOWN;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, tmp))
-        return 0x07;
-    tmp[0] = AKM_BIT_SELF_TEST;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_ASTC, 1, tmp))
-        goto AKM_restore;
-    tmp[0] = AKM_MODE_SELF_TEST;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, tmp))
-        goto AKM_restore;
-
-    do {
-        delay_ms(10);
-        if (i2c_read(st.chip_cfg.compass_addr, AKM_REG_ST1, 1, tmp))
-            goto AKM_restore;
-        if (tmp[0] & AKM_DATA_READY)
-            break;
-    } while (tries--);
-    if (!(tmp[0] & AKM_DATA_READY))
-        goto AKM_restore;
-
-    if (i2c_read(st.chip_cfg.compass_addr, AKM_REG_HXL, 6, tmp))
-        goto AKM_restore;
-
-    result = 0;
-    data = (short)(tmp[1] << 8) | tmp[0];
-    if ((data > 100) || (data < -100))
-        result |= 0x01;
-    data = (short)(tmp[3] << 8) | tmp[2];
-    if ((data > 100) || (data < -100))
-        result |= 0x02;
-    data = (short)(tmp[5] << 8) | tmp[4];
-    if ((data > -300) || (data < -1000))
-        result |= 0x04;
-
-AKM_restore:
-    tmp[0] = 0 | SUPPORTS_AK89xx_HIGH_SENS;
-    i2c_write(st.chip_cfg.compass_addr, AKM_REG_ASTC, 1, tmp);
-    tmp[0] = SUPPORTS_AK89xx_HIGH_SENS;
-    i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, tmp);
-    mpu_set_bypass(0);
-    return result;
-}
-#endif
-#endif
-
-static int get_st_biases(long *gyro, long *accel, unsigned char hw_test)
-{
-    unsigned char data[MAX_PACKET_LENGTH];
-    unsigned char packet_count, ii;
-    unsigned short fifo_count;
-
-    data[0] = 0x01;
-    data[1] = 0;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 2, data))
-        return -1;
-    delay_ms(200);
-    data[0] = 0;
-    if (i2c_write(st.hw->addr, st.reg->int_enable, 1, data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->i2c_mst, 1, data))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, data))
-        return -1;
-    data[0] = BIT_FIFO_RST | BIT_DMP_RST;
-    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, data))
-        return -1;
-    delay_ms(15);
-    data[0] = st.test->reg_lpf;
-    if (i2c_write(st.hw->addr, st.reg->lpf, 1, data))
-        return -1;
-    data[0] = st.test->reg_rate_div;
-    if (i2c_write(st.hw->addr, st.reg->rate_div, 1, data))
-        return -1;
-    if (hw_test)
-        data[0] = st.test->reg_gyro_fsr | 0xE0;
-    else
-        data[0] = st.test->reg_gyro_fsr;
-    if (i2c_write(st.hw->addr, st.reg->gyro_cfg, 1, data))
-        return -1;
-
-    if (hw_test)
-        data[0] = st.test->reg_accel_fsr | 0xE0;
-    else
-        data[0] = test.reg_accel_fsr;
-    if (i2c_write(st.hw->addr, st.reg->accel_cfg, 1, data))
-        return -1;
-    if (hw_test)
-        delay_ms(200);
-
-    /* Fill FIFO for test.wait_ms milliseconds. */
-    data[0] = BIT_FIFO_EN;
-    if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, data))
-        return -1;
-
-    data[0] = INV_XYZ_GYRO | INV_XYZ_ACCEL;
-    if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, data))
-        return -1;
-    delay_ms(test.wait_ms);
-    data[0] = 0;
-    if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, data))
-        return -1;
-
-    if (i2c_read(st.hw->addr, st.reg->fifo_count_h, 2, data))
-        return -1;
-
-    fifo_count = (data[0] << 8) | data[1];
-    packet_count = fifo_count / MAX_PACKET_LENGTH;
-    gyro[0] = gyro[1] = gyro[2] = 0;
-    accel[0] = accel[1] = accel[2] = 0;
-
-    for (ii = 0; ii < packet_count; ii++) {
-        short accel_cur[3], gyro_cur[3];
-        if (i2c_read(st.hw->addr, st.reg->fifo_r_w, MAX_PACKET_LENGTH, data))
-            return -1;
-        accel_cur[0] = ((short)data[0] << 8) | data[1];
-        accel_cur[1] = ((short)data[2] << 8) | data[3];
-        accel_cur[2] = ((short)data[4] << 8) | data[5];
-        accel[0] += (long)accel_cur[0];
-        accel[1] += (long)accel_cur[1];
-        accel[2] += (long)accel_cur[2];
-        gyro_cur[0] = (((short)data[6] << 8) | data[7]);
-        gyro_cur[1] = (((short)data[8] << 8) | data[9]);
-        gyro_cur[2] = (((short)data[10] << 8) | data[11]);
-        gyro[0] += (long)gyro_cur[0];
-        gyro[1] += (long)gyro_cur[1];
-        gyro[2] += (long)gyro_cur[2];
-    }
-#ifdef EMPL_NO_64BIT
-    gyro[0] = (long)(((float)gyro[0]*65536.f) / test.gyro_sens / packet_count);
-    gyro[1] = (long)(((float)gyro[1]*65536.f) / test.gyro_sens / packet_count);
-    gyro[2] = (long)(((float)gyro[2]*65536.f) / test.gyro_sens / packet_count);
-    if (has_accel) {
-        accel[0] = (long)(((float)accel[0]*65536.f) / test.accel_sens /
-            packet_count);
-        accel[1] = (long)(((float)accel[1]*65536.f) / test.accel_sens /
-            packet_count);
-        accel[2] = (long)(((float)accel[2]*65536.f) / test.accel_sens /
-            packet_count);
-        /* Don't remove gravity! */
-        accel[2] -= 65536L;
-    }
-#else
-    gyro[0] = (long)(((long long)gyro[0]<<16) / test.gyro_sens / packet_count);
-    gyro[1] = (long)(((long long)gyro[1]<<16) / test.gyro_sens / packet_count);
-    gyro[2] = (long)(((long long)gyro[2]<<16) / test.gyro_sens / packet_count);
-    accel[0] = (long)(((long long)accel[0]<<16) / test.accel_sens /
-        packet_count);
-    accel[1] = (long)(((long long)accel[1]<<16) / test.accel_sens /
-        packet_count);
-    accel[2] = (long)(((long long)accel[2]<<16) / test.accel_sens /
-        packet_count);
-    /* Don't remove gravity! */
-    if (accel[2] > 0L)
-        accel[2] -= 65536L;
-    else
-        accel[2] += 65536L;
-#endif
-
-    return 0;
-}
-
-/**
- *  @brief      Trigger gyro/accel/compass self-test.
- *  On success/error, the self-test returns a mask representing the sensor(s)
- *  that failed. For each bit, a one (1) represents a "pass" case; conversely,
- *  a zero (0) indicates a failure.
- *
- *  \n The mask is defined as follows:
- *  \n Bit 0:   Gyro.
- *  \n Bit 1:   Accel.
- *  \n Bit 2:   Compass.
- *
- *  \n Currently, the hardware self-test is unsupported for MPU6500. However,
- *  this function can still be used to obtain the accel and gyro biases.
- *
- *  \n This function must be called with the device either face-up or face-down
- *  (z-axis is parallel to gravity).
- *  @param[out] gyro        Gyro biases in q16 format.
- *  @param[out] accel       Accel biases (if applicable) in q16 format.
- *  @return     Result mask (see above).
- */
-int mpu_run_self_test(long *gyro, long *accel)
-{
-#ifdef MPU6050
-    const unsigned char tries = 2;
-    long gyro_st[3], accel_st[3];
-    unsigned char accel_result, gyro_result;
-#ifdef AK89xx_SECONDARY
-    unsigned char compass_result;
-#endif
-    int ii;
-#endif
-    int result;
-    unsigned char accel_fsr, fifo_sensors, sensors_on;
-    unsigned short gyro_fsr, sample_rate, lpf;
-    unsigned char dmp_was_on;
-
-    if (st.chip_cfg.dmp_on) {
-        mpu_set_dmp_state(0);
-        dmp_was_on = 1;
-    } else
-        dmp_was_on = 0;
-
-    /* Get initial settings. */
-    mpu_get_gyro_fsr(&gyro_fsr);
-    mpu_get_accel_fsr(&accel_fsr);
-    mpu_get_lpf(&lpf);
-    mpu_get_sample_rate(&sample_rate);
-    sensors_on = st.chip_cfg.sensors;
-    mpu_get_fifo_config(&fifo_sensors);
-
-    /* For older chips, the self-test will be different. */
-#if defined MPU6050
-    for (ii = 0; ii < tries; ii++)
-        if (!get_st_biases(gyro, accel, 0))
-            break;
-    if (ii == tries) {
-        /* If we reach this point, we most likely encountered an I2C error.
-         * We'll just report an error for all three sensors.
-         */
-        result = 0;
-        goto restore;
-    }
-    for (ii = 0; ii < tries; ii++)
-        if (!get_st_biases(gyro_st, accel_st, 1))
-            break;
-    if (ii == tries) {
-        /* Again, probably an I2C error. */
-        result = 0;
-        goto restore;
-    }
-    accel_result = accel_self_test(accel, accel_st);
-    gyro_result = gyro_self_test(gyro, gyro_st);
-
-    result = 0;
-    if (!gyro_result)
-        result |= 0x01;
-    if (!accel_result)
-        result |= 0x02;
-
-#ifdef AK89xx_SECONDARY
-    compass_result = compass_self_test();
-    if (!compass_result)
-        result |= 0x04;
-#endif
-restore:
-#elif defined MPU6500
-    /* For now, this function will return a "pass" result for all three sensors
-     * for compatibility with current test applications.
-     */
-    get_st_biases(gyro, accel, 0);
-    result = 0x7;
-#endif
-    /* Set to invalid values to ensure no I2C writes are skipped. */
-    st.chip_cfg.gyro_fsr = 0xFF;
-    st.chip_cfg.accel_fsr = 0xFF;
-    st.chip_cfg.lpf = 0xFF;
-    st.chip_cfg.sample_rate = 0xFFFF;
-    st.chip_cfg.sensors = 0xFF;
-    st.chip_cfg.fifo_enable = 0xFF;
-    st.chip_cfg.clk_src = INV_CLK_PLL;
-    mpu_set_gyro_fsr(gyro_fsr);
-    mpu_set_accel_fsr(accel_fsr);
-    mpu_set_lpf(lpf);
-    mpu_set_sample_rate(sample_rate);
-    mpu_set_sensors(sensors_on);
-    mpu_configure_fifo(fifo_sensors);
-
-    if (dmp_was_on)
-        mpu_set_dmp_state(1);
-
-    return result;
-}
-
-/**
- *  @brief      Write to the DMP memory.
- *  This function prevents I2C writes past the bank boundaries. The DMP memory
- *  is only accessible when the chip is awake.
- *  @param[in]  mem_addr    Memory location (bank << 8 | start address)
- *  @param[in]  length      Number of bytes to write.
- *  @param[in]  data        Bytes to write to memory.
- *  @return     0 if successful.
- */
-int mpu_write_mem(unsigned short mem_addr, unsigned short length,
-        unsigned char *data)
-{
-    unsigned char tmp[2];
-
-    if (!data)
-        return -1;
-    if (!st.chip_cfg.sensors)
-        return -1;
-
-    tmp[0] = (unsigned char)(mem_addr >> 8);
-    tmp[1] = (unsigned char)(mem_addr & 0xFF);
-
-    /* Check bank boundaries. */
-    if (tmp[1] + length > st.hw->bank_size)
-        return -1;
-
-    if (i2c_write(st.hw->addr, st.reg->bank_sel, 2, tmp))
-        return -1;
-    if (i2c_write(st.hw->addr, st.reg->mem_r_w, length, data))
-        return -1;
-    return 0;
-}
-
-/**
- *  @brief      Read from the DMP memory.
- *  This function prevents I2C reads past the bank boundaries. The DMP memory
- *  is only accessible when the chip is awake.
- *  @param[in]  mem_addr    Memory location (bank << 8 | start address)
- *  @param[in]  length      Number of bytes to read.
- *  @param[out] data        Bytes read from memory.
- *  @return     0 if successful.
- */
-int mpu_read_mem(unsigned short mem_addr, unsigned short length,
-        unsigned char *data)
-{
-    unsigned char tmp[2];
-
-    if (!data)
-        return -1;
-    if (!st.chip_cfg.sensors)
-        return -1;
-
-    tmp[0] = (unsigned char)(mem_addr >> 8);
-    tmp[1] = (unsigned char)(mem_addr & 0xFF);
-
-    /* Check bank boundaries. */
-    if (tmp[1] + length > st.hw->bank_size)
-        return -1;
-
-    if (i2c_write(st.hw->addr, st.reg->bank_sel, 2, tmp))
-        return -1;
-    if (i2c_read(st.hw->addr, st.reg->mem_r_w, length, data))
-        return -1;
-    return 0;
-}
-
-/**
- *  @brief      Load and verify DMP image.
- *  @param[in]  length      Length of DMP image.
- *  @param[in]  firmware    DMP code.
- *  @param[in]  start_addr  Starting address of DMP code memory.
- *  @param[in]  sample_rate Fixed sampling rate used when DMP is enabled.
- *  @return     0 if successful.
- */
-int mpu_load_firmware(unsigned short length, const unsigned char *firmware,
-    unsigned short start_addr, unsigned short sample_rate)
-{
-    unsigned short ii;
-    unsigned short this_write;
-    /* Must divide evenly into st.hw->bank_size to avoid bank crossings. */
-#define LOAD_CHUNK  (16)
-    unsigned char cur[LOAD_CHUNK], tmp[2];
-
-    if (st.chip_cfg.dmp_loaded)
-        /* DMP should only be loaded once. */
-        return -1;
-
-    if (!firmware)
-        return -1;
-    for (ii = 0; ii < length; ii += this_write) {
-        this_write = min(LOAD_CHUNK, length - ii);
-        if (mpu_write_mem(ii, this_write, (unsigned char*)&firmware[ii]))
-            return -1;
-        if (mpu_read_mem(ii, this_write, cur))
-            return -1;
-        if (memcmp(firmware+ii, cur, this_write))
-            return -2;
-    }
-
-    /* Set program start address. */
-    tmp[0] = start_addr >> 8;
-    tmp[1] = start_addr & 0xFF;
-    if (i2c_write(st.hw->addr, st.reg->prgm_start_h, 2, tmp))
-        return -1;
-
-    st.chip_cfg.dmp_loaded = 1;
-    st.chip_cfg.dmp_sample_rate = sample_rate;
-    return 0;
-}
-
-/**
- *  @brief      Enable/disable DMP support.
- *  @param[in]  enable  1 to turn on the DMP.
- *  @return     0 if successful.
- */
-int mpu_set_dmp_state(unsigned char enable)
-{
-    unsigned char tmp;
-    if (st.chip_cfg.dmp_on == enable)
-        return 0;
-
-    if (enable) {
-        if (!st.chip_cfg.dmp_loaded)
-            return -1;
-        /* Disable data ready interrupt. */
-        set_int_enable(0);
-        /* Disable bypass mode. */
-        mpu_set_bypass(0);
-        /* Keep constant sample rate, FIFO rate controlled by DMP. */
-        mpu_set_sample_rate(st.chip_cfg.dmp_sample_rate);
-        /* Remove FIFO elements. */
-        tmp = 0;
-        i2c_write(st.hw->addr, 0x23, 1, &tmp);
-        st.chip_cfg.dmp_on = 1;
-        /* Enable DMP interrupt. */
-        set_int_enable(1);
-        mpu_reset_fifo();
-    } else {
-        /* Disable DMP interrupt. */
-        set_int_enable(0);
-        /* Restore FIFO settings. */
-        tmp = st.chip_cfg.fifo_enable;
-        i2c_write(st.hw->addr, 0x23, 1, &tmp);
-        st.chip_cfg.dmp_on = 0;
-        mpu_reset_fifo();
-    }
-    return 0;
-}
-
-/**
- *  @brief      Get DMP state.
- *  @param[out] enabled 1 if enabled.
- *  @return     0 if successful.
- */
-int mpu_get_dmp_state(unsigned char *enabled)
-{
-    enabled[0] = st.chip_cfg.dmp_on;
-    return 0;
-}
-
-
-/* This initialization is similar to the one in ak8975.c. */
-static int setup_compass(void)
-{
-#ifdef AK89xx_SECONDARY
-    unsigned char data[4], akm_addr;
-
-    mpu_set_bypass(1);
-
-    /* Find compass. Possible addresses range from 0x0C to 0x0F. */
-    for (akm_addr = 0x0C; akm_addr <= 0x0F; akm_addr++) {
-        int result;
-        result = i2c_read(akm_addr, AKM_REG_WHOAMI, 1, data);
-        if (!result && (data[0] == AKM_WHOAMI))
-            break;
-    }
-
-    if (akm_addr > 0x0F) {
-        /* TODO: Handle this case in all compass-related functions. */
-        log_e("Compass not found.\n");
-        return -1;
-    }
-
-    st.chip_cfg.compass_addr = akm_addr;
-
-    data[0] = AKM_POWER_DOWN;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, data))
-        return -1;
-    delay_ms(1);
-
-    data[0] = AKM_FUSE_ROM_ACCESS;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, data))
-        return -1;
-    delay_ms(1);
-
-    /* Get sensitivity adjustment data from fuse ROM. */
-    if (i2c_read(st.chip_cfg.compass_addr, AKM_REG_ASAX, 3, data))
-        return -1;
-    st.chip_cfg.mag_sens_adj[0] = (long)data[0] + 128;
-    st.chip_cfg.mag_sens_adj[1] = (long)data[1] + 128;
-    st.chip_cfg.mag_sens_adj[2] = (long)data[2] + 128;
-
-    data[0] = AKM_POWER_DOWN;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, data))
-        return -1;
-    delay_ms(1);
-
-    mpu_set_bypass(0);
-
-    /* Set up master mode, master clock, and ES bit. */
-    data[0] = 0x40;
-    if (i2c_write(st.hw->addr, st.reg->i2c_mst, 1, data))
-        return -1;
-
-    /* Slave 0 reads from AKM data registers. */
-    data[0] = BIT_I2C_READ | st.chip_cfg.compass_addr;
-    if (i2c_write(st.hw->addr, st.reg->s0_addr, 1, data))
-        return -1;
-
-    /* Compass reads start at this register. */
-    data[0] = AKM_REG_ST1;
-    if (i2c_write(st.hw->addr, st.reg->s0_reg, 1, data))
-        return -1;
-
-    /* Enable slave 0, 8-byte reads. */
-    data[0] = BIT_SLAVE_EN | 8;
-    if (i2c_write(st.hw->addr, st.reg->s0_ctrl, 1, data))
-        return -1;
-
-    /* Slave 1 changes AKM measurement mode. */
-    data[0] = st.chip_cfg.compass_addr;
-    if (i2c_write(st.hw->addr, st.reg->s1_addr, 1, data))
-        return -1;
-
-    /* AKM measurement mode register. */
-    data[0] = AKM_REG_CNTL;
-    if (i2c_write(st.hw->addr, st.reg->s1_reg, 1, data))
-        return -1;
-
-    /* Enable slave 1, 1-byte writes. */
-    data[0] = BIT_SLAVE_EN | 1;
-    if (i2c_write(st.hw->addr, st.reg->s1_ctrl, 1, data))
-        return -1;
-
-    /* Set slave 1 data. */
-    data[0] = AKM_SINGLE_MEASUREMENT;
-    if (i2c_write(st.hw->addr, st.reg->s1_do, 1, data))
-        return -1;
-
-    /* Trigger slave 0 and slave 1 actions at each sample. */
-    data[0] = 0x03;
-    if (i2c_write(st.hw->addr, st.reg->i2c_delay_ctrl, 1, data))
-        return -1;
-
-#ifdef MPU9150
-    /* For the MPU9150, the auxiliary I2C bus needs to be set to VDD. */
-    data[0] = BIT_I2C_MST_VDDIO;
-    if (i2c_write(st.hw->addr, st.reg->yg_offs_tc, 1, data))
-        return -1;
-#endif
-
-    return 0;
-#else
-    return -1;
-#endif
-}
-
-/**
- *  @brief      Read raw compass data.
- *  @param[out] data        Raw data in hardware units.
- *  @param[out] timestamp   Timestamp in milliseconds. Null if not needed.
- *  @return     0 if successful.
- */
-int mpu_get_compass_reg(short *data, unsigned long *timestamp)
-{
-#ifdef AK89xx_SECONDARY
-    unsigned char tmp[9];
-
-    if (!(st.chip_cfg.sensors & INV_XYZ_COMPASS))
-        return -1;
-
-#ifdef AK89xx_BYPASS
-    if (i2c_read(st.chip_cfg.compass_addr, AKM_REG_ST1, 8, tmp))
-        return -1;
-    tmp[8] = AKM_SINGLE_MEASUREMENT;
-    if (i2c_write(st.chip_cfg.compass_addr, AKM_REG_CNTL, 1, tmp+8))
-        return -1;
-#else
-    if (i2c_read(st.hw->addr, st.reg->raw_compass, 8, tmp))
-        return -1;
-#endif
-
-#if defined AK8975_SECONDARY
-    /* AK8975 doesn't have the overrun error bit. */
-    if (!(tmp[0] & AKM_DATA_READY))
-        return -2;
-    if ((tmp[7] & AKM_OVERFLOW) || (tmp[7] & AKM_DATA_ERROR))
-        return -3;
-#elif defined AK8963_SECONDARY
-    /* AK8963 doesn't have the data read error bit. */
-    if (!(tmp[0] & AKM_DATA_READY) || (tmp[0] & AKM_DATA_OVERRUN))
-        return -2;
-    if (tmp[7] & AKM_OVERFLOW)
-        return -3;
-#endif
-    data[0] = (tmp[2] << 8) | tmp[1];
-    data[1] = (tmp[4] << 8) | tmp[3];
-    data[2] = (tmp[6] << 8) | tmp[5];
-
-    data[0] = ((long)data[0] * st.chip_cfg.mag_sens_adj[0]) >> 8;
-    data[1] = ((long)data[1] * st.chip_cfg.mag_sens_adj[1]) >> 8;
-    data[2] = ((long)data[2] * st.chip_cfg.mag_sens_adj[2]) >> 8;
-
-    if (timestamp)
-        get_ms(timestamp);
-    return 0;
-#else
-    return -1;
-#endif
-}
-
-/**
- *  @brief      Get the compass full-scale range.
- *  @param[out] fsr Current full-scale range.
- *  @return     0 if successful.
- */
-int mpu_get_compass_fsr(unsigned short *fsr)
-{
-#ifdef AK89xx_SECONDARY
-    fsr[0] = st.hw->compass_fsr;
-    return 0;
-#else
-    return -1;
-#endif
-}
-
-/**
- *  @brief      Enters LP accel motion interrupt mode.
- *  The behaviour of this feature is very different between the MPU6050 and the
- *  MPU6500. Each chip's version of this feature is explained below.
- *
- *  \n The hardware motion threshold can be between 32mg and 8160mg in 32mg
- *  increments.
- *
- *  \n Low-power accel mode supports the following frequencies:
- *  \n 1.25Hz, 5Hz, 20Hz, 40Hz
- *
- *  \n MPU6500:
- *  \n Unlike the MPU6050 version, the hardware does not "lock in" a reference
- *  sample. The hardware monitors the accel data and detects any large change
- *  over a short period of time.
- *
- *  \n The hardware motion threshold can be between 4mg and 1020mg in 4mg
- *  increments.
- *
- *  \n MPU6500 Low-power accel mode supports the following frequencies:
- *  \n 1.25Hz, 2.5Hz, 5Hz, 10Hz, 20Hz, 40Hz, 80Hz, 160Hz, 320Hz, 640Hz
- *
- *  \n\n NOTES:
- *  \n The driver will round down @e thresh to the nearest supported value if
- *  an unsupported threshold is selected.
- *  \n To select a fractional wake-up frequency, round down the value passed to
- *  @e lpa_freq.
- *  \n The MPU6500 does not support a delay parameter. If this function is used
- *  for the MPU6500, the value passed to @e time will be ignored.
- *  \n To disable this mode, set @e lpa_freq to zero. The driver will restore
- *  the previous configuration.
- *
- *  @param[in]  thresh      Motion threshold in mg.
- *  @param[in]  time        Duration in milliseconds that the accel data must
- *                          exceed @e thresh before motion is reported.
- *  @param[in]  lpa_freq    Minimum sampling rate, or zero to disable.
- *  @return     0 if successful.
- */
-int mpu_lp_motion_interrupt(unsigned short thresh, unsigned char time,
-    unsigned char lpa_freq)
-{
-    unsigned char data[3];
-
-    if (lpa_freq) {
-        unsigned char thresh_hw;
-
-#if defined MPU6500
-        /* 1LSb = 4mg. */
-        if (thresh > 1020)
-            thresh_hw = 255;
-        else if (thresh < 4)
-            thresh_hw = 1;
-        else
-            thresh_hw = thresh >> 2;
-#endif
-
-        if (!time)
-            /* Minimum duration must be 1ms. */
-            time = 1;
-
-#if defined MPU6500
-        if (lpa_freq > 640)
-#endif
-            /* At this point, the chip has not been re-configured, so the
-             * function can safely exit.
-             */
-            return -1;
-
-        if (!st.chip_cfg.int_motion_only) {
-            /* Store current settings for later. */
-            if (st.chip_cfg.dmp_on) {
-                mpu_set_dmp_state(0);
-                st.chip_cfg.cache.dmp_on = 1;
-            } else
-                st.chip_cfg.cache.dmp_on = 0;
-            mpu_get_gyro_fsr(&st.chip_cfg.cache.gyro_fsr);
-            mpu_get_accel_fsr(&st.chip_cfg.cache.accel_fsr);
-            mpu_get_lpf(&st.chip_cfg.cache.lpf);
-            mpu_get_sample_rate(&st.chip_cfg.cache.sample_rate);
-            st.chip_cfg.cache.sensors_on = st.chip_cfg.sensors;
-            mpu_get_fifo_config(&st.chip_cfg.cache.fifo_sensors);
-        }
-
-#if defined MPU6500
-        /* Disable hardware interrupts. */
-        set_int_enable(0);
-
-        /* Enter full-power accel-only mode, no FIFO/DMP. */
-        data[0] = 0;
-        data[1] = 0;
-        data[2] = BIT_STBY_XYZG;
-        if (i2c_write(st.hw->addr, st.reg->user_ctrl, 3, data))
-            goto lp_int_restore;
-
-        /* Set motion threshold. */
-        data[0] = thresh_hw;
-        if (i2c_write(st.hw->addr, st.reg->motion_thr, 1, data))
-            goto lp_int_restore;
-
-        /* Set wake frequency. */
-        if (lpa_freq == 1)
-            data[0] = INV_LPA_1_25HZ;
-        else if (lpa_freq == 2)
-            data[0] = INV_LPA_2_5HZ;
-        else if (lpa_freq <= 5)
-            data[0] = INV_LPA_5HZ;
-        else if (lpa_freq <= 10)
-            data[0] = INV_LPA_10HZ;
-        else if (lpa_freq <= 20)
-            data[0] = INV_LPA_20HZ;
-        else if (lpa_freq <= 40)
-            data[0] = INV_LPA_40HZ;
-        else if (lpa_freq <= 80)
-            data[0] = INV_LPA_80HZ;
-        else if (lpa_freq <= 160)
-            data[0] = INV_LPA_160HZ;
-        else if (lpa_freq <= 320)
-            data[0] = INV_LPA_320HZ;
-        else
-            data[0] = INV_LPA_640HZ;
-        if (i2c_write(st.hw->addr, st.reg->lp_accel_odr, 1, data))
-            goto lp_int_restore;
-
-        /* Enable motion interrupt (MPU6500 version). */
-        data[0] = BITS_WOM_EN;
-        if (i2c_write(st.hw->addr, st.reg->accel_intel, 1, data))
-            goto lp_int_restore;
-
-        /* Enable cycle mode. */
-        data[0] = BIT_LPA_CYCLE;
-        if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, data))
-            goto lp_int_restore;
-
-        /* Enable interrupt. */
-        data[0] = BIT_MOT_INT_EN;
-        if (i2c_write(st.hw->addr, st.reg->int_enable, 1, data))
-            goto lp_int_restore;
-
-        st.chip_cfg.int_motion_only = 1;
-        return 0;
-#endif
-    } else {
-        /* Don't "restore" the previous state if no state has been saved. */
-        int ii;
-        char *cache_ptr = (char*)&st.chip_cfg.cache;
-        for (ii = 0; ii < sizeof(st.chip_cfg.cache); ii++) {
-            if (cache_ptr[ii] != 0)
-                goto lp_int_restore;
-        }
-        /* If we reach this point, motion interrupt mode hasn't been used yet. */
-        return -1;
-    }
-lp_int_restore:
-    /* Set to invalid values to ensure no I2C writes are skipped. */
-    st.chip_cfg.gyro_fsr = 0xFF;
-    st.chip_cfg.accel_fsr = 0xFF;
-    st.chip_cfg.lpf = 0xFF;
-    st.chip_cfg.sample_rate = 0xFFFF;
-    st.chip_cfg.sensors = 0xFF;
-    st.chip_cfg.fifo_enable = 0xFF;
-    st.chip_cfg.clk_src = INV_CLK_PLL;
-    mpu_set_sensors(st.chip_cfg.cache.sensors_on);
-    mpu_set_gyro_fsr(st.chip_cfg.cache.gyro_fsr);
-    mpu_set_accel_fsr(st.chip_cfg.cache.accel_fsr);
-    mpu_set_lpf(st.chip_cfg.cache.lpf);
-    mpu_set_sample_rate(st.chip_cfg.cache.sample_rate);
-    mpu_configure_fifo(st.chip_cfg.cache.fifo_sensors);
-
-    if (st.chip_cfg.cache.dmp_on)
-        mpu_set_dmp_state(1);
-
-#ifdef MPU6500
-    /* Disable motion interrupt (MPU6500 version). */
-    data[0] = 0;
-    if (i2c_write(st.hw->addr, st.reg->accel_intel, 1, data))
-        goto lp_int_restore;
-#endif
-
-    st.chip_cfg.int_motion_only = 0;
-    return 0;
-}
-
-/**
- *  @}
- */
-

+ 0 - 132
Core备份3/imu6/inv_mpu6.h

@@ -1,132 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011-2012 InvenSense Corporation, All Rights Reserved.
-    See included License.txt for License information.
- $
- */
-/**
- *  @addtogroup  DRIVERS Sensor Driver Layer
- *  @brief       Hardware drivers to communicate with sensors via I2C.
- *
- *  @{
- *      @file       inv_mpu.h
- *      @brief      An I2C-based driver for Invensense gyroscopes.
- *      @details    This driver currently works for the following devices:
- *                  MPU6050
- *                  MPU6500
- *                  MPU9150 (or MPU6050 w/ AK8975 on the auxiliary bus)
- *                  MPU9250 (or MPU6500 w/ AK8963 on the auxiliary bus)
- */
-
-#ifndef _INV_MPU_H_
-#define _INV_MPU_H_
-
-#define MOTION_DRIVER_TARGET_STM32
-#define MPU6050
-//#define EMPL
-//#define USE_DMP
-
-#define INV_X_GYRO      (0x40)
-#define INV_Y_GYRO      (0x20)
-#define INV_Z_GYRO      (0x10)
-#define INV_XYZ_GYRO    (INV_X_GYRO | INV_Y_GYRO | INV_Z_GYRO)
-#define INV_XYZ_ACCEL   (0x08)
-#define INV_XYZ_COMPASS (0x01)
-
-struct int_param_s {
-#if defined EMPL_TARGET_MSP430 || defined MOTION_DRIVER_TARGET_MSP430 || defined MOTION_DRIVER_TARGET_STM32
-    void (*cb)(void);
-    unsigned short pin;
-    unsigned char lp_exit;
-    unsigned char active_low;
-#elif defined EMPL_TARGET_UC3L0
-    unsigned long pin;
-    void (*cb)(volatile void*);
-    void *arg;
-#endif
-};
-
-#define MPU_INT_STATUS_DATA_READY       (0x0001)
-#define MPU_INT_STATUS_DMP              (0x0002)
-#define MPU_INT_STATUS_PLL_READY        (0x0004)
-#define MPU_INT_STATUS_I2C_MST          (0x0008)
-#define MPU_INT_STATUS_FIFO_OVERFLOW    (0x0010)
-#define MPU_INT_STATUS_ZMOT             (0x0020)
-#define MPU_INT_STATUS_MOT              (0x0040)
-#define MPU_INT_STATUS_FREE_FALL        (0x0080)
-#define MPU_INT_STATUS_DMP_0            (0x0100)
-#define MPU_INT_STATUS_DMP_1            (0x0200)
-#define MPU_INT_STATUS_DMP_2            (0x0400)
-#define MPU_INT_STATUS_DMP_3            (0x0800)
-#define MPU_INT_STATUS_DMP_4            (0x1000)
-#define MPU_INT_STATUS_DMP_5            (0x2000)
-
-/* Set up APIs */
-int mpu_init(struct int_param_s *int_param);
-int mpu_init_slave(void);
-int mpu_set_bypass(unsigned char bypass_on);
-
-/* Configuration APIs */
-int mpu_lp_accel_mode(unsigned char rate);
-int mpu_lp_motion_interrupt(unsigned short thresh, unsigned char time,
-    unsigned char lpa_freq);
-int mpu_set_int_level(unsigned char active_low);
-int mpu_set_int_latched(unsigned char enable);
-
-int mpu_set_dmp_state(unsigned char enable);
-int mpu_get_dmp_state(unsigned char *enabled);
-
-int mpu_get_lpf(unsigned short *lpf);
-int mpu_set_lpf(unsigned short lpf);
-
-int mpu_get_gyro_fsr(unsigned short *fsr);
-int mpu_set_gyro_fsr(unsigned short fsr);
-
-int mpu_get_accel_fsr(unsigned char *fsr);
-int mpu_set_accel_fsr(unsigned char fsr);
-
-int mpu_get_compass_fsr(unsigned short *fsr);
-
-int mpu_get_gyro_sens(float *sens);
-int mpu_get_accel_sens(unsigned short *sens);
-
-int mpu_get_sample_rate(unsigned short *rate);
-int mpu_set_sample_rate(unsigned short rate);
-int mpu_get_compass_sample_rate(unsigned short *rate);
-int mpu_set_compass_sample_rate(unsigned short rate);
-
-int mpu_get_fifo_config(unsigned char *sensors);
-int mpu_configure_fifo(unsigned char sensors);
-
-int mpu_get_power_state(unsigned char *power_on);
-int mpu_set_sensors(unsigned char sensors);
-
-int mpu_set_accel_bias(const long *accel_bias);
-
-/* Data getter/setter APIs */
-int mpu_get_gyro_reg(short *data, unsigned long *timestamp);
-int mpu_get_accel_reg(short *data, unsigned long *timestamp);
-int mpu_get_compass_reg(short *data, unsigned long *timestamp);
-int mpu_get_temperature(long *data, unsigned long *timestamp);
-
-int mpu_get_int_status(short *status);
-int mpu_read_fifo(short *gyro, short *accel, unsigned long *timestamp,
-    unsigned char *sensors, unsigned char *more);
-int mpu_read_fifo_stream(unsigned short length, unsigned char *data,
-    unsigned char *more);
-int mpu_reset_fifo(void);
-
-int mpu_write_mem(unsigned short mem_addr, unsigned short length,
-    unsigned char *data);
-int mpu_read_mem(unsigned short mem_addr, unsigned short length,
-    unsigned char *data);
-int mpu_load_firmware(unsigned short length, const unsigned char *firmware,
-    unsigned short start_addr, unsigned short sample_rate);
-
-int mpu_reg_dump(void);
-int mpu_read_reg(unsigned char reg, unsigned char *data);
-int mpu_run_self_test(long *gyro, long *accel);
-int mpu_register_tap_cb(void (*func)(unsigned char, unsigned char));
-
-#endif  /* #ifndef _INV_MPU_H_ */
-

+ 0 - 1380
Core备份3/imu6/inv_mpu_dmp_motion_driver6.c

@@ -1,1380 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011-2012 InvenSense Corporation, All Rights Reserved.
-    See included License.txt for License information.
- $
- */
-/**
- *  @addtogroup  DRIVERS Sensor Driver Layer
- *  @brief       Hardware drivers to communicate with sensors via I2C.
- *
- *  @{
- *      @file       inv_mpu_dmp_motion_driver.c
- *      @brief      DMP image and interface functions.
- *      @details    All functions are preceded by the dmp_ prefix to
- *                  differentiate among MPL and general driver function calls.
- */
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include "inv_mpu6.h"
-#include "inv_mpu_dmp_motion_driver6.h"
-#include "dmpKey6.h"
-#include "dmpmap6.h"
-
-#include "MPU60506.h"
-
-/* The following functions must be defined for this platform:
- * i2c_write(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char const *data)
- * i2c_read(unsigned char slave_addr, unsigned char reg_addr,
- *      unsigned char length, unsigned char *data)
- * delay_ms(unsigned long num_ms)
- * get_ms(unsigned long *count)
- */
-#if defined MOTION_DRIVER_TARGET_MSP430
-#include "msp430.h"
-#include "msp430_clock.h"
-#define delay_ms    msp430_delay_ms
-#define get_ms      msp430_get_clock_ms
-#define log_i(...)     do {} while (0)
-#define log_e(...)     do {} while (0)
-
-#elif defined EMPL_TARGET_MSP430
-#include "msp430.h"
-#include "msp430_clock.h"
-#include "log.h"
-#define delay_ms    msp430_delay_ms
-#define get_ms      msp430_get_clock_ms
-#define log_i       MPL_LOGI
-#define log_e       MPL_LOGE
-
-#elif defined EMPL_TARGET_UC3L0
-/* Instead of using the standard TWI driver from the ASF library, we're using
- * a TWI driver that follows the slave address + register address convention.
- */
-#include "delay.h"
-#include "sysclk.h"
-#include "log.h"
-#include "uc3l0_clock.h"
-/* delay_ms is a function already defined in ASF. */
-#define get_ms  uc3l0_get_clock_ms
-#define log_i       MPL_LOGI
-#define log_e       MPL_LOGE
-
-#elif defined MOTION_DRIVER_TARGET_STM32
-
-#define delay_ms    HAL_Delay
-#define get_ms      get_tick_count
-
-#define log_i(...)     do {} while (0)
-#define log_e(...)     do {} while (0)
-
-#else
-#error  Gyro driver is missing the system layer implementations.
-#endif
-
-/* These defines are copied from dmpDefaultMPU6050.c in the general MPL
- * releases. These defines may change for each DMP image, so be sure to modify
- * these values when switching to a new image.
- */
-#define CFG_LP_QUAT             (2712)
-#define END_ORIENT_TEMP         (1866)
-#define CFG_27                  (2742)
-#define CFG_20                  (2224)
-#define CFG_23                  (2745)
-#define CFG_FIFO_ON_EVENT       (2690)
-#define END_PREDICTION_UPDATE   (1761)
-#define CGNOTICE_INTR           (2620)
-#define X_GRT_Y_TMP             (1358)
-#define CFG_DR_INT              (1029)
-#define CFG_AUTH                (1035)
-#define UPDATE_PROP_ROT         (1835)
-#define END_COMPARE_Y_X_TMP2    (1455)
-#define SKIP_X_GRT_Y_TMP        (1359)
-#define SKIP_END_COMPARE        (1435)
-#define FCFG_3                  (1088)
-#define FCFG_2                  (1066)
-#define FCFG_1                  (1062)
-#define END_COMPARE_Y_X_TMP3    (1434)
-#define FCFG_7                  (1073)
-#define FCFG_6                  (1106)
-#define FLAT_STATE_END          (1713)
-#define SWING_END_4             (1616)
-#define SWING_END_2             (1565)
-#define SWING_END_3             (1587)
-#define SWING_END_1             (1550)
-#define CFG_8                   (2718)
-#define CFG_15                  (2727)
-#define CFG_16                  (2746)
-#define CFG_EXT_GYRO_BIAS       (1189)
-#define END_COMPARE_Y_X_TMP     (1407)
-#define DO_NOT_UPDATE_PROP_ROT  (1839)
-#define CFG_7                   (1205)
-#define FLAT_STATE_END_TEMP     (1683)
-#define END_COMPARE_Y_X         (1484)
-#define SKIP_SWING_END_1        (1551)
-#define SKIP_SWING_END_3        (1588)
-#define SKIP_SWING_END_2        (1566)
-#define TILTG75_START           (1672)
-#define CFG_6                   (2753)
-#define TILTL75_END             (1669)
-#define END_ORIENT              (1884)
-#define CFG_FLICK_IN            (2573)
-#define TILTL75_START           (1643)
-#define CFG_MOTION_BIAS         (1208)
-#define X_GRT_Y                 (1408)
-#define TEMPLABEL               (2324)
-#define CFG_ANDROID_ORIENT_INT  (1853)
-#define CFG_GYRO_RAW_DATA       (2722)
-#define X_GRT_Y_TMP2            (1379)
-
-#define D_0_22                  (22+512)
-#define D_0_24                  (24+512)
-
-#define D_0_36                  (36)
-#define D_0_52                  (52)
-#define D_0_96                  (96)
-#define D_0_104                 (104)
-#define D_0_108                 (108)
-#define D_0_163                 (163)
-#define D_0_188                 (188)
-#define D_0_192                 (192)
-#define D_0_224                 (224)
-#define D_0_228                 (228)
-#define D_0_232                 (232)
-#define D_0_236                 (236)
-
-#define D_1_2                   (256 + 2)
-#define D_1_4                   (256 + 4)
-#define D_1_8                   (256 + 8)
-#define D_1_10                  (256 + 10)
-#define D_1_24                  (256 + 24)
-#define D_1_28                  (256 + 28)
-#define D_1_36                  (256 + 36)
-#define D_1_40                  (256 + 40)
-#define D_1_44                  (256 + 44)
-#define D_1_72                  (256 + 72)
-#define D_1_74                  (256 + 74)
-#define D_1_79                  (256 + 79)
-#define D_1_88                  (256 + 88)
-#define D_1_90                  (256 + 90)
-#define D_1_92                  (256 + 92)
-#define D_1_96                  (256 + 96)
-#define D_1_98                  (256 + 98)
-#define D_1_106                 (256 + 106)
-#define D_1_108                 (256 + 108)
-#define D_1_112                 (256 + 112)
-#define D_1_128                 (256 + 144)
-#define D_1_152                 (256 + 12)
-#define D_1_160                 (256 + 160)
-#define D_1_176                 (256 + 176)
-#define D_1_178                 (256 + 178)
-#define D_1_218                 (256 + 218)
-#define D_1_232                 (256 + 232)
-#define D_1_236                 (256 + 236)
-#define D_1_240                 (256 + 240)
-#define D_1_244                 (256 + 244)
-#define D_1_250                 (256 + 250)
-#define D_1_252                 (256 + 252)
-#define D_2_12                  (512 + 12)
-#define D_2_96                  (512 + 96)
-#define D_2_108                 (512 + 108)
-#define D_2_208                 (512 + 208)
-#define D_2_224                 (512 + 224)
-#define D_2_236                 (512 + 236)
-#define D_2_244                 (512 + 244)
-#define D_2_248                 (512 + 248)
-#define D_2_252                 (512 + 252)
-
-#define CPASS_BIAS_X            (35 * 16 + 4)
-#define CPASS_BIAS_Y            (35 * 16 + 8)
-#define CPASS_BIAS_Z            (35 * 16 + 12)
-#define CPASS_MTX_00            (36 * 16)
-#define CPASS_MTX_01            (36 * 16 + 4)
-#define CPASS_MTX_02            (36 * 16 + 8)
-#define CPASS_MTX_10            (36 * 16 + 12)
-#define CPASS_MTX_11            (37 * 16)
-#define CPASS_MTX_12            (37 * 16 + 4)
-#define CPASS_MTX_20            (37 * 16 + 8)
-#define CPASS_MTX_21            (37 * 16 + 12)
-#define CPASS_MTX_22            (43 * 16 + 12)
-#define D_EXT_GYRO_BIAS_X       (61 * 16)
-#define D_EXT_GYRO_BIAS_Y       (61 * 16) + 4
-#define D_EXT_GYRO_BIAS_Z       (61 * 16) + 8
-#define D_ACT0                  (40 * 16)
-#define D_ACSX                  (40 * 16 + 4)
-#define D_ACSY                  (40 * 16 + 8)
-#define D_ACSZ                  (40 * 16 + 12)
-
-#define FLICK_MSG               (45 * 16 + 4)
-#define FLICK_COUNTER           (45 * 16 + 8)
-#define FLICK_LOWER             (45 * 16 + 12)
-#define FLICK_UPPER             (46 * 16 + 12)
-
-#define D_AUTH_OUT              (992)
-#define D_AUTH_IN               (996)
-#define D_AUTH_A                (1000)
-#define D_AUTH_B                (1004)
-
-#define D_PEDSTD_BP_B           (768 + 0x1C)
-#define D_PEDSTD_HP_A           (768 + 0x78)
-#define D_PEDSTD_HP_B           (768 + 0x7C)
-#define D_PEDSTD_BP_A4          (768 + 0x40)
-#define D_PEDSTD_BP_A3          (768 + 0x44)
-#define D_PEDSTD_BP_A2          (768 + 0x48)
-#define D_PEDSTD_BP_A1          (768 + 0x4C)
-#define D_PEDSTD_INT_THRSH      (768 + 0x68)
-#define D_PEDSTD_CLIP           (768 + 0x6C)
-#define D_PEDSTD_SB             (768 + 0x28)
-#define D_PEDSTD_SB_TIME        (768 + 0x2C)
-#define D_PEDSTD_PEAKTHRSH      (768 + 0x98)
-#define D_PEDSTD_TIML           (768 + 0x2A)
-#define D_PEDSTD_TIMH           (768 + 0x2E)
-#define D_PEDSTD_PEAK           (768 + 0X94)
-#define D_PEDSTD_STEPCTR        (768 + 0x60)
-#define D_PEDSTD_TIMECTR        (964)
-#define D_PEDSTD_DECI           (768 + 0xA0)
-
-#define D_HOST_NO_MOT           (976)
-#define D_ACCEL_BIAS            (660)
-
-#define D_ORIENT_GAP            (76)
-
-#define D_TILT0_H               (48)
-#define D_TILT0_L               (50)
-#define D_TILT1_H               (52)
-#define D_TILT1_L               (54)
-#define D_TILT2_H               (56)
-#define D_TILT2_L               (58)
-#define D_TILT3_H               (60)
-#define D_TILT3_L               (62)
-
-#define DMP_CODE_SIZE           (3062)
-
-static const unsigned char dmp_memory[DMP_CODE_SIZE] = {
-    /* bank # 0 */
-    0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x00, 0x00,
-    0x00, 0x65, 0x00, 0x54, 0xff, 0xef, 0x00, 0x00, 0xfa, 0x80, 0x00, 0x0b, 0x12, 0x82, 0x00, 0x01,
-    0x03, 0x0c, 0x30, 0xc3, 0x0e, 0x8c, 0x8c, 0xe9, 0x14, 0xd5, 0x40, 0x02, 0x13, 0x71, 0x0f, 0x8e,
-    0x38, 0x83, 0xf8, 0x83, 0x30, 0x00, 0xf8, 0x83, 0x25, 0x8e, 0xf8, 0x83, 0x30, 0x00, 0xf8, 0x83,
-    0xff, 0xff, 0xff, 0xff, 0x0f, 0xfe, 0xa9, 0xd6, 0x24, 0x00, 0x04, 0x00, 0x1a, 0x82, 0x79, 0xa1,
-    0x00, 0x00, 0x00, 0x3c, 0xff, 0xff, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x38, 0x83, 0x6f, 0xa2,
-    0x00, 0x3e, 0x03, 0x30, 0x40, 0x00, 0x00, 0x00, 0x02, 0xca, 0xe3, 0x09, 0x3e, 0x80, 0x00, 0x00,
-    0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
-    0x00, 0x0c, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x6e, 0x00, 0x00, 0x06, 0x92, 0x0a, 0x16, 0xc0, 0xdf,
-    0xff, 0xff, 0x02, 0x56, 0xfd, 0x8c, 0xd3, 0x77, 0xff, 0xe1, 0xc4, 0x96, 0xe0, 0xc5, 0xbe, 0xaa,
-    0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0b, 0x2b, 0x00, 0x00, 0x16, 0x57, 0x00, 0x00, 0x03, 0x59,
-    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0xfa, 0x00, 0x02, 0x6c, 0x1d, 0x00, 0x00, 0x00, 0x00,
-    0x3f, 0xff, 0xdf, 0xeb, 0x00, 0x3e, 0xb3, 0xb6, 0x00, 0x0d, 0x22, 0x78, 0x00, 0x00, 0x2f, 0x3c,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x42, 0xb5, 0x00, 0x00, 0x39, 0xa2, 0x00, 0x00, 0xb3, 0x65,
-    0xd9, 0x0e, 0x9f, 0xc9, 0x1d, 0xcf, 0x4c, 0x34, 0x30, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00,
-    0x3b, 0xb6, 0x7a, 0xe8, 0x00, 0x64, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    /* bank # 1 */
-    0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0xfa, 0x92, 0x10, 0x00, 0x22, 0x5e, 0x00, 0x0d, 0x22, 0x9f,
-    0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0xff, 0x46, 0x00, 0x00, 0x63, 0xd4, 0x00, 0x00,
-    0x10, 0x00, 0x00, 0x00, 0x04, 0xd6, 0x00, 0x00, 0x04, 0xcc, 0x00, 0x00, 0x04, 0xcc, 0x00, 0x00,
-    0x00, 0x00, 0x10, 0x72, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x06, 0x00, 0x02, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x64, 0x00, 0x20, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, 0x00,
-    0x00, 0x00, 0x00, 0x32, 0xf8, 0x98, 0x00, 0x00, 0xff, 0x65, 0x00, 0x00, 0x83, 0x0f, 0x00, 0x00,
-    0xff, 0x9b, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
-    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0xb2, 0x6a, 0x00, 0x02, 0x00, 0x00,
-    0x00, 0x01, 0xfb, 0x83, 0x00, 0x68, 0x00, 0x00, 0x00, 0xd9, 0xfc, 0x00, 0x7c, 0xf1, 0xff, 0x83,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x64, 0x03, 0xe8, 0x00, 0x64, 0x00, 0x28,
-    0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x16, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
-    0x00, 0x00, 0x10, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x01, 0xf4, 0x00, 0x00, 0x10, 0x00,
-    /* bank # 2 */
-    0x00, 0x28, 0x00, 0x00, 0xff, 0xff, 0x45, 0x81, 0xff, 0xff, 0xfa, 0x72, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x05, 0x00, 0x05, 0xba, 0xc6, 0x00, 0x47, 0x78, 0xa2,
-    0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x14,
-    0x00, 0x00, 0x25, 0x4d, 0x00, 0x2f, 0x70, 0x6d, 0x00, 0x00, 0x05, 0xae, 0x00, 0x0c, 0x02, 0xd0,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x64, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x0e,
-    0x00, 0x00, 0x0a, 0xc7, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0xff, 0xff, 0xff, 0x9c,
-    0x00, 0x00, 0x0b, 0x2b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x64,
-    0xff, 0xe5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    /* bank # 3 */
-    0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x24, 0x26, 0xd3,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x96, 0x00, 0x3c,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x0c, 0x0a, 0x4e, 0x68, 0xcd, 0xcf, 0x77, 0x09, 0x50, 0x16, 0x67, 0x59, 0xc6, 0x19, 0xce, 0x82,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xd7, 0x84, 0x00, 0x03, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc7, 0x93, 0x8f, 0x9d, 0x1e, 0x1b, 0x1c, 0x19,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x18, 0x85, 0x00, 0x00, 0x40, 0x00,
-    0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x67, 0x7d, 0xdf, 0x7e, 0x72, 0x90, 0x2e, 0x55, 0x4c, 0xf6, 0xe6, 0x88,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-
-    /* bank # 4 */
-    0xd8, 0xdc, 0xb4, 0xb8, 0xb0, 0xd8, 0xb9, 0xab, 0xf3, 0xf8, 0xfa, 0xb3, 0xb7, 0xbb, 0x8e, 0x9e,
-    0xae, 0xf1, 0x32, 0xf5, 0x1b, 0xf1, 0xb4, 0xb8, 0xb0, 0x80, 0x97, 0xf1, 0xa9, 0xdf, 0xdf, 0xdf,
-    0xaa, 0xdf, 0xdf, 0xdf, 0xf2, 0xaa, 0xc5, 0xcd, 0xc7, 0xa9, 0x0c, 0xc9, 0x2c, 0x97, 0xf1, 0xa9,
-    0x89, 0x26, 0x46, 0x66, 0xb2, 0x89, 0x99, 0xa9, 0x2d, 0x55, 0x7d, 0xb0, 0xb0, 0x8a, 0xa8, 0x96,
-    0x36, 0x56, 0x76, 0xf1, 0xba, 0xa3, 0xb4, 0xb2, 0x80, 0xc0, 0xb8, 0xa8, 0x97, 0x11, 0xb2, 0x83,
-    0x98, 0xba, 0xa3, 0xf0, 0x24, 0x08, 0x44, 0x10, 0x64, 0x18, 0xb2, 0xb9, 0xb4, 0x98, 0x83, 0xf1,
-    0xa3, 0x29, 0x55, 0x7d, 0xba, 0xb5, 0xb1, 0xa3, 0x83, 0x93, 0xf0, 0x00, 0x28, 0x50, 0xf5, 0xb2,
-    0xb6, 0xaa, 0x83, 0x93, 0x28, 0x54, 0x7c, 0xf1, 0xb9, 0xa3, 0x82, 0x93, 0x61, 0xba, 0xa2, 0xda,
-    0xde, 0xdf, 0xdb, 0x81, 0x9a, 0xb9, 0xae, 0xf5, 0x60, 0x68, 0x70, 0xf1, 0xda, 0xba, 0xa2, 0xdf,
-    0xd9, 0xba, 0xa2, 0xfa, 0xb9, 0xa3, 0x82, 0x92, 0xdb, 0x31, 0xba, 0xa2, 0xd9, 0xba, 0xa2, 0xf8,
-    0xdf, 0x85, 0xa4, 0xd0, 0xc1, 0xbb, 0xad, 0x83, 0xc2, 0xc5, 0xc7, 0xb8, 0xa2, 0xdf, 0xdf, 0xdf,
-    0xba, 0xa0, 0xdf, 0xdf, 0xdf, 0xd8, 0xd8, 0xf1, 0xb8, 0xaa, 0xb3, 0x8d, 0xb4, 0x98, 0x0d, 0x35,
-    0x5d, 0xb2, 0xb6, 0xba, 0xaf, 0x8c, 0x96, 0x19, 0x8f, 0x9f, 0xa7, 0x0e, 0x16, 0x1e, 0xb4, 0x9a,
-    0xb8, 0xaa, 0x87, 0x2c, 0x54, 0x7c, 0xba, 0xa4, 0xb0, 0x8a, 0xb6, 0x91, 0x32, 0x56, 0x76, 0xb2,
-    0x84, 0x94, 0xa4, 0xc8, 0x08, 0xcd, 0xd8, 0xb8, 0xb4, 0xb0, 0xf1, 0x99, 0x82, 0xa8, 0x2d, 0x55,
-    0x7d, 0x98, 0xa8, 0x0e, 0x16, 0x1e, 0xa2, 0x2c, 0x54, 0x7c, 0x92, 0xa4, 0xf0, 0x2c, 0x50, 0x78,
-    /* bank # 5 */
-    0xf1, 0x84, 0xa8, 0x98, 0xc4, 0xcd, 0xfc, 0xd8, 0x0d, 0xdb, 0xa8, 0xfc, 0x2d, 0xf3, 0xd9, 0xba,
-    0xa6, 0xf8, 0xda, 0xba, 0xa6, 0xde, 0xd8, 0xba, 0xb2, 0xb6, 0x86, 0x96, 0xa6, 0xd0, 0xf3, 0xc8,
-    0x41, 0xda, 0xa6, 0xc8, 0xf8, 0xd8, 0xb0, 0xb4, 0xb8, 0x82, 0xa8, 0x92, 0xf5, 0x2c, 0x54, 0x88,
-    0x98, 0xf1, 0x35, 0xd9, 0xf4, 0x18, 0xd8, 0xf1, 0xa2, 0xd0, 0xf8, 0xf9, 0xa8, 0x84, 0xd9, 0xc7,
-    0xdf, 0xf8, 0xf8, 0x83, 0xc5, 0xda, 0xdf, 0x69, 0xdf, 0x83, 0xc1, 0xd8, 0xf4, 0x01, 0x14, 0xf1,
-    0xa8, 0x82, 0x4e, 0xa8, 0x84, 0xf3, 0x11, 0xd1, 0x82, 0xf5, 0xd9, 0x92, 0x28, 0x97, 0x88, 0xf1,
-    0x09, 0xf4, 0x1c, 0x1c, 0xd8, 0x84, 0xa8, 0xf3, 0xc0, 0xf9, 0xd1, 0xd9, 0x97, 0x82, 0xf1, 0x29,
-    0xf4, 0x0d, 0xd8, 0xf3, 0xf9, 0xf9, 0xd1, 0xd9, 0x82, 0xf4, 0xc2, 0x03, 0xd8, 0xde, 0xdf, 0x1a,
-    0xd8, 0xf1, 0xa2, 0xfa, 0xf9, 0xa8, 0x84, 0x98, 0xd9, 0xc7, 0xdf, 0xf8, 0xf8, 0xf8, 0x83, 0xc7,
-    0xda, 0xdf, 0x69, 0xdf, 0xf8, 0x83, 0xc3, 0xd8, 0xf4, 0x01, 0x14, 0xf1, 0x98, 0xa8, 0x82, 0x2e,
-    0xa8, 0x84, 0xf3, 0x11, 0xd1, 0x82, 0xf5, 0xd9, 0x92, 0x50, 0x97, 0x88, 0xf1, 0x09, 0xf4, 0x1c,
-    0xd8, 0x84, 0xa8, 0xf3, 0xc0, 0xf8, 0xf9, 0xd1, 0xd9, 0x97, 0x82, 0xf1, 0x49, 0xf4, 0x0d, 0xd8,
-    0xf3, 0xf9, 0xf9, 0xd1, 0xd9, 0x82, 0xf4, 0xc4, 0x03, 0xd8, 0xde, 0xdf, 0xd8, 0xf1, 0xad, 0x88,
-    0x98, 0xcc, 0xa8, 0x09, 0xf9, 0xd9, 0x82, 0x92, 0xa8, 0xf5, 0x7c, 0xf1, 0x88, 0x3a, 0xcf, 0x94,
-    0x4a, 0x6e, 0x98, 0xdb, 0x69, 0x31, 0xda, 0xad, 0xf2, 0xde, 0xf9, 0xd8, 0x87, 0x95, 0xa8, 0xf2,
-    0x21, 0xd1, 0xda, 0xa5, 0xf9, 0xf4, 0x17, 0xd9, 0xf1, 0xae, 0x8e, 0xd0, 0xc0, 0xc3, 0xae, 0x82,
-    /* bank # 6 */
-    0xc6, 0x84, 0xc3, 0xa8, 0x85, 0x95, 0xc8, 0xa5, 0x88, 0xf2, 0xc0, 0xf1, 0xf4, 0x01, 0x0e, 0xf1,
-    0x8e, 0x9e, 0xa8, 0xc6, 0x3e, 0x56, 0xf5, 0x54, 0xf1, 0x88, 0x72, 0xf4, 0x01, 0x15, 0xf1, 0x98,
-    0x45, 0x85, 0x6e, 0xf5, 0x8e, 0x9e, 0x04, 0x88, 0xf1, 0x42, 0x98, 0x5a, 0x8e, 0x9e, 0x06, 0x88,
-    0x69, 0xf4, 0x01, 0x1c, 0xf1, 0x98, 0x1e, 0x11, 0x08, 0xd0, 0xf5, 0x04, 0xf1, 0x1e, 0x97, 0x02,
-    0x02, 0x98, 0x36, 0x25, 0xdb, 0xf9, 0xd9, 0x85, 0xa5, 0xf3, 0xc1, 0xda, 0x85, 0xa5, 0xf3, 0xdf,
-    0xd8, 0x85, 0x95, 0xa8, 0xf3, 0x09, 0xda, 0xa5, 0xfa, 0xd8, 0x82, 0x92, 0xa8, 0xf5, 0x78, 0xf1,
-    0x88, 0x1a, 0x84, 0x9f, 0x26, 0x88, 0x98, 0x21, 0xda, 0xf4, 0x1d, 0xf3, 0xd8, 0x87, 0x9f, 0x39,
-    0xd1, 0xaf, 0xd9, 0xdf, 0xdf, 0xfb, 0xf9, 0xf4, 0x0c, 0xf3, 0xd8, 0xfa, 0xd0, 0xf8, 0xda, 0xf9,
-    0xf9, 0xd0, 0xdf, 0xd9, 0xf9, 0xd8, 0xf4, 0x0b, 0xd8, 0xf3, 0x87, 0x9f, 0x39, 0xd1, 0xaf, 0xd9,
-    0xdf, 0xdf, 0xf4, 0x1d, 0xf3, 0xd8, 0xfa, 0xfc, 0xa8, 0x69, 0xf9, 0xf9, 0xaf, 0xd0, 0xda, 0xde,
-    0xfa, 0xd9, 0xf8, 0x8f, 0x9f, 0xa8, 0xf1, 0xcc, 0xf3, 0x98, 0xdb, 0x45, 0xd9, 0xaf, 0xdf, 0xd0,
-    0xf8, 0xd8, 0xf1, 0x8f, 0x9f, 0xa8, 0xca, 0xf3, 0x88, 0x09, 0xda, 0xaf, 0x8f, 0xcb, 0xf8, 0xd8,
-    0xf2, 0xad, 0x97, 0x8d, 0x0c, 0xd9, 0xa5, 0xdf, 0xf9, 0xba, 0xa6, 0xf3, 0xfa, 0xf4, 0x12, 0xf2,
-    0xd8, 0x95, 0x0d, 0xd1, 0xd9, 0xba, 0xa6, 0xf3, 0xfa, 0xda, 0xa5, 0xf2, 0xc1, 0xba, 0xa6, 0xf3,
-    0xdf, 0xd8, 0xf1, 0xba, 0xb2, 0xb6, 0x86, 0x96, 0xa6, 0xd0, 0xca, 0xf3, 0x49, 0xda, 0xa6, 0xcb,
-    0xf8, 0xd8, 0xb0, 0xb4, 0xb8, 0xd8, 0xad, 0x84, 0xf2, 0xc0, 0xdf, 0xf1, 0x8f, 0xcb, 0xc3, 0xa8,
-    /* bank # 7 */
-    0xb2, 0xb6, 0x86, 0x96, 0xc8, 0xc1, 0xcb, 0xc3, 0xf3, 0xb0, 0xb4, 0x88, 0x98, 0xa8, 0x21, 0xdb,
-    0x71, 0x8d, 0x9d, 0x71, 0x85, 0x95, 0x21, 0xd9, 0xad, 0xf2, 0xfa, 0xd8, 0x85, 0x97, 0xa8, 0x28,
-    0xd9, 0xf4, 0x08, 0xd8, 0xf2, 0x8d, 0x29, 0xda, 0xf4, 0x05, 0xd9, 0xf2, 0x85, 0xa4, 0xc2, 0xf2,
-    0xd8, 0xa8, 0x8d, 0x94, 0x01, 0xd1, 0xd9, 0xf4, 0x11, 0xf2, 0xd8, 0x87, 0x21, 0xd8, 0xf4, 0x0a,
-    0xd8, 0xf2, 0x84, 0x98, 0xa8, 0xc8, 0x01, 0xd1, 0xd9, 0xf4, 0x11, 0xd8, 0xf3, 0xa4, 0xc8, 0xbb,
-    0xaf, 0xd0, 0xf2, 0xde, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xd8, 0xf1, 0xb8, 0xf6,
-    0xb5, 0xb9, 0xb0, 0x8a, 0x95, 0xa3, 0xde, 0x3c, 0xa3, 0xd9, 0xf8, 0xd8, 0x5c, 0xa3, 0xd9, 0xf8,
-    0xd8, 0x7c, 0xa3, 0xd9, 0xf8, 0xd8, 0xf8, 0xf9, 0xd1, 0xa5, 0xd9, 0xdf, 0xda, 0xfa, 0xd8, 0xb1,
-    0x85, 0x30, 0xf7, 0xd9, 0xde, 0xd8, 0xf8, 0x30, 0xad, 0xda, 0xde, 0xd8, 0xf2, 0xb4, 0x8c, 0x99,
-    0xa3, 0x2d, 0x55, 0x7d, 0xa0, 0x83, 0xdf, 0xdf, 0xdf, 0xb5, 0x91, 0xa0, 0xf6, 0x29, 0xd9, 0xfb,
-    0xd8, 0xa0, 0xfc, 0x29, 0xd9, 0xfa, 0xd8, 0xa0, 0xd0, 0x51, 0xd9, 0xf8, 0xd8, 0xfc, 0x51, 0xd9,
-    0xf9, 0xd8, 0x79, 0xd9, 0xfb, 0xd8, 0xa0, 0xd0, 0xfc, 0x79, 0xd9, 0xfa, 0xd8, 0xa1, 0xf9, 0xf9,
-    0xf9, 0xf9, 0xf9, 0xa0, 0xda, 0xdf, 0xdf, 0xdf, 0xd8, 0xa1, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xac,
-    0xde, 0xf8, 0xad, 0xde, 0x83, 0x93, 0xac, 0x2c, 0x54, 0x7c, 0xf1, 0xa8, 0xdf, 0xdf, 0xdf, 0xf6,
-    0x9d, 0x2c, 0xda, 0xa0, 0xdf, 0xd9, 0xfa, 0xdb, 0x2d, 0xf8, 0xd8, 0xa8, 0x50, 0xda, 0xa0, 0xd0,
-    0xde, 0xd9, 0xd0, 0xf8, 0xf8, 0xf8, 0xdb, 0x55, 0xf8, 0xd8, 0xa8, 0x78, 0xda, 0xa0, 0xd0, 0xdf,
-    /* bank # 8 */
-    0xd9, 0xd0, 0xfa, 0xf8, 0xf8, 0xf8, 0xf8, 0xdb, 0x7d, 0xf8, 0xd8, 0x9c, 0xa8, 0x8c, 0xf5, 0x30,
-    0xdb, 0x38, 0xd9, 0xd0, 0xde, 0xdf, 0xa0, 0xd0, 0xde, 0xdf, 0xd8, 0xa8, 0x48, 0xdb, 0x58, 0xd9,
-    0xdf, 0xd0, 0xde, 0xa0, 0xdf, 0xd0, 0xde, 0xd8, 0xa8, 0x68, 0xdb, 0x70, 0xd9, 0xdf, 0xdf, 0xa0,
-    0xdf, 0xdf, 0xd8, 0xf1, 0xa8, 0x88, 0x90, 0x2c, 0x54, 0x7c, 0x98, 0xa8, 0xd0, 0x5c, 0x38, 0xd1,
-    0xda, 0xf2, 0xae, 0x8c, 0xdf, 0xf9, 0xd8, 0xb0, 0x87, 0xa8, 0xc1, 0xc1, 0xb1, 0x88, 0xa8, 0xc6,
-    0xf9, 0xf9, 0xda, 0x36, 0xd8, 0xa8, 0xf9, 0xda, 0x36, 0xd8, 0xa8, 0xf9, 0xda, 0x36, 0xd8, 0xa8,
-    0xf9, 0xda, 0x36, 0xd8, 0xa8, 0xf9, 0xda, 0x36, 0xd8, 0xf7, 0x8d, 0x9d, 0xad, 0xf8, 0x18, 0xda,
-    0xf2, 0xae, 0xdf, 0xd8, 0xf7, 0xad, 0xfa, 0x30, 0xd9, 0xa4, 0xde, 0xf9, 0xd8, 0xf2, 0xae, 0xde,
-    0xfa, 0xf9, 0x83, 0xa7, 0xd9, 0xc3, 0xc5, 0xc7, 0xf1, 0x88, 0x9b, 0xa7, 0x7a, 0xad, 0xf7, 0xde,
-    0xdf, 0xa4, 0xf8, 0x84, 0x94, 0x08, 0xa7, 0x97, 0xf3, 0x00, 0xae, 0xf2, 0x98, 0x19, 0xa4, 0x88,
-    0xc6, 0xa3, 0x94, 0x88, 0xf6, 0x32, 0xdf, 0xf2, 0x83, 0x93, 0xdb, 0x09, 0xd9, 0xf2, 0xaa, 0xdf,
-    0xd8, 0xd8, 0xae, 0xf8, 0xf9, 0xd1, 0xda, 0xf3, 0xa4, 0xde, 0xa7, 0xf1, 0x88, 0x9b, 0x7a, 0xd8,
-    0xf3, 0x84, 0x94, 0xae, 0x19, 0xf9, 0xda, 0xaa, 0xf1, 0xdf, 0xd8, 0xa8, 0x81, 0xc0, 0xc3, 0xc5,
-    0xc7, 0xa3, 0x92, 0x83, 0xf6, 0x28, 0xad, 0xde, 0xd9, 0xf8, 0xd8, 0xa3, 0x50, 0xad, 0xd9, 0xf8,
-    0xd8, 0xa3, 0x78, 0xad, 0xd9, 0xf8, 0xd8, 0xf8, 0xf9, 0xd1, 0xa1, 0xda, 0xde, 0xc3, 0xc5, 0xc7,
-    0xd8, 0xa1, 0x81, 0x94, 0xf8, 0x18, 0xf2, 0xb0, 0x89, 0xac, 0xc3, 0xc5, 0xc7, 0xf1, 0xd8, 0xb8,
-    /* bank # 9 */
-    0xb4, 0xb0, 0x97, 0x86, 0xa8, 0x31, 0x9b, 0x06, 0x99, 0x07, 0xab, 0x97, 0x28, 0x88, 0x9b, 0xf0,
-    0x0c, 0x20, 0x14, 0x40, 0xb0, 0xb4, 0xb8, 0xf0, 0xa8, 0x8a, 0x9a, 0x28, 0x50, 0x78, 0xb7, 0x9b,
-    0xa8, 0x29, 0x51, 0x79, 0x24, 0x70, 0x59, 0x44, 0x69, 0x38, 0x64, 0x48, 0x31, 0xf1, 0xbb, 0xab,
-    0x88, 0x00, 0x2c, 0x54, 0x7c, 0xf0, 0xb3, 0x8b, 0xb8, 0xa8, 0x04, 0x28, 0x50, 0x78, 0xf1, 0xb0,
-    0x88, 0xb4, 0x97, 0x26, 0xa8, 0x59, 0x98, 0xbb, 0xab, 0xb3, 0x8b, 0x02, 0x26, 0x46, 0x66, 0xb0,
-    0xb8, 0xf0, 0x8a, 0x9c, 0xa8, 0x29, 0x51, 0x79, 0x8b, 0x29, 0x51, 0x79, 0x8a, 0x24, 0x70, 0x59,
-    0x8b, 0x20, 0x58, 0x71, 0x8a, 0x44, 0x69, 0x38, 0x8b, 0x39, 0x40, 0x68, 0x8a, 0x64, 0x48, 0x31,
-    0x8b, 0x30, 0x49, 0x60, 0x88, 0xf1, 0xac, 0x00, 0x2c, 0x54, 0x7c, 0xf0, 0x8c, 0xa8, 0x04, 0x28,
-    0x50, 0x78, 0xf1, 0x88, 0x97, 0x26, 0xa8, 0x59, 0x98, 0xac, 0x8c, 0x02, 0x26, 0x46, 0x66, 0xf0,
-    0x89, 0x9c, 0xa8, 0x29, 0x51, 0x79, 0x24, 0x70, 0x59, 0x44, 0x69, 0x38, 0x64, 0x48, 0x31, 0xa9,
-    0x88, 0x09, 0x20, 0x59, 0x70, 0xab, 0x11, 0x38, 0x40, 0x69, 0xa8, 0x19, 0x31, 0x48, 0x60, 0x8c,
-    0xa8, 0x3c, 0x41, 0x5c, 0x20, 0x7c, 0x00, 0xf1, 0x87, 0x98, 0x19, 0x86, 0xa8, 0x6e, 0x76, 0x7e,
-    0xa9, 0x99, 0x88, 0x2d, 0x55, 0x7d, 0xd8, 0xb1, 0xb5, 0xb9, 0xa3, 0xdf, 0xdf, 0xdf, 0xae, 0xd0,
-    0xdf, 0xaa, 0xd0, 0xde, 0xf2, 0xab, 0xf8, 0xf9, 0xd9, 0xb0, 0x87, 0xc4, 0xaa, 0xf1, 0xdf, 0xdf,
-    0xbb, 0xaf, 0xdf, 0xdf, 0xb9, 0xd8, 0xb1, 0xf1, 0xa3, 0x97, 0x8e, 0x60, 0xdf, 0xb0, 0x84, 0xf2,
-    0xc8, 0xf8, 0xf9, 0xd9, 0xde, 0xd8, 0x93, 0x85, 0xf1, 0x4a, 0xb1, 0x83, 0xa3, 0x08, 0xb5, 0x83,
-    /* bank # 10 */
-    0x9a, 0x08, 0x10, 0xb7, 0x9f, 0x10, 0xd8, 0xf1, 0xb0, 0xba, 0xae, 0xb0, 0x8a, 0xc2, 0xb2, 0xb6,
-    0x8e, 0x9e, 0xf1, 0xfb, 0xd9, 0xf4, 0x1d, 0xd8, 0xf9, 0xd9, 0x0c, 0xf1, 0xd8, 0xf8, 0xf8, 0xad,
-    0x61, 0xd9, 0xae, 0xfb, 0xd8, 0xf4, 0x0c, 0xf1, 0xd8, 0xf8, 0xf8, 0xad, 0x19, 0xd9, 0xae, 0xfb,
-    0xdf, 0xd8, 0xf4, 0x16, 0xf1, 0xd8, 0xf8, 0xad, 0x8d, 0x61, 0xd9, 0xf4, 0xf4, 0xac, 0xf5, 0x9c,
-    0x9c, 0x8d, 0xdf, 0x2b, 0xba, 0xb6, 0xae, 0xfa, 0xf8, 0xf4, 0x0b, 0xd8, 0xf1, 0xae, 0xd0, 0xf8,
-    0xad, 0x51, 0xda, 0xae, 0xfa, 0xf8, 0xf1, 0xd8, 0xb9, 0xb1, 0xb6, 0xa3, 0x83, 0x9c, 0x08, 0xb9,
-    0xb1, 0x83, 0x9a, 0xb5, 0xaa, 0xc0, 0xfd, 0x30, 0x83, 0xb7, 0x9f, 0x10, 0xb5, 0x8b, 0x93, 0xf2,
-    0x02, 0x02, 0xd1, 0xab, 0xda, 0xde, 0xd8, 0xf1, 0xb0, 0x80, 0xba, 0xab, 0xc0, 0xc3, 0xb2, 0x84,
-    0xc1, 0xc3, 0xd8, 0xb1, 0xb9, 0xf3, 0x8b, 0xa3, 0x91, 0xb6, 0x09, 0xb4, 0xd9, 0xab, 0xde, 0xb0,
-    0x87, 0x9c, 0xb9, 0xa3, 0xdd, 0xf1, 0xb3, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0xb0, 0x87, 0xa3, 0xa3,
-    0xa3, 0xa3, 0xb2, 0x8b, 0xb6, 0x9b, 0xf2, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3,
-    0xa3, 0xf1, 0xb0, 0x87, 0xb5, 0x9a, 0xa3, 0xf3, 0x9b, 0xa3, 0xa3, 0xdc, 0xba, 0xac, 0xdf, 0xb9,
-    0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3,
-    0xd8, 0xd8, 0xd8, 0xbb, 0xb3, 0xb7, 0xf1, 0xaa, 0xf9, 0xda, 0xff, 0xd9, 0x80, 0x9a, 0xaa, 0x28,
-    0xb4, 0x80, 0x98, 0xa7, 0x20, 0xb7, 0x97, 0x87, 0xa8, 0x66, 0x88, 0xf0, 0x79, 0x51, 0xf1, 0x90,
-    0x2c, 0x87, 0x0c, 0xa7, 0x81, 0x97, 0x62, 0x93, 0xf0, 0x71, 0x71, 0x60, 0x85, 0x94, 0x01, 0x29,
-    /* bank # 11 */
-    0x51, 0x79, 0x90, 0xa5, 0xf1, 0x28, 0x4c, 0x6c, 0x87, 0x0c, 0x95, 0x18, 0x85, 0x78, 0xa3, 0x83,
-    0x90, 0x28, 0x4c, 0x6c, 0x88, 0x6c, 0xd8, 0xf3, 0xa2, 0x82, 0x00, 0xf2, 0x10, 0xa8, 0x92, 0x19,
-    0x80, 0xa2, 0xf2, 0xd9, 0x26, 0xd8, 0xf1, 0x88, 0xa8, 0x4d, 0xd9, 0x48, 0xd8, 0x96, 0xa8, 0x39,
-    0x80, 0xd9, 0x3c, 0xd8, 0x95, 0x80, 0xa8, 0x39, 0xa6, 0x86, 0x98, 0xd9, 0x2c, 0xda, 0x87, 0xa7,
-    0x2c, 0xd8, 0xa8, 0x89, 0x95, 0x19, 0xa9, 0x80, 0xd9, 0x38, 0xd8, 0xa8, 0x89, 0x39, 0xa9, 0x80,
-    0xda, 0x3c, 0xd8, 0xa8, 0x2e, 0xa8, 0x39, 0x90, 0xd9, 0x0c, 0xd8, 0xa8, 0x95, 0x31, 0x98, 0xd9,
-    0x0c, 0xd8, 0xa8, 0x09, 0xd9, 0xff, 0xd8, 0x01, 0xda, 0xff, 0xd8, 0x95, 0x39, 0xa9, 0xda, 0x26,
-    0xff, 0xd8, 0x90, 0xa8, 0x0d, 0x89, 0x99, 0xa8, 0x10, 0x80, 0x98, 0x21, 0xda, 0x2e, 0xd8, 0x89,
-    0x99, 0xa8, 0x31, 0x80, 0xda, 0x2e, 0xd8, 0xa8, 0x86, 0x96, 0x31, 0x80, 0xda, 0x2e, 0xd8, 0xa8,
-    0x87, 0x31, 0x80, 0xda, 0x2e, 0xd8, 0xa8, 0x82, 0x92, 0xf3, 0x41, 0x80, 0xf1, 0xd9, 0x2e, 0xd8,
-    0xa8, 0x82, 0xf3, 0x19, 0x80, 0xf1, 0xd9, 0x2e, 0xd8, 0x82, 0xac, 0xf3, 0xc0, 0xa2, 0x80, 0x22,
-    0xf1, 0xa6, 0x2e, 0xa7, 0x2e, 0xa9, 0x22, 0x98, 0xa8, 0x29, 0xda, 0xac, 0xde, 0xff, 0xd8, 0xa2,
-    0xf2, 0x2a, 0xf1, 0xa9, 0x2e, 0x82, 0x92, 0xa8, 0xf2, 0x31, 0x80, 0xa6, 0x96, 0xf1, 0xd9, 0x00,
-    0xac, 0x8c, 0x9c, 0x0c, 0x30, 0xac, 0xde, 0xd0, 0xde, 0xff, 0xd8, 0x8c, 0x9c, 0xac, 0xd0, 0x10,
-    0xac, 0xde, 0x80, 0x92, 0xa2, 0xf2, 0x4c, 0x82, 0xa8, 0xf1, 0xca, 0xf2, 0x35, 0xf1, 0x96, 0x88,
-    0xa6, 0xd9, 0x00, 0xd8, 0xf1, 0xff
-};
-
-static const unsigned short sStartAddress = 0x0400;
-
-/* END OF SECTION COPIED FROM dmpDefaultMPU6050.c */
-
-#define INT_SRC_TAP             (0x01)
-#define INT_SRC_ANDROID_ORIENT  (0x08)
-
-#define DMP_FEATURE_SEND_ANY_GYRO   (DMP_FEATURE_SEND_RAW_GYRO | \
-                                     DMP_FEATURE_SEND_CAL_GYRO)
-
-#define MAX_PACKET_LENGTH   (32)
-
-#define DMP_SAMPLE_RATE     (200)
-#define GYRO_SF             (46850825LL * 200 / DMP_SAMPLE_RATE)
-
-#define FIFO_CORRUPTION_CHECK
-#ifdef FIFO_CORRUPTION_CHECK
-#define QUAT_ERROR_THRESH       (1L<<24)
-#define QUAT_MAG_SQ_NORMALIZED  (1L<<28)
-#define QUAT_MAG_SQ_MIN         (QUAT_MAG_SQ_NORMALIZED - QUAT_ERROR_THRESH)
-#define QUAT_MAG_SQ_MAX         (QUAT_MAG_SQ_NORMALIZED + QUAT_ERROR_THRESH)
-#endif
-
-struct dmp_s {
-    void (*tap_cb)(unsigned char count, unsigned char direction);
-    void (*android_orient_cb)(unsigned char orientation);
-    unsigned short orient;
-    unsigned short feature_mask;
-    unsigned short fifo_rate;
-    unsigned char packet_length;
-};
-
-static struct dmp_s dmp = {
-    .tap_cb = NULL,
-    .android_orient_cb = NULL,
-    .orient = 0,
-    .feature_mask = 0,
-    .fifo_rate = 0,
-    .packet_length = 0
-};
-
-/**
- *  @brief  Load the DMP with this image.
- *  @return 0 if successful.
- */
-int dmp_load_motion_driver_firmware(void)
-{
-    return mpu_load_firmware(DMP_CODE_SIZE, dmp_memory, sStartAddress,
-        DMP_SAMPLE_RATE);
-}
-
-/**
- *  @brief      Push gyro and accel orientation to the DMP.
- *  The orientation is represented here as the output of
- *  @e inv_orientation_matrix_to_scalar.
- *  @param[in]  orient  Gyro and accel orientation in body frame.
- *  @return     0 if successful.
- */
-int dmp_set_orientation(unsigned short orient)
-{
-    unsigned char gyro_regs[3], accel_regs[3];
-    const unsigned char gyro_axes[3] = {DINA4C, DINACD, DINA6C};
-    const unsigned char accel_axes[3] = {DINA0C, DINAC9, DINA2C};
-    const unsigned char gyro_sign[3] = {DINA36, DINA56, DINA76};
-    const unsigned char accel_sign[3] = {DINA26, DINA46, DINA66};
-
-    gyro_regs[0] = gyro_axes[orient & 3];
-    gyro_regs[1] = gyro_axes[(orient >> 3) & 3];
-    gyro_regs[2] = gyro_axes[(orient >> 6) & 3];
-    accel_regs[0] = accel_axes[orient & 3];
-    accel_regs[1] = accel_axes[(orient >> 3) & 3];
-    accel_regs[2] = accel_axes[(orient >> 6) & 3];
-
-    /* Chip-to-body, axes only. */
-    if (mpu_write_mem(FCFG_1, 3, gyro_regs))
-        return -1;
-    if (mpu_write_mem(FCFG_2, 3, accel_regs))
-        return -1;
-
-    memcpy(gyro_regs, gyro_sign, 3);
-    memcpy(accel_regs, accel_sign, 3);
-    if (orient & 4) {
-        gyro_regs[0] |= 1;
-        accel_regs[0] |= 1;
-    }
-    if (orient & 0x20) {
-        gyro_regs[1] |= 1;
-        accel_regs[1] |= 1;
-    }
-    if (orient & 0x100) {
-        gyro_regs[2] |= 1;
-        accel_regs[2] |= 1;
-    }
-
-    /* Chip-to-body, sign only. */
-    if (mpu_write_mem(FCFG_3, 3, gyro_regs))
-        return -1;
-    if (mpu_write_mem(FCFG_7, 3, accel_regs))
-        return -1;
-    dmp.orient = orient;
-    return 0;
-}
-
-/**
- *  @brief      Push gyro biases to the DMP.
- *  Because the gyro integration is handled in the DMP, any gyro biases
- *  calculated by the MPL should be pushed down to DMP memory to remove
- *  3-axis quaternion drift.
- *  \n NOTE: If the DMP-based gyro calibration is enabled, the DMP will
- *  overwrite the biases written to this location once a new one is computed.
- *  @param[in]  bias    Gyro biases in q16.
- *  @return     0 if successful.
- */
-int dmp_set_gyro_bias(long *bias)
-{
-    long gyro_bias_body[3];
-    unsigned char regs[4];
-
-    gyro_bias_body[0] = bias[dmp.orient & 3];
-    if (dmp.orient & 4)
-        gyro_bias_body[0] *= -1;
-    gyro_bias_body[1] = bias[(dmp.orient >> 3) & 3];
-    if (dmp.orient & 0x20)
-        gyro_bias_body[1] *= -1;
-    gyro_bias_body[2] = bias[(dmp.orient >> 6) & 3];
-    if (dmp.orient & 0x100)
-        gyro_bias_body[2] *= -1;
-
-#ifdef EMPL_NO_64BIT
-    gyro_bias_body[0] = (long)(((float)gyro_bias_body[0] * GYRO_SF) / 1073741824.f);
-    gyro_bias_body[1] = (long)(((float)gyro_bias_body[1] * GYRO_SF) / 1073741824.f);
-    gyro_bias_body[2] = (long)(((float)gyro_bias_body[2] * GYRO_SF) / 1073741824.f);
-#else
-    gyro_bias_body[0] = (long)(((long long)gyro_bias_body[0] * GYRO_SF) >> 30);
-    gyro_bias_body[1] = (long)(((long long)gyro_bias_body[1] * GYRO_SF) >> 30);
-    gyro_bias_body[2] = (long)(((long long)gyro_bias_body[2] * GYRO_SF) >> 30);
-#endif
-
-    regs[0] = (unsigned char)((gyro_bias_body[0] >> 24) & 0xFF);
-    regs[1] = (unsigned char)((gyro_bias_body[0] >> 16) & 0xFF);
-    regs[2] = (unsigned char)((gyro_bias_body[0] >> 8) & 0xFF);
-    regs[3] = (unsigned char)(gyro_bias_body[0] & 0xFF);
-    if (mpu_write_mem(D_EXT_GYRO_BIAS_X, 4, regs))
-        return -1;
-
-    regs[0] = (unsigned char)((gyro_bias_body[1] >> 24) & 0xFF);
-    regs[1] = (unsigned char)((gyro_bias_body[1] >> 16) & 0xFF);
-    regs[2] = (unsigned char)((gyro_bias_body[1] >> 8) & 0xFF);
-    regs[3] = (unsigned char)(gyro_bias_body[1] & 0xFF);
-    if (mpu_write_mem(D_EXT_GYRO_BIAS_Y, 4, regs))
-        return -1;
-
-    regs[0] = (unsigned char)((gyro_bias_body[2] >> 24) & 0xFF);
-    regs[1] = (unsigned char)((gyro_bias_body[2] >> 16) & 0xFF);
-    regs[2] = (unsigned char)((gyro_bias_body[2] >> 8) & 0xFF);
-    regs[3] = (unsigned char)(gyro_bias_body[2] & 0xFF);
-    return mpu_write_mem(D_EXT_GYRO_BIAS_Z, 4, regs);
-}
-
-/**
- *  @brief      Push accel biases to the DMP.
- *  These biases will be removed from the DMP 6-axis quaternion.
- *  @param[in]  bias    Accel biases in q16.
- *  @return     0 if successful.
- */
-int dmp_set_accel_bias(long *bias)
-{
-    long accel_bias_body[3];
-    unsigned char regs[12];
-    long long accel_sf;
-    unsigned short accel_sens;
-
-    mpu_get_accel_sens(&accel_sens);
-    accel_sf = (long long)accel_sens << 15;
-//    __no_operation();
-    __NOP();
-
-    accel_bias_body[0] = bias[dmp.orient & 3];
-    if (dmp.orient & 4)
-        accel_bias_body[0] *= -1;
-    accel_bias_body[1] = bias[(dmp.orient >> 3) & 3];
-    if (dmp.orient & 0x20)
-        accel_bias_body[1] *= -1;
-    accel_bias_body[2] = bias[(dmp.orient >> 6) & 3];
-    if (dmp.orient & 0x100)
-        accel_bias_body[2] *= -1;
-
-#ifdef EMPL_NO_64BIT
-    accel_bias_body[0] = (long)(((float)accel_bias_body[0] * accel_sf) / 1073741824.f);
-    accel_bias_body[1] = (long)(((float)accel_bias_body[1] * accel_sf) / 1073741824.f);
-    accel_bias_body[2] = (long)(((float)accel_bias_body[2] * accel_sf) / 1073741824.f);
-#else
-    accel_bias_body[0] = (long)(((long long)accel_bias_body[0] * accel_sf) >> 30);
-    accel_bias_body[1] = (long)(((long long)accel_bias_body[1] * accel_sf) >> 30);
-    accel_bias_body[2] = (long)(((long long)accel_bias_body[2] * accel_sf) >> 30);
-#endif
-
-    regs[0] = (unsigned char)((accel_bias_body[0] >> 24) & 0xFF);
-    regs[1] = (unsigned char)((accel_bias_body[0] >> 16) & 0xFF);
-    regs[2] = (unsigned char)((accel_bias_body[0] >> 8) & 0xFF);
-    regs[3] = (unsigned char)(accel_bias_body[0] & 0xFF);
-    regs[4] = (unsigned char)((accel_bias_body[1] >> 24) & 0xFF);
-    regs[5] = (unsigned char)((accel_bias_body[1] >> 16) & 0xFF);
-    regs[6] = (unsigned char)((accel_bias_body[1] >> 8) & 0xFF);
-    regs[7] = (unsigned char)(accel_bias_body[1] & 0xFF);
-    regs[8] = (unsigned char)((accel_bias_body[2] >> 24) & 0xFF);
-    regs[9] = (unsigned char)((accel_bias_body[2] >> 16) & 0xFF);
-    regs[10] = (unsigned char)((accel_bias_body[2] >> 8) & 0xFF);
-    regs[11] = (unsigned char)(accel_bias_body[2] & 0xFF);
-    return mpu_write_mem(D_ACCEL_BIAS, 12, regs);
-}
-
-/**
- *  @brief      Set DMP output rate.
- *  Only used when DMP is on.
- *  @param[in]  rate    Desired fifo rate (Hz).
- *  @return     0 if successful.
- */
-int dmp_set_fifo_rate(unsigned short rate)
-{
-    const unsigned char regs_end[12] = {DINAFE, DINAF2, DINAAB,
-        0xc4, DINAAA, DINAF1, DINADF, DINADF, 0xBB, 0xAF, DINADF, DINADF};
-    unsigned short div;
-    unsigned char tmp[8];
-
-    if (rate > DMP_SAMPLE_RATE)
-        return -1;
-    div = DMP_SAMPLE_RATE / rate - 1;
-    tmp[0] = (unsigned char)((div >> 8) & 0xFF);
-    tmp[1] = (unsigned char)(div & 0xFF);
-    if (mpu_write_mem(D_0_22, 2, tmp))
-        return -1;
-    if (mpu_write_mem(CFG_6, 12, (unsigned char*)regs_end))
-        return -1;
-
-    dmp.fifo_rate = rate;
-    return 0;
-}
-
-/**
- *  @brief      Get DMP output rate.
- *  @param[out] rate    Current fifo rate (Hz).
- *  @return     0 if successful.
- */
-int dmp_get_fifo_rate(unsigned short *rate)
-{
-    rate[0] = dmp.fifo_rate;
-    return 0;
-}
-
-/**
- *  @brief      Set tap threshold for a specific axis.
- *  @param[in]  axis    1, 2, and 4 for XYZ accel, respectively.
- *  @param[in]  thresh  Tap threshold, in mg/ms.
- *  @return     0 if successful.
- */
-int dmp_set_tap_thresh(unsigned char axis, unsigned short thresh)
-{
-    unsigned char tmp[4], accel_fsr;
-    float scaled_thresh;
-    unsigned short dmp_thresh, dmp_thresh_2;
-    if (!(axis & TAP_XYZ) || thresh > 1600)
-        return -1;
-
-    scaled_thresh = (float)thresh / DMP_SAMPLE_RATE;
-
-    mpu_get_accel_fsr(&accel_fsr);
-    switch (accel_fsr) {
-    case 2:
-        dmp_thresh = (unsigned short)(scaled_thresh * 16384);
-        /* dmp_thresh * 0.75 */
-        dmp_thresh_2 = (unsigned short)(scaled_thresh * 12288);
-        break;
-    case 4:
-        dmp_thresh = (unsigned short)(scaled_thresh * 8192);
-        /* dmp_thresh * 0.75 */
-        dmp_thresh_2 = (unsigned short)(scaled_thresh * 6144);
-        break;
-    case 8:
-        dmp_thresh = (unsigned short)(scaled_thresh * 4096);
-        /* dmp_thresh * 0.75 */
-        dmp_thresh_2 = (unsigned short)(scaled_thresh * 3072);
-        break;
-    case 16:
-        dmp_thresh = (unsigned short)(scaled_thresh * 2048);
-        /* dmp_thresh * 0.75 */
-        dmp_thresh_2 = (unsigned short)(scaled_thresh * 1536);
-        break;
-    default:
-        return -1;
-    }
-    tmp[0] = (unsigned char)(dmp_thresh >> 8);
-    tmp[1] = (unsigned char)(dmp_thresh & 0xFF);
-    tmp[2] = (unsigned char)(dmp_thresh_2 >> 8);
-    tmp[3] = (unsigned char)(dmp_thresh_2 & 0xFF);
-
-    if (axis & TAP_X) {
-        if (mpu_write_mem(DMP_TAP_THX, 2, tmp))
-            return -1;
-        if (mpu_write_mem(D_1_36, 2, tmp+2))
-            return -1;
-    }
-    if (axis & TAP_Y) {
-        if (mpu_write_mem(DMP_TAP_THY, 2, tmp))
-            return -1;
-        if (mpu_write_mem(D_1_40, 2, tmp+2))
-            return -1;
-    }
-    if (axis & TAP_Z) {
-        if (mpu_write_mem(DMP_TAP_THZ, 2, tmp))
-            return -1;
-        if (mpu_write_mem(D_1_44, 2, tmp+2))
-            return -1;
-    }
-    return 0;
-}
-
-/**
- *  @brief      Set which axes will register a tap.
- *  @param[in]  axis    1, 2, and 4 for XYZ, respectively.
- *  @return     0 if successful.
- */
-int dmp_set_tap_axes(unsigned char axis)
-{
-    unsigned char tmp = 0;
-
-    if (axis & TAP_X)
-        tmp |= 0x30;
-    if (axis & TAP_Y)
-        tmp |= 0x0C;
-    if (axis & TAP_Z)
-        tmp |= 0x03;
-    return mpu_write_mem(D_1_72, 1, &tmp);
-}
-
-/**
- *  @brief      Set minimum number of taps needed for an interrupt.
- *  @param[in]  min_taps    Minimum consecutive taps (1-4).
- *  @return     0 if successful.
- */
-int dmp_set_tap_count(unsigned char min_taps)
-{
-    unsigned char tmp;
-
-    if (min_taps < 1)
-        min_taps = 1;
-    else if (min_taps > 4)
-        min_taps = 4;
-
-    tmp = min_taps - 1;
-    return mpu_write_mem(D_1_79, 1, &tmp);
-}
-
-/**
- *  @brief      Set length between valid taps.
- *  @param[in]  time    Milliseconds between taps.
- *  @return     0 if successful.
- */
-int dmp_set_tap_time(unsigned short time)
-{
-    unsigned short dmp_time;
-    unsigned char tmp[2];
-
-    dmp_time = time / (1000 / DMP_SAMPLE_RATE);
-    tmp[0] = (unsigned char)(dmp_time >> 8);
-    tmp[1] = (unsigned char)(dmp_time & 0xFF);
-    return mpu_write_mem(DMP_TAPW_MIN, 2, tmp);
-}
-
-/**
- *  @brief      Set max time between taps to register as a multi-tap.
- *  @param[in]  time    Max milliseconds between taps.
- *  @return     0 if successful.
- */
-int dmp_set_tap_time_multi(unsigned short time)
-{
-    unsigned short dmp_time;
-    unsigned char tmp[2];
-
-    dmp_time = time / (1000 / DMP_SAMPLE_RATE);
-    tmp[0] = (unsigned char)(dmp_time >> 8);
-    tmp[1] = (unsigned char)(dmp_time & 0xFF);
-    return mpu_write_mem(D_1_218, 2, tmp);
-}
-
-/**
- *  @brief      Set shake rejection threshold.
- *  If the DMP detects a gyro sample larger than @e thresh, taps are rejected.
- *  @param[in]  sf      Gyro scale factor.
- *  @param[in]  thresh  Gyro threshold in dps.
- *  @return     0 if successful.
- */
-int dmp_set_shake_reject_thresh(long sf, unsigned short thresh)
-{
-    unsigned char tmp[4];
-    long thresh_scaled = sf / 1000 * thresh;
-    tmp[0] = (unsigned char)(((long)thresh_scaled >> 24) & 0xFF);
-    tmp[1] = (unsigned char)(((long)thresh_scaled >> 16) & 0xFF);
-    tmp[2] = (unsigned char)(((long)thresh_scaled >> 8) & 0xFF);
-    tmp[3] = (unsigned char)((long)thresh_scaled & 0xFF);
-    return mpu_write_mem(D_1_92, 4, tmp);
-}
-
-/**
- *  @brief      Set shake rejection time.
- *  Sets the length of time that the gyro must be outside of the threshold set
- *  by @e gyro_set_shake_reject_thresh before taps are rejected. A mandatory
- *  60 ms is added to this parameter.
- *  @param[in]  time    Time in milliseconds.
- *  @return     0 if successful.
- */
-int dmp_set_shake_reject_time(unsigned short time)
-{
-    unsigned char tmp[2];
-
-    time /= (1000 / DMP_SAMPLE_RATE);
-    tmp[0] = time >> 8;
-    tmp[1] = time & 0xFF;
-    return mpu_write_mem(D_1_90,2,tmp);
-}
-
-/**
- *  @brief      Set shake rejection timeout.
- *  Sets the length of time after a shake rejection that the gyro must stay
- *  inside of the threshold before taps can be detected again. A mandatory
- *  60 ms is added to this parameter.
- *  @param[in]  time    Time in milliseconds.
- *  @return     0 if successful.
- */
-int dmp_set_shake_reject_timeout(unsigned short time)
-{
-    unsigned char tmp[2];
-
-    time /= (1000 / DMP_SAMPLE_RATE);
-    tmp[0] = time >> 8;
-    tmp[1] = time & 0xFF;
-    return mpu_write_mem(D_1_88,2,tmp);
-}
-
-/**
- *  @brief      Get current step count.
- *  @param[out] count   Number of steps detected.
- *  @return     0 if successful.
- */
-int dmp_get_pedometer_step_count(unsigned long *count)
-{
-    unsigned char tmp[4];
-    if (!count)
-        return -1;
-
-    if (mpu_read_mem(D_PEDSTD_STEPCTR, 4, tmp))
-        return -1;
-
-    count[0] = ((unsigned long)tmp[0] << 24) | ((unsigned long)tmp[1] << 16) |
-        ((unsigned long)tmp[2] << 8) | tmp[3];
-    return 0;
-}
-
-/**
- *  @brief      Overwrite current step count.
- *  WARNING: This function writes to DMP memory and could potentially encounter
- *  a race condition if called while the pedometer is enabled.
- *  @param[in]  count   New step count.
- *  @return     0 if successful.
- */
-int dmp_set_pedometer_step_count(unsigned long count)
-{
-    unsigned char tmp[4];
-
-    tmp[0] = (unsigned char)((count >> 24) & 0xFF);
-    tmp[1] = (unsigned char)((count >> 16) & 0xFF);
-    tmp[2] = (unsigned char)((count >> 8) & 0xFF);
-    tmp[3] = (unsigned char)(count & 0xFF);
-    return mpu_write_mem(D_PEDSTD_STEPCTR, 4, tmp);
-}
-
-/**
- *  @brief      Get duration of walking time.
- *  @param[in]  time    Walk time in milliseconds.
- *  @return     0 if successful.
- */
-int dmp_get_pedometer_walk_time(unsigned long *time)
-{
-    unsigned char tmp[4];
-    if (!time)
-        return -1;
-
-    if (mpu_read_mem(D_PEDSTD_TIMECTR, 4, tmp))
-        return -1;
-
-    time[0] = (((unsigned long)tmp[0] << 24) | ((unsigned long)tmp[1] << 16) |
-        ((unsigned long)tmp[2] << 8) | tmp[3]) * 20;
-    return 0;
-}
-
-/**
- *  @brief      Overwrite current walk time.
- *  WARNING: This function writes to DMP memory and could potentially encounter
- *  a race condition if called while the pedometer is enabled.
- *  @param[in]  time    New walk time in milliseconds.
- */
-int dmp_set_pedometer_walk_time(unsigned long time)
-{
-    unsigned char tmp[4];
-
-    time /= 20;
-
-    tmp[0] = (unsigned char)((time >> 24) & 0xFF);
-    tmp[1] = (unsigned char)((time >> 16) & 0xFF);
-    tmp[2] = (unsigned char)((time >> 8) & 0xFF);
-    tmp[3] = (unsigned char)(time & 0xFF);
-    return mpu_write_mem(D_PEDSTD_TIMECTR, 4, tmp);
-}
-
-/**
- *  @brief      Enable DMP features.
- *  The following \#define's are used in the input mask:
- *  \n DMP_FEATURE_TAP
- *  \n DMP_FEATURE_ANDROID_ORIENT
- *  \n DMP_FEATURE_LP_QUAT
- *  \n DMP_FEATURE_6X_LP_QUAT
- *  \n DMP_FEATURE_GYRO_CAL
- *  \n DMP_FEATURE_SEND_RAW_ACCEL
- *  \n DMP_FEATURE_SEND_RAW_GYRO
- *  \n NOTE: DMP_FEATURE_LP_QUAT and DMP_FEATURE_6X_LP_QUAT are mutually
- *  exclusive.
- *  \n NOTE: DMP_FEATURE_SEND_RAW_GYRO and DMP_FEATURE_SEND_CAL_GYRO are also
- *  mutually exclusive.
- *  @param[in]  mask    Mask of features to enable.
- *  @return     0 if successful.
- */
-int dmp_enable_feature(unsigned short mask)
-{
-    unsigned char tmp[10];
-
-    /* TODO: All of these settings can probably be integrated into the default
-     * DMP image.
-     */
-    /* Set integration scale factor. */
-    tmp[0] = (unsigned char)((GYRO_SF >> 24) & 0xFF);
-    tmp[1] = (unsigned char)((GYRO_SF >> 16) & 0xFF);
-    tmp[2] = (unsigned char)((GYRO_SF >> 8) & 0xFF);
-    tmp[3] = (unsigned char)(GYRO_SF & 0xFF);
-    mpu_write_mem(D_0_104, 4, tmp);
-
-    /* Send sensor data to the FIFO. */
-    tmp[0] = 0xA3;
-    if (mask & DMP_FEATURE_SEND_RAW_ACCEL) {
-        tmp[1] = 0xC0;
-        tmp[2] = 0xC8;
-        tmp[3] = 0xC2;
-    } else {
-        tmp[1] = 0xA3;
-        tmp[2] = 0xA3;
-        tmp[3] = 0xA3;
-    }
-    if (mask & DMP_FEATURE_SEND_ANY_GYRO) {
-        tmp[4] = 0xC4;
-        tmp[5] = 0xCC;
-        tmp[6] = 0xC6;
-    } else {
-        tmp[4] = 0xA3;
-        tmp[5] = 0xA3;
-        tmp[6] = 0xA3;
-    }
-    tmp[7] = 0xA3;
-    tmp[8] = 0xA3;
-    tmp[9] = 0xA3;
-    mpu_write_mem(CFG_15,10,tmp);
-
-    /* Send gesture data to the FIFO. */
-    if (mask & (DMP_FEATURE_TAP | DMP_FEATURE_ANDROID_ORIENT))
-        tmp[0] = DINA20;
-    else
-        tmp[0] = 0xD8;
-    mpu_write_mem(CFG_27,1,tmp);
-
-    if (mask & DMP_FEATURE_GYRO_CAL)
-        dmp_enable_gyro_cal(1);
-    else
-        dmp_enable_gyro_cal(0);
-
-    if (mask & DMP_FEATURE_SEND_ANY_GYRO) {
-        if (mask & DMP_FEATURE_SEND_CAL_GYRO) {
-            tmp[0] = 0xB2;
-            tmp[1] = 0x8B;
-            tmp[2] = 0xB6;
-            tmp[3] = 0x9B;
-        } else {
-            tmp[0] = DINAC0;
-            tmp[1] = DINA80;
-            tmp[2] = DINAC2;
-            tmp[3] = DINA90;
-        }
-        mpu_write_mem(CFG_GYRO_RAW_DATA, 4, tmp);
-    }
-
-    if (mask & DMP_FEATURE_TAP) {
-        /* Enable tap. */
-        tmp[0] = 0xF8;
-        mpu_write_mem(CFG_20, 1, tmp);
-        dmp_set_tap_thresh(TAP_XYZ, 250);
-        dmp_set_tap_axes(TAP_XYZ);
-        dmp_set_tap_count(1);
-        dmp_set_tap_time(100);
-        dmp_set_tap_time_multi(500);
-
-        dmp_set_shake_reject_thresh(GYRO_SF, 200);
-        dmp_set_shake_reject_time(40);
-        dmp_set_shake_reject_timeout(10);
-    } else {
-        tmp[0] = 0xD8;
-        mpu_write_mem(CFG_20, 1, tmp);
-    }
-
-    if (mask & DMP_FEATURE_ANDROID_ORIENT) {
-        tmp[0] = 0xD9;
-    } else
-        tmp[0] = 0xD8;
-    mpu_write_mem(CFG_ANDROID_ORIENT_INT, 1, tmp);
-
-    if (mask & DMP_FEATURE_LP_QUAT)
-        dmp_enable_lp_quat(1);
-    else
-        dmp_enable_lp_quat(0);
-
-    if (mask & DMP_FEATURE_6X_LP_QUAT)
-        dmp_enable_6x_lp_quat(1);
-    else
-        dmp_enable_6x_lp_quat(0);
-
-    /* Pedometer is always enabled. */
-    dmp.feature_mask = mask | DMP_FEATURE_PEDOMETER;
-    mpu_reset_fifo();
-
-    dmp.packet_length = 0;
-    if (mask & DMP_FEATURE_SEND_RAW_ACCEL)
-        dmp.packet_length += 6;
-    if (mask & DMP_FEATURE_SEND_ANY_GYRO)
-        dmp.packet_length += 6;
-    if (mask & (DMP_FEATURE_LP_QUAT | DMP_FEATURE_6X_LP_QUAT))
-        dmp.packet_length += 16;
-    if (mask & (DMP_FEATURE_TAP | DMP_FEATURE_ANDROID_ORIENT))
-        dmp.packet_length += 4;
-
-    return 0;
-}
-
-/**
- *  @brief      Get list of currently enabled DMP features.
- *  @param[out] Mask of enabled features.
- *  @return     0 if successful.
- */
-int dmp_get_enabled_features(unsigned short *mask)
-{
-    mask[0] = dmp.feature_mask;
-    return 0;
-}
-
-/**
- *  @brief      Calibrate the gyro data in the DMP.
- *  After eight seconds of no motion, the DMP will compute gyro biases and
- *  subtract them from the quaternion output. If @e dmp_enable_feature is
- *  called with @e DMP_FEATURE_SEND_CAL_GYRO, the biases will also be
- *  subtracted from the gyro output.
- *  @param[in]  enable  1 to enable gyro calibration.
- *  @return     0 if successful.
- */
-int dmp_enable_gyro_cal(unsigned char enable)
-{
-    if (enable) {
-        unsigned char regs[9] = {0xb8, 0xaa, 0xb3, 0x8d, 0xb4, 0x98, 0x0d, 0x35, 0x5d};
-        return mpu_write_mem(CFG_MOTION_BIAS, 9, regs);
-    } else {
-        unsigned char regs[9] = {0xb8, 0xaa, 0xaa, 0xaa, 0xb0, 0x88, 0xc3, 0xc5, 0xc7};
-        return mpu_write_mem(CFG_MOTION_BIAS, 9, regs);
-    }
-}
-
-/**
- *  @brief      Generate 3-axis quaternions from the DMP.
- *  In this driver, the 3-axis and 6-axis DMP quaternion features are mutually
- *  exclusive.
- *  @param[in]  enable  1 to enable 3-axis quaternion.
- *  @return     0 if successful.
- */
-int dmp_enable_lp_quat(unsigned char enable)
-{
-    unsigned char regs[4];
-    if (enable) {
-        regs[0] = DINBC0;
-        regs[1] = DINBC2;
-        regs[2] = DINBC4;
-        regs[3] = DINBC6;
-    }
-    else
-        memset(regs, 0x8B, 4);
-
-    mpu_write_mem(CFG_LP_QUAT, 4, regs);
-
-    return mpu_reset_fifo();
-}
-
-/**
- *  @brief       Generate 6-axis quaternions from the DMP.
- *  In this driver, the 3-axis and 6-axis DMP quaternion features are mutually
- *  exclusive.
- *  @param[in]   enable  1 to enable 6-axis quaternion.
- *  @return      0 if successful.
- */
-int dmp_enable_6x_lp_quat(unsigned char enable)
-{
-    unsigned char regs[4];
-    if (enable) {
-        regs[0] = DINA20;
-        regs[1] = DINA28;
-        regs[2] = DINA30;
-        regs[3] = DINA38;
-    } else
-        memset(regs, 0xA3, 4);
-
-    mpu_write_mem(CFG_8, 4, regs);
-
-    return mpu_reset_fifo();
-}
-
-/**
- *  @brief      Decode the four-byte gesture data and execute any callbacks.
- *  @param[in]  gesture Gesture data from DMP packet.
- *  @return     0 if successful.
- */
-static int decode_gesture(unsigned char *gesture)
-{
-    unsigned char tap, android_orient;
-
-    android_orient = gesture[3] & 0xC0;
-    tap = 0x3F & gesture[3];
-
-    if (gesture[1] & INT_SRC_TAP) {
-        unsigned char direction, count;
-        direction = tap >> 3;
-        count = (tap % 8) + 1;
-        if (dmp.tap_cb)
-            dmp.tap_cb(direction, count);
-    }
-
-    if (gesture[1] & INT_SRC_ANDROID_ORIENT) {
-        if (dmp.android_orient_cb)
-            dmp.android_orient_cb(android_orient >> 6);
-    }
-
-    return 0;
-}
-
-/**
- *  @brief      Specify when a DMP interrupt should occur.
- *  A DMP interrupt can be configured to trigger on either of the two
- *  conditions below:
- *  \n a. One FIFO period has elapsed (set by @e mpu_set_sample_rate).
- *  \n b. A tap event has been detected.
- *  @param[in]  mode    DMP_INT_GESTURE or DMP_INT_CONTINUOUS.
- *  @return     0 if successful.
- */
-int dmp_set_interrupt_mode(unsigned char mode)
-{
-    const unsigned char regs_continuous[11] =
-        {0xd8, 0xb1, 0xb9, 0xf3, 0x8b, 0xa3, 0x91, 0xb6, 0x09, 0xb4, 0xd9};
-    const unsigned char regs_gesture[11] =
-        {0xda, 0xb1, 0xb9, 0xf3, 0x8b, 0xa3, 0x91, 0xb6, 0xda, 0xb4, 0xda};
-
-    switch (mode) {
-    case DMP_INT_CONTINUOUS:
-        return mpu_write_mem(CFG_FIFO_ON_EVENT, 11,
-            (unsigned char*)regs_continuous);
-    case DMP_INT_GESTURE:
-        return mpu_write_mem(CFG_FIFO_ON_EVENT, 11,
-            (unsigned char*)regs_gesture);
-    default:
-        return -1;
-    }
-}
-
-/**
- *  @brief      Get one packet from the FIFO.
- *  If @e sensors does not contain a particular sensor, disregard the data
- *  returned to that pointer.
- *  \n @e sensors can contain a combination of the following flags:
- *  \n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
- *  \n INV_XYZ_GYRO
- *  \n INV_XYZ_ACCEL
- *  \n INV_WXYZ_QUAT
- *  \n If the FIFO has no new data, @e sensors will be zero.
- *  \n If the FIFO is disabled, @e sensors will be zero and this function will
- *  return a non-zero error code.
- *  @param[out] gyro        Gyro data in hardware units.
- *  @param[out] accel       Accel data in hardware units.
- *  @param[out] quat        3-axis quaternion data in hardware units.
- *  @param[out] timestamp   Timestamp in milliseconds.
- *  @param[out] sensors     Mask of sensors read from FIFO.
- *  @param[out] more        Number of remaining packets.
- *  @return     0 if successful.
- */
-int dmp_read_fifo(short *gyro, short *accel, long *quat,
-    unsigned long *timestamp, short *sensors, unsigned char *more)
-{
-    unsigned char fifo_data[MAX_PACKET_LENGTH];
-    unsigned char ii = 0;
-
-    /* TODO: sensors[0] only changes when dmp_enable_feature is called. We can
-     * cache this value and save some cycles.
-     */
-    sensors[0] = 0;
-
-    /* Get a packet. */
-    if (mpu_read_fifo_stream(dmp.packet_length, fifo_data, more))
-        return -1;
-
-    /* Parse DMP packet. */
-    if (dmp.feature_mask & (DMP_FEATURE_LP_QUAT | DMP_FEATURE_6X_LP_QUAT)) {
-#ifdef FIFO_CORRUPTION_CHECK
-        long quat_q14[4], quat_mag_sq;
-#endif
-        quat[0] = ((long)fifo_data[0] << 24) | ((long)fifo_data[1] << 16) |
-            ((long)fifo_data[2] << 8) | fifo_data[3];
-        quat[1] = ((long)fifo_data[4] << 24) | ((long)fifo_data[5] << 16) |
-            ((long)fifo_data[6] << 8) | fifo_data[7];
-        quat[2] = ((long)fifo_data[8] << 24) | ((long)fifo_data[9] << 16) |
-            ((long)fifo_data[10] << 8) | fifo_data[11];
-        quat[3] = ((long)fifo_data[12] << 24) | ((long)fifo_data[13] << 16) |
-            ((long)fifo_data[14] << 8) | fifo_data[15];
-        ii += 16;
-#ifdef FIFO_CORRUPTION_CHECK
-        /* We can detect a corrupted FIFO by monitoring the quaternion data and
-         * ensuring that the magnitude is always normalized to one. This
-         * shouldn't happen in normal operation, but if an I2C error occurs,
-         * the FIFO reads might become misaligned.
-         *
-         * Let's start by scaling down the quaternion data to avoid long long
-         * math.
-         */
-        quat_q14[0] = quat[0] >> 16;
-        quat_q14[1] = quat[1] >> 16;
-        quat_q14[2] = quat[2] >> 16;
-        quat_q14[3] = quat[3] >> 16;
-        quat_mag_sq = quat_q14[0] * quat_q14[0] + quat_q14[1] * quat_q14[1] +
-            quat_q14[2] * quat_q14[2] + quat_q14[3] * quat_q14[3];
-        if ((quat_mag_sq < QUAT_MAG_SQ_MIN) ||
-            (quat_mag_sq > QUAT_MAG_SQ_MAX)) {
-            /* Quaternion is outside of the acceptable threshold. */
-            mpu_reset_fifo();
-            sensors[0] = 0;
-            return -1;
-        }
-        sensors[0] |= INV_WXYZ_QUAT;
-#endif
-    }
-
-    if (dmp.feature_mask & DMP_FEATURE_SEND_RAW_ACCEL) {
-        accel[0] = ((short)fifo_data[ii+0] << 8) | fifo_data[ii+1];
-        accel[1] = ((short)fifo_data[ii+2] << 8) | fifo_data[ii+3];
-        accel[2] = ((short)fifo_data[ii+4] << 8) | fifo_data[ii+5];
-        ii += 6;
-        sensors[0] |= INV_XYZ_ACCEL;
-    }
-
-    if (dmp.feature_mask & DMP_FEATURE_SEND_ANY_GYRO) {
-        gyro[0] = ((short)fifo_data[ii+0] << 8) | fifo_data[ii+1];
-        gyro[1] = ((short)fifo_data[ii+2] << 8) | fifo_data[ii+3];
-        gyro[2] = ((short)fifo_data[ii+4] << 8) | fifo_data[ii+5];
-        ii += 6;
-        sensors[0] |= INV_XYZ_GYRO;
-    }
-
-    /* Gesture data is at the end of the DMP packet. Parse it and call
-     * the gesture callbacks (if registered).
-     */
-    if (dmp.feature_mask & (DMP_FEATURE_TAP | DMP_FEATURE_ANDROID_ORIENT))
-        decode_gesture(fifo_data + ii);
-
-    get_ms(timestamp);
-    return 0;
-}
-
-/**
- *  @brief      Register a function to be executed on a tap event.
- *  The tap direction is represented by one of the following:
- *  \n TAP_X_UP
- *  \n TAP_X_DOWN
- *  \n TAP_Y_UP
- *  \n TAP_Y_DOWN
- *  \n TAP_Z_UP
- *  \n TAP_Z_DOWN
- *  @param[in]  func    Callback function.
- *  @return     0 if successful.
- */
-int dmp_register_tap_cb(void (*func)(unsigned char, unsigned char))
-{
-    dmp.tap_cb = func;
-    return 0;
-}
-
-/**
- *  @brief      Register a function to be executed on a android orientation event.
- *  @param[in]  func    Callback function.
- *  @return     0 if successful.
- */
-int dmp_register_android_orient_cb(void (*func)(unsigned char))
-{
-    dmp.android_orient_cb = func;
-    return 0;
-}
-
-/**
- *  @}
- */
-

+ 0 - 97
Core备份3/imu6/inv_mpu_dmp_motion_driver6.h

@@ -1,97 +0,0 @@
-/*
- $License:
-    Copyright (C) 2011-2012 InvenSense Corporation, All Rights Reserved.
-    See included License.txt for License information.
- $
- */
-/**
- *  @addtogroup  DRIVERS Sensor Driver Layer
- *  @brief       Hardware drivers to communicate with sensors via I2C.
- *
- *  @{
- *      @file       inv_mpu_dmp_motion_driver.h
- *      @brief      DMP image and interface functions.
- *      @details    All functions are preceded by the dmp_ prefix to
- *                  differentiate among MPL and general driver function calls.
- */
-#ifndef _INV_MPU_DMP_MOTION_DRIVER_H_
-#define _INV_MPU_DMP_MOTION_DRIVER_H_
-
-#define TAP_X               (0x01)
-#define TAP_Y               (0x02)
-#define TAP_Z               (0x04)
-#define TAP_XYZ             (0x07)
-
-#define TAP_X_UP            (0x01)
-#define TAP_X_DOWN          (0x02)
-#define TAP_Y_UP            (0x03)
-#define TAP_Y_DOWN          (0x04)
-#define TAP_Z_UP            (0x05)
-#define TAP_Z_DOWN          (0x06)
-
-#define ANDROID_ORIENT_PORTRAIT             (0x00)
-#define ANDROID_ORIENT_LANDSCAPE            (0x01)
-#define ANDROID_ORIENT_REVERSE_PORTRAIT     (0x02)
-#define ANDROID_ORIENT_REVERSE_LANDSCAPE    (0x03)
-
-#define DMP_INT_GESTURE     (0x01)
-#define DMP_INT_CONTINUOUS  (0x02)
-
-#define DMP_FEATURE_TAP             (0x001)
-#define DMP_FEATURE_ANDROID_ORIENT  (0x002)
-#define DMP_FEATURE_LP_QUAT         (0x004)
-#define DMP_FEATURE_PEDOMETER       (0x008)
-#define DMP_FEATURE_6X_LP_QUAT      (0x010)
-#define DMP_FEATURE_GYRO_CAL        (0x020)
-#define DMP_FEATURE_SEND_RAW_ACCEL  (0x040)
-#define DMP_FEATURE_SEND_RAW_GYRO   (0x080)
-#define DMP_FEATURE_SEND_CAL_GYRO   (0x100)
-
-#define INV_WXYZ_QUAT       (0x100)
-
-/* Set up functions. */
-int dmp_load_motion_driver_firmware(void);
-int dmp_set_fifo_rate(unsigned short rate);
-int dmp_get_fifo_rate(unsigned short *rate);
-int dmp_enable_feature(unsigned short mask);
-int dmp_get_enabled_features(unsigned short *mask);
-int dmp_set_interrupt_mode(unsigned char mode);
-int dmp_set_orientation(unsigned short orient);
-int dmp_set_gyro_bias(long *bias);
-int dmp_set_accel_bias(long *bias);
-
-/* Tap functions. */
-int dmp_register_tap_cb(void (*func)(unsigned char, unsigned char));
-int dmp_set_tap_thresh(unsigned char axis, unsigned short thresh);
-int dmp_set_tap_axes(unsigned char axis);
-int dmp_set_tap_count(unsigned char min_taps);
-int dmp_set_tap_time(unsigned short time);
-int dmp_set_tap_time_multi(unsigned short time);
-int dmp_set_shake_reject_thresh(long sf, unsigned short thresh);
-int dmp_set_shake_reject_time(unsigned short time);
-int dmp_set_shake_reject_timeout(unsigned short time);
-
-/* Android orientation functions. */
-int dmp_register_android_orient_cb(void (*func)(unsigned char));
-
-/* LP quaternion functions. */
-int dmp_enable_lp_quat(unsigned char enable);
-int dmp_enable_6x_lp_quat(unsigned char enable);
-
-/* Pedometer functions. */
-int dmp_get_pedometer_step_count(unsigned long *count);
-int dmp_set_pedometer_step_count(unsigned long count);
-int dmp_get_pedometer_walk_time(unsigned long *time);
-int dmp_set_pedometer_walk_time(unsigned long time);
-
-/* DMP gyro calibration functions. */
-int dmp_enable_gyro_cal(unsigned char enable);
-
-/* Read function. This function should be called whenever the MPU interrupt is
- * detected.
- */
-int dmp_read_fifo(short *gyro, short *accel, long *quat,
-    unsigned long *timestamp, short *sensors, unsigned char *more);
-
-#endif  /* #ifndef _INV_MPU_DMP_MOTION_DRIVER_H_ */
-

+ 2 - 0
MDK-ARM/.vscode/keil-assistant.log

@@ -52,3 +52,5 @@
 
 [info] Log at : 2024/5/10|19:52:20|GMT+0800
 
+[info] Log at : 2024/5/12|12:12:35|GMT+0800
+

+ 9 - 0
MDK-ARM/EventRecorderStub.scvd

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<component_viewer schemaVersion="0.1" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="Component_Viewer.xsd">
+
+<component name="EventRecorderStub" version="1.0.0"/>       <!--name and version of the component-->
+  <events>
+  </events>
+
+</component_viewer>

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1327 - 16
MDK-ARM/SmartGlove.uvguix.94772


+ 65 - 45
MDK-ARM/SmartGlove.uvoptx

@@ -117,10 +117,30 @@
         <pMon>BIN\CMSIS_AGDI.dll</pMon>
       </DebugOpt>
       <TargetDriverDllRegistry>
+        <SetRegEntry>
+          <Number>0</Number>
+          <Key>ARMRTXEVENTFLAGS</Key>
+          <Name>-L70 -Z18 -C0 -M0 -T1</Name>
+        </SetRegEntry>
+        <SetRegEntry>
+          <Number>0</Number>
+          <Key>DLGTARM</Key>
+          <Name>(1010=-1,-1,-1,-1,0)(6017=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(6016=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0)</Name>
+        </SetRegEntry>
+        <SetRegEntry>
+          <Number>0</Number>
+          <Key>ARMDBGFLAGS</Key>
+          <Name></Name>
+        </SetRegEntry>
+        <SetRegEntry>
+          <Number>0</Number>
+          <Key>DLGUARM</Key>
+          <Name></Name>
+        </SetRegEntry>
         <SetRegEntry>
           <Number>0</Number>
           <Key>CMSIS_AGDI</Key>
-          <Name>-X"Any" -UAny -O2254 -S0 -C0 -P00000000 -N00("") -D00(00000000) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC8000 -FN1 -FF0STM32H7x_128k.FLM -FS08000000 -FL020000 -FP0($$Device:STM32H750VBTx$CMSIS\Flash\STM32H7x_128k.FLM)</Name>
+          <Name>-X"Any" -UAny -O2254 -S0 -C0 -P00000000 -N00("ARM CoreSight SW-DP") -D00(6BA02477) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC8000 -FN1 -FF0STM32H7x_128k.FLM -FS08000000 -FL020000 -FP0($$Device:STM32H750VBTx$CMSIS\Flash\STM32H7x_128k.FLM)</Name>
         </SetRegEntry>
         <SetRegEntry>
           <Number>0</Number>
@@ -215,24 +235,24 @@
     <File>
       <GroupNumber>2</GroupNumber>
       <FileNumber>2</FileNumber>
-      <FileType>1</FileType>
+      <FileType>5</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
       <bDave2>0</bDave2>
-      <PathWithFileName>../Core/Src/main.c</PathWithFileName>
-      <FilenameWithoutPath>main.c</FilenameWithoutPath>
+      <PathWithFileName>..\Core\imu\dmpKey.h</PathWithFileName>
+      <FilenameWithoutPath>dmpKey.h</FilenameWithoutPath>
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>
     <File>
       <GroupNumber>2</GroupNumber>
       <FileNumber>3</FileNumber>
-      <FileType>1</FileType>
+      <FileType>5</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
       <bDave2>0</bDave2>
-      <PathWithFileName>../Core/Src/gpio.c</PathWithFileName>
-      <FilenameWithoutPath>gpio.c</FilenameWithoutPath>
+      <PathWithFileName>..\Core\imu\dmpmap.h</PathWithFileName>
+      <FilenameWithoutPath>dmpmap.h</FilenameWithoutPath>
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>
@@ -243,20 +263,20 @@
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
       <bDave2>0</bDave2>
-      <PathWithFileName>../Core/Src/adc.c</PathWithFileName>
-      <FilenameWithoutPath>adc.c</FilenameWithoutPath>
+      <PathWithFileName>..\Core\imu\inv_mpu.c</PathWithFileName>
+      <FilenameWithoutPath>inv_mpu.c</FilenameWithoutPath>
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>
     <File>
       <GroupNumber>2</GroupNumber>
       <FileNumber>5</FileNumber>
-      <FileType>1</FileType>
+      <FileType>5</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
       <bDave2>0</bDave2>
-      <PathWithFileName>../Core/Src/i2c.c</PathWithFileName>
-      <FilenameWithoutPath>i2c.c</FilenameWithoutPath>
+      <PathWithFileName>..\Core\imu\inv_mpu.h</PathWithFileName>
+      <FilenameWithoutPath>inv_mpu.h</FilenameWithoutPath>
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>
@@ -267,20 +287,20 @@
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
       <bDave2>0</bDave2>
-      <PathWithFileName>../Core/Src/quadspi.c</PathWithFileName>
-      <FilenameWithoutPath>quadspi.c</FilenameWithoutPath>
+      <PathWithFileName>..\Core\imu\inv_mpu_dmp_motion_driver.c</PathWithFileName>
+      <FilenameWithoutPath>inv_mpu_dmp_motion_driver.c</FilenameWithoutPath>
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>
     <File>
       <GroupNumber>2</GroupNumber>
       <FileNumber>7</FileNumber>
-      <FileType>1</FileType>
+      <FileType>5</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
       <bDave2>0</bDave2>
-      <PathWithFileName>../Core/Src/tim.c</PathWithFileName>
-      <FilenameWithoutPath>tim.c</FilenameWithoutPath>
+      <PathWithFileName>..\Core\imu\inv_mpu_dmp_motion_driver.h</PathWithFileName>
+      <FilenameWithoutPath>inv_mpu_dmp_motion_driver.h</FilenameWithoutPath>
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>
@@ -291,20 +311,20 @@
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
       <bDave2>0</bDave2>
-      <PathWithFileName>../Core/Src/usart.c</PathWithFileName>
-      <FilenameWithoutPath>usart.c</FilenameWithoutPath>
+      <PathWithFileName>..\Core\imu\MPU6050.c</PathWithFileName>
+      <FilenameWithoutPath>MPU6050.c</FilenameWithoutPath>
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>
     <File>
       <GroupNumber>2</GroupNumber>
       <FileNumber>9</FileNumber>
-      <FileType>1</FileType>
+      <FileType>5</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
       <bDave2>0</bDave2>
-      <PathWithFileName>../Core/Src/stm32h7xx_it.c</PathWithFileName>
-      <FilenameWithoutPath>stm32h7xx_it.c</FilenameWithoutPath>
+      <PathWithFileName>..\Core\imu\MPU6050.h</PathWithFileName>
+      <FilenameWithoutPath>MPU6050.h</FilenameWithoutPath>
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>
@@ -315,32 +335,32 @@
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
       <bDave2>0</bDave2>
-      <PathWithFileName>../Core/Src/stm32h7xx_hal_msp.c</PathWithFileName>
-      <FilenameWithoutPath>stm32h7xx_hal_msp.c</FilenameWithoutPath>
+      <PathWithFileName>../Core/Src/main.c</PathWithFileName>
+      <FilenameWithoutPath>main.c</FilenameWithoutPath>
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>
     <File>
       <GroupNumber>2</GroupNumber>
       <FileNumber>11</FileNumber>
-      <FileType>5</FileType>
+      <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
       <bDave2>0</bDave2>
-      <PathWithFileName>..\Core\imu\dmpKey.h</PathWithFileName>
-      <FilenameWithoutPath>dmpKey.h</FilenameWithoutPath>
+      <PathWithFileName>../Core/Src/gpio.c</PathWithFileName>
+      <FilenameWithoutPath>gpio.c</FilenameWithoutPath>
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>
     <File>
       <GroupNumber>2</GroupNumber>
       <FileNumber>12</FileNumber>
-      <FileType>5</FileType>
+      <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
       <bDave2>0</bDave2>
-      <PathWithFileName>..\Core\imu\dmpmap.h</PathWithFileName>
-      <FilenameWithoutPath>dmpmap.h</FilenameWithoutPath>
+      <PathWithFileName>../Core/Src/adc.c</PathWithFileName>
+      <FilenameWithoutPath>adc.c</FilenameWithoutPath>
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>
@@ -351,20 +371,20 @@
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
       <bDave2>0</bDave2>
-      <PathWithFileName>..\Core\imu\inv_mpu.c</PathWithFileName>
-      <FilenameWithoutPath>inv_mpu.c</FilenameWithoutPath>
+      <PathWithFileName>../Core/Src/i2c.c</PathWithFileName>
+      <FilenameWithoutPath>i2c.c</FilenameWithoutPath>
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>
     <File>
       <GroupNumber>2</GroupNumber>
       <FileNumber>14</FileNumber>
-      <FileType>5</FileType>
+      <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
       <bDave2>0</bDave2>
-      <PathWithFileName>..\Core\imu\inv_mpu.h</PathWithFileName>
-      <FilenameWithoutPath>inv_mpu.h</FilenameWithoutPath>
+      <PathWithFileName>../Core/Src/quadspi.c</PathWithFileName>
+      <FilenameWithoutPath>quadspi.c</FilenameWithoutPath>
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>
@@ -375,20 +395,20 @@
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
       <bDave2>0</bDave2>
-      <PathWithFileName>..\Core\imu\inv_mpu_dmp_motion_driver.c</PathWithFileName>
-      <FilenameWithoutPath>inv_mpu_dmp_motion_driver.c</FilenameWithoutPath>
+      <PathWithFileName>../Core/Src/tim.c</PathWithFileName>
+      <FilenameWithoutPath>tim.c</FilenameWithoutPath>
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>
     <File>
       <GroupNumber>2</GroupNumber>
       <FileNumber>16</FileNumber>
-      <FileType>5</FileType>
+      <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
       <bDave2>0</bDave2>
-      <PathWithFileName>..\Core\imu\inv_mpu_dmp_motion_driver.h</PathWithFileName>
-      <FilenameWithoutPath>inv_mpu_dmp_motion_driver.h</FilenameWithoutPath>
+      <PathWithFileName>../Core/Src/usart.c</PathWithFileName>
+      <FilenameWithoutPath>usart.c</FilenameWithoutPath>
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>
@@ -399,20 +419,20 @@
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
       <bDave2>0</bDave2>
-      <PathWithFileName>..\Core\imu\MPU6050.c</PathWithFileName>
-      <FilenameWithoutPath>MPU6050.c</FilenameWithoutPath>
+      <PathWithFileName>../Core/Src/stm32h7xx_it.c</PathWithFileName>
+      <FilenameWithoutPath>stm32h7xx_it.c</FilenameWithoutPath>
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>
     <File>
       <GroupNumber>2</GroupNumber>
       <FileNumber>18</FileNumber>
-      <FileType>5</FileType>
+      <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
       <bDave2>0</bDave2>
-      <PathWithFileName>..\Core\imu\MPU6050.h</PathWithFileName>
-      <FilenameWithoutPath>MPU6050.h</FilenameWithoutPath>
+      <PathWithFileName>../Core/Src/stm32h7xx_hal_msp.c</PathWithFileName>
+      <FilenameWithoutPath>stm32h7xx_hal_msp.c</FilenameWithoutPath>
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>

+ 41 - 41
MDK-ARM/SmartGlove.uvprojx

@@ -339,7 +339,7 @@
               <MiscControls></MiscControls>
               <Define>USE_HAL_DRIVER,STM32H750xx</Define>
               <Undefine></Undefine>
-              <IncludePath>../Core/Inc;../Drivers/STM32H7xx_HAL_Driver/Inc;../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy;../Drivers/CMSIS/Device/ST/STM32H7xx/Include;../Drivers/CMSIS/Include;..\Core\imu</IncludePath>
+              <IncludePath>../Core/Inc;../Drivers/STM32H7xx_HAL_Driver/Inc;../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy;../Drivers/CMSIS/Device/ST/STM32H7xx/Include;../Drivers/CMSIS/Include;../Core/imu</IncludePath>
             </VariousControls>
           </Cads>
           <Aads>
@@ -393,6 +393,46 @@
         <Group>
           <GroupName>Application/User/Core</GroupName>
           <Files>
+            <File>
+              <FileName>dmpKey.h</FileName>
+              <FileType>5</FileType>
+              <FilePath>..\Core\imu\dmpKey.h</FilePath>
+            </File>
+            <File>
+              <FileName>dmpmap.h</FileName>
+              <FileType>5</FileType>
+              <FilePath>..\Core\imu\dmpmap.h</FilePath>
+            </File>
+            <File>
+              <FileName>inv_mpu.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\Core\imu\inv_mpu.c</FilePath>
+            </File>
+            <File>
+              <FileName>inv_mpu.h</FileName>
+              <FileType>5</FileType>
+              <FilePath>..\Core\imu\inv_mpu.h</FilePath>
+            </File>
+            <File>
+              <FileName>inv_mpu_dmp_motion_driver.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\Core\imu\inv_mpu_dmp_motion_driver.c</FilePath>
+            </File>
+            <File>
+              <FileName>inv_mpu_dmp_motion_driver.h</FileName>
+              <FileType>5</FileType>
+              <FilePath>..\Core\imu\inv_mpu_dmp_motion_driver.h</FilePath>
+            </File>
+            <File>
+              <FileName>MPU6050.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\Core\imu\MPU6050.c</FilePath>
+            </File>
+            <File>
+              <FileName>MPU6050.h</FileName>
+              <FileType>5</FileType>
+              <FilePath>..\Core\imu\MPU6050.h</FilePath>
+            </File>
             <File>
               <FileName>main.c</FileName>
               <FileType>1</FileType>
@@ -438,46 +478,6 @@
               <FileType>1</FileType>
               <FilePath>../Core/Src/stm32h7xx_hal_msp.c</FilePath>
             </File>
-            <File>
-              <FileName>dmpKey.h</FileName>
-              <FileType>5</FileType>
-              <FilePath>..\Core\imu\dmpKey.h</FilePath>
-            </File>
-            <File>
-              <FileName>dmpmap.h</FileName>
-              <FileType>5</FileType>
-              <FilePath>..\Core\imu\dmpmap.h</FilePath>
-            </File>
-            <File>
-              <FileName>inv_mpu.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\Core\imu\inv_mpu.c</FilePath>
-            </File>
-            <File>
-              <FileName>inv_mpu.h</FileName>
-              <FileType>5</FileType>
-              <FilePath>..\Core\imu\inv_mpu.h</FilePath>
-            </File>
-            <File>
-              <FileName>inv_mpu_dmp_motion_driver.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\Core\imu\inv_mpu_dmp_motion_driver.c</FilePath>
-            </File>
-            <File>
-              <FileName>inv_mpu_dmp_motion_driver.h</FileName>
-              <FileType>5</FileType>
-              <FilePath>..\Core\imu\inv_mpu_dmp_motion_driver.h</FilePath>
-            </File>
-            <File>
-              <FileName>MPU6050.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\Core\imu\MPU6050.c</FilePath>
-            </File>
-            <File>
-              <FileName>MPU6050.h</FileName>
-              <FileType>5</FileType>
-              <FilePath>..\Core\imu\MPU6050.h</FilePath>
-            </File>
           </Files>
         </Group>
         <Group>

+ 2 - 0
MDK-ARM/SmartGlove/ExtDll.iex

@@ -0,0 +1,2 @@
+[EXTDLL]
+Count=0

BIN
MDK-ARM/SmartGlove/SmartGlove.axf


+ 42 - 8
MDK-ARM/SmartGlove/SmartGlove.build_log.htm

@@ -22,21 +22,55 @@ Dialog DLL:      TCM.DLL V1.53.0.0
  
 <h2>Project:</h2>
 D:\keil5 project\SmartGlove\MDK-ARM\SmartGlove.uvprojx
-Project File Date:  05/09/2024
+Project File Date:  05/12/2024
 
 <h2>Output:</h2>
 *** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\keil5\ARM\ARMCC\Bin'
 Build target 'SmartGlove'
 compiling main.c...
-../Core/Src/main.c(148): warning:  #177-D: variable "buff"  was declared but never referenced
-  char buff[100]={0};
-../Core/Src/main.c(218): warning:  #188-D: enumerated type mixed with another type
-  		HAL_GPIO_WritePin(GPIOC,GPIO_PIN_13,1);
-../Core/Src/main.c: 2 warnings, 0 errors
+../Core/Src/main.c(213): warning:  #167-D: argument of type "int *" is incompatible with parameter of type "short *"
+  			    MPU_Get_Gyroscope(&gx1,&gy1,&gz1);
+../Core/Src/main.c(213): warning:  #167-D: argument of type "int *" is incompatible with parameter of type "short *"
+  			    MPU_Get_Gyroscope(&gx1,&gy1,&gz1);
+../Core/Src/main.c(213): warning:  #167-D: argument of type "int *" is incompatible with parameter of type "short *"
+  			    MPU_Get_Gyroscope(&gx1,&gy1,&gz1);
+../Core/Src/main.c(295): warning:  #188-D: enumerated type mixed with another type
+      HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, 1);
+../Core/Src/main.c(167): warning:  #177-D: variable "gx2"  was declared but never referenced
+  	short gx2,gy2,gz2;
+../Core/Src/main.c(167): warning:  #177-D: variable "gy2"  was declared but never referenced
+  	short gx2,gy2,gz2;
+../Core/Src/main.c(167): warning:  #177-D: variable "gz2"  was declared but never referenced
+  	short gx2,gy2,gz2;
+../Core/Src/main.c(168): warning:  #177-D: variable "gx3"  was declared but never referenced
+  	short gx3,gy3,gz3;
+../Core/Src/main.c(168): warning:  #177-D: variable "gy3"  was declared but never referenced
+  	short gx3,gy3,gz3;
+../Core/Src/main.c(168): warning:  #177-D: variable "gz3"  was declared but never referenced
+  	short gx3,gy3,gz3;
+../Core/Src/main.c(169): warning:  #177-D: variable "gx4"  was declared but never referenced
+  	short gx4,gy4,gz4;
+../Core/Src/main.c(169): warning:  #177-D: variable "gy4"  was declared but never referenced
+  	short gx4,gy4,gz4;
+../Core/Src/main.c(169): warning:  #177-D: variable "gz4"  was declared but never referenced
+  	short gx4,gy4,gz4;
+../Core/Src/main.c(170): warning:  #177-D: variable "gx5"  was declared but never referenced
+  	short gx5,gy5,gz5;
+../Core/Src/main.c(170): warning:  #177-D: variable "gy5"  was declared but never referenced
+  	short gx5,gy5,gz5;
+../Core/Src/main.c(170): warning:  #177-D: variable "gz5"  was declared but never referenced
+  	short gx5,gy5,gz5;
+../Core/Src/main.c(171): warning:  #177-D: variable "gx6"  was declared but never referenced
+  	short gx6,gy6,gz6;
+../Core/Src/main.c(171): warning:  #177-D: variable "gy6"  was declared but never referenced
+  	short gx6,gy6,gz6;
+../Core/Src/main.c(171): warning:  #177-D: variable "gz6"  was declared but never referenced
+  	short gx6,gy6,gz6;
+../Core/Src/main.c: 19 warnings, 0 errors
 linking...
-Program Size: Code=45148 RO-data=4220 RW-data=108 ZI-data=1860  
+Program Size: Code=44540 RO-data=4220 RW-data=100 ZI-data=1860  
 FromELF: creating hex file...
-"SmartGlove\SmartGlove.axf" - 0 Error(s), 2 Warning(s).
+"SmartGlove\SmartGlove.axf" - 0 Error(s), 19 Warning(s).
 
 <h2>Software Packages used:</h2>
 

+ 2695 - 2734
MDK-ARM/SmartGlove/SmartGlove.hex

@@ -1,8 +1,8 @@
 :020000040800F2
-:10000000B0070024B10200088D620008BB5600084A
-:1000100089620008190A00087176000800000000D3
-:1000200000000000000000000000000071670008F0
-:100030009D0C000800000000916200087367000832
+:10000000A8070024B1020008E5620008EF560008C6
+:10001000E1620008190A0008C97600080000000023
+:10002000000000000000000000000000C967000898
+:100030009D0C000800000000E9620008CB67000882
 :10004000CB020008CB020008CB020008CB0200085C
 :10005000CB020008CB020008CB020008CB0200084C
 :10006000CB020008CB020008CB020008CB0200083C
@@ -41,9 +41,9 @@
 :10027000CB020008CB020008CB02000800000000FF
 :10028000CB020008CB020008CB02000800000000EF
 :1002900000000000CB020008DFF810D000F088FA60
-:1002A00000480047899B0008AFF30080B007002496
+:1002A00000480047999A0008AFF30080A80700248F
 :1002B0000648804706480047FEE7FEE7FEE7FEE700
-:1002C000FEE7FEE7FEE7FEE7FEE7FEE7516800080F
+:1002C000FEE7FEE7FEE7FEE7FEE7FEE7A9680008B7
 :1002D000990200082DE9F05F0546002092469B46F2
 :1002E00088460646814640241BE02846414647464C
 :1002F000224600F095F853465A46C01A914110D351
@@ -123,8 +123,8 @@
 :1007900064EB0101141E73F1000405DB1C464FF0ED
 :1007A0000043524263EB0403994208BF904230BDBC
 :1007B000064C074D06E0E06840F0010394E80700AE
-:1007C00098471034AC42F6D3FFF76AFDB8C0000872
-:1007D000D8C00008202A06DBCB17203A41FA02F0E5
+:1007C00098471034AC42F6D3FFF76AFD58BE0008D4
+:1007D00078BE0008202A06DBCB17203A41FA02F047
 :1007E00043EAE07306E041FA02F3D040C2F120028E
 :1007F000914008431946704710B5141E73F1000468
 :1008000008DA401C41F1000192185B411A4301D102
@@ -141,11 +141,11 @@
 :1008B000A2E7000070B504464F492068884203D083
 :1008C0004E492068884208D14D48006800F4403005
 :1008D00008B1012009E0002007E04A48006800F460
-:1008E000403008B1012000E00020B8B103F062FD03
+:1008E000403008B1012000E00020B8B103F07CFDE9
 :1008F00005466068B0F5803F06D0B0F5003F04D0F3
 :10090000B0F5403F08D105E000BF6068000CB5FBC2
 :10091000F0F502E0AD0800E000BF2BE04FF400204E
-:10092000002102F0ABF805466068C0F31101F9B987
+:10092000002102F0C5F805466068C0F31101F9B96D
 :1009300080140C281CD2DFE800F01B060708090A07
 :100940000B111315171900BF00BF00BF00BF00BF78
 :100950006068800C4000B5FBF0F50AE02D0908E066
@@ -162,21 +162,21 @@
 :100A00000823024008630258002D3101105E5F0088
 :100A100020BCBE0040787D0100BFFEE7F0B585B088
 :100A20003D4803901020ADF810000C208DF8120006
-:100A300001208DF8130003A809F066FA0646314636
-:100A400036A006F017FE002E63D178200AF0E4F9F4
-:100A500010B936A006F00EFE782009F03BF910B967
-:100A60003BA006F007FE32200AF07AF910B942A046
-:100A700006F000FE002002900190009002A809F00C
-:100A800033FA01A809F0B6F9684609F05BF99DF858
-:100A90000030BDF80420BDF8081041A006F0EAFDC2
-:100AA00007F0DAFF10B949A006F0E4FD544C2046E7
-:100AB00009F042F80546E01C09F03EF845EAC0009E
-:100AC00085B2A01D09F038F845EA801085B200BF54
-:100AD0002F46384608F01CFA10B94AA006F0CAFDA5
-:100AE00040F2731007F060FE10B950A006F0C2FD8E
-:100AF000322008F03DF910B956A006F0BBFD0AF00F
-:100B00005FFA012009F0F2FF10B95BA006F0B2FD18
-:100B100000BF05B0F0BD0000FD9900086D70755F65
+:100A300001208DF8130003A809F0EEFA06463146AE
+:100A400036A006F043FE002E63D178200AF0F6F8B7
+:100A500010B936A006F03AFE782009F0C3F910B9B3
+:100A60003BA006F033FE32200AF09AF810B942A0FB
+:100A700006F02CFE002002900190009002A809F0E0
+:100A8000BBFA01A809F03EFA684609F0E3F99DF8BF
+:100A90000030BDF80420BDF8081041A006F016FE95
+:100AA00008F006F810B949A006F010FE544C204694
+:100AB00008F0CAFF0546E01C08F0C6FF45EAC00082
+:100AC00085B2A01D08F0C0FF45EA801085B200BFC6
+:100AD0002F46384608F048FA10B94AA006F0F6FD4D
+:100AE00040F2731007F08CFE10B950A006F0EEFD36
+:100AF000322008F069F910B956A006F0E7FD0AF0B7
+:100B000045F9012009F048FF10B95BA006F0DEFDB1
+:100B100000BF05B0F0BD00001D9900086D70755F45
 :100B2000696E69742C2025640D0A00006D70755F74
 :100B30007365745F73656E736F7220636F6D706C35
 :100B4000657465202E2E2E2E2E2E0D0A000000001C
@@ -191,7 +191,7 @@
 :100BD0006C6F61645F6D6F74696F6E5F647269766C
 :100BE00065725F6669726D7761726520636F6D70A3
 :100BF0006C657465202E2E2E2E2E2E0D0A00000000
-:100C000045000024646D705F7365745F6F72696581
+:100C00002D000024646D705F7365745F6F72696599
 :100C10006E746174696F6E20636F6D706C6574655E
 :100C2000202E2E2E2E2E2E0D0A000000646D705FD9
 :100C3000656E61626C655F6665617475726520637F
@@ -207,19 +207,19 @@
 :100CD00000BF00201590169046492068884202D136
 :100CE0004548009001E000200090009850B9606DE8
 :100CF00040F02000606500BF002084F8500000BF75
-:100D00000120DFE7009804F0F6FF0746206804F0B2
-:100D1000F2FF002861D1002F5FD136492068884258
+:100D00000120DFE7009804F0F0FF0746206804F0B8
+:100D1000ECFF002861D1002F5FD13649206888425E
 :100D200003D035492068884201D1344800E0344876
 :100D30000546306858B3A86820F4404071680843FD
 :100D4000A8602C492068884203D02B49206888423B
 :100D500001D12A4800E02A482849884209D125487B
-:100D600004F0BAFF8146244804F0B6FF49EA0000C7
-:100D700002E0244804F0B0FF70BBB168306808435B
+:100D600004F0B4FF8146244804F0B0FF49EA0000D3
+:100D700002E0244804F0AAFF70BBB1683068084361
 :100D8000A96840F61F7291430843A8602BE0A86849
 :100D900020F44040A86017492068884203D01649D3
 :100DA0002068884201D1154800E01548134988425F
-:100DB00009D1104804F090FF81460F4804F08CFFE1
-:100DC00049EA000002E00F4804F086FF20B9A86855
+:100DB00009D1104804F08AFF81460F4804F086FFED
+:100DC00049EA000002E00F4804F080FF20B9A8685B
 :100DD00040F61F718843A86005E0606D40F0200078
 :100DE00060654FF0010800BF002084F8500000BF8C
 :100DF000404667E7002002400021024000230240F5
@@ -229,7 +229,7 @@
 :100E30002068884200D100BFF7492068884200D16D
 :100E400000BFF6492068884200D100BF00BF94F877
 :100E50005000012802D10220BDE8F88F012084F85B
-:100E6000500000BF206804F041FF00287ED12868B0
+:100E6000500000BF206804F03BFF00287ED12868B6
 :100E700000F00040A8B92068C1692868C0F31300D9
 :100E800018B92868C0F3846004E0286890FAA0F0DC
 :100E9000B0FA80F000F01F0201209040014320686A
@@ -237,9 +237,9 @@
 :100EB0000CEB8B03D3F800C000F01F0E4FF01F0B9C
 :100EC0000BFA0EFB2CEA0B0C00F01F0BC2F3846E26
 :100ED0000EFA0BFE4CEA0E0CC3F800C000BF2068EF
-:100EE00004F004FF8146206804F0ECFE8046B9F16E
+:100EE00004F0FEFE8146206804F0E6FE8046B9F17B
 :100EF000000F6FD1B8F1000FFBD1AA6829682068F4
-:100F000004F0FEFEC648006800F07040B0F1805F5B
+:100F000004F0F8FEC648006800F07040B0F1805F61
 :100F100007D168692168C968C1F382014900884026
 :100F200014E02068C06800F0100038B968692168D2
 :100F3000C968C1F382014900884007E068692168F7
@@ -259,7 +259,7 @@
 :10101000806E00F0F8402978B0EB816F05D1206830
 :10102000806E20F00040216888662068C06E00F065
 :10103000F8402978B0EB816F05D12068C06E20F0B0
-:1010400000402168C866206804F041FE002872D183
+:1010400000402168C866206804F03BFE002872D189
 :101050002068EA682968D0F8C030C1F3130C23EA8D
 :101060000C0302F0180BDFF8BCC12CFA0BFC0CEAE5
 :10107000010C43EA0C03C0F8C03000BF6449E868C3
@@ -282,48 +282,48 @@
 :1011800018E0C3F3846304E02B6893FAA3F3B3FA83
 :1011900083F35B1C03F01F030A3B03EB43034FF095
 :1011A000007B4BEA03534CEA03031946AA68206804
-:1011B00004F0A6FD286800F00040002866D0154A1B
+:1011B00004F0A0FD286800F00040002866D0154A21
 :1011C0002168914203D0144A2168914201D1164905
 :1011D00000E016490846816801F0E07600BF0D493D
 :1011E0002068884203D00C492068884201D10E480B
-:1011F00000E00E480C4988421AD1064804F067FD09
-:101200008346054804F063FD4BEA000013E000004C
+:1011F00000E00E480C4988421AD1064804F061FD0F
+:101200008346054804F05DFD4BEA000013E0000052
 :101210000000FF4700200240002102400060025809
 :101220000010005CFFFF0F00002302400063025823
-:101230003E4804F04CFDE8BB3D492868884226D171
+:101230003E4804F046FDE8BB3D492868884226D177
 :1012400006F4000018BB39492068884266D1394B42
 :1012500022689A4203D0384B22689A4201D1374A19
-:1012600000E0374A104646F4000104F05DFD3548C1
+:1012600000E0374A104646F4000104F057FD3548C7
 :1012700000683549B0FBF1F0401C4000009002E0EE
 :101280000098401E009000980028F9D146E02F49B0
 :101290002868884219D106F08070B0B923492068C7
 :1012A00088423BD1234B22689A4205D0224B2268C8
 :1012B0009A4200E025E001D1204A00E0204A104691
-:1012C00046F0807104F030FD28E02149286888420A
+:1012C00046F0807104F02AFD28E021492868884210
 :1012D00024D106F4800008BB1449206888421DD13F
 :1012E000144B22689A4203D0134B22689A4201D1D0
-:1012F000124A00E0124A104646F4800104F014FD40
+:1012F000124A00E0124A104646F4800104F00EFD46
 :101300000CE0606D40F0200060654FF0010A05E0E0
 :10131000606D40F0200060654FF0010A00BF0020C2
 :1013200084F8500000BF504696E500000060025867
 :10133000000084CB00200240002102400023024034
-:10134000006302585C000024400D0300000052C7F7
+:101340000063025854000024400D0300000052C7FF
 :101350000000B8CF2DE9F84F04464FF000090020F7
 :10136000009014B90120BDE8F88FE06818B1207F23
 :10137000012800D100BF606D30B9204600F030F97F
 :101380000020A06584F8500020688168C1F3407196
 :1013900031B120688168874A1140816000BF00BF79
-:1013A000206804F09EFCA8B920688168824A114038
+:1013A000206804F098FCA8B920688168824A11403E
 :1013B00041F08051816000BF804800688049B0FBE7
 :1013C000F1F0401C009002E00098401E0090009850
-:1013D0000028F9D1206804F084FC48B9606D40F021
+:1013D0000028F9D1206804F07EFC48B9606D40F027
 :1013E00010006065A06D40F00100A0654FF001099C
-:1013F000206804F07BFC0646606D00F010000028B9
+:1013F000206804F075FC0646606D00F010000028BF
 :101400007ED1002EFCD1606D20F4807040F002008F
-:101410006065206804F05BFC78BB6A4920688842FC
+:101410006065206804F055FC78BB6A492068884202
 :1014200003D069492068884201D1684800E06848D3
-:101430006649884209D1634804F049FC8246624803
-:1014400004F045FC4AEA000002E0624804F03FFC78
+:101430006649884209D1634804F043FC8246624809
+:1014400004F03FFC4AEA000002E0624804F039FC84
 :1014500098B95C4B22689A4203D05B4B22689A424F
 :1014600001D15A4A00E05A4A10466168826822F463
 :101470007C120A43826000BF00BF00F03DFA41F2D7
@@ -333,7 +333,7 @@
 :1014B000217F40EA0145207F012803D1208C401E76
 :1014C00045EA4045606A28B1A08C00F47870A16AB2
 :1014D000084305432068C0683F4908402843216805
-:1014E000C860206804F002FC8046206804F0EAFB33
+:1014E000C860206804F0FCFB8046206804F0E4FB40
 :1014F0000746B8F1000F3BD1D7BB207DE16A00E081
 :1015000050E041EA80352068C06844F20301884316
 :1015100028432168C86094F83800012817D1606A10
@@ -346,14 +346,14 @@
 :10158000491E08432168086305E02068006B20F0CD
 :101590000F0021680863606D20F0020040F0010038
 :1015A000606505E0606D40F0100060654FF0010976
-:1015B0004846D8E6C0FFFF5FC0FFFF7F5C00002405
+:1015B0004846D8E6C0FFFF5FC0FFFF7F540000240D
 :1015C000400D0300002002400021024000230240A1
 :1015D000006302580060025803C0F0FF1EF800FCD0
 :1015E00010B5B8B00446142132A8FEF7DCFEC021C5
 :1015F00002A8FEF7D8FE3049206888425AD14FF43D
 :1016000000210020CDE90210042004900921059159
 :101610000221069107910891C021099120210A9188
-:101620004FF440610B9100202B9002A801F07EFE48
+:101620004FF440610B9100202B9002A801F098FE2E
 :1016300008B1FFF734FB00BF2048006840F02000ED
 :101640001E4908600846006800F02000019000BFB5
 :1016500000BF00BF19480830006840F0010017497A
@@ -365,7 +365,7 @@
 :1016B00000F01EF838B010BD00200240D844025897
 :1016C000000002580008025870B5044600F01AF9EC
 :1016D00006462546681C10B104480078054400BF42
-:1016E00000F010F9801BA842FAD370BD5800002406
+:1016E00000F010F9801BA842FAD370BD500000240E
 :1016F000F8B502460B4600216F4DD7E001278F4019
 :101700001E6806EA0704002C72D01E7906F0030654
 :10171000012E04D01E7906F00306022E13D1906824
@@ -399,7 +399,7 @@
 :1018D000000C025800100258001402580018025858
 :1018E000001C025800200258002402580AB18161ED
 :1018F00001E00B048361704701480068000C7047E9
-:101900000010005C0148006870470000500000248F
+:101900000010005C01480068704700004800002497
 :10191000024692F8410020282DD100BF92F84000E5
 :10192000012801D102207047012082F8400000BF49
 :10193000242082F841001068006820F0010013683C
@@ -413,2684 +413,2645 @@
 :1019B0001068016821F4706141EA03211068016038
 :1019C0001068006840F0010014682060202082F850
 :1019D000410000BF002082F8400000BFDAE702208B
-:1019E000D8E7000010B504460CB9012010BD94F8EA
-:1019F000410028B9002084F84000204600F0D8F9C2
-:101A0000242084F841002068006820F0010021684B
-:101A10000860606820F07060216808612068806854
-:101A200020F4004021688860E068012805D1A068A2
-:101A300040F400402168886004E0A06840F404405D
-:101A400021688860E068022806D12068406840F478
-:101A500000602168486005E02068406820F400606C
-:101A6000216848602068406813490843216848603D
-:101A70002068C06820F400402168C860D4E90401EF
-:101A80000843A16940EA01202168C860D4E9070140
-:101A90000843216808602068006840F00100216860
-:101AA000086000206064202084F84100002020634A
-:101AB00084F8420000BF99E7008000022DE9F84356
-:101AC0000446894616461F46DDF8208094F84100FA
-:101AD000202873D100BF94F84000012802D10220D1
-:101AE000BDE8F883012084F8400000BFFFF70AFF3B
-:101AF000054619230122D1032046009503F0A8FED4
-:101B000008B10120ECE7222084F84100102084F87D
-:101B1000420000206064666267856063608DFF2814
-:101B20000CD9FF2020853C48009094F828204FF0E5
-:101B300080734946204603F06FFE0BE0608D2085E0
-:101B40003548009094F828204FF00073494620460D
-:101B500003F062FE3FE02A464146204603F0BAFE0B
-:101B600008B10120BCE72068406A616A0870606AB9
-:101B7000401C6062208D401E2085608D401E608567
-:101B8000608D40B3208D30BB43460022802120462B
-:101B9000009503F05DFE08B10120A1E7608DFF28EC
-:101BA0000DD9FF2020850020009094F828204FF0C8
-:101BB00080734946204603F02FFE0CE02AE0608D3A
-:101BC00020850020009094F828204FF000734946AB
-:101BD000204603F021FE608D0028BCD12A464146F4
-:101BE000204603F0D9FE08B1012079E720202168C2
-:101BF000C861206840680949084021684860202081
-:101C000084F84100002084F8420000BF84F84000BE
-:101C100000BF65E7022063E70024008000E800FEC3
-:101C20002DE9F84F04468A4617469846DDF8289075
-:101C300094F84100202878D100BF94F84000012892
-:101C400002D10220BDE8F88F012084F8400000BFD7
-:101C5000FFF758FE054619230122D10320460095BF
-:101C600003F0F6FD08B10120ECE7212084F84100E3
-:101C7000102084F84200002060646762A4F82A8083
-:101C80006063608DFF2804D9FF2020854FF08076A7
-:101C900003E0608D20854FF00076208DC0B1606A32
-:101CA000007821688862606A401C6062608D401E16
-:101CB0006085208D401E20853B48009094F82800C8
-:101CC000401CC2B233465146204603F0A5FD08E051
-:101CD0003548009094F8282033465146204603F0BA
-:101CE0009BFD3FE02A464946204603F085FE08B1A9
-:101CF0000120A7E7606A007821688862606A401C5A
-:101D00006062608D401E6085208D401E2085608D44
-:101D100040B3208D30BB4B460022802120460095E9
-:101D200003F096FD10B101208CE73AE0608DFF28AA
-:101D30000CD9FF2020850020009094F828204FF037
-:101D400080735146204603F067FD0BE0608D2085CF
-:101D50000020009094F828204FF000735146204650
-:101D600003F05AFD608D0028BCD12A464946204622
-:101D700003F012FE08B1012064E720202168C86149
-:101D8000206840680949084021684860202084F89C
-:101D90004100002084F8420000BF84F8400000BFEA
-:101DA00050E702204EE700000020008000E800FE1F
-:101DB00010B5B8B00446142132A8FEF7F4FAC021D9
-:101DC00002A8FEF7F0FA67492068884236D1082158
-:101DD0000020CDE90210239002A801F0A7FA08B173
-:101DE000FEF75DFF00BF6048006840F002005E49FA
-:101DF00008600846006800F00200019000BF00BFC4
-:101E00004FF4C070329012203390002034903590FF
-:101E10000420369032A95548FFF76AFC00BF5248AB
-:101E20000830006840F400104F4908310860084647
-:101E3000006800F40010019000BF91E04C49206858
-:101E4000884237D108200021CDE9020100202390EB
-:101E500002A801F06BFA08B1FEF721FF00BF42486B
-:101E6000006840F00200404908600846006800F041
-:101E70000200019000BF00BF4FF44060329012207A
-:101E800033900020349035900420369032A93748A2
-:101E9000FFF72EFC00BF34480830006840F4800093
-:101EA0003149083108600846006800F4800001905C
-:101EB00000BF55E02F492068884251D108210020F9
-:101EC000CDE90210239002A801F030FA08B1FEF724
-:101ED000E6FE00BF2448006840F004002249086084
-:101EE0000846006800F00400019000BF00BF00BF7A
-:101EF0000846006840F0010008600846006800F0ED
-:101F00000100019000BF00BF4FF40070329012201A
-:101F100033900020349035900420369032A9164832
-:101F2000FFF7E6FB4FF480703290122033900020D0
-:101F3000349035900420369032A91048FFF7D8FB32
-:101F400000BF09480830006840F400000649083125
-:101F500008600846006800F40000019000BF00BF60
-:101F600038B010BD00540040E0440258000402584C
-:101F700000580040005C0040000802580000025871
-:101F8000034800680349097808440149086070471C
-:101F9000500000245800002410B5032000F0A8F8D9
-:101FA00002F052FA10490968C1F303210F4A515C4B
-:101FB00001F01F0120FA01F40B48006800F00F0047
-:101FC0001146085C00F01F0024FA00F00849086080
-:101FD000084804600F2000F00FF808B1012010BD80
-:101FE00000F036F80020FAE71844025866BF0008EF
-:101FF000600000245C00002470B50446114800789D
-:1020000008B9012070BD0F4800784FF47A71B1FB18
-:10201000F0F00D490968B1FBF0F5284602F056FFD3
-:1020200008B10120EEE7102C07D200222146501EF5
-:1020300000F020F80548046001E00120E2E70020FC
-:10204000E0E70000580000245C0000245400002455
-:1020500008B500BF0648006840F002000449086067
-:102060000846006800F00200009000BF00BF08BDF5
-:10207000F44402582DE9F05F80460D46164605F0FF
-:1020800021FB074639462A46334601F00700C0F1D6
-:10209000070ABAF1040F02D94FF0040A01E0C0F1B7
-:1020A000070AD14600F1040ABAF1070F02D24FF035
-:1020B000000A01E0A0F1030AD4464FF0010A0AFA2F
-:1020C00009FAAAF1010A0AEA020A0AFA0CFA4FF01E
-:1020D000010B0BFA0CFBABF1010B0BEA030B4AEA09
-:1020E0000B042146404605F0F5FABDE8F09F0000DC
-:1020F00000BF00F00702064B19684FF6FF031940B6
-:10210000044B0B4343EA0221014B196000BF7047A7
-:102110000CED00E00000FA0570B5044615480068B3
-:10212000C0F3800048B91348006800F00700A042DF
-:1021300001D0012070BD0020FCE70E48006820F0AF
-:10214000070020430B490860FFF7DCFB054607E06A
-:10215000FFF7D8FB401BB0F57A7F01D90120E9E7F2
-:10216000044808380068C0F340300028F0D0002050
-:10217000E0E700000C480258F8B50446FFF7C2FB40
-:1021800006460CB90120F8BD206A402800D000BFE7
-:1021900094F8410038B9204600F046F841F2883101
-:1021A000204600F00FF92068006820F4F851A0687C
-:1021B000401E41EA002021680860A06C33460022DE
-:1021C00020210090204604F064F8054635BB2179B3
-:1021D000E06840EA0160E1690843216A0843216838
-:1021E00009680F4A1140084321680860208A616924
-:1021F00041EA0040A169084321684968094A114041
-:102200000843216848602068006840F001002168A8
-:10221000086000206064012084F841002846B2E78D
-:102220002FFFFF00FEF8E0FF10B5B8B00446142100
-:1022300032A8FEF7B8F8C02102A8FEF7B4F85A4950
-:10224000206888427ED14FF000710020CDE9021055
-:10225000159002A801F06AF808B1FEF720FD00BF52
-:102260005248006840F480405049086008460068C1
-:1022700000F48040019000BF00BF00BF4B480C300D
-:10228000006840F0100049490C31086008460068B9
-:1022900000F01000019000BF00BF00BF08460068BA
-:1022A00040F0010008600846006800F0010001905D
-:1022B00000BF00BF00BF0846006840F00200086091
-:1022C0000846006800F00200019000BF00BF00BF98
-:1022D0000846006840F0080008600846006800F002
-:1022E0000800019000BF00BF00BF0846006840F032
-:1022F000040008600846006800F00400019000BF78
-:1023000000BF04203290022033900020349035909A
-:102310000920369032A92648FFF7EAF902203290C8
-:1023200033900020349035900920369032A921480E
-:10233000FFF7DEF904203290022033900020349021
-:10234000359000E02EE00920369032A91A48FFF7B8
-:10235000CFF94FF400603290022033900020349087
-:1023600035900920369032A91448FFF7C1F94FF48F
-:102370008060329002203390002034903590092004
-:10238000369032A90E48FFF7B3F940203290022070
-:1023900033900020349035900A20369032A90648B8
-:1023A000FFF7A6F938B010BD00500052D4440258CF
-:1023B000001002580000025800040258000C025895
-:1023C000000802588164704710B501F0F3FF054919
-:1023D0000968C1F30211044A515C01F01F01C840B1
-:1023E00010BD00002044025866BF000870B50146C9
-:1023F000844D2D6805F00303824D2D68C5F305104B
-:10240000804D2D1D2D6805F001047E4D0C352D6885
-:10241000C5F3CC0515FB04F501EE105AB8EE411AD0
-:10242000F0EE410A00286FD023B1012B4ED0022BD1
-:102430006BD16BE0734D283D2D68C5F340153DB35E
-:10244000704D283D2D68C5F3C1066F4D25FA06F283
-:1024500001EE102AF8EE411A01EE100AB8EE411A08
-:1024600081EE812A9FED691AC0EE811A654D08350B
-:102470002D68C5F3080501EE105AB8EE411A31EE89
-:10248000811AF7EE001A31EE211A22EE010A1CE041
-:1024900001EE100AB8EE411ADFED5D1A81EE812AD5
-:1024A0009FED5A1AC0EE811A564D08352D68C5F3B6
-:1024B000080501EE105AB8EE411A31EE811AF7EE16
-:1024C000001A31EE211A22EE010A5BE001EE100A39
-:1024D000B8EE411ADFED4F1A81EE812A9FED4B1ABB
-:1024E000C0EE811A474D08352D68C5F3080501EE89
-:1024F000105AB8EE411A31EE811AF7EE001A31EE99
-:10250000211A22EE010A3DE077E01DE001EE100AFB
-:10251000B8EE411A9FED402AC2EE011A9FED3B1A18
-:1025200080EE812A374D08352D68C5F3080501EE88
-:10253000105AB8EE411A32EE011AB7EE002A31EE07
-:10254000021A21EE810A1DE001EE100AB8EE411ACE
-:10255000DFED2F1A81EE812A9FED2C1AC0EE811A31
-:10256000284D08352D68C5F3080501EE105AB8EE60
-:10257000411A31EE811AF7EE001A31EE211A22EEDD
-:10258000010A00BF00BF1F4D08352D68C5F3462561
-:1025900001EE105AB8EE411AF7EE001A31EE211A88
-:1025A000C0EE011ABCEEE11A81ED001A154D083596
-:1025B0002D68C5F3064501EE105AB8EE411AF7EE44
-:1025C000001A31EE211AC0EE011ABCEEE11A81EDBB
-:1025D000011A0C4D08352D68C5F3066501EE105A39
-:1025E000B8EE411AF7EE001A31EE211AC0EE011AC8
-:1025F000BCEEE11A81ED021A03E000250D604D608A
-:102600008D6070BD284402580090D0030000004641
-:102610000024744C0024744A20BCBE4B70B50146A3
-:10262000844D2D6805F00303824D2D68C5F30530F8
-:10263000804D2D1D2D68C5F300147E4D14352D6879
-:10264000C5F3CC0515FB04F501EE105AB8EE411A9E
-:10265000F0EE410A00286FD023B1012B4ED0022B9F
-:102660006BD16BE0734D283D2D68C5F340153DB32C
-:10267000704D283D2D68C5F3C1066F4D25FA06F251
-:1026800001EE102AF8EE411A01EE100AB8EE411AD6
-:1026900081EE812A9FED691AC0EE811A654D1035D1
-:1026A0002D68C5F3080501EE105AB8EE411A31EE57
-:1026B000811AF7EE001A31EE211A22EE010A1CE00F
-:1026C00001EE100AB8EE411ADFED5D1A81EE812AA3
-:1026D0009FED5A1AC0EE811A564D10352D68C5F37C
-:1026E000080501EE105AB8EE411A31EE811AF7EEE4
-:1026F000001A31EE211A22EE010A5BE001EE100A07
-:10270000B8EE411ADFED4F1A81EE812A9FED4B1A88
-:10271000C0EE811A474D10352D68C5F3080501EE4E
-:10272000105AB8EE411A31EE811AF7EE001A31EE66
-:10273000211A22EE010A3DE077E01DE001EE100AC9
-:10274000B8EE411A9FED402AC2EE011A9FED3B1AE6
-:1027500080EE812A374D10352D68C5F3080501EE4E
-:10276000105AB8EE411A32EE011AB7EE002A31EED5
-:10277000021A21EE810A1DE001EE100AB8EE411A9C
-:10278000DFED301A81EE812A9FED2C1AC0EE811AFE
-:10279000284D10352D68C5F3080501EE105AB8EE26
-:1027A000411A31EE811AF7EE001A31EE211A22EEAB
-:1027B000010A00BF00BF1F4D10352D68C5F3462527
-:1027C00001EE105AB8EE411AF7EE001A31EE211A56
-:1027D000C0EE011ABCEEE11A81ED001A154D10355C
-:1027E0002D68C5F3064501EE105AB8EE411AF7EE12
-:1027F000001A31EE211AC0EE011ABCEEE11A81ED89
-:10280000011A0C4D10352D68C5F3066501EE105AFE
-:10281000B8EE411AF7EE001A31EE211AC0EE011A95
-:10282000BCEEE11A81ED021A03E000250D604D6057
-:102830008D6070BD284402580090D003000000460F
-:102840000024744C0024744A20BCBE4B70B5014671
-:10285000844D2D6805F00303824D2D68C5F30550A6
-:10286000804D2D1D2D68C5F300247E4D1C352D682F
-:10287000C5F3CC0515FB04F501EE105AB8EE411A6C
-:10288000F0EE410A00286FD023B1012B4ED0022B6D
-:102890006BD16BE0734D283D2D68C5F340153DB3FA
-:1028A000704D283D2D68C5F3C1066F4D25FA06F21F
-:1028B00001EE102AF8EE411A01EE100AB8EE411AA4
-:1028C00081EE812A9FED691AC0EE811A654D183597
-:1028D0002D68C5F3080501EE105AB8EE411A31EE25
-:1028E000811AF7EE001A31EE211A22EE010A1CE0DD
-:1028F00001EE100AB8EE411ADFED5D1A81EE812A71
-:102900009FED5A1AC0EE811A564D18352D68C5F341
-:10291000080501EE105AB8EE411A31EE811AF7EEB1
-:10292000001A31EE211A22EE010A5BE001EE100AD4
-:10293000B8EE411ADFED4F1A81EE812A9FED4B1A56
-:10294000C0EE811A474D18352D68C5F3080501EE14
-:10295000105AB8EE411A31EE811AF7EE001A31EE34
-:10296000211A22EE010A3DE077E01DE001EE100A97
-:10297000B8EE411A9FED402AC2EE011A9FED3B1AB4
-:1029800080EE812A374D18352D68C5F3080501EE14
-:10299000105AB8EE411A32EE011AB7EE002A31EEA3
-:1029A000021A21EE810A1DE001EE100AB8EE411A6A
-:1029B000DFED301A81EE812A9FED2C1AC0EE811ACC
-:1029C000284D18352D68C5F3080501EE105AB8EEEC
-:1029D000411A31EE811AF7EE001A31EE211A22EE79
-:1029E000010A00BF00BF1F4D18352D68C5F34625ED
-:1029F00001EE105AB8EE411AF7EE001A31EE211A24
-:102A0000C0EE011ABCEEE11A81ED001A154D183521
-:102A10002D68C5F3064501EE105AB8EE411AF7EEDF
-:102A2000001A31EE211AC0EE011ABCEEE11A81ED56
-:102A3000011A0C4D18352D68C5F3066501EE105AC4
-:102A4000B8EE411AF7EE001A31EE211AC0EE011A63
-:102A5000BCEEE11A81ED021A03E000250D604D6025
-:102A60008D6070BD284402580090D00300000046DD
-:102A70000024744C0024744A20BCBE4B2DE9F04362
-:102A800089B006460F464FF4807186EA010038434C
-:102A900070D1F748006800F00709B9F1050F65D259
-:102AA000DFE809F0031221623000F1485038006875
-:102AB00000F00070B0F1007F04D106A8FFF796FC8B
-:102AC000079C00E0002453E0E9485038006800F01B
-:102AD0000060B0F1006F04D103A8FFF79FFD039CD5
-:102AE00000E0002444E0E2485038006800F0005064
-:102AF000B0F1005F04D16846FFF7A8FE009C00E03B
-:102B0000002435E0DA48001F006800F04055D8483E
-:102B10005038006800F00400042809D145B9D448B1
-:102B200050380068C0F3C101D24820FA01F41AE01D
-:102B3000CF485038006800F48070B0F5807F04D131
-:102B4000B5F1805F01D1CC4C0DE0C9485038006828
-:102B500000F40030B0F5003F04D1B5F1005F01D1C1
-:102B6000C64C00E0002403E0C54C01E0002400BF97
-:102B7000D4E3FFE74FF4007186EA010038437AD1CD
-:102B8000BB48006800F4E079B9F1800F2CD006DC76
-:102B9000B9F1000F0AD0B9F1400F69D115E0B9F1D0
-:102BA000C00F63D0B9F5807F62D12CE0B0485038B7
-:102BB000006800F00070B0F1007F04D106A8FFF7B4
-:102BC00015FC079C00E0002454E0A9485038006838
-:102BD00000F00060B0F1006F04D103A8FFF71EFD04
-:102BE000039C00E0002445E0A1485038006800F054
-:102BF0000050B0F1005F04D16846FFF727FE009C4B
-:102C000000E0002436E09A48001F006800F04055BC
-:102C100097485038006800F00400042809D145B9ED
-:102C2000934850380068C0F3C101924820FA01F47B
-:102C30001BE08F485038006800F48070B0F5807F4A
-:102C400004D1B5F1805F01D18B4C0EE0884850383B
-:102C5000006800F40030B0F5003F05D1B5F1005F29
-:102C600002D1864C01E006E0002403E0844C01E040
-:102C7000002400BF52E34FF4806186EA010038432C
-:102C80007BD17B480830006800F46009B9F5800FFB
-:102C90002CD006DCB9F1000F0AD0B9F5001F69D1BC
-:102CA00015E0B9F5C00F63D0B9F5000F62D12CE083
-:102CB0006F485038006800F00070B0F1007F04D118
-:102CC00006A8FFF793FB079C00E0002454E0684847
-:102CD0005038006800F00060B0F1006F04D103A824
-:102CE000FFF79CFC039C00E0002445E0604850385E
-:102CF000006800F00050B0F1005F04D16846FFF7B3
-:102D0000A5FD009C00E0002436E05948001F006843
-:102D100000F0405556485038006800F00400042880
-:102D200009D145B9524850380068C0F3C101514833
-:102D300020FA01F41BE04E485038006800F480701F
-:102D4000B0F5807F04D1B5F1805F01D14A4C0EE02F
-:102D500047485038006800F40030B0F5003F05D116
-:102D6000B5F1005F02D1454C01E006E0002403E02C
-:102D7000434C01E0002400BFD0E24FF4006186EA3A
-:102D80000100384373D13A480830006800F0E06928
-:102D9000B9F1007F2CD006DCB9F1000F0AD0B9F1EF
-:102DA000807F75D115E0B9F1407F6FD0B9F1806FA8
-:102DB0006ED12CE02E485038006800F00070B0F161
-:102DC000007F04D106A8FFF711FB079C00E0002458
-:102DD00060E027485038006800F00060B0F1006FF4
-:102DE00004D103A8FFF71AFC039C00E0002451E083
-:102DF0001F485038006800F00050B0F1005F04D167
-:102E00006846FFF723FD009C00E0002442E01848DC
-:102E1000001F006800F0405515485038006800F069
-:102E20000400042809D145B9114850380068C0F39E
-:102E3000C101104820FA01F427E00D48503800681D
-:102E400000F48070B0F5807F04D1B5F1805F01D1CE
-:102E5000094C1AE006485038006800F40030B0F51C
-:102E6000003F11D1B5F1005F0ED1044C0DE012E02E
-:102E7000504402580090D00300093D0040787D0185
-:102E80000080BB0004E001E0002403E0F74C01E017
-:102E9000002400BF42E24FF4805186EA010038432B
-:102EA0007AD1F348006800F4E048B8F5005F2CD010
-:102EB00006DCB8F1000F0AD0B8F5805F69D115E0E3
-:102EC000B8F5405F63D0B8F5804F62D12CE0E84898
-:102ED0005038006800F00070B0F1007F04D106A8FF
-:102EE000FFF784FA079C00E0002454E0E0485038E3
-:102EF000006800F00060B0F1006F04D103A8FFF794
-:102F00008DFB039C00E0002445E0D9485038006860
-:102F100000F00050B0F1005F04D16846FFF796FC66
-:102F2000009C00E0002436E0D148001F006800F05B
-:102F30004055CF485038006800F00400042809D1FB
-:102F400045B9CB4850380068C0F3C101C94820FAE0
-:102F500001F41BE0C6485038006800F48070B0F5FA
-:102F6000807F04D1B5F1805F01D1C34C0EE0C04831
-:102F70005038006800F40030B0F5003F05D1B5F1DD
-:102F8000005F02D1BD4C01E006E0002403E0B74C35
-:102F900001E0002400BFC1E14FF4005186EA0100C6
-:102FA000384367D1B248006800F4E028B8F5403FE4
-:102FB00033D009DCB8F1000F0DD0B8F5803F0ED04A
-:102FC000B8F5003F53D119E0B8F5802F37D0B8F5E8
-:102FD000A02F4CD13FE001F013FA044649E0A44889
-:102FE0005038006800F00060B0F1006F04D103A811
-:102FF000FFF714FB049C00E000243AE09C485038A2
-:10300000006800F00050B0F1005F04D16846FFF79F
-:103010001DFC019C00E000242BE09548503800681E
-:1030200000F00400042808D1914850380068C0F32B
-:10303000C101904820FA01F400E0002419E08C4816
-:103040005038006800F48070B0F5807F01D18A4C60
-:1030500000E000240DE086485038006800F400309D
-:10306000B0F5003F01D1854C00E0002401E00024D0
-:1030700000BF53E14FF4002186EA0100384361D1DB
-:103080007B480830006800F44038B8F1000F06D0E3
-:10309000B8F5803F12D0B8F5003F50D11DE074481C
-:1030A0005038006800F00060B0F1006F04D103A850
-:1030B000FFF7B4FA039C00E0002442E06C4850386B
-:1030C000006800F00050B0F1005F04D16846FFF7DF
-:1030D000BDFB029C00E0002433E06548001F00684F
-:1030E00000F0405562485038006800F004000428A1
-:1030F00009D145B95E4850380068C0F3C1015D4848
-:1031000020FA01F41AE05A485038006800F4807040
-:10311000B0F5807F04D1B5F1805F01D1564C0DE050
-:1031200053485038006800F40030B0F5003F04D137
-:10313000B5F1005F01D1514C00E0002401E0002412
-:1031400000BFEBE04FF4803186EA010038432CD118
-:103150004748001F006800F48038B8F1000F03D022
-:10316000B8F5803F1ED10EE041485038006800F0AD
-:103170000070B0F1007F04D106A8FFF737F9079C73
-:1031800000E0002410E03A485038006800F0006089
-:10319000B0F1006F04D103A8FFF740FA059C00E0EE
-:1031A000002401E0002400BFB8E04FF4804186EA2B
-:1031B0000100384372D12E480830006800F0E04822
-:1031C000B8F1405F33D009DCB8F1000F0DD0B8F191
-:1031D000805F0ED0B8F1005F5DD119E0B8F1804F8B
-:1031E00037D0B8F1A04F56D14AE0FFF7EDF80446CA
-:1031F00053E01F485038006800F00060B0F1006FE5
-:1032000004D103A8FFF70AFA049C00E0002444E07C
-:1032100017485038006800F00050B0F1005F04D14A
-:103220006846FFF713FB019C00E0002435E01048DE
-:103230005038006800F00400042808D10C485038C9
-:103240000068C0F3C1010B4820FA01F400E000243B
-:1032500023E007485038006800F48070B0F5807FA4
-:1032600001D1054C00E0002417E017E00080BB000E
-:10327000504402580090D00300093D0040787D0181
-:103280002848006800F40030B0F5003F01D1264C1A
-:1032900000E0002401E0002400BF3FE04FF40041C3
-:1032A00086EA0100384338D11E485030006800F0EB
-:1032B0004058B8F1000F06D0B8F1805F0ED0B8F1D9
-:1032C000005F27D118E01748006800F40030B0F51F
-:1032D000003F01D1144C00E000241DE011480068BB
-:1032E00000F00070B0F1007F04D106A8FFF77EF86F
-:1032F000079C00E000240FE00A48006800F000602E
-:10330000B0F1006F04D103A8FFF788F9049C00E036
-:10331000002401E0002400BF00E00024204609B0A2
-:10332000BDE8F0830044025840787D012DE9F0416A
-:1033300004460025A8464FF00062D4E90010114071
-:103340000020134659404040014331D1A06E48B19E
-:10335000B0F5801F0DD0B0F5001F11D0B0F5401FA3
-:1033600016D114E0F948006840F40030F7490860CD
-:1033700010E0022104F1080002F0B2FF054609E066
-:10338000022104F1280003F05DF8054602E001E0A7
-:10339000012500BF00BF55B9EC482430006820F477
-:1033A0004010A16E0843E9492431086000E0A846B6
-:1033B0004FF48073D4E90010194000205940404078
-:1033C00001432ED1A06D05281BD2DFE800F0030ACF
-:1033D00011181900DD48006840F40030DB4908602E
-:1033E00011E0002104F1080002F07AFF05460AE02E
-:1033F000002104F1280003F025F8054603E002E06F
-:1034000001E0012500BF00BF55B9D0482430006855
-:1034100020F00700A16D0843CC492431086000E08A
-:10342000A8464FF40073D4E9001019400020594019
-:103430004040014334D1E06D802818D003DC40B116
-:1034400040281DD10CE0C02818D0B0F5807F17D1DE
-:1034500015E0BE48006840F40030BC49086011E047
-:10346000002104F1080002F03BFF05460AE00021BC
-:1034700004F1280002F0E6FF054603E002E001E067
-:10348000012500BF00BF55B9B0482430006820F4C2
-:10349000E070E16D0843AD492431086000E0A846C2
-:1034A0004FF48063D4E90010194000205940404097
-:1034B000014339D1D4F8A800B0F5800F1AD004DC4C
-:1034C00050B1B0F5001F1ED10DE0B0F5C00F18D0FF
-:1034D000B0F5000F17D115E09C48006840F40030AB
-:1034E0009A49086011E0002104F1080002F0F8FE9A
-:1034F00005460AE0002104F1280002F0A3FF05467A
-:1035000003E002E001E0012500BF00BF5DB98F4884
-:103510002C30006820F46000D4F8A81008438B49D0
-:103520002C31086000E0A8464FF40062D4E9001096
-:1035300011400020134659404040014339D1D4F88E
-:10354000AC00B0F1007F1AD004DC50B1B0F1807F44
-:103550001ED10DE0B0F1407F18D0B0F1806F17D1CF
-:1035600015E07A48006840F400307849086011E0BE
-:10357000002104F1080002F0B3FE05460AE0002134
-:1035800004F1280002F05EFF054603E002E001E0DE
-:10359000012500BF00BF5DB96C482C30006820F0E9
-:1035A000E060D4F8AC10084368492C31086000E0B2
-:1035B000A8464FF00073D4E900011840002158409C
-:1035C0004940084328D1E06CA8B1102804D0202835
-:1035D00009D0302810D10DE05C48006840F400307C
-:1035E0005A4908600AE0022104F1080002F078FE5E
-:1035F000054603E002E001E0012500BF00BF55B928
-:1036000052482030006820F03000E16C08434F49F8
-:103610002031086000E0A8464FF48053D4E9001040
-:103620001940002059404040014337D1206EB0F589
-:10363000005F1AD004DC50B1B0F5805F1ED10DE000
-:10364000B0F5405F18D0B0F5804F17D115E03F4876
-:10365000006840F400303D49086011E0002104F1A9
-:10366000080002F03DFE05460AE0002104F12800B2
-:1036700002F0E8FE054603E002E001E0012500BF9C
-:1036800000BF55B931482430006820F4E040216E75
-:1036900008432E492431086000E0A8464FF4005347
-:1036A000D4E900101940002059404040014335D171
-:1036B000606EB0F5403F1ED007DC68B1B0F5803FCA
-:1036C0000BD0B0F5003F19D10EE0B0F5802F13D02C
-:1036D000B0F5A02F12D110E012E0012104F1080092
-:1036E00002F0FEFD05460BE0012104F1280002F086
-:1036F000A9FE054604E003E002E001E0012500BF69
-:1037000000BF55B911482430006820F4E020616EF4
-:1037100008430E492431086000E0A8464FF4804376
-:10372000D4E900011840002158404940084337D1EE
-:10373000D4F8B000B0F1405F20D009DC78B1B0F12E
-:10374000805F0DD0B0F1005F1BD110E02C44025817
-:10375000B0F1804F13D0B0F1A04F12D110E012E0C1
-:10376000012104F1080002F0BBFD05460BE0012138
-:1037700004F1280002F066FE054604E003E002E0E2
-:1037800001E0012500BF00BF4DB9FE48006820F0F0
-:10379000E040D4F8B0100843FA49086000E0A846B9
-:1037A0004FF40042D4E90010114000201346594064
-:1037B0004040014329D1206FB0B1B0F1805F03D008
-:1037C000B0F1005F11D108E0EE482C38006840F4F9
-:1037D0000030EC492C39086009E0012104F10800AF
-:1037E00002F07EFD054602E001E0012500BF00BFBA
-:1037F00055B9E4480838006820F04050216F08436C
-:10380000E0490839086000E0A8464FF08072D4E92A
-:1038100000101140002013465940404001432AD176
-:10382000A06CB8B1012804D002280BD0032812D113
-:103830000FE0D4482C38006840F40030D1492C39CE
-:1038400008600AE0022104F1080002F049FD054683
-:1038500003E002E001E0012500BF00BF55B9C948FF
-:103860000C38006820F00300A16C0843C5490C39EE
-:10387000086000E0A8464FF48002D4E9000110403F
-:10388000002113465840494008437DD1BE48006896
-:1038900040F48070BC490860FEF734F8064606E044
-:1038A000FEF730F8801B642801D9032505E0B648EF
-:1038B000006800F480700028F2D000BF85BBB148DA
-:1038C0001830006800F44070B4F8B41001F440718E
-:1038D000884213D0AB481830006820F44077A948DC
-:1038E0001830006840F48030A64918310860084656
-:1038F000006820F48030086008460760D4F8B400FF
-:10390000B0F5807F15D1FDF7FDFF064609E0FDF714
-:10391000F9FF801B41F28831884202D9032507E074
-:1039200038E0984818300068C0F340000028EED016
-:1039300000BF55BB00BFB4F8B40000F44070B0F550
-:10394000407F0ED18F484838006820F47C518F4A60
-:10395000D4F8B400104041EA10108A494839086090
-:1039600007E088484838006820F47C508549483989
-:103970000860844818300068B4F8B410C1F30B0133
-:1039800008438049183101E005E001E0086002E0E9
-:10399000A84600E0A8460122D4E900011040002119
-:1039A000134658404940084330D1E06F18281AD0D8
-:1039B00005DC48B1082808D0102817D10CE02028D1
-:1039C00012D0282812D110E012E0012104F10800E1
-:1039D00002F086FC05460BE0012104F1280002F00C
-:1039E00031FD054604E003E002E001E0012500BFEF
-:1039F00000BF55B96348001F006820F03800E16F30
-:103A000008436049091F086000E0A8460222D4E983
-:103A1000000110400021134658404940084329D175
-:103A2000A06F062816D2DFE800F003040B1213146F
-:103A300012E0012104F1080002F052FC05460BE0FF
-:103A4000012104F1280002F0FDFC054604E003E03A
-:103A500002E001E0012500BF00BF55B94948001F41
-:103A6000006820F00700A16F08434649091F08605D
-:103A700000E0A8460423D4E9001019400020594072
-:103A80004040014329D1D4F89400062816D2DFE83B
-:103A900000F003040B12131412E0012104F10800DA
-:103AA00002F01EFC05460BE0012104F1280002F0A3
-:103AB000C9FC054604E003E002E001E0012500BF87
-:103AC00000BF4DB92F48006820F00700D4F89410CB
-:103AD00008432C49086000E0A8462023D4E90001EF
-:103AE0001840002158404940084337D1D4F890008D
-:103AF000B0F1405F1ED007DC68B1B0F1805F0BD041
-:103B0000B0F1005F19D10EE0B0F1804F13D0B0F1E9
-:103B1000A04F12D110E012E0002104F1080002F0E1
-:103B2000DFFB05460BE0022104F1280002F08AFCCD
-:103B3000054604E003E002E001E0012500BF00BF0C
-:103B40005DB91048001F006820F0E040D4F89010E4
-:103B500008430C49091F086000E0A8464023D4E947
-:103B60000010194000205940404001433CD1D4F896
-:103B70009C00B0F5406F25D00EDCA0B1B0F5806F91
-:103B800012D005E05844025800480258FFFCFF0FCD
-:103B9000B0F5006F19D10EE0B0F5805F13D0B0F52D
-:103BA000A05F12D110E012E0002104F1080002F041
-:103BB00097FB05460BE0022104F1280002F042FCCD
-:103BC000054604E003E002E001E0012500BF00BF7C
-:103BD0004DB9FE48006820F4E050D4F89C1008432A
-:103BE000FA49086000E0A8468023D4E90010194093
-:103BF000002059404040014335D1D4F8A000B0F531
-:103C0000C04F1ED007DC68B1B0F5005F0BD0B0F537
-:103C1000804F19D10EE0B0F5004F13D0B0F5204F12
-:103C200012D110E012E0002104F1080002F058FB6C
-:103C300005460BE0022104F1280002F003FC0546D2
-:103C400004E003E002E001E0012500BF00BF4DB940
-:103C5000DE48006820F46040D4F8A0100843DB4937
-:103C6000086000E0A8460823D4E9001019400020AD
-:103C700059404040014317D1D4F88400B0F5805F2B
-:103C800007D1022104F1280002F0DCFB08B14FF05B
-:103C90000108CE48001F006820F44050D4F884107A
-:103CA0000843CA49091F08601023D4E900101940CD
-:103CB000002059404040014315D1D4F89800B0F598
-:103CC000807F07D1022104F1280002F0BBFB08B17C
-:103CD0004FF00108BD48006820F44070D4F89810F7
-:103CE0000843BA4908604FF40022D4E900011040AB
-:103CF0000021134658404940084327D1D4F8A40076
-:103D000030B1B0F5803F0AD0B0F5003F0FD10DE0E3
-:103D1000002104F1080002F0E3FA054609E002215F
-:103D200004F1280002F08EFB054602E001E00125C7
-:103D300000BF00BF4DB9A548006820F44030D4F85A
-:103D4000A4100843A149086000E0A8464FF480236E
-:103D5000D4E90001184000215840494008432DD1C2
-:103D6000D4F88800B0F5801F06D0B0F5001F0CD045
-:103D7000B0F5401F11D10FE094482C38006840F492
-:103D8000003092492C39086009E0012104F1280033
-:103D900002F058FB054602E001E0012500BF00BF2C
-:103DA0005DB98A48001F006820F44010D4F88810DC
-:103DB00008438649091F086000E0A8464FF4803296
-:103DC000D4E90001104000211346584049400843FF
-:103DD00025D1206D18B1B0F5803F10D108E07B48A7
-:103DE0002C38006840F4003078492C39086008E02D
-:103DF000022104F1080002F073FA054601E00125F2
-:103E000000BF00BF55B971480C38006820F48030FD
-:103E1000216D08436D490C39086000E0A8464FF059
-:103E20000052D4E900101140002013465940404090
-:103E3000014307D1022104F1280002F003FB08B17D
-:103E40004FF001084FF40033D4E90001184000217D
-:103E500058404940084329D1D4F88000A0B1B0F5BA
-:103E6000807F06D0B0F5007F0CD0B0F5407F0CD13C
-:103E700009E056482C38006840F4003053492C398A
-:103E8000086004E003E002E001E0012500BF00BF9C
-:103E90005DB94E48001F006820F44070D4F88010CF
-:103EA00008434A49091F086000E0A8464FF4801201
-:103EB000D4E900101140002013465940404001430E
-:103EC00009D142480838006820F00040616F08437B
-:103ED0003E49083908604FF08052D4E90010114083
-:103EE000002013465940404001430AD13748483822
-:103EF000006820F48040D4F8B810084333494839AA
-:103F000008604FF40012D4E900101140002013465D
-:103F100059404040014309D12C480838006820F03E
-:103F20008070E16E08432949083908604FF08042EB
-:103F3000D4E900101140002013465940404001438D
-:103F400011D100BF21484838006820F400401F49C3
-:103F50004839086008460068D4F8BC1008431B497B
-:103F60004839086000BF4FF00042D4E9001011400A
-:103F70000020134659404040014309D113480C38F2
-:103F8000006820F04050616D084310490C3908600A
-:103F90004FF40002D4E900101140002013465940AC
-:103FA000404001430AD10948001F006820F4400046
-:103FB000D4F88C1008430549091F0860012300212B
-:103FC0006068184001224940504001E058440258BE
-:103FD000014306D104F1080002F082F9054605B15B
-:103FE000A846022200216068104049405040014329
-:103FF00007D1012104F1080002F072F9054605B16C
-:10400000A846042300206168194004224040514022
-:10401000084307D1022104F1080002F061F90546C6
-:1040200005B1A846082300216068184008224940CD
-:104030005040014306D104F1280002F003FA05467E
-:1040400005B1A84610220021606810404940504048
-:10405000014307D1012104F1280002F0F3F90546DC
-:1040600005B1A8462022002061681140404051401F
-:10407000084307D1022104F1280002F0E3F90546C4
-:1040800005B1A846B8F1000F02D10020BDE8F081CB
-:104090000120FBE72DE9F04104460D4614B901204B
-:1040A000BDE8F081BD48006800F00F00A8420ED2C4
-:1040B000BA48006820F00F002843B8490860084655
-:1040C000006800F00F00A84201D00120E8E7207846
-:1040D00000F0040004280ED1B1492069096801F0FC
-:1040E0007001884207D9AE48006820F0700021694D
-:1040F0000843AB490860207800F00800082811D177
-:10410000A749091D6069096801F07001884209D951
-:10411000A348001D006820F0700061690843A049B1
-:10412000091D0860207800F01000102811D19C496A
-:10413000091DA069096801F4E061884209D998481D
-:10414000001D006820F4E060A16908439449091D3E
-:104150000860207800F02000202811D19049083113
-:10416000E069096801F07001884209D98C4808307B
-:10417000006820F07000E16908438949083108604F
-:10418000207800F0020002280ED18549E068096815
-:1041900001F00F01884207D98148006820F00F0024
-:1041A000E16808437E490860207800F0010000289B
-:1041B00050D07B48006820F47060A16808437849BB
-:1041C00008606068022807D1754818380068C0F395
-:1041D0004040F8B9012063E76068032807D17048C0
-:1041E00018380068C0F34060A0B9012058E7606843
-:1041F000012807D16A4818380068C0F3002048B980
-:1042000001204DE7664818380068C0F3800008B9FF
-:10421000012045E762480838006820F0070061681F
-:1042200008435F4908390860FDF76CFB064608E063
-:10423000FDF768FB801B41F28831884201D90320D9
-:104240002EE757480838006800F038006168B0EB86
-:10425000C10FEDD1207800F0020002280ED15049A4
-:10426000E068096801F00F01884207D24C480068F5
-:1042700020F00F00E168084349490860474800689A
-:1042800000F00F00A8420ED94448006820F00F004B
-:104290002843424908600846006800F00F00A84221
-:1042A00001D00120FCE6207800F0040004280ED1A3
-:1042B0003B492069096801F07001884207D23848FB
-:1042C000006820F0700021690843354908602078B3
-:1042D00000F00800082811D13149091D60690968FA
-:1042E00001F07001884209D22D48001D006820F0BD
-:1042F0007000616908432A49091D0860207800F0B0
-:104300001000102811D12649091DA069096801F47F
-:10431000E061884209D22248001D006820F4E06074
-:10432000A16908431E49091D0860207800F020009B
-:10433000202811D11A490831E069096801F070019B
-:10434000884209D216480830006820F07000E16900
-:10435000084313490831086000F076F810490968ED
-:10436000C1F303210F4A515C01F01F0120FA01F74C
-:104370000B48006800F00F001146085C00F01F00B9
-:1043800027FA00F0084908600848076008480068F4
-:10439000FDF732FE8046404682E6000000200052D3
-:1043A0001844025866BF0008600000245C00002426
-:1043B0005400002410B500F047F80D490968C1F316
-:1043C00003210C4A515C01F01F0120FA01F4084856
-:1043D000006800F00F001146085C00F01F0024FA8E
-:1043E00000F005490860054804600846006810BDF3
-:1043F0001844025866BF0008600000245C000024D6
-:1044000000B5FFF7D7FF05490968C1F30211044A57
-:10441000515C01F01F01C84000BD00001C4402585F
-:1044200066BF000800B5FFF7C5FF05490968C1F37D
-:104430000221044A515C01F01F01C84000BD000088
-:104440001C44025866BF0008F0B5824E366806F07C
-:10445000380636B1082E15D0102E15D0182E7DD165
-:1044600014E07C4E103E3668C6F3401646B1794ED5
-:10447000103E3668C6F3C107774E26FA07F000E013
-:104480007548E5E07548E3E07548E1E0714E18369F
-:10449000366806F003046F4E18363668C6F3051109
-:1044A0006C4E1C36366806F001056A4E24363668B6
-:1044B000C6F3CC0616FB05F601EE106AB8EE410A0B
-:1044C000002971D024B1012C50D0022C6DD16DE0A7
-:1044D000604E103E3668C6F340163EB35D4E103E49
-:1044E0003668C6F3C1075C4E26FA07F301EE103AB0
-:1044F000F8EE411A01EE101AB8EE411A81EE812A47
-:104500009FED581AC0EE011A524E20363668C6F397
-:10451000080601EE106AB8EE411A31EE811AF7EE84
-:10452000001A31EE211A62EE010A1EE001EE101AA5
-:10453000B8EE411ADFED4C1A81EE812A9FED491A3F
-:10454000C0EE011A434E20363668C6F3080601EE67
-:10455000106AB8EE411A31EE811A00E076E0F7EE0B
-:10456000001A31EE211A62EE010A5BE001EE101A28
-:10457000B8EE411A9FED3D2AC2EE011A9FED391A9D
-:1045800080EE012A334E20363668C6F3080601EE67
-:10459000106AB8EE411A32EE011AB7EE002A31EE77
-:1045A000021A61EE810A3DE04EE01DE001EE101AB4
-:1045B000B8EE411ADFED2E1A81EE812A9FED291AFD
-:1045C000C0EE011A234E20363668C6F3080601EE07
-:1045D000106AB8EE411A31EE811AF7EE001A31EE88
-:1045E000211A62EE010A1DE001EE101AB8EE411A1E
-:1045F0009FED1E2AC2EE011A9FED1A1A80EE012AC3
-:10460000144E20363668C6F3080601EE106AB8EE7E
-:10461000411A32EE011AB7EE002A31EE021A61EEAB
-:10462000810A00BF00BF0B4E20363668C6F346260F
-:10463000721C01EE102AB8EE411AC0EE811ABCEECF
-:10464000E11A11EE100A00E0002001E0034800BF6B
-:1046500000BFF0BD104402580090D00300093D0097
-:1046600040787D01000000460024744C0024744A08
-:1046700020BCBE4B2DE9F047044614B90120BDE82B
-:10468000F087207800F00100002870D0FA48006818
-:1046900000F03808F8481830D0F80090B8F1100F42
-:1046A00006D0B8F1180F0FD109F0030002280BD182
-:1046B000F14810380068C0F3404000286AD06068B4
-:1046C000002867D10120DAE700BF6068B0F5803FBD
-:1046D00008D1E9481038006840F48030E6491039C4
-:1046E00008602EE0606868B9E3481038006820F47C
-:1046F0008030E149103908600846006820F48020C5
-:1047000008601EE06068B0F5A02F0DD1DA481038BF
-:10471000006840F48020D8491039086008460068D5
-:1047200040F4803008600CE0D3481038006820F472
-:104730008030D149103908600846006820F4802094
-:10474000086000BF606898B1FDF7DCF8054606E038
-:10475000FDF7D8F8401B642801D903208FE7C6482D
-:1047600010380068C0F340400028F1D012E012E099
-:10477000FDF7C8F8054606E0FDF7C4F8401B6428BD
-:1047800001D903207BE7BC4810380068C0F34040E3
-:104790000028F1D100BF207800F00200022874D177
-:1047A000B548006800F03808B3481830D0F80090D9
-:1047B000B8F1000F05D0B8F1180F56D109F0030079
-:1047C000D0BBAD4810380068C0F3800018B1E06875
-:1047D00008B9012053E7A8481038006820F01900F4
-:1047E000E1680843A44910390860FDF78BF80546D5
-:1047F00006E0FDF787F8401B022801D903203EE7B9
-:104800009D4810380068C0F380000028F1D000BF38
-:10481000FDF772F841F2030188421AD82069402856
-:104820000BD195480C38006820F47C3040F40030FF
-:1048300091490C39086017E017E08F480C38006880
-:1048400020F47C30216940EA01308B490C39086042
-:104850000AE089480C38006820F0FE40217C40EADC
-:10486000016085490C39086066E0E06888B38248D9
-:104870001038006820F01900E16808437E491039BB
-:104880000860FDF73FF8054607E056E0FDF73AF807
-:10489000401B022801D90320F1E677481038006850
-:1048A000C0F380000028F1D000BFFDF725F841F2E9
-:1048B000030188421AD8206940280BD16E480C3871
-:1048C000006820F47C3040F400306B490C390860FB
-:1048D00017E017E068480C38006820F47C30216944
-:1048E00040EA013064490C3908600AE062480C383B
-:1048F000006820F0FE40217C40EA01605E490C39EE
-:10490000086019E05C481038006820F001005A493E
-:1049100010390860FCF7F6FF054606E0FCF7F2FFE9
-:10492000401B022801D90320A9E65348103800682B
-:10493000C0F380000028F1D100BF207800F0100003
-:1049400010287CD14C48006800F038084A481830DC
-:10495000D0F80090B8F1080F06D0B8F1180F3DD18B
-:1049600009F00300012839D1434810380068C0F32A
-:10497000002020B1E069802801D001207FE600BF3F
-:10498000FCF7BAFF41F2030188421AD8206A2028B6
-:104990000AD139480C38006820F0F84040F08040D7
-:1049A00035490C39086018E033480C38006820F0AD
-:1049B000F84094F8201040EA81602F490C390860D3
-:1049C0000BE02D48001F006820F07C5094F8201068
-:1049D00040EA01602849091F086066E0E06978B391
-:1049E00025481038006840F08000234910390860DD
-:1049F000FCF788FF054606E0FCF784FF401B022811
-:104A000001D903203BE61C4810380068C0F30020A1
-:104A10000028F1D000BFFCF76FFF41F2030188428C
-:104A20001CD8206A20280CD113480C38006820F0CC
-:104A3000F84040F0804010490C3908601AE035E039
-:104A40001CE00D480C38006820F0F84094F8201065
-:104A500040EA816008490C3908600BE00648001FF5
-:104A6000006820F07C5094F8201040EA0160024970
-:104A7000091F086019E0000010440258FA48006855
-:104A800020F08000F8490860FCF73CFF054606E08E
-:104A9000FCF738FF401B022801D90320EFE5F2485C
-:104AA0000068C0F300200028F2D100BF207800F099
-:104AB0000800082836D16069D0B1EB48743000682E
-:104AC00040F00100E84974310860FCF71BFF05461F
-:104AD00006E0FCF717FF401B022801D90320CEE5B2
-:104AE000E14874300068C0F340000028F1D019E0BC
-:104AF000DD487430006820F00100DB497431086043
-:104B0000FCF700FF054606E0FCF7FCFE401B022810
-:104B100001D90320B3E5D44874300068C0F34000E5
-:104B20000028F1D1207800F02000202830D1A069A1
-:104B3000B8B1CD48006840F48050CB490860FCF71C
-:104B4000E1FE054606E0FCF7DDFE401B022801D928
-:104B5000032094E5C4480068C0F340300028F2D038
-:104B600016E0C148006820F48050BF490860FCF797
-:104B7000C9FE054606E0FCF7C5FE401B022801D928
-:104B800003207CE5B8480068C0F340300028F2D12B
-:104B9000207800F0040004287DD1B448006840F477
-:104BA0008070B2490860FCF7ADFE054606E0FCF7F0
-:104BB000A9FE401B642801D9032060E5AB480068CA
-:104BC00000F480700028F2D000BFA068012808D14E
-:104BD000A5487030006840F00100A34970310860BA
-:104BE0002DE0A06868B9A0487030006820F001008E
-:104BF0009D49703108600846006820F00400086094
-:104C00001DE0A06805280DD197487030006840F07D
-:104C100004009549703108600846006840F00100C2
-:104C200008600CE090487030006820F001008E4968
-:104C3000703108600846006820F00400086000BF7A
-:104C4000A068A0B1FCF75EFE054608E0FCF75AFE3E
-:104C5000401B41F28831884201D903200FE5824888
-:104C600070300068C0F340000028EFD013E0FCF77C
-:104C700049FE054608E0FCF745FE401B41F288313D
-:104C8000884201D90320FAE4774870300068C0F305
-:104C900040000028EFD1606A00287DD072481030B3
-:104CA000006800F03800182877D0606A022875D1B3
-:104CB0006D48006820F080706B490860FCF722FEA8
-:104CC000054606E0FCF71EFE401B022801D9032022
-:104CD000D5E465480068C0F340600028F2D100BF09
-:104CE000D4E90A1041EA00105F492831096840F20E
-:104CF000F332914308435C4928310860208E401EFE
-:104D0000C0F30800616B491E4FF47E4202EA412164
-:104D10000843218F491ED20102EA014108433C2188
-:104D2000095D491E120202EA016108434E49303111
-:104D3000086000BF081F006820F00100091F08601C
-:104D40004948343000684FF6F8718843A16C40EA56
-:104D5000C10045493431086043482C30006820F0D8
-:104D60000C00216C084340492C310860084600685B
-:104D700020F00200616C08433B492C310860084672
-:104D8000006840F4803008600846006840F4003055
-:104D900008600846006802E093E038E01FE040F455
-:104DA000802008600846006840F0010008602E4836
-:104DB000006840F080702C490860FCF7A3FD0546B0
-:104DC00006E0FCF79FFD401B022801D9032056E4B2
-:104DD00025480068C0F340600028F2D071E0224806
-:104DE000006820F0807020490860FCF78BFD0546C4
-:104DF00006E0FCF787FD401B022801D903203EE4B2
-:104E000019480068C0F340600028F2D159E0164804
-:104E100028300768144830300668606A012821D0BD
-:104E200007F00301A06A81421CD1C7F30511E06AB3
-:104E3000884217D1C6F30801206B401E814211D170
-:104E4000606B401EC6F3462188420BD1A06B401E0A
-:104E5000C6F30641884205D1E06B401EC6F30661E9
-:104E6000884205D001200AE4004402580048025854
-:104E700015480068C0F3CC07A06CB84221D0124896
-:104E80000838006820F001000F4908390860FCF775
-:104E900039FD054600BFFCF735FD401BFBD00A4835
-:104EA00000684FF6F8718843A16C40EAC1000649DA
-:104EB000086005480838006840F0010002490839D8
-:104EC000086000204AE400003444025870B50446EB
-:104ED0002546681EB0F1807F01D301200FE0681ED7
-:104EE0004FF0E02148610F214FF0FF3002F0F2FB5C
-:104EF00000204FF0E021886107200861002070BD8C
-:104F000010B50346002200BF93F83C00012801D1F0
-:104F1000022010BD012083F83C0000BF22F0FF00FA
-:104F2000CC6840EA040222F440708C6840EA040233
-:104F300022F480604C6840EA040222F400600C68AD
-:104F400040EA040222F480500C6940EA040222F490
-:104F500000504C6940EA040222F480408C6A40EA26
-:104F6000040222F470200C8B40EA04420F4C1868B3
-:104F7000A04203D00E4C1868A0420ED122F470005B
-:104F80008C8C40EA045222F08070CC6940EA040222
-:104F900022F000700C6A40EA04021868426400BF04
-:104FA000002083F83C0000BF00BFB2E700000140D2
-:104FB0000004014030B502460B4600BF92F83C00A9
-:104FC000012801D1022030BD012082F83C0000BF41
-:104FD000022082F83D001068416810688468214D05
-:104FE0001068A84203D0204D1068A84203D121F4D4
-:104FF00070015868014321F070011868014310687E
-:105000004160184D1068A8421BD01068B0F1804F65
-:1050100017D0164D1068A84213D0154D1068A8423D
-:105020000FD0144D1068A8420BD00F4D1068A84245
-:1050300007D0114D1068A84203D0104D1068A84247
-:1050400005D124F08004986804431068846001202E
-:1050500082F83D0000BF002082F83C0000BF00BF86
-:10506000B1E70000000001400004014000040040DE
-:1050700000080040000C00400018004000400140C3
-:1050800010B586B00446142101A8FBF78CF931490C
-:10509000206888421CD100BF2F48006840F01000F3
-:1050A0002D4908600846006800F01000009000BF1D
-:1050B00000BF4FF4D44001900220029000200390E2
-:1050C00004900120059001A92448FCF711FB3FE062
-:1050D0002349206888421BD100BF1F48006840F068
-:1050E00004001D4908600846006800F004000090B4
-:1050F00000BF00BFC020019002200290002003905A
-:1051000004900220059001A91648FCF7F1FA1FE06F
-:105110001549206888421BD100BF0F48006840F045
-:1051200008000D4908600846006800F0080000907B
-:1051300000BF00BF4FF440500190022002900020B9
-:10514000039004900220059001A90848FCF7D0FACA
-:1051500006B010BD00000140E044025800100258A3
-:10516000000400400008025800080040000C0258EB
-:105170002DE9F04104460D461646002700BF94F87D
-:105180003C00012802D10220BDE8F081012084F812
-:105190003C0000BF0C2E51D005DC4EB1042E1ED0B9
-:1051A000082E7AD133E0102E60D0142EF9D175E09C
-:1051B0002946206801F038FC2068806940F008002A
-:1051C000216888612068806920F004002168886176
-:1051D00020688069296908432168886178E0294648
-:1051E000206801F077FC2068806940F40060216845
-:1051F00088612068806920F4806021688861206867
-:105200008069296940EA01202168886160E02946B7
-:10521000206801F0B9FC2068C06940F008002168EE
-:10522000C8612068C06920F004002168C861206856
-:10523000C069296908432168C86149E02946206896
-:1052400001F0FCFC2068C06940F400602168C8617E
-:105250002068C06920F480602168C8612068C06946
-:10526000296940EA01202168C86131E029462068A7
-:1052700001F01EFD2068406D40F00800216848657F
-:105280002068406D20F00400216848652068406D6A
-:1052900029690843216848651AE017E02946206813
-:1052A00001F03EFD2068406D40F4006021684865D3
-:1052B0002068406D20F48060216848652068406D5A
-:1052C000296940EA01202168486501E0012700BF03
-:1052D00000BF00BF002084F83C0000BF384653E701
-:1052E00010B504460CB9012010BD94F83D0028B952
-:1052F000002084F83C00204600F02AF8022084F8C0
-:105300003D00211D206801F021FB012084F84800A8
-:1053100000BF84F83E0001213F2001554020015587
-:1053200041200155422001554320015500BF00BFD7
-:10533000012084F8440045200155462001554720AE
-:10534000015500BF012084F83D000020CCE700009B
-:1053500008B51D4A016891420DD100BF1B4909687B
-:1053600041F00101194A11601146096801F001017B
-:10537000009100BF27E0164A016891420FD100BF9B
-:1053800012490839096841F00201104A083A1160CF
-:105390001146096801F00201009100BF13E00D4AB7
-:1053A000016891420FD100BF08490839096841F0EE
-:1053B0000401064A083A11601146096801F0040127
-:1053C000009100BF00BF08BD00000140F04402583A
-:1053D0000004004000080040014600BF91F884002E
-:1053E000012801D102207047012081F8840000BF0C
-:1053F0002420C1F88800086802680868006820F066
-:1054000001000B68186022F000520020486608680E
-:1054100002602020C1F8880000BF002081F88400CD
-:1054200000BF00BFDFE770B504460D4600BF94F82B
-:105430008400012801D1022070BD012084F884007D
-:1054400000BF2420C4F8880020680668206800682F
-:1054500020F00100216808602068806820F060600A
-:10546000284321688860204601F092FC206806608D
-:105470002020C4F8880000BF002084F8840000BF0A
-:1054800000BFD9E770B504460D4600BF94F884000C
-:10549000012801D1022070BD012084F8840000BFE2
-:1054A0002420C4F88800206806682068006820F07E
-:1054B0000100216808602068806820F0604028436F
-:1054C00021688860204601F063FC20680660202087
-:1054D000C4F8880000BF002084F8840000BF00BF2B
-:1054E000D9E710B504460CB9012010BDA06900B180
-:1054F00000E000BFD4F8880028B9002084F88400B8
-:10550000204600F02BF82420C4F8880020680068AA
-:1055100020F0010021680860A06A10B1204601F067
-:1055200063FC204601F088FD012800D1DDE72068FA
-:10553000406820F49040216848602068806820F02E
-:105540002A00216888602068006840F00100216816
-:105550000860204601F0C4FCC7E7000010B5B8B0F1
-:105560000446142132A8FAF71EFFC02102A8FAF758
-:105570001AFF1E492068884235D102210020CDE95A
-:105580000210209002A8FDF7D1FE08B1FBF787FBBF
-:1055900000BF1748006840F400301549086008460D
-:1055A000006800F40030019000BF00BF00BF104849
-:1055B0000838006840F008000D49083908600846BE
-:1055C000006800F00800019000BF00BF602032902A
-:1055D000022033900020349035900720369032A975
-:1055E0000448FCF785F838B010BD000000440040C6
-:1055F000E8440258000C02582DE9F84F04460E46C4
-:1056000017469946D4F88800202854D106B117B916
-:105610000120BDE8F88F00205434E063212060634E
-:10562000FCF770F9824627806780543CA068B0F58B
-:10563000805F04D1206910B90025B04602E03546EC
-:105640004FF0000820E05346002280212046CDF88C
-:10565000009001F0B7FF20B12020C4F8880003209B
-:10566000D7E745B9B8F80000C0F3080021688862A0
-:1056700008F1020803E02878216888626D1CB4F8FC
-:105680005600401EA4F85600B4F856000028DAD19F
-:105690005346002240212046CDF8009001F092FFB1
-:1056A00020B12020C4F888000320B2E72020C4F8ED
-:1056B00088000020ADE70220ABE700BFFEE70168ED
-:1056C0008969C1F3400111B100210268916201684A
-:1056D000896901F0010129B90168896941F0010175
-:1056E00002689161704700002DE9F74F04460E46AD
-:1056F00000272068D0F818800025DDF8089008F011
-:105700001000102845D12168C86134E0701C90B3A6
-:10571000FCF7F8F8A0EB0900B04200D85EBB2068A7
-:10572000406800F4804A94F842B020688069C0F371
-:10573000C03070B1BAF5804F0BD0BBF1200F08D04C
-:105740002068406840F4804021684860FCF7DAF83F
-:10575000814609E0FCF7D6F8A0EB0900192803D927
-:1057600045F02005012705E020688069C0F340105E
-:105770000028EFD000BF20688069C0F3401008B94E
-:10578000002FC3D017B920202168C86145F0040557
-:1057900001272068D0F8188008F48070B0F5807F69
-:1057A00006D145F001054FF480702168C8610127DA
-:1057B00008F48060B0F5806F06D145F008054FF41D
-:1057C00080602168C861012708F40070B0F5007F8F
-:1057D00006D145F002054FF400702168C861012729
-:1057E000AFB12046FFF76BFF2068406809490840C9
-:1057F00021684860606C28436064202084F8410080
-:10580000002084F8420000BF84F8400000BF384602
-:10581000BDE8FE8F00E800FEF0B5059CC1F3090667
-:105820004FF47F0707EA02473E431E43264326F014
-:105830000045066876684FF4806707EA545767F0BA
-:10584000FC2747F4C047BE432E4307687E60F0BD87
-:105850002DE9F04104460D4617461E46DDF8188036
-:105860002BE0424631462046FFF73EFF10B10120B3
-:10587000BDE8F081701C00B3FCF744F8A0EB080011
-:10588000B04200D8CEB9206880692840A84201D132
-:10589000012000E00020B8420FD1606C40F02000F1
-:1058A0006064202084F84100002084F8420000BF9A
-:1058B00084F8400000BF0120DAE7206880692840B2
-:1058C000A84201D1012000E00020B842C9D0002048
-:1058D000CEE700002DE9F04104460E4617460025AC
-:1058E0004EE03A4631462046FFF7FEFE00B1012564
-:1058F00020688069C0F3401030B32DBB20688069F8
-:10590000C0F3800010B1208D00B1002520688069AF
-:10591000C0F30010C8B110202168C8610420606481
-:1059200020202168C861206840681A490840216821
-:105930004860202084F84100002084F8420000BF25
-:1059400084F8400000BF012501E000206064FBF7FF
-:10595000D9FFC01BB04200D896B98DB920688069C4
-:10596000C0F3800060B9606C40F0200060642020CB
-:1059700084F8410000BF002084F8400000BF0125EA
-:1059800020688069C0F3800008B9002DA9D028469E
-:10599000BDE8F08100E800FE70B504460D461646ED
-:1059A00022E0324629462046FFF79EFE08B101203C
-:1059B00070BDFBF7A7FF801BA84200D8A5B92068DF
-:1059C0008069C0F3401078B9606C40F020006064DA
-:1059D000202084F84100002084F8420000BF84F8B1
-:1059E000400000BF0120E3E720688069C0F3401059
-:1059F0000028D6D00020DBE770B504460D461646D9
-:105A000024E0324629462046FFF76EFE08B1012009
-:105A100070BD681CD0B1FBF775FF801BA84200D891
-:105A2000A5B920688069C0F3400078B9606C40F087
-:105A300020006064202084F84100002084F84200A7
-:105A400000BF84F8400000BF0120E1E720688069C2
-:105A5000C0F340000028D4D00020D9E7FFB581B0C2
-:105A6000044615461E463F480068012825D10020FF
-:105A700040EA4400C7B242F21070012302AA39463C
-:105A800000903948FCF7CCF828B138A001F0F2FDBD
-:105A9000012005B0F0BD012000EB4400C7B242F286
-:105AA00010702B463246394600902F48FCF706F816
-:105AB00010B133A001F0DEFD51E02A480068022851
-:105AC00024D1002040EA4400C7B242F21070012302
-:105AD00002AA394600902F48FCF7A2F820B123A073
-:105AE00001F0C8FD0120D4E7012000EB4400C7B25B
-:105AF00042F210702B463246394600902548FBF79B
-:105B0000DDFF10B11EA001F0B5FD28E015480068CA
-:105B1000032824D1002040EA4400C7B242F21070AA
-:105B2000012302AA394600901B48FCF779F820B1FE
-:105B30000EA001F09FFD0120ABE7012000EB440027
-:105B4000C7B242F210702B463246394600901248D6
-:105B5000FBF7B4FF10B10AA001F08CFD00BF00BF3D
-:105B600097E7000000000024D00000242B2B777260
-:105B70006974652062797465206661696C0D0A003C
-:105B80002D2D726561642062797465206661696C8F
-:105B90000D0A000024010024780100242DE9FF41B2
-:105BA00005460E4614461F463C480068012824D18D
-:105BB000002040EA4500C5B2002001900290039009
-:105BC0008DF8046000BF04E03A5C411C01AB5A54FC
-:105BD000401CA042F8DB42F21070631C01AA294667
-:105BE00000902F48FCF71CF830B12EA001F042FDC8
-:105BF000012004B0BDE8F0814DE02848006802288B
-:105C000022D1002040EA4500C5B200200190029058
-:105C100003908DF8046000BF04E03A5C411C01ABC6
-:105C20005A54401CA042F8DB42F21070631C01AAD7
-:105C3000294600902148FBF7F3FF20B119A001F09D
-:105C400019FD0120D5E726E014480068032822D179
-:105C5000002040EA4500C5B2002001900290039068
-:105C60008DF8046000BF04E03A5C411C01AB5A545B
-:105C7000401CA042F8DB42F21070631C01AA2946C6
-:105C800000900F48FBF7CCFF20B106A001F0F2FC1A
-:105C90000120AEE700BF0020ABE7000000000024B9
-:105CA000D00000242B2B7772697465206C656E2000
-:105CB00062797465206661696C0D0A002401002414
-:105CC0007801002401468868C0F3C000704701468F
-:105CD000886800F0010070470146886800F0010004
-:105CE000704701468868C0F30070704701468868B5
-:105CF000C0F38000704701468868C0F38000704799
-:105D000070B500F11404C1F3406504EB85031C6811
-:105D1000C1F304560725B540AC43C1F3045502FA5C
-:105D200005F52C431C6070BD826822F0E0720A43C6
-:105D30008260704700B58BB00020089009900A90EF
-:105D40001C2101A8FAF72FFB1E481F4908600020FC
-:105D5000486000211C488160C1600421016100216C
-:105D600001754175012181610021017741628162E4
-:105D7000C1620163416380F83810FBF7EBFA08B1A8
-:105D8000FAF78DFF0020089008A90F48FAF78AFF5C
-:105D900008B1FAF784FF0D48019006200290002018
-:105DA00003900B48049004200590002006908DF885
-:105DB0001D0001A90448FBF727F808B1FAF76FFFA7
-:105DC0000BB000BD002002406C0000240800900CC5
-:105DD0000000FF4700B587B0142102A8FAF7E3FAE4
-:105DE00000BF3948006840F0100037490860084695
-:105DF000006800F01000019000BF00BF00BF08461F
-:105E0000006840F0040008600846006800F00400E4
-:105E1000019000BF00BF00BF0846006840F080004E
-:105E200008600846006800F08000019000BF00BFD5
-:105E300000BF0846006840F001000860084600689E
-:105E400000F00100019000BF00BF00BF08460068DD
-:105E500040F0020008600846006800F0020001906F
-:105E600000BF00BF00BF0846006840F0080008609F
-:105E70000846006800F00800019000BF00BF002243
-:105E800042F202011148FBF731FD002208211048BF
-:105E9000FBF72CFD42F2020002900120039000204B
-:105EA0000490059002A90948FBF722FC0820029003
-:105EB0000120039000200490059002A90448FBF7FC
-:105EC00017FC07B000BD0000E0440258000802586B
-:105ED0000000025810B51248124908601248486084
-:105EE0000021104881600121C160002101614161F0
-:105EF0008161C1610162FBF775FD08B1FAF7CFFE60
-:105F000000210848FBF704FD08B1FAF7C8FE00219C
-:105F10000448FBF732FD08B1FAF7C1FE10BD0000DE
-:105F200000540040D0000024FFECC01010B512480F
-:105F30001249086012484860002110488160012120
-:105F4000C1600021016141618161C1610162FBF7B2
-:105F500049FD08B1FAF7A3FE00210848FBF7D8FC79
-:105F600008B1FAF79CFE00210448FBF706FD08B1D2
-:105F7000FAF795FE10BD00000058004024010024EF
-:105F8000FFECC01010B51248124908601248486072
-:105F90000021104881600121C1600021016141613F
-:105FA0008161C1610162FBF71DFD08B1FAF777FE5F
-:105FB00000210848FBF7ACFC08B1FAF770FE00219D
-:105FC0000448FBF7DAFC08B1FAF769FE10BD0000DF
-:105FD000005C004078010024FFECC01010B50B48B5
-:105FE0000B490860FF2048600121094881600021B9
-:105FF000C16001210161002141618161C1610162D2
-:10600000FCF7BAF808B1FAF74AFE10BD005000528A
-:10601000CC01002400B595B000201290139014908C
-:106020001C210BA8FAF7BFF92C216846FAF7BBF937
-:1060300032483349086000204860002130488160C0
-:106040004FF6FF71C1600021016141618161FFF77D
-:1060500047F908B1FAF723FE00201290139014902C
-:1060600012A92748FEF7A6FF08B1FAF718FE60202C
-:106070000B9000200C900D900E900F9010901190AE
-:1060800000220BA91E48FFF773F808B1FAF707FEC4
-:1060900004220BA91A48FFF76BF808B1FAF7FFFDC5
-:1060A00008220BA91648FFF763F808B1FAF7F7FDC5
-:1060B0000C220BA91248FFF75BF808B1FAF7EFFDC5
-:1060C0000020009001900290039004904FF4005043
-:1060D00005900020069007904FF000700890002077
-:1060E00009900A9069460648FEF70AFF08B1FAF7D8
-:1060F000D6FD0348FEF7C4FF15B000BD0000014007
-:106100001802002400B58BB00020089009900A9076
-:106110001C2101A8FAF747F91B481C490860002018
-:1061200048600021194881604FF6FF71C16000216D
-:1061300001618161FFF7D4F808B1FAF7B0FD0020E2
-:1061400008900A9008A91148FEF734FF08B1FAF741
-:10615000A6FD60200190002002900390059000228F
-:1061600001A90A48FFF704F808B1FAF798FD0422DC
-:1061700001A90648FEF7FCFF08B1FAF790FD0348B5
-:10618000FEF77EFF0BB000BD000400406402002457
-:1061900000B58BB00020089009900A901C2101A83E
-:1061A000FAF701F91B481C490860002048600021EB
-:1061B000194881604FF6FF71C16000210161816162
-:1061C000FFF78EF808B1FAF76AFD002008900A90F0
-:1061D00008A91148FEF7EEFE08B1FAF760FD60204D
-:1061E00001900020029003900590002201A90A4826
-:1061F000FEF7BEFF08B1FAF752FD042201A90648D6
-:10620000FEF7B6FF08B1FAF74AFD0348FEF738FF7C
-:106210000BB000BD00080040B002002410B51848C3
-:10622000184908604FF4E13048600021154881604A
-:10623000C16001610C21416100218161C161016284
-:10624000416200200F4988620846FFF74AF908B109
-:10625000FAF725FD00210B48FFF714F908B1FAF70A
-:106260001EFD00210748FFF7DEF808B1FAF717FD19
-:106270000448FFF7B1F808B1FAF711FD10BD0000AE
-:1062800000440040FC02002400BFFEE700BFFEE720
-:1062900070472DE9F04104460E4617469846069D84
-:1062A00012E0681C80B1FBF72DFBA0EB0800A842B0
-:1062B00000D84DB9042084F84100606C40F0010022
-:1062C00060640120BDE8F08120688068304008B13A
-:1062D000012000E00020B842E3D10020F2E70000F6
-:1062E0002DE9F04104460E4600275548006800F0AD
-:1062F0000300032802D10120BDE8F081504828386E
-:10630000006820F080604E4928390860FBF7FAFAEF
-:10631000054606E0FBF7F6FA401B022801D90320E8
-:10632000EAE7474828380068C0F3C0600028F1D188
-:1063300000BF4348006820F47C30216840EA013007
-:106340003F490860A088401EC0F30800A168491EAC
-:106350004FF47E4202EA41210843A189491ED2013D
-:1063600002EA01410843217C491E120202EA01614E
-:10637000084333491031086000BF3148001D0068F0
-:1063800020F0C000616908432D49091D08600846D6
-:10639000006820F02000A16908432949091D086010
-:1063A0000846006820F01000086025481430006896
-:1063B0004FF6F8718843E16940EAC1002049143181
-:1063C00008601F48001D006840F010001C49091DAE
-:1063D00008602EB90846006840F40020086012E00A
-:1063E000012E08D11648001D006840F480101449A1
-:1063F000091D086007E01248001D006840F4001005
-:106400000F49091D08600E482838006840F0806078
-:106410000B4928390860FBF775FA054606E0FBF7DB
-:1064200071FA401B022801D9032065E70448283887
-:106430000068C0F3C0600028F1D038465CE7000077
-:10644000284402582DE9F04104460E4600275548DD
-:10645000006800F00300032802D10120BDE8F081AC
-:1064600050482838006820F080504E49283908608C
-:10647000FBF748FA054606E0FBF744FA401B022802
-:1064800001D90320EAE7474828380068C0F3407084
-:106490000028F1D100BF4348006820F07C702188BB
-:1064A00040EA01503F490860A088401EC0F3080040
-:1064B000A168491E4FF47E4202EA41210843A189A6
-:1064C000491ED20102EA01410843217C491E120201
-:1064D00002EA0161084333491831086000BF3148BE
-:1064E000001D006820F44060616908432D49091DC2
-:1064F00008600846006820F40070A1690843294933
-:10650000091D08600846006820F48070086025486E
-:106510001C3000684FF6F8718843E16940EAC10019
-:1065200020491C3108601F48001D006840F480703D
-:106530001C49091D08602EB90846006840F4800017
-:10654000086012E0012E08D11648001D006840F4D2
-:1065500000001449091D086007E01248001D00688A
-:1065600040F080700F49091D08600E482838006807
-:1065700040F080500B4928390860FBF7C3F9054605
-:1065800006E0FBF7BFF9401B022801D9032065E7AD
-:10659000044828380068C0F340700028F1D038461D
-:1065A0005CE7000028440258F0B52DED048B8DB057
-:1065B00004460D461646B7EE000AF0EE409A9FEDEF
-:1065C000670AB0EE408A9FED650AF0EE408A9FEDC3
-:1065D000630AB0EE409A06A808A907AB02AACDE963
-:1065E000001009A90BA802F043FA074627B10120C1
-:1065F0000DB0BDEC048BF0BDBDF8200000F4807040
-:1066000000287CD09DED020AB8EEC00B9FED541B14
-:1066100080EE012BB7EEC20BF0EE409A9DED030A1F
-:10662000B8EEC00B9FED4E1B80EE012BB7EEC20BF8
-:10663000B0EE408A9DED040AB8EEC00B9FED481BFA
-:1066400080EE012BB7EEC20BF0EE408A9DED050AFD
-:10665000B8EEC00B9FED421B80EE012BB7EEC20BD4
-:10666000B0EE409AB8EE001A28EE011A21EE091A8F
-:10667000F0EE001A69EEA11A01EEA81AB7EEC11ADF
-:10668000B0EE410B01F03CF8B7EEC00BB7EEC00A1C
-:106690009FED351B20EE010BB7EEC00B84ED000A19
-:1066A000B8EE002A28EE022A22EE082AF0EE002A8E
-:1066B00068EEA22A02EEE82AF7EE002A32EE222A3B
-:1066C000B7EEC22AB0EE421BB0EE002A28EE822AB4
-:1066D00022EE092AF0EE002A69EEA22A02EE882AAA
-:1066E000B7EEC22AB0EE420B01F00EFAB7EEC00BC5
-:1066F000B7EEC00A9FED1C1B20EE010B00E02BE063
-:10670000B7EEC00B85ED000A29EEA92A08EE082A8B
-:1067100008EEE82A09EE492AB7EEC22AB0EE421B7B
-:1067200028EE282A09EE892AF0EE002A22EE222AF3
-:10673000B7EEC22AB0EE420B01F0E6F9B7EEC00B9D
-:10674000B7EEC00A9FED081B20EE010BB7EEC00BA1
-:1067500086ED000A00204BE7022049E70000000018
-:10676000000000000000D0416666666666A64C40E8
-:10677000704710B5FBF704FC10BD000000B59DB0DC
-:106780004C210AA8F9F70FFE202102A8F9F70BFE09
-:106790000220FBF7C1FC00BF002001902A480068DE
-:1067A00020F00100284908600846006800F0010058
-:1067B00001902648006840F440402449086008469B
-:1067C000006800F44040019000BF00BF00BF1F48B8
-:1067D000006800F40050B0F5005FF8D102200A9084
-:1067E00001200D9040200E90022013900021149162
-:1067F00004211591322116910221179118911991B6
-:106800000C211A9100211B911C910AA8FDF732FF5F
-:1068100008B1FAF744FA3F200290032003900020C9
-:1068200004900820059040200690079000010890F1
-:1068300040200990022102A8FDF72CFC08B1FAF7CC
-:106840002EFA1DB000BD00002C0400581848025854
-:106850003448006840F470003249086032480068EB
-:1068600000F00F00072806D22F48006820F00F0024
-:10687000C01D2D4908602D48006840F001002B49DB
-:10688000086000202949103108602848006828491C
-:106890000840264908602448006800F00F000728D7
-:1068A00006D92148006820F00F00C01D1E4908606D
-:1068B00000201E4918310860091D0860091D086084
-:1068C0001C481A49283108601B48091D08601B48EC
-:1068D000091D08600020091D08601848091D08608E
-:1068E0000020091D08601548091D08600020091DC9
-:1068F00008600E48006820F480200C4908600020E1
-:106900000A49603108600E4800686FF30F00B0F16B
-:10691000005F02D201200B49086043F2D2000A490D
-:106920000860704788ED00E00020005200440258E3
-:106930007FEDF6EA000202020000FF018002010181
-:106940000010005C088100510040005210B5026840
-:106950002D4B98420ED0B0F1804F0BD02B4B98426C
-:1069600008D02B4B984205D02A4B984202D02A4B94
-:10697000984203D122F070024B681A43224B98428E
-:1069800017D0B0F1804F14D0204B984211D0204B3B
-:1069900098420ED01F4B98420BD01F4B984208D004
-:1069A0001E4B984205D01E4B984202D01D4B984278
-:1069B00003D122F44072CB681A4322F080034C6961
-:1069C00043EA040202608B68C3620B6883620E4B69
-:1069D00098420BD0104B984208D0104B984205D0EB
-:1069E0000F4B984202D00F4B984201D10B690363C1
-:1069F00001234361036903F001031BB1036923F021
-:106A00000103036110BD00000000014000040040CC
-:106A100000080040000C004000040140004001401C
-:106A2000004401400048014030B5026A056A25F083
-:106A30000105056243688469204D2C4024F003045D
-:106A40000D682C4322F002028D682A431C4DA84297
-:106A500000D10FE01B4DA84200D10BE01A4DA84217
-:106A600000D107E0194DA84200D103E0184DA8421B
-:106A700006D100BF22F00802CD682A4322F00402AA
-:106A80000F4DA8420BD00F4DA84208D00E4DA84282
-:106A900005D00E4DA84202D00D4DA84207D123F4D7
-:106AA000807323F400734D692B438D692B4343603E
-:106AB00084614D684563026230BD00008FFFFEFFB8
-:106AC000000001400004014000400140004401403A
-:106AD0000048014030B5026A056A25F010050562DC
-:106AE00043688469224D2C4024F440740D6844EAC4
-:106AF000052422F020028D6842EA05121D4DA842AD
-:106B000000D10FE01C4DA84200D10BE01B4DA84264
-:106B100000D100BF1A4DA84200D100BF194DA842B4
-:106B200007D106E022F08002CD6842EA051222F089
-:106B30004002104DA8420BD00F4DA84208D00F4D77
-:106B4000A84205D00E4DA84202D00E4DA84209D150
-:106B500023F4806323F400634D6943EA85038D6960
-:106B600043EA8503436084614D688563026230BDFA
-:106B7000FF8FFFFE00000140000401400040014083
-:106B8000004401400048014030B5026A056A25F41E
-:106B9000807505624368C469224D2C4024F00304CB
-:106BA0000D682C4322F400728D6842EA05221E4DC6
-:106BB000A84200D10FE01D4DA84200D10BE01C4DB2
-:106BC000A84200D100BF1B4DA84200D100BF1A4D02
-:106BD000A84207D106E022F40062CD6842EA05220D
-:106BE00022F48062104DA8420BD0104DA84208D06C
-:106BF0000F4DA84205D00F4DA84202D00E4DA8421D
-:106C000009D123F4805323F400534D6943EA05135B
-:106C10008D6943EA05134360C4614D68C563026230
-:106C200030BD00008FFFFEFF000001400004014066
-:106C300000400140004401400048014030B5036A73
-:106C4000056A25F4805505624468C269124D2A40E0
-:106C500022F440720D6842EA052223F400538D6845
-:106C600043EA05330D4DA8420BD00D4DA84208D084
-:106C70000C4DA84205D00C4DA84202D00B4DA842A5
-:106C800004D124F480444D6944EA85144460C2610F
-:106C90004D680564036230BDFF8FFFFE00000140B8
-:106CA0000004014000400140004401400048014010
-:106CB00030B5026A056A25F4803505624368446D83
-:106CC000114D2C400D682C4322F400320D8942EA0C
-:106CD00005420E4DA8420BD00D4DA84208D00D4DD7
-:106CE000A84205D00C4DA84202D00C4DA84204D1B8
-:106CF00023F480334D6943EA0523436044654D68BE
-:106D00008565026230BD00008FFFFEFF000001407C
-:106D1000000401400040014000440140004801409F
-:106D200030B5026A056A25F4801505624368446D32
-:106D3000114D2C400D6844EA052422F400120D89FF
-:106D400042EA05520D4DA8420BD00D4DA84208D085
-:106D50000C4DA84205D00C4DA84202D00B4DA842C4
-:106D600004D123F480234D6943EA852343604465BD
-:106D70004D68C565026230BDFF8FFFFE0000014017
-:106D8000000401400040014000440140004801402F
-:106D900070B5456E2DB90125A0F86A50A0F868506D
-:106DA0001CE0102310240568AD68C5F34261056836
-:106DB000AD686A0F0A4DAD5C15FB04F5094EB65C73
-:106DC00095FBF6F5A0F86A50054D6D5C15FB03F5D3
-:106DD000044E765C95FBF6F5A0F8685070BD000097
-:106DE00056BF00085EBF000890F8281001F00801A7
-:106DF000082907D10168496821F40041826B1143D9
-:106E00000268516090F8281001F0010139B1016861
-:106E1000496821F40031C26A11430268516090F858
-:106E2000281001F00201022907D10168496821F404
-:106E30008031026B11430268516090F8281001F014
-:106E40000401042907D10168496821F48021426BBB
-:106E500011430268516090F8281001F010011029C8
-:106E600007D10168896821F48051C26B114302681F
-:106E7000916090F8281001F02001202907D10168C5
-:106E8000896821F40051026C11430268916090F806
-:106E9000281001F04001402913D10168496821F40C
-:106EA0008011426C114302685160416CB1F5801F42
-:106EB00007D10168496821F4C001826C114302685E
-:106EC000516090F8281001F08001802907D10168F5
-:106ED000496821F40021C26C114302685160704777
-:106EE00038B504460020C4F89000FAF70BFD0546BB
-:106EF0002068006800F00800082821D16FF07E406B
-:106F00002B4600224FF400110090204600F05AFB5F
-:106F1000B0B100BF00BF216851E8001F21F0800020
-:106F2000226842E800010029F5D100BF2020C4F802
-:106F3000880000BF002084F8840000BF032038BD13
-:106F40002068006800F00400042830D16FF07E4013
-:106F50002B4600224FF480010090204600F032FBC7
-:106F600028B300BF00BF216851E8001F21F49070D2
-:106F7000226842E800010029F5D100BF00BF00BF30
-:106F80002168083151E8001F21F001002168083113
-:106F900041E80002002AF3D100BF2020C4F88C0091
-:106FA00000BF002084F8840000BF0320C7E7202032
-:106FB000C4F88800C4F88C000020E066206700BF99
-:106FC00084F8840000BF00BFB9E7000000BF00BF25
-:106FD000026852E8002F22F49071036843E800121F
-:106FE000002AF5D100BF00BF00BF0268083252E896
-:106FF000002F104B02EA03010268083242E8001336
-:10700000002BF2D100BFC16E01290CD100BF00BF1F
-:10701000026852E8002F22F01001036843E80012D2
-:10702000002AF5D100BF2021C0F88C100021C166D4
-:1070300041677047FEFFFFEF2DE9F04F89B005462D
-:1070400000200890F8492868884200D100E000BF7D
-:107050002969A868084369690843E96940EA0108A1
-:1070600028680068F149084040EA0800296808607B
-:107070002868406820F44050E9680843296848605F
-:10708000D5F81880E8492868884202D0286A40EA82
-:10709000080828688068E649084040EA080029682E
-:1070A00088602868C06A20F00F00696A0843296870
-:1070B000C86200BFDF492868884220D1DE480068E6
-:1070C00000F03800182811D005DC48B1082809D094
-:1070D000102811D108E020280AD028280CD109E076
-:1070E00001240BE0042409E0082407E0102405E053
-:1070F000202403E0402401E0802400BFF8E0CF49D1
-:107100002868884219D1CC48006800F0070006289A
-:1071100010D2DFE800F0030507090B0D00240BE097
-:10712000042409E0082407E0102405E0202403E0FB
-:10713000402401E0802400BFDAE0C1492868884289
-:1071400019D1BD48006800F00700062810D2DFE81A
-:1071500000F0030507090B0D00240BE0042409E0EF
-:10716000082407E0102405E0202403E0402401E087
-:10717000802400BFBCE0B3492868884219D1AE48DA
-:10718000006800F00700062810D2DFE800F00305D1
-:1071900007090B0D00240BE0042409E0082407E094
-:1071A000102405E0202403E0402401E0802400BFF7
-:1071B0009EE0A5492868884219D19F48006800F0E0
-:1071C0000700062810D2DFE800F0030507090B0DC1
-:1071D00000240BE0042409E0082407E0102405E063
-:1071E000202403E0402401E0802400BF80E0974990
-:1071F0002868884220D19048006800F0380018289C
-:1072000011D005DC48B1082809D0102811D108E0B8
-:1072100020280AD028280CD109E001240BE00424FE
-:1072200009E0082407E0102405E0202403E04024BE
-:1072300001E0802400BF5BE085492868884219D1BD
-:107240007D48006800F00700062810D2DFE800F053
-:10725000030507090B0D00240BE0042409E00824B2
-:1072600007E0102405E0202403E0402401E080240E
-:1072700000BF3DE077492868884219D16E48006810
-:1072800000F00700062810D2DFE800F00305070928
-:107290000B0D00240BE0042409E0082407E010246F
-:1072A00005E0202403E0402401E0802400BF1FE02B
-:1072B0005D49286888421AD15F48001D006800F0C7
-:1072C0000700062810D2DFE800F0030507090B0DC0
-:1072D00002240BE0042409E0082407E0102405E060
-:1072E000202403E0402401E0802400BF00E080244B
-:1072F00000BF4D49286888427DD1102C1AD006DC89
-:10730000022C09D0042C0BD0082C29D10DE0202C04
-:1073100021D0402C24D120E0FBF756F8064623E08C
-:1073200005A8FBF77BF9069E1EE002A8FBF78EFA84
-:10733000039E19E0404854380068C0F3401040B143
-:107340003D4854380068C0F3C101434820FA01F6B3
-:1073500000E0414E08E0414E06E04FF4004603E0F5
-:1073600000260120089000BF00BF002E10D03C492D
-:10737000686A31F81000B6FBF0F9686800EB40006D
-:10738000484503D868680003484502D201200890A8
-:1073900003E13349686A31F810C062460023304681
-:1073A0001946F8F797FF4FF4807300228446ACFB30
-:1073B000030B01FB03B10CFB021C6968490803467F
-:1073C00059184CEB0200CDE90010D5F804C0624614
-:1073D000002308460199F8F77DFF0746B7F5407F7F
-:1073E00006D3B7F5801F03D22868C760D5E002E056
-:1073F00001200890D1E0E869B0F5004F7BD1082C5E
-:1074000039D005DC5CB1012C2CD0042C4CD12DE002
-:10741000102C35D0202C42D0402C45D141E0FCF737
-:10742000EFFF064644E00000000C0058F369FFCF70
-:10743000FFF4FF1100100140544402580044004082
-:1074400000480040004C0040005000400014014043
-:1074500000780040007C00400090D00300093D000F
-:107460003EBF0008FCF7DEFF064621E005A8FBF75B
-:10747000D5F8069E1CE002A8FBF7E8F9039E17E08A
-:107480004C480068C0F3401038B14A480068C0F367
-:10749000C101494820FA01F600E0474E08E0474E96
-:1074A00006E04FF4004603E000260120089000BFEC
-:1074B00000BFFEB14249686A31F81000B6FBF0F037
-:1074C0004000696800EB5100B0FBF1F7102F0FD3BB
-:1074D000B7F5803F0CD24FF6F07007EA000AC7F309
-:1074E00042004AEA000A2868C0F80CA055E002E011
-:1074F0000120089051E0082C1AD005DC5CB1012C69
-:107500000DD0042C2DD10EE0102C16D0202C23D021
-:10751000402C26D122E0FCF773FF064625E0FCF75D
-:1075200081FF064621E005A8FBF778F8069E1CE0DF
-:1075300002A8FBF78BF9039E17E01E480068C0F312
-:10754000401038B11B480068C0F3C1011A4820FA46
-:1075500001F600E0184E08E0184E06E04FF4004631
-:1075600003E000260120089000BF00BFAEB114491F
-:10757000686A31F81000B6FBF0F0696800EB510062
-:10758000B0FBF1F7102F06D3B7F5803F03D2B8B2A6
-:107590002968C86001E0012008900120A5F86A0070
-:1075A000A5F8680000206867A867089809B0BDE8DA
-:1075B000F08F0000004402580090D00300093D0005
-:1075C0003EBF00082DE9F04104460D461746984697
-:1075D000069E41E0701C00283ED0FAF793F9A0EB1C
-:1075E0000800B04200D816B90320BDE8F081206839
-:1075F000006800F0040070B3802D2DD0402D2BD0FA
-:107600002068C069C0F3C00078B108202168086212
-:107610002046FFF7DBFC0820C4F8900000BF0020E4
-:1076200084F8840000BF0120DFE72068C069C0F350
-:10763000C02080B14FF40060216808622046FFF747
-:10764000C5FC2020C4F8900000BF002084F884000E
-:1076500000BF0320C9E7FFE72068C0692840A842AF
-:1076600001D1012000E00020B842B3D00020BCE7E7
-:1076700000BFFEE70FB4054B10B503A9044A0298FA
-:1076800000F056FC10BC5DF814FB00005D93000890
-:107690006400002403B401984100009850EAC1201E
-:1076A00018BF04204A0D18BF40F0010040F2FF72DD
-:1076B000B2EB515F08BF40F00200012808BF05206F
-:1076C00002B0704702480068C0F302207047000013
-:1076D0000CED00E010B5002804DB0A07130E054A84
-:1076E000135406E00A07140E034A00F00F031B1F91
-:1076F000D45410BD00E400E018ED00E000000000EC
-:1077000070B56B482DED020B2DED0A8B82B00D9DEF
-:1077100025F000449FED68BB9FED699B84422EDB02
-:10772000A4F140510C98A1F17F6108430FD0664845
-:10773000844202DC18D10C98B0B19DED0C0B02B064
-:10774000BDEC0A8B02B0BDE8704000F0F9BA9DEDC7
-:107750000C0B9DED0C1B20EE0B0B01EE090B02B088
-:10776000BDEC0A8B02B070BD012000F019FB02B025
-:10777000BDEC0A8B02B0BDE8704000F0E9BA534896
-:107780009FED538B844230DA9DED0C0BB4F1795FA1
-:107790000ADA51EC100BFFF77DFF042808BF00F058
-:1077A000E3FA9DED0C0BDAE720EE009B4A48062138
-:1077B000B0EE490B784400F08BFA20EE09AB474855
-:1077C000B0EE490B0421784400F082FA09EE008BF8
-:1077D0008AEE080B8DED000B9DED0C0B9DED0C1B47
-:1077E0009DED002B01EE020BB9E79DED0C0B51EC6A
-:1077F000100B01F0A7FD41EC100B9FED391B3A482F
-:1078000038EE400B06218DED000B20EE01ABB0EE03
-:107810004A0B784400F05CFA20EE0ACB3348B0EE15
-:107820004A0B0421784400F053FA0AEE008B51EC25
-:107830001A0B03F029FD41EC110B2D489FED2E2B67
-:10784000A0420EDC8CEE080B8DED000B9DED003B95
-:10785000B0EE410B01EE030B10EE029B3BEE490B29
-:1078600021E08DED001B002000909DED000B9DEDB3
-:10787000003B00EE43AB31EE000B21EE021B8AEE23
-:10788000003B8CEE080B03EE429B9DED003B11EE9E
-:10789000009B9FED1B1BB0EE410B03EE420B39EE3C
-:1078A000400B31EE400B002DD8BFB1EE400B56E738
-:1078B0000000F03F00000000182D4454FB21F93F68
-:1078C000075C143326A6913C0000F07F0000E03FE7
-:1078D000000000000000F03FC0470000DE4700004D
-:1078E000000000000000E03F624700008047000009
-:1078F0003333EF3F000000000000000000000040B4
-:10790000182D4454FB21E93F70B565482DED020B5D
-:107910002DED048B059D25F00044A04218DC614844
-:10792000844202DC0AD1049840B19DED040BBDEC09
-:10793000048B02B0BDE8704000F002BA002DCCBF4D
-:107940009FED590B9FED5A0BBDEC048B02B070BD3F
-:107950005948A04215DD5948A042D8BF4FF0FF3426
-:1079600055DD9DED040B51EC100BFFF793FE042841
-:1079700008BF00F0F9F99DED040BBDEC048B02B0DB
-:1079800070BD9DED040B51EC100B01F0DBFCCDE95B
-:1079900004014B489FED4C0BA0421CDD4C48A0421B
-:1079A0000BDD9DED042B00249FED4B1B12EE010B14
-:1079B00032EE011B80EE012B27E09DED041B9DEDB7
-:1079C000042B012431EE401B32EE000B81EE002B24
-:1079D0008DED042B1BE04248A0420FDD9DED042BF2
-:1079E00002249FED411B9DED043B32EE412B03EE43
-:1079F000010B82EE001B8DED041B08E09DED040BD6
-:107A00009FED3B1B032481EE002B8DED042B9DEDA0
-:107A1000040B3948062120EE009B29EE098BB0EEBD
-:107A2000480B784400F054F920EE099B3348B0EE3F
-:107A3000480B0521784400F04BF920EE080B002C90
-:107A40000BDA9DED042B39EE001B9DED040BBDEC14
-:107A5000048B02B002EE410B70BD2948784439EE28
-:107A6000000B00EBC4009DED042B90ED001B25489E
-:107A700012EE001B9DED040B31EE400B784400EB41
-:107A8000C400002D90ED001B31EE400BB8BFB1EEED
-:107A9000400BBDEC048B02B070BD00000000000084
-:107AA000000010440000F07F182D4454FB21F93FE2
-:107AB000182D4454FB21F9BF0000DC3F0000203E9C
-:107AC0000000F33F00000000000000000000F03F55
-:107AD0000000E63F00000000000000000000004041
-:107AE0000080034000000000000000000000F83F9C
-:107AF000000000000000F0BF0A460000D045000072
-:107B0000884500004845000070B5614E2DED040B1E
-:107B10002DED048B82B0DDF824C0DDE907235C4243
-:107B20002CF000411C4341EAD474069D22F0004031
-:107B3000B44205D86C422C4340EAD474B4420BD909
-:107B40009DED081B9DED060B02B0BDEC048B04B04F
-:107B5000BDE8704000F0F7B8ACF14054A4F17F6488
-:107B60001C430BD0022404EAAC7444EAD2740543EB
-:107B70009FED498B9FED4A2B0DD016E09DED060B36
-:107B800051EC100B00F0B8FD41EC100B02B0BDEC55
-:107B9000048B04B070BD002C14BF012C9DED060BAE
-:107BA000F4D0022C2ED0032C2FD00B439FED3E1B84
-:107BB0009FED3F0B0AD0B1421DD1B04209D121F057
-:107BC000804120F080400991079014E0002ADDDA1E
-:107BD00015E0394B7B44002C08BF93ED000BD5D04A
-:107BE000012C04BF93ED000BB1EE400BCED0022C64
-:107BF00008D0032C09D0B0420AD1002AC6DAB0EE70
-:107C0000410BC3E7B0EE480BC0E7B0EE420BBDE757
-:107C1000401A00159FED2A9B3C28C8BF8DED000B34
-:107C200015DCBCF1000FBCBF10F13C0F8DED009BCB
-:107C30000DDB9DED061B9DED082B81EE020B51EC3B
-:107C4000100B01F07FFB00F057FDCDE9000194B16E
-:107C5000012C0CD09DED001B9FED1B0B022C31EE77
-:107C6000400B0CBF38EE400B30EE480B8EE701980E
-:107C700080F0004001909DED000BB4EE490BF1EE59
-:107C800010FA04BF022000F08BF89DED000B7DE799
-:107C90000000F07F00000000182D4454FB21094033
-:107CA000182D4454FB2109C0182D4454FB21F9BF61
-:107CB000182D4454FB21F93F8844000000000000C7
-:107CC0000000000000000000075C143326A6A13C61
-:107CD000491E00EBC102B0EE401B92ED000B31F0EB
-:107CE00006020DD0491E00EBC102B0EE403B92ED02
-:107CF000002B31F00602B0EE420B03EE010BF1D186
-:107D0000022914D004290AD0062918BF704790ED23
-:107D10000A2B00EE012B90ED080B02EE010B90ED0B
-:107D2000062B00EE012B90ED040B02EE010B90ED03
-:107D3000022B00EE012B90ED000B02EE010B7047C1
-:107D400030EE000B704730EE010B70470000000072
-:107D50009FED031B81EE010B704700000000000047
-:107D600000000000000000009FED030B20EE000B60
-:107D7000704700000000000000000000000000103C
-:107D800002E008C8121F08C1002AFAD170477047E4
-:107D9000002001E001C1121F002AFBD17047000042
-:107DA0000149086070470000680000242DE9FF5F6A
-:107DB00082B00021DDE90430020DDDF840B003435C
-:107DC00018D044F61050A2F2FF3242431514119815
-:107DD00001281FD0A5EB0B00401C5FEA000A4FF002
-:107DE00000064E4FDFF83891B046504615D5CAF11F
-:107DF000000413E0119801244AA3012801D16FEA7D
-:107E00000B010298119AC0E90031C0E9024206B0A4
-:107E1000BDE8F09FCBF10000DFE704460021404AB7
-:107E2000491842EB0450CDE9001012E0E00707D0FA
-:107E300032463B4640464946F8F7A9FB804689460C
-:107E400032463B4610461946F8F7A1FB06460F4658
-:107E50006410002CEAD1DDE90401DDE90023BAF168
-:107E6000000F06DAF8F793FB42464B46F8F78FFB14
-:107E700005E0F8F7FEFB42464B46F8F7FAFB0446EE
-:107E80000E460022284BF8F77BFC03D84FF0FF305A
-:107E9000014607E00022254B20463146F8F7D0FA8C
-:107EA000F8F756FC102409E0002C0ADB0A22002314
-:107EB000F8F710FA039B30321A55641E50EA01029B
-:107EC000F2D1641C039AC4F111031444119A012ADB
-:107ED00003D0012208430DD10AE0084304D000205A
-:107EE0004FF0110B119072E7A3EB0B056D1E0DE027
-:107EF0005B4504DD4FF0000205F1010504E003DA03
-:107F00004FF00002A5F10105002AECD0029811996A
-:107F1000C0E90231C0E9004579E7000000001440E3
-:107F20000000F03F300000000000F0430000E03FA0
-:107F30002DE9FF4F95B09A46884606460025EEE1AA
-:107F4000252877D100242746F94A0121039400E02F
-:107F5000044316F8013F203B01FA03F01042F7D129
-:107F600030782A2811D06FF02F033078A0F130023A
-:107F7000092A16D8039A44F0020402EB820203EBAA
-:107F800042021044761C0390EFE758F8042B03924A
-:107F9000002A03DA504244F40054039044F00204EF
-:107FA000761C30782E2816D116F8010F44F0040400
-:107FB0002A280DD06FF02F023078A0F13003092B62
-:107FC00009D807EB870302EB4303C718761CF3E7D6
-:107FD00058F8047B761C30786C280FD006DC4C28CF
-:107FE00017D068280DD06A2814D104E0742810D066
-:107FF0007A280FD10DE044F400140AE044F4801410
-:1080000001E044F440147278824202D104F58014F5
-:10801000761C761C307866280BD013DC582877D075
-:1080200009DC002875D04528F6D04628F4D047282A
-:108030001AD193E118E0632835D0642879D06528F7
-:1080400012D18BE1702873D008DC6728F1D0692841
-:108050006FD06E280DD06F2806D1ACE073282CD0DD
-:10806000752874D0782853D05246179990476D1CC4
-:1080700054E1C4F30250022809D003280DD0D8F8E7
-:10808000001004280DD00D6008F1040846E1D8F86E
-:108090000010EA17C1E90052F6E7D8F800100D8089
-:1080A000F2E70D70F0E718F8041B8DF800100020BF
-:1080B0008DF80100EB46012003E058F804BB4FF0B7
-:1080C000FF3061074FF0000102D40DE009F101011A
-:1080D0008946B9420FDA8145F8DB1BF809100029FF
-:1080E000F4D108E009F1010189468142FADB1BF86D
-:1080F00009100029F6D103985346A0EB0907214641
-:108100003846179A00F080FA284400EB090507E08A
-:1081100044E008E10DE01BF8010B52461799904727
-:10812000B9F10109F7D2534621463846179AF2E0D1
-:1081300039E00A21C4F302524FF0000B0091022AE9
-:1081400006D058F8040BC117032A09D00AE023E02F
-:1081500008F1070020F00702F2E80201904605E06E
-:1081600000B2C117042A01D140B2C117002906DAB2
-:108170000A460021404261EB02012D2202E0220565
-:1081800004D52B228DF80420012203E0E20701D060
-:108190002022F7E7914657E00A2100E010214FF036
-:1081A000000B00910BE010214FF0000B44F0040491
-:1081B0000827009103E008204FF0000B0090C4F363
-:1081C0000252022A05D058F8040B0021032A08D0D5
-:1081D00008E008F1070020F00702F2E802019046EB
-:1081E00003E080B2042A00D1C0B24FF00009220798
-:1081F0002AD53278702A07D0DDF800C08CF0100C38
-:108200005CEA0B0C05D00EE040228DF80420012220
-:1082100008E050EA010306D030238DF804308DF8D1
-:10822000052002229146009B83F0080353EA0B03CA
-:108230000AD150EA010201D1620705D530228DF83A
-:1082400004204FF001097F1E3278582A04D039A249
-:108250000C920CAA02920BE03BA2F9E75B46009A53
-:10826000F8F738F80C9B9B5C029A521E029213702E
-:1082700050EA0102F2D1029804A9081A00F1200B79
-:10828000600702D524F4803400E001275F4502DD59
-:10829000A7EB0B0000E0002000EB0B01009003981F
-:1082A0004944401A0390E00306D453462146179AE6
-:1082B000039800F0A9F90544002706E001A85246FA
-:1082C000C05D179990476D1C7F1C4F45F6DBE0039E
-:1082D0000CD553462146179A039800F095F90544AA
-:1082E00004E030205246179990476D1C0099481EB3
-:1082F00000900029F5DC08E00298029952460078C7
-:10830000491C0291179990476D1CBBF10001ABF11C
-:10831000010BF1DC5BE100F065F90544761C307877
-:1083200000287FF40DAE19B02846BDE8F08F00009C
-:10833000092801003031323334353637383961623B
-:1083400063646566000000003031323334353637FF
-:10835000383941424344454600000000600700D4DC
-:10836000062708F1070020F00700F0E80223804606
-:1083700003F0004C5FEA0C0001D097A009E0200553
-:1083800001D596A005E0E00701D095A001E0AFF28D
-:108390004C001390307823F0004365280CD006DCA5
-:1083A000452809D046281DD047287FD13BE06628C4
-:1083B00018D067287AD136E00021112F01DB112077
-:1083C00000E0781CCDE9000104A90CA8FFF7EEFC41
-:1083D000DDE90D010C9A4FF0000B07F10109109235
-:1083E00000914EE04FF000400097CDE9011004A944
-:1083F0000CA8FFF7DBFCDDE90D020C9B0F994FF099
-:10840000000B91461093009211B9791C00EB010901
-:10841000B7EB090003D4C0F1FF3B07F10109A9EB59
-:108420000700019042E0012F00DA01270021112FFF
-:1084300001DD112000E03846CDE9000104A90CA8B7
-:10844000FFF7B4FCDDE90D010C9A00914FF0000B31
-:10845000B946109221070FD4009A4A4503DA914693
-:1084600001E0A9F10109B9F1010F05DD109AA9F1A7
-:108470000101515C3029F4D0B84202DA10F1040F46
-:1084800003DA0121CDE9011010E0002803DC834468
-:10849000A9EB000102E0411C494500DD8946A0EB43
-:1084A0000B00401C01904FF000400290200705D4C3
-:1084B0000198484502DB4FF0FF30019000208DF815
-:1084C0004B0002980DF14B07B0F1004F25D0022070
-:1084D0000C902B200D90029800280CDA404202905C
-:1084E0002D200D9007E00A210298F7F774FF303134
-:1084F000029007F8011D0C99481E0C900029F2DC2F
-:1085000002980028EFD1791E0D980870307800F09D
-:10851000200040F0450007F8020D11A8C01BC01D47
-:1085200002901398007800B1012000EB0901019836
-:1085300001EBE071029801440398401A401E039039
-:10854000E00306D453462146179A039800F05CF8DE
-:1085500005441398007818B15246179990476D1C3E
-:10856000E00323D553462146179A039800F04CF8B0
-:1085700005441BE0BBF1000F07DB0098584504DD04
-:108580001098179910F80B0001E017993020524607
-:10859000904701980BF1010B401E05F10105019078
-:1085A00004D12E205246179990476D1CB9F1000155
-:1085B000A9F10109DEDC05E017F8010B5246179915
-:1085C00090476D1C0299481E02900029F4DC534626
-:1085D0002146179A03989EE62D0000002B0000000C
-:1085E000200000002DE9F041044600251E461746F4
-:1085F000880404D405E039462020B0476D1C641E71
-:10860000F9D52846BDE8F0812DE9F0410446002562
-:108610001E469046C80301D5302700E02027880475
-:1086200004D505E041463846B0476D1C641EF9D5B7
-:108630002846BDE8F0810000F0B52DED028B83B037
-:1086400006460F460025684600F096FE002448E0E6
-:1086500056F8241057F82420881A002801DB014618
-:1086600000E0414200EE101AB8EEC00ADFED200A29
-:1086700080EE208A684600EB840090ED000AB5EE9B
-:10868000C00AF1EE10FA19D0684600EB8400D0ED74
-:10869000000A88EE200AF7EE000A70EE608A00BF3A
-:1086A000B0EEE80A1348D0ED090AB4EEE00AF1EEA4
-:1086B00010FA15DD0120A040054311E00D4890EDB2
-:1086C000070AB4EEC80AF1EE10FA06DC90ED080ACB
-:1086D000B4EEC80AF1EE10FA02D20120A040054320
-:1086E000641C032CB4DB284603B0BDEC028BF0BD48
-:1086F0000000804720B3000810B541EC100BFFF7D5
-:1087000003F951EC100B10BD2DE9F0410446E0785F
-:1087100000F0C006E07800F03F05607800F001004E
-:1087200098B1EF102846E91705EB5171C910A5EB78
-:10873000C101491C01F0FF080B48006820B10A483C
-:10874000414602683846904700BF607800F0080054
-:1087500030B10548406818B1B011034A51688847E4
-:108760000020BDE8F08100009003002438B50446E5
-:1087700064B120208DF8000028208DF80100302001
-:108780008DF8020038208DF8030004E0A3220421B4
-:108790006846F7F701FE6A46042140F69E2002F083
-:1087A000B9FB01F095FE38BD3EB5044602208DF8B8
-:1087B0000000CA208DF80100E3208DF80200092096
-:1087C0008DF803006A460421682002F0A3FBA32071
-:1087D0008DF8000004F0400048B1C0208DF8010081
-:1087E000C8208DF80200C2208DF8030006E0A32007
-:1087F0008DF801008DF802008DF8030004F4C070BC
-:1088000048B1C4208DF80400CC208DF80500C620A6
-:108810008DF8060006E0A3208DF804008DF8050011
-:108820008DF80600A3208DF807008DF808008DF85C
-:1088300009006A460A2140F6A72002F06BFB04F00B
-:10884000030018B120208DF8000002E0D8208DF838
-:1088500000006A46012140F6B62002F05BFB04F0FE
-:10886000200018B1012000F0ADF802E0002000F077
-:10887000A9F804F4C07008B304F4807060B1B220A9
-:108880008DF800008B208DF80100B6208DF80200D5
-:108890009B208DF803000BE0B0208DF800008020B5
-:1088A0008DF80100B4208DF8020090208DF80300AF
-:1088B0006A46042140F6A22002F02CFB04F00100DD
-:1088C00020B3F8208DF800006A4601214FF40B60B8
-:1088D00002F020FBFA21072000F02EFC072000F018
-:1088E000F5FB012000F015FC642000F005FD4FF4BD
-:1088F000FA7000F014FDC821304800F0A5FB2820D4
-:1089000000F0BEFB0A2000F0CEFB08E0D8208DF876
-:1089100000006A4601214FF40B6002F0FBFA04F0FC
-:10892000020018B1D9208DF8000002E0D8208DF89F
-:1089300000006A46012140F23D7002F0EBFA04F0BB
-:10894000040018B1012000F069F802E0002000F0F6
-:1089500065F804F0100018B10120FFF707FF02E0EE
-:108960000020FFF703FF44F008001549488101F09B
-:10897000AFFD00201249887304F0400018B108468A
-:10898000807B801D887304F4C07020B10C48807B0C
-:10899000801D0B49887304F0140020B10848807BC7
-:1089A00010300749887304F0030020B10448807B2D
-:1089B000001D0349887300203EBD000009E3CA0280
-:1089C000900300243EB504466CB10EA1D1E900200D
-:1089D0008968CDE9002002916A4609214FF4976029
-:1089E00002F098FA3EBD0AA2D2E900109268CDE9E1
-:1089F000010200916A4609214FF4976002F08AFA59
-:108A0000F0E70000B8AAB38DB4980D355D00000002
-:108A1000B8AAAAAAB088C3C5C700000038B50446E2
-:108A200064B1C0208DF80000C2208DF80100C42080
-:108A30008DF80200C6208DF8030004E08B2204218B
-:108A40006846F7F7A9FC6A46042140F6982002F030
-:108A500061FA01F03DFD38BD10B5C8234FF48062C6
-:108A6000024940F6F63001F071FB10BD48B3000832
-:108A70002DE9F04F8DB00746884615469946DDE949
-:108A8000166B0024002030806B49887B5A4605A96C
-:108A900001F04CFC18B1601E0DB0BDE8F08F6648C7
-:108AA000807A00F01400002867D09DF814000006BA
-:108AB0009DF8151040EA01409DF8161040EA01208B
-:108AC0009DF81710084328609DF8180000069DF8CF
-:108AD000191040EA01409DF81A1040EA01209DF863
-:108AE0001B10084368609DF81C0000069DF81D10CF
-:108AF00040EA01409DF81E1040EA01209DF81F1039
-:108B00000843A8609DF8200000069DF8211040EA67
-:108B100001409DF8221040EA01209DF823100843EF
-:108B2000E86004F11000C4B228680014019068687D
-:108B300000140290A86800140390E86800140490E0
-:108B400001984043029901FB0100039901FB0100D8
-:108B5000049901FB010ABAF1706F02DBBAF1885F78
-:108B600005DD01F0B5FC00203080401E94E7B6F929
-:108B7000000040F48070308000BF2F48807A00F001
-:108B8000400020B305A9601C085C095D40EA012093
-:108B900000B2A8F8000005A9E01C095C05AAA01C09
-:108BA000105C41EA002000B2A8F8020005A9601D8F
-:108BB000095C201D105C41EA002000B2A8F8040006
-:108BC000A01DC4B2B6F9000040F0080030801A4879
-:108BD000408900F4C07008B305A9601C085C095DF9
-:108BE00040EA012000B2388005A9E01C095C05AA12
-:108BF000A01C105C41EA002000B2788005A9601D2D
-:108C0000095C201D105C41EA002000B2B880A01D64
-:108C1000C4B2B6F9000040F0700030800648807A97
-:108C200000F0030018B105A90819FFF76DFD4846CB
-:108C300000F0DCFE00202FE79003002470B588B020
-:108C4000064601A801F0A4F8BDF804000021C903FC
-:108C500041EA5045C40300BF4448007A00F00300D5
-:108C600056F8200005904148007A00F0040010B149
-:108C70000598404205903D48007AC0F3C10056F87F
-:108C8000200006903948007A00F0200010B10698C4
-:108C9000404206903548007AC0F3811056F8200013
-:108CA00007903248008900F4807010B10798404264
-:108CB00007900598C117A0FB042301FB043100FBBA
-:108CC0000510810041EA927005900698C117A0FB3B
-:108CD000042301FB043100FB0510810041EA92707E
-:108CE00006900798C117A0FB042301FB043100FB89
-:108CF0000510810041EA927007900598000E8DF8EA
-:108D000008000598000C8DF809000598000A8DF8F8
-:108D10000A000598C0B28DF80B000698000E8DF879
-:108D20000C000698000C8DF80D000698000A8DF8CE
-:108D30000E000698C0B28DF80F000798000E8DF84F
-:108D400010000798000C8DF811000798000A8DF8A4
-:108D500012000798C0B28DF8130002AA0C214FF43C
-:108D6000257002F0D7F808B070BD00009003002411
-:108D700030B585B0044616A207CA02AB07C3C82C9B
-:108D800003DD4FF0FF3005B030BDC82090FBF4F09C
-:108D9000401E85B2280A8DF80000E8B28DF8010067
-:108DA0006A46022140F2162002F0B4F810B14FF0EA
-:108DB000FF30E8E702AA0C2140F6C12002F0AAF831
-:108DC00010B14FF0FF30DEE7044884810020DAE77D
-:108DD000FEF2ABC4AAF1DFDFBBAFDFDF90030024FC
-:108DE0001FB504464848007A00F0030054F82000FC
-:108DF00001904548007A00F0040010B1019840420B
-:108E000001904148007AC0F3C10054F8200002905C
-:108E10003D48007A00F0200010B1029840420290D4
-:108E20003948007AC0F3811054F820000390364886
-:108E3000008900F4807010B10398404203903349D8
-:108E4000019880FB0101800F40EA810001902F49C9
-:108E5000029880FB0110820042EA917002902B4937
-:108E6000039880FB0110820042EA91700390019800
-:108E7000000E8DF800000198000C8DF8010001989B
-:108E8000000A8DF802000198C0B28DF803006A460E
-:108E900004214FF4747002F03DF818B14FF0FF3028
-:108EA00004B010BD0298000E8DF800000298000C6E
-:108EB0008DF801000298000A8DF802000298C0B2F5
-:108EC0008DF803006A4604214FF4757002F022F811
-:108ED00010B14FF0FF30E3E70398000E8DF800006B
-:108EE0000398000C8DF801000398000A8DF8020029
-:108EF0000398C0B28DF803006A4604214FF47670DF
-:108F000002F008F8CCE700009003002409E3CA024D
-:108F100010B586B0044647A00068039046A00068DC
-:108F2000029046A00068019045A00068009004F0FF
-:108F3000030003A9085C8DF8140003A8C4F3C10161
-:108F4000405C8DF8150003A8C4F38111405C8DF8D6
-:108F5000160004F0030002A9085C8DF8100002A8B6
-:108F6000C4F3C101405C8DF8110002A8C4F3811163
-:108F7000405C8DF8120005AA032140F2264001F062
-:108F8000C9FF18B14FF0FF3006B010BD04AA03218D
-:108F900040F22A4001F0BEFF10B14FF0FF30F3E77E
-:108FA000019805900098049004F0040058B19DF8D1
-:108FB000140040F001008DF814009DF8100040F0FE
-:108FC00001008DF8100004F0200058B19DF8150044
-:108FD00040F001008DF815009DF8110040F00100EF
-:108FE0008DF8110004F4807058B19DF8160040F01F
-:108FF00001008DF816009DF8120040F001008DF878
-:10900000120005AA03214FF4886001F083FF10B11C
-:109010004FF0FF30B8E704AA032140F2314001F0DD
-:1090200079FF10B14FF0FF30AEE706480481002011
-:10903000AAE700004CCD6C000CC92C003656760017
-:109040002646660090030024F8B505460E464FF408
-:109050007A7095FBF0F000FB06F4200E8DF800000E
-:10906000200C8DF80100200A8DF80200E0B28DF886
-:1090700003006A4604214FF4AE7001F04BFFF8BDC7
-:1090800038B50446052094FBF0F084B220128DF828
-:109090000000E0B28DF801006A4602214FF4AD7085
-:1090A00001F038FF38BD38B50446052094FBF0F0D8
-:1090B00084B220128DF80000E0B28DF801006A46FB
-:1090C00002214FF4AC7001F025FF38BD38B50446DD
-:1090D0000020009004F0010020B19DF8000040F055
-:1090E0003000009004F0020020B19DF8000040F034
-:1090F0000C00009004F0040020B19DF8000040F046
-:10910000030000906A4601214FF4A47001F002FFB1
-:1091100038BD38B50446012C01DA012402E0042CE4
-:1091200000DD0424601EC0B200906A46012140F2B6
-:109130004F1001F0EFFE38BDF0B52DED028B83B07E
-:1091400006460F4606F0070010B1B7F5C86F05DDFB
-:109150004FF0FF3003B0BDEC028BF0BD00EE107A93
-:10916000B8EE400ADFED5B0A80EE208A01A800F02D
-:10917000E9FD9DF80400022806D0042817D008282D
-:1091800028D010284CD138E09FED530A28EE000A71
-:10919000BCEEC00A10EE100A84B29FED500A28EE11
-:1091A000000ABCEEC00A10EE100A85B23BE09FED4B
-:1091B0004C0A28EE000ABCEEC00A10EE100A84B277
-:1091C0009FED480A28EE000ABCEEC00A10EE100A15
-:1091D00085B228E09FED440A28EE000ABCEEC00AE2
-:1091E00010EE100A84B29FED410A28EE000ABCEE90
-:1091F000C00A10EE100A85B215E09FED3D0A28EE78
-:10920000000ABCEEC00A10EE100A84B29FED390AC3
-:1092100028EE000ABCEEC00A10EE100A85B202E089
-:109220004FF0FF3096E700BF20128DF80800E0B243
-:109230008DF8090028128DF80A00E8B28DF80B00AD
-:1092400006F00100A0B102AA02214FF4EA7001F079
-:1092500061FE10B14FF0FF307CE70DF10A020221F0
-:109260004FF4927001F056FE10B14FF0FF3071E7ED
-:1092700006F00200A0B102AA02214FF4EC7001F046
-:1092800049FE10B14FF0FF3064E70DF10A020221F0
-:109290004FF4947001F03EFE10B14FF0FF3059E7EB
-:1092A00006F00400A0B102AA02214FF4EE7001F012
-:1092B00031FE10B14FF0FF304CE70DF10A020221F0
-:1092C0004FF4967001F026FE10B14FF0FF3041E7E9
-:1092D00000203FE700004843000080460000404671
-:1092E000000000460000C0450000804500004045E9
-:1092F000000000450000C04438B50446052094FB3A
-:10930000F0F085B228128DF80000E8B28DF8010067
-:109310006A4602214FF4EF7001F0FCFD38BD38B50C
-:109320000446052094FBF0F085B228128DF8000069
-:10933000E8B28DF801006A4602214FF4ED7001F0A9
-:10934000E9FD38BD82B0CDE9000121F00040019077
-:109350009DED000B02B051EC100B704713B50C469D
-:109360004FF6FF73012269460248FCF745F9009861
-:109370001CBD0000FC0200247CB50546314908787C
-:1093800001AB04220D21FCF769FB48B12E49087896
-:1093900001AB04220D21FCF761FB08B107207CBD65
-:1093A0009DF80700C0F301109DF8041001F0E001E2
-:1093B00040EAE1008DF800009DF80700C0F381004D
-:1093C0009DF8051001F0E00140EAE1008DF8010090
-:1093D0009DF8070000F003009DF8061001F0E00181
-:1093E00040EAE1008DF80200002427E01DF80400A7
-:1093F00030B99FED160A05EB840080ED000A1BE0F2
-:109400009FED130A05EB840080ED000A0BE005EBED
-:10941000840090ED000ADFED0F0A20EE200A05EB34
-:10942000840080ED000A1DF80400401EC0B20DF853
-:1094300004000028EBD100BF601CC4B2032CD5DBB4
-:109440000020ACE7100000241400002400000000FD
-:109450007B14AE3E1D5A843F2DE9F04F87B0054680
-:109460000C46914601208DF8100000208DF8110067
-:10947000FE4A1268517DFE4A107804AB0222FCF7C6
-:109480008DFB70B1F94A1268517DFA4A107804AB2D
-:109490000222FCF783FB20B14FF0FF3007B0BDE89C
-:1094A000F08FC820F8F710F900208DF81000EF4A6F
-:1094B0001268517CEE4A107804AB0122FCF76EFB77
-:1094C00060B1EA4A1268517CEA4A107804AB012282
-:1094D000FCF764FB10B14FF0FF30DFE7E34A12689E
-:1094E0005179E34A107804AB0122FCF757FB60B1D5
-:1094F000DE4A12685179DF4A107804AB0122FCF78A
-:109500004DFB10B14FF0FF30C8E7D84A1268517DCB
-:10951000D74A107804AB0122FCF740FB60B1D34A74
-:109520001268517DD34A107804AB0122FCF736FB58
-:1095300010B14FF0FF30B1E7CC4A1268917ECC4AAF
-:10954000107804AB0122FCF729FB60B1C74A12680E
-:10955000917EC84A107804AB0122FCF71FFB10B1C2
-:109560004FF0FF309AE7C14A12681179C04A10786B
-:1095700004AB0122FCF712FB60B1BC4A12681179FE
-:10958000BC4A107804AB0122FCF708FB10B14FF085
-:10959000FF3083E70C208DF81000B44A126811796F
-:1095A000B34A107804AB0122FCF7F8FA60B1AF4A75
-:1095B00012681179AF4A107804AB0122FCF7EEFA79
-:1095C00010B14FF0FF3069E70F20F8F77DF8A7489A
-:1095D000806A407A8DF81000A44A12689178A44AF3
-:1095E000107804AB0122FCF7D9FA60B19F4A1268E7
-:1095F0009178A04A107804AB0122FCF7CFFA10B1A1
-:109600004FF0FF304AE79948806A007A8DF81000E1
-:10961000964A12685178964A107804AB0122FCF7FA
-:10962000BDFA60B1914A12685178924A107804AB41
-:109630000122FCF7B3FA10B14FF0FF302EE7B9F179
-:10964000000F07D08948806A807A40F0E0008DF8EA
-:10965000100004E08548806A807A8DF81000834A03
-:1096600012689179824A107804AB0122FCF796FACD
-:1096700060B17E4A126891797E4A107804AB01226B
-:10968000FCF78CFA10B14FF0FF3007E7B9F1000F8B
-:1096900007D07648806AC07A40F0E0008DF810006C
-:1096A00003E07548C07A8DF81000704A1268D179CD
-:1096B0006F4A107804AB0122FCF770FA60B16B4A74
-:1096C0001268D1796B4A107804AB0122FCF766FA74
-:1096D00010B14FF0FF30E1E6B9F1000F02D0C82021
-:1096E000F7F7F2FF40208DF81000604A12681179F8
-:1096F0005F4A107804AB0122FCF750FA60B15B4A74
-:10970000126811795B4A107804AB0122FCF746FA23
-:1097100010B14FF0FF30C1E678208DF81000534AA9
-:1097200012685179524A107804AB0122FCF736FADC
-:1097300060B14E4A126851794E4A107804AB01224A
-:10974000FCF72CFA10B14FF0FF30A7E64A498889A0
-:10975000F7F7BAFF00208DF81000444A12685179DB
-:10976000434A107804AB0122FCF718FA60B13F4A73
-:10977000126851793F4A107804AB0122FCF70EFAC7
-:1097800010B14FF0FF3089E6384A1268117B384A31
-:10979000107804AB0222FCF761F960B1334A126819
-:1097A000117B344A107804AB0222FCF7F7F910B1B0
-:1097B0004FF0FF3072E69DF811009DF8101040EA5E
-:1097C000012B0C209BFBF0F0C6B20020A860686063
-:1097D0002860A06060602060824677E0234A1268BB
-:1097E000517B234A107804AB0C22FCF737F960B1A7
-:1097F0001E4A1268517B1F4A107804AB0C22FCF7FA
-:109800002DF910B14FF0FF3048E69DF811009DF89A
-:10981000101040EA012000B2ADF808009DF81300D6
-:109820009DF8121040EA012000B2ADF80A009DF840
-:1098300015009DF8141040EA012000B2ADF80C00AC
-:10984000BDF90810206808442060BDF90A1060685E
-:1098500008446060BDF90C10A0680844A0609DF841
-:1098600017009DF8161040EA012007E018000024B8
-:10987000100000241400002420B3000800B2ADF84A
-:1098800000009DF819009DF8181040EA012000B270
-:10989000ADF802009DF81B009DF81A1040EA012067
-:1098A00000B2ADF80400BDF9001028680844286033
-:1098B000BDF90210686808446860BDF90410A86822
-:1098C0000844A8600AF1010000F0FF0AB24585DBF8
-:1098D0004548D0F800C02868C117090441EA104182
-:1098E0000704624600233846F6F725FD324600237A
-:1098F000CDE90201F6F71FFD28603B48D0F800C013
-:109900006868C117090441EA104107046246002350
-:109910003846F6F710FD32460023CDE90201F6F78E
-:109920000AFD68603048D0F800C0A868C117090473
-:1099300041EA10410704624600233846F6F7FBFC73
-:1099400032460023CDE90201F6F7F5FCA86026486F
-:10995000D0F804C02068C117090441EA1041070487
-:10996000624600233846F6F7E6FC32460023CDE98E
-:109970000201F6F7E0FC20601B48D0F804C06068E4
-:10998000C117090441EA1041070462460023384622
-:10999000F6F7D1FC32460023CDE90201F6F7CBFC05
-:1099A00060601148D0F804C0A068C117090441EAFA
-:1099B00010410704624600233846F6F7BCFC3246E5
-:1099C0000023CDE90201F6F7B6FCA060A0680028EC
-:1099D00004DDA068A0F58030A06003E0A06800F579
-:1099E0008030A060002059E520B3000810B504467F
-:1099F000F7F788FF2060002010BD0000012001491A
-:109A0000C8707047A0030024F0B52DED048B81B021
-:109A100006460F460025424908786B4603220D2171
-:109A2000FCF71CF860B13F4908786B4603220D2112
-:109A3000FCF714F820B1072001B0BDEC048BF0BD99
-:109A40009DF8000000F01F008DF800009DF8010057
-:109A500000F01F008DF801009DF8020000F01F00CB
-:109A60008DF80200002456E056F8241057F8242000
-:109A7000881A002801DB014600E0414200EE101A7E
-:109A8000B8EEC00ADFED280A80EE208A1DF8040037
-:109A900070B3264890ED000AB8EE400ADFED240AC4
-:109AA00080EE801AB0EE419A05E09FED220A29EE81
-:109AB000000AB0EE409A1DF80400401EC0B20DF836
-:109AC00004000028F1D188EE090AF7EE000A70EED2
-:109AD000608A00BFB0EEE80A1448D0ED060AB4EE82
-:109AE000E00AF1EE10FA15DD0120A040054311E077
-:109AF0000E4890ED040AB4EEC80AF1EE10FA06DC46
-:109B000090ED050AB4EEC80AF1EE10FA02D2012077
-:109B1000A0400543641C032CA6DB28468CE700000C
-:109B200010000024140000240000804720B3000827
-:109B300000B04C4554E3853F014691F90020002ACE
-:109B400001DD00201EE091F90020002A01DA042046
-:109B500018E091F90120002A01DD012012E091F9BD
-:109B60000120002A01DA05200CE091F90220002AE8
-:109B700001DD022006E091F90220002A01DA062028
-:109B800000E0072070470000A0B0F8F705FAFCF7E6
-:109B9000F5FDFCF71FF9FCF7CDF8FCF79BF9FCF796
-:109BA0001DFAFCF737FAFCF7ADFAFCF7F1FAFCF70F
-:109BB00035FBFCF7BBF9FCF7E5F9F6F72FFF374863
-:109BC000F8F7DAFA012467E0012C17D1682034494C
-:109BD0000860D12033490860D02033490860022052
-:109BE00032490860642101A8F6F7DDFB1DAA1EA911
-:109BF0001FA8FCF7D9FC0546052448E0052C46D1F2
-:109C0000682027490860D12026490860D0202649CD
-:109C100008600120254908601AAA1BA91CA8FCF7A6
-:109C2000C3FC05469DED1A0AB7EEC00A8DED0E0B7A
-:109C30009DED1B0AB7EEC00A8DED0C0B9DED1C0AC5
-:109C4000B7EEC00A8DED0A0BB7EEC90A8DED080B11
-:109C5000B7EEE80A8DED060BB7EEC80A8DED040BE2
-:109C60009DED1D0AB7EEC00A8DED020B9DED1E0A9B
-:109C7000B7EEC00A8DED000B9DED1F0AB7EEC00ACE
-:109C800053EC102B0AA0FDF7F5FC012400BF0122C4
-:109C900051030F48F7F72AFE96E70000CC01002495
-:109CA00004000024080000240C000024000000240C
-:109CB00025662C25662C25662C25662C25662C25EC
-:109CC000662C25662C25662C25660D0A00000000F2
-:109CD0000008025870B50446002624F00104184814
-:109CE00090F8240008B1002070BD1548807A10B9A2
-:109CF0004FF0FF30F8E71248057C807A2040104989
-:109D000008740846007CA04202D04FF0FF3600E005
-:109D1000002614B90A48007D18B1012001F056FA56
-:109D200002E0002001F052FA3CB100F0D1FB20B17A
-:109D3000034805744FF0FF30D6E73046D4E7000003
-:109D40001800002401461148407A30B1012807D09C
-:109D5000022808D003280CD108E0022008700BE08C
-:109D60000420087008E00820087005E01020087042
-:109D700002E04FF0FF30704700BF0448C07C18B1CC
-:109D800008784006000E08700020F4E71800002450
-:109D900001461348407A30B1012808D002280AD081
-:109DA000032810D10BE04FF4804008800EE041F60C
-:109DB0009C7008800AE04FF48050088006E04FF461
-:109DC0000060088002E04FF0FF30704700BF044899
-:109DD000C07C10B10888401008800020F5E7000022
-:109DE0001800002401460248007C087000207047DB
-:109DF0001800002401460F48007A30B1012807D02E
-:109E0000022809D003280FD10AE0FA2008800EE0CA
-:109E10004FF4FA7008800AE04FF47A70088006E088
-:109E20004FF4FA60088002E00020088000BF00BF05
-:109E3000002070471800002401461248007A30B113
-:109E4000012809D002280CD0032814D10EE09FED80
-:109E50000E0A81ED000A11E09FED0C0A81ED000A67
-:109E60000CE09FED0B0A81ED000A07E09FED090A67
-:109E700081ED000A02E04FF0FF30704700BF002084
-:109E8000FBE70000180000240000034300008342A9
-:109E9000333303423333834101461248C07A0828E2
-:109EA00017D2DFE800F01704070A0D101318BC20C2
-:109EB000088013E06220088010E02A2008800DE06E
-:109EC000142008800AE00A20088007E005200880A6
-:109ED00004E000BF00BF0020088000BF00BF0020DA
-:109EE00070470000180000240146064890F824003E
-:109EF00010B14FF0FF3070470248C0890880002041
-:109F0000F9E70000180000247CB5054680208DF894
-:109F10000000784A1268517D774A10786B4601221A
-:109F2000FBF73CFE60B1734A1268517D734A1078AA
-:109F30006B460122FBF732FE10B14FF0FF307CBDC3
-:109F40006420F7F7C1FB00208DF80000694A126811
-:109F5000517D694A10786B460122FBF71FFE60B104
-:109F6000644A1268517D654A10786B460122FBF7FE
-:109F700015FE10B14FF0FF30E1E75E4A1268517DE7
-:109F80005D4A10786B460122FBF768FD60B1594AC3
-:109F90001268517D594A10786B460122FBF7FEFD8D
-:109FA00010B14FF0FF30CAE79DF80500C007400F21
-:109FB0009DF8031001F0010140EA41009DF80110F5
-:109FC00001F0010140EA010494B1012C03D1012107
-:109FD0004848C1743AE0022C03D100214548C174BD
-:109FE00034E0214646A0FDF745FB4FF0FF30A6E7E1
-:109FF000404A1268D178404A10786B460122FBF73C
-:10A000002DFD60B13B4A1268D1783C4A10786B460E
-:10A010000122FBF723FD10B14FF0FF308FE79DF8D1
-:10A02000000000F00F042CB93F48FDF723FB4FF070
-:10A03000FF3084E7042C06D13CA0FDF71BFB012177
-:10A040002C48C17402E000212A48C174FF2129482C
-:10A050008172FF2027490872FF2126484172C17290
-:10A060004FF6FF71C181FF210174817401210173D9
-:10A0700080F82210002180F82310417501751630F8
-:10A08000016041608160163880F8241080F8251046
-:10A09000C1844FF4FA6000F081FD10B14FF0FF3041
-:10A0A0004DE7022000F0F2FB10B14FF0FF3046E721
-:10A0B0002A2000F007FE10B14FF0FF303FE73220BA
-:10A0C00000F04EFE10B14FF0FF3038E70020FFF7F0
-:10A0D00001FE10B14FF0FF3031E7002000F024FC0A
-:10A0E00010B14FF0FF302AE7002000F095FE00206D
-:10A0F00025E70000180000241000002414000024AC
-:10A10000556E737570706F7274656420736F6674CA
-:10A11000776172652070726F647563742072657602
-:10A120002025642E0A00000068C0000848616C66A3
-:10A130002073656E736974697669747920706172D1
-:10A140007420666F756E642E0A0000002DE9F043DE
-:10A1500085B005460E46904699462E4890F8250053
-:10A1600020B14FF0FF3005B0BDE8F08316B94FF0D5
-:10A17000FF30F8E7002423E0281B102801DD102021
-:10A1800000E0281B87B232193946204600F0C2FE93
-:10A1900010B14FF0FF30E6E701AA3946204600F043
-:10A1A00043F910B14FF0FF30DDE730193A4601A90D
-:10A1B000F6F704F910B16FF00100D4E7E01984B2AA
-:10A1C000AC42D9DB4FEA28208DF8000008F0FF00F0
-:10A1D0008DF801000F4A1268517F0F4A10786B46C4
-:10A1E0000222FBF7DBFC60B10A4A1268517F0B4A7E
-:10A1F00010786B460222FBF7D1FC10B14FF0FF3014
-:10A20000B1E70121034880F82510A0F8269000202E
-:10A21000A9E7000018000024100000241400002406
-:10A2200038B50446282C02DD4FF0FF3038BD24BB82
-:10A23000002000F005FD00208DF8000007208DF8BB
-:10A240000100374A1268517D364A10786B46022267
-:10A25000FBF7A4FC60B1324A1268517D324A107893
-:10A260006B460222FBF79AFC10B14FF0FF30DDE79E
-:10A2700000212B4801750020D8E7012000F0E0FC08
-:10A2800020208DF80000012C06D100208DF801005F
-:10A29000052000F017FD17E0052C06DC01208DF8E5
-:10A2A0000100052000F00EFD0EE0142C06DC02205B
-:10A2B0008DF801000A2000F005FD05E003208DF86F
-:10A2C0000100142000F0FEFC9DF80100072101EBC5
-:10A2D0008010C0B28DF80100114A1268517D114AF8
-:10A2E00010786B460222FBF759FC60B10C4A1268E9
-:10A2F000517D0D4A10786B460222FBF74FFC10B1DE
-:10A300004FF0FF3092E70821054881720021017368
-:10A31000012101750020FFF7DDFC002086E7000029
-:10A32000180000241000002414000024F8B504468E
-:10A330000F461646394890F8240010B94FF0FF3008
-:10A34000F8BD3648807A10B94FF0FF30F8E7334A4D
-:10A350001268117B324A10786B460222FBF77EFBB3
-:10A3600060B12E4A1268117B2E4A10786B46022289
-:10A37000FBF774FB10B14FF0FF30E1E79DF80100EF
-:10A380009DF8001040EA0125A54203DA0020307054
-:10A39000401ED5E7214840684088B5EB600F20DDBE
-:10A3A0001E4A1268D17C1E4A10786B460122FBF7C8
-:10A3B00055FB60B1194A1268D17C1A4A10786B4675
-:10A3C0000122FBF74BFB10B14FF0FF30B8E79DF8CF
-:10A3D000000000F0100020B100F07AF86FF00100EA
-:10A3E000AEE7E2B20D4B1B68597B0D4B18783B462C
-:10A3F000FBF734FB60B1E2B2084B1B68597B094B99
-:10A4000018783B46FBF72AFB10B14FF0FF3097E777
-:10A4100095FBF4F0401E3070002091E718000024F6
-:10A420001000002414000024F8B505460C4616461A
-:10A4300016B94FF0FF30F8BD2348807A10B94FF0BD
-:10A44000FF30F8E728128DF80000E8B28DF801001F
-:10A450009DF8010020441C4949684989884202DD71
-:10A460004FF0FF30E7E7184A1268D17E174A10789C
-:10A470006B460222FBF792FB60B1134A1268D17E51
-:10A48000124A10786B460222FBF788FB10B14FF09E
-:10A49000FF30D0E7E2B20C4B1B68197E0B4B1878EB
-:10A4A0003346FBF7DBFA60B1E2B2074B1B68197E5B
-:10A4B000064B18786B46FBF771FB10B14FF0FF307D
-:10A4C000B9E70020B7E700001800002410000024BE
-:10A4D00008B5A448807A10B94FF0FF3008BD0020BD
-:10A4E0000090A04A1268517C9F4A10786B46012266
-:10A4F000FBF754FB60B19B4A1268517C9B4A107871
-:10A500006B460122FBF74AFB10B14FF0FF30E5E745
-:10A51000944A12685179944A10786B460122FBF7ED
-:10A520003DFB60B18F4A12685179904A10786B46B2
-:10A530000122FBF733FB10B14FF0FF30CEE7894A21
-:10A5400012681179884A10786B460122FBF726FBC6
-:10A5500060B1844A12681179844A10786B460122EE
-:10A56000FBF71CFB10B14FF0FF30B7E77D4890F8C8
-:10A570002400002879D00C2000907A4A12681179C2
-:10A58000794A10786B460122FBF708FB60B1754AE7
-:10A5900012681179754A10786B460122FBF7FEFAB2
-:10A5A00010B14FF0FF3099E73220F7F78DF8C02057
-:10A5B00000906C48807A00F0010020B19DF8000006
-:10A5C00040F020000090674A12681179664A1078BE
-:10A5D0006B460122FBF7E2FA60B1624A1268117918
-:10A5E000624A10786B460122FBF7D8FA10B14FF09F
-:10A5F000FF3073E75B48407C10B10220009001E01F
-:10A6000000200090574A1268517C574A10786B46D8
-:10A610000122FBF7C3FA60B1524A1268517C534AD7
-:10A6200010786B460122FBF7B9FA10B14FF0FF30FA
-:10A6300054E7002000904B4A126851794A4A10783A
-:10A640006B460122FBF7AAFA00287DD0454A126822
-:10A650005179464A10786B460122FBF79FFA002891
-:10A660007DD04FF0FF3039E7FFE7042000903D4AEE
-:10A67000126811793C4A10786B460122FBF78EFA7A
-:10A6800060B1384A12681179384A10786B46012255
-:10A69000FBF784FA10B14FF0FF301FE73148807CA0
-:10A6A00020B93048807A00F0010010B940200090B5
-:10A6B00001E0602000902B4A126811792A4A107834
-:10A6C0006B460122FBF76AFA60B1264A12681179DB
-:10A6D000264A10786B460122FBF760FA10B14FF062
-:10A6E000FF30FBE63220F6F7EFFF1E48407C10B14A
-:10A6F0000120009001E0002000901A4A1268517C6D
-:10A70000194A10786B460122FBF748FA60B1154AE6
-:10A710001268517C154A10786B460122FBF73EFA0D
-:10A7200010B14FF0FF30D9E60E4A126851790E4A47
-:10A7300010780C4B10330122FBF730FA20B1094A94
-:10A7400012685179094A00E009E01078054B10338E
-:10A750000122FBF723FA10B14FF0FF30BEE60020D4
-:10A76000BCE600001800002410000024140000249F
-:10A770002DE9F04F8DB083460F4602200C904248E1
-:10A7800090F8240020B1002000F0B0F9012600E08C
-:10A79000002603A8FFF72EFB05A8FFF7D3FA01A8B0
-:10A7A000FFF77AFB02A8FFF79FFB374890F80AA053
-:10A7B00004A8FFF717FB002407E00022394658469B
-:10A7C000FEF74AFE00B902E0641C022CF5DB00BF74
-:10A7D000022C01D1002528E0002407E0012206A96F
-:10A7E00009A8FEF739FE00B902E0641C022CF5DB73
-:10A7F00000BF022C01D1002517E006A93846FDF75D
-:10A800001BFF00F0FF0809A95846FFF7FDF800F00C
-:10A81000FF090025B9F1000F01D145F00105B8F19C
-:10A82000000F01D145F0020500BFFF201649087254
-:10A83000FF2115484172C1724FF6FF71C181FF219E
-:10A840008172017401210173BDF80C0000F0A6F9BA
-:10A850009DF8140000F01AF8BDF8040000F032FA78
-:10A86000BDF8080000F07CFA504600F0D5FA9DF8DB
-:10A870001000FFF72FFA16B1012000F037F9284633
-:10A880000DB0BDE8F08F00001800002438B5044674
-:10A890002248807A10B94FF0FF3038BD022C06D024
-:10A8A000042C07D0082C08D0102C0CD108E0002074
-:10A8B00000900BE00820009008E01020009005E0D8
-:10A8C0001820009002E04FF0FF30E6E700BF134889
-:10A8D000407A9DF80010B0EBE10F01D10020DCE7D9
-:10A8E0000E4A1268D1790E4A10786B460122FBF7A6
-:10A8F00055F960B1094A1268D1790A4A10786B4655
-:10A900000122FBF74BF910B14FF0FF30C5E79DF87E
-:10A910000000C110014841720020BEE71800002469
-:10A92000100000241400002438B504466C48807CD4
-:10A93000A04201D1002038BD002C62D0684A1268C4
-:10A940001179684A10786B460122FBF787F860B1ED
-:10A95000634A12681179644A10786B460122FBF74A
-:10A960007DF810B14FF0FF30E5E79DF8000020F0D2
-:10A97000200000905A4A126811795A4A10786B46A2
-:10A980000122FBF70BF960B1554A12681179564A5A
-:10A9900010786B460122FBF701F910B14FF0FF3040
-:10A9A000C9E70320F6F790FE022000904C4890F88B
-:10A9B000220020B19DF8000040F08000009048483F
-:10A9C00090F8230020B19DF8000040F03000009086
-:10A9D000434A1268D17D434A10786B460122FBF747
-:10A9E000DDF8002878D03E4A1268D17D3E4A1078C2
-:10A9F0006B460122FBF7D2F800286DD04FF0FF30F4
-:10AA000099E7374A12681179364A10786B46012265
-:10AA1000FBF724F860B1324A12681179324A107893
-:10AA20006B460122FBF71AF810B14FF0FF3082E7B6
-:10AA30002B48807A00F0010028B19DF8000040F01A
-:10AA40002000009004E09DF8000020F0200000901D
-:10AA5000234A12681179234A10786B460122FBF7CA
-:10AA60009DF860B11E4A126811791F4A10786B4632
-:10AA70000122FBF793F810B14FF0FF305BE70320A2
-:10AA8000F6F722FE164890F8220010B180200090C0
-:10AA900001E000200090124890F8230020B19DF8BA
-:10AAA000000040F0300000900D4A1268D17D0D4A40
-:10AAB00010786B460122FBF771F860B1084A126802
-:10AAC000D17D094A10786B460122FBF767F810B177
-:10AAD0004FF0FF302FE7FFE70148847400202AE79A
-:10AAE00018000024100000241400002438B5044687
-:10AAF000274890F82400A04201D1002038BD54B36B
-:10AB0000234890F8250010B94FF0FF30F6E70020F9
-:10AB100000F05CFB0020FFF707FF1D49C88C00F028
-:10AB20001FF9002000901B4908786B460122232161
-:10AB3000FBF734F8184908786B4601222321FBF70C
-:10AB40002DF80121124880F82410012000F03EFB6E
-:10AB5000FFF7BEFC19E0002000F038FB0C48007C39
-:10AB600000900C4908786B4601222321FBF716F868
-:10AB7000094908786B4601222321FBF70FF80021D1
-:10AB8000034880F82410FFF7A3FC0020B6E700007C
-:10AB900018000024100000241400002438B50446D6
-:10ABA0002448807A10B94FF0FF3038BDFA2C09D014
-:10ABB000B4F5FA7F09D0B4F57A7F09D0B4F5FA6F0D
-:10ABC0000CD108E0002000900BE00820009008E085
-:10ABD0001020009005E01820009002E04FF0FF30B8
-:10ABE000E3E700BF1348007A9DF80010B0EBE10FD7
-:10ABF00001D10020D9E70F4A126891790E4A1078E6
-:10AC00006B460122FAF7CAFF60B10A4A12689179CD
-:10AC10000A4A10786B460122FAF7C0FF10B14FF0D4
-:10AC2000FF30C2E79DF80000C01002490872002002
-:10AC3000BBE70000180000241000002414000024CA
-:10AC400038B504461C4890F82300A04201D10020EA
-:10AC500038BD14B13020009001E00020009016486B
-:10AC6000807C20B19DF8000040F002000090124866
-:10AC700090F8220020B19DF8000040F08000009084
-:10AC80000D4A1268D17D0D4A10786B460122FAF701
-:10AC900085FF60B1084A1268D17D094A10786B4679
-:10ACA0000122FAF77BFF10B14FF0FF30D0E70248E6
-:10ACB00080F823400020CBE7180000241000002477
-:10ACC0001400002438B504462248807A10B94FF0A9
-:10ACD000FF3038BDBC2C02DB0120009015E0622C57
-:10ACE00002DB0220009010E02A2C02DB03200090FF
-:10ACF0000BE0142C02DB0420009006E00A2C02DB9F
-:10AD00000520009001E0062000901248C07A9DF8CE
-:10AD10000010884201D10020DBE70E4A12689178CA
-:10AD20000D4A10786B460122FAF738FF60B1094AE4
-:10AD300012689178094A10786B460122FAF72EFFC3
-:10AD400010B14FF0FF30C4E79DF800100148C17208
-:10AD50000020BEE718000024100000241400002486
-:10AD600038B504462948807A10B94FF0FF3038BD15
-:10AD7000264890F8240010B14FF0FF30F7E7234841
-:10AD8000007D50B134B1282C04DCE0B2FFF748FA62
-:10AD90000020ECE70020FFF743FA042C01DA04243A
-:10ADA00004E0B4F57A7F01DD4FF47A744FF47A70E1
-:10ADB00090FBF4F0401EC0B20090144A1268517823
-:10ADC000134A10786B460122FAF7E8FE60B10F4A89
-:10ADD000126851780F4A10786B460122FAF7DEFEAE
-:10ADE00010B14FF0FF30C2E79DF80000401C4FF457
-:10ADF0007A7191FBF0F081B20448C1810146C989A2
-:10AE00004810FFF75FFF0020B1E7000018000024A2
-:10AE1000100000241400002438B5044604F070002B
-:10AE200010B10120009005E014B10020009001E075
-:10AE300040200090344A1268517D344A10786B46A5
-:10AE40000122FAF7ABFE70B12F4A1268517D304AE9
-:10AE500010786B460122FAF7A1FE20B100212A48A2
-:10AE60008172481E38BD9DF8000020F04001264840
-:10AE700001730020009004F0400020B99DF800000C
-:10AE800040F00400009004F0200020B99DF800007C
-:10AE900040F00200009004F0100020B99DF800007E
-:10AEA00040F00100009004F0080020B99DF8000077
-:10AEB00040F038000090144A1268917D134A1078CF
-:10AEC0006B460122FAF76AFE70B10F4A1268917D53
-:10AED0000F4A10786B460122FAF760FE20B100217C
-:10AEE00009488172481EBDE724B1082C02D0002019
-:10AEF000FFF7A6FE04488472002101753220F6F7A0
-:10AF0000E3FB0020AEE7000018000024100000243E
-:10AF100014000024F8B504460D46164616B94FF045
-:10AF2000FF30F8BD2348807A10B94FF0FF30F8E7C2
-:10AF300020128DF80000E0B28DF801009DF80100AC
-:10AF400028441C4949684989884202DD4FF0FF3096
-:10AF5000E7E7184A1268D17E174A10786B4602223A
-:10AF6000FAF71CFE60B1134A1268D17E134A1078BA
-:10AF70006B460222FAF712FE10B14FF0FF30D0E715
-:10AF8000EAB20C4B1B68197E0B4B18783346FAF764
-:10AF900005FE60B1074A1268D17E084A10786B46F8
-:10AFA0000222FAF7FBFD10B14FF0FF30B9E70020A5
-:10AFB000B7E700001800002410000024140000244B
-:10AFC00010B58AB00020099003A906A8FFF7D0FBAE
-:10AFD0000446072C3FD102A8FEF72EFF9DED060A7E
-:10AFE000B8EEC00ADDED020A20EE200ABDEEC00A6E
-:10AFF0008DED060A9DED070AB8EEC00ADDED020AE6
-:10B0000020EE200ABDEEC00A8DED070A9DED080A6C
-:10B01000B8EEC00ADDED020A20EE200ABDEEC00A3D
-:10B020008DED080A06A8FDF7DBFE01A8FEF7B0FECD
-:10B03000BDF80410039848430390BDF80410049829
-:10B0400048430490BDF8041005984843059003A8B0
-:10B05000FDF7F4FD00BF74208DF82400E0B28DF8F8
-:10B06000250009A9062000F002F80AB010BD70B54D
-:10B0700086B005460C46142101A8F5F794F9242062
-:10B080008DF804008DF805500DB1012D17D1204623
-:10B090000188090A8DF8061001788DF8071041889B
-:10B0A000090A8DF8081081788DF809108188090A3D
-:10B0B0008DF80A1001798DF80B10082683E0022D17
-:10B0C0003ED120460168090E8DF806100168090C72
-:10B0D0008DF807100188090A8DF8081001788DF89D
-:10B0E00009104168090E8DF80A104168090C8DF8A5
-:10B0F0000B108188090A8DF80C1001798DF80D105C
-:10B100008168090E8DF80E108168090C8DF80F10FA
-:10B110000189090A8DF81010017A8DF81110C168A3
-:10B12000090E8DF81210C168090C8DF81310818971
-:10B13000090A8DF81410017B8DF81510122642E0D3
-:10B14000032D07D120788DF8060060788DF8070070
-:10B15000042638E0042D04D120788DF8060003265B
-:10B1600031E0052D20D120460168090E8DF806102A
-:10B170000168090C8DF807100188090A8DF808107C
-:10B1800001788DF809104168090E8DF80A104168A0
-:10B19000090C8DF80B108188090A8DF80C100179C3
-:10B1A0008DF80D100A260EE0062D0CD120788DF8B2
-:10B1B000060060788DF80700A0788DF80800E07828
-:10B1C0008DF80900062606B070BD000038B50446AB
-:10B1D0002A4890F8240008B314B10220009001E03E
-:10B1E00000200090254A1268517C254A10786B4651
-:10B1F0000122FAF7D3FC60B1204A1268517C214A3F
-:10B2000010786B460122FAF7C9FC10B14FF0FF30FD
-:10B2100038BD9DF80010194841742CE01748807A19
-:10B2200010B94FF0FF30F3E724B11448407C08B167
-:10B230000020EDE714B10120009001E00020009013
-:10B240000E4A1268517C0E4A10786B460122FAF7BA
-:10B25000A5FC60B1094A1268517C0A4A10786B4615
-:10B260000122FAF79BFC10B14FF0FF30D0E79DF8B8
-:10B270000010024841740020CAE7000018000024B2
-:10B28000100000241400002400B541EC100B2DED3B
-:10B29000028B83B0B1EEC08B18EE100A18EE901A34
-:10B2A0008DED008B002818BF0120084320F00040DE
-:10B2B000C0F17F6000F1E040C00F14D010EE101A12
-:10B2C00010EE900A8DED000B002918BF01210843F4
-:10B2D00020F00040C0F17F6000F1E040C00F04BFEB
-:10B2E0000120FCF75DFD51EC180B03B0BDEC028BA7
-:10B2F00000BD000075191A0C6A231B1C00001F20DA
-:10B300007274433B4138393A006B6C376F06246DD9
-:10B310006E706800000476005401F7FD0001000023
-:10B320008300000000080000000100183200050042
-:10B33000000020410000D242295C0F3E9A99993EBC
-:10B340003333733F295C0F3E00007000000000247F
-:10B35000000000020003000000650054FFEF000041
-:10B36000FA80000B12820001030C30C30E8C8CE9B2
-:10B3700014D5400213710F8E3883F8833000F883A0
-:10B38000258EF8833000F883FFFFFFFF0FFEA9D65C
-:10B39000240004001A8279A10000003CFFFF000095
-:10B3A0000010000038836FA2003E03304000000010
-:10B3B00002CAE3093E8000002000000000000000F7
-:10B3C0004000000060000000000C0000000C186E3F
-:10B3D000000006920A16C0DFFFFF0256FD8CD377ED
-:10B3E000FFE1C496E0C5BEAA00000000FFFF0B2BE2
-:10B3F00000001657000003594000000000001DFA2D
-:10B4000000026C1D000000003FFFDFEB003EB3B602
-:10B41000000D227800002F3C00000000001942B50A
-:10B42000000039A20000B365D90E9FC91DCF4C346E
-:10B4300030000000500000003BB67AE800640000D5
-:10B4400000C8000000000000100000001000FA9288
-:10B450001000225E000D229F00010000003200005B
-:10B46000FF46000063D400001000000004D6000076
-:10B4700004CC000004CC000000001072000000406A
-:10B4800000000000000000000006000200050007A8
-:10B490000000000000640000000000000000000543
-:10B4A0000005006400200000000000000000000013
-:10B4B000000040000000030000000032F898000087
-:10B4C000FF650000830F0000FF9BFC0000000000F0
-:10B4D000000000000000000000000000000000006C
-:10B4E000000000000000000000000000000000005C
-:10B4F00000000000000010004000000000000006F6
-:10B500000000B26A000200000001FB830068000036
-:10B5100000D9FC007CF1FF83000000000065000002
-:10B52000006403E80064002800000025000000001B
-:10B5300016A000000000100000001000002F000006
-:10B54000000001F40000100000280000FFFF45810A
-:10B55000FFFFFA7200000000000000000044000538
-:10B560000005BAC6004778A20000000100000000F4
-:10B5700000000600000000140000254D002F706D33
-:10B58000000005AE000C02D000000000000000002A
-:10B590000000000000000000001B00000000000090
-:10B5A000000000000000000000640000000800002F
-:10B5B000000000000000000000000000000000008B
-:10B5C000000000000000000000000000000000007B
-:10B5D000000000000000000000000000000000006B
-:10B5E000000000000000000000000000000000005B
-:10B5F000000000000000000000000000000000004B
-:10B600000000000000000000001B0000000000001F
-:10B6100000000000000E000E00000AC70004000039
-:10B6200000000032FFFFFF9C00000B2B0000000217
-:10B630000000000100000064FFE5000000000000C1
-:10B6400000000000000000000000000100000000F9
-:10B6500000010000000000000001800000018000E7
-:10B6600000018000002426D300000000000000003C
-:10B67000000600100096003C0000000000000000E2
-:10B6800000000000000000000C0A4E68CDCF7709D2
-:10B6900050166759C619CE82000000000000000055
-:10B6A000000000000000000000000000000000009A
-:10B6B00017D7840003000000000000000000000015
-:10B6C000C7938F9D1E1B1C19000000000000000086
-:10B6D000000000000000000000000000000000006A
-:10B6E0000203188500004000000000030000000372
-:10B6F000000000000000000040000000000000000A
-:10B700000000000000000000000000000000000039
-:10B710000000000000000000000000000000000029
-:10B72000000000000000000000000000677DDF7ED8
-:10B7300072902E554CF6E6880000000000000000D4
-:10B740000000000000000000D8DCB4B8B0D8B9ABED
-:10B75000F3F8FAB3B7BB8E9EAEF132F51BF1B4B875
-:10B76000B08097F1A9DFDFDFAADFDFDFF2AAC5CD66
-:10B77000C7A90CC92C97F1A989264666B28999A94F
-:10B780002D557DB0B08AA896365676F1BAA3B4B2DC
-:10B7900080C0B8A89711B28398BAA3F024084410C7
-:10B7A0006418B2B9B49883F1A329557DBAB5B1A391
-:10B7B0008393F0002850F5B2B6AA839328547CF105
-:10B7C000B9A3829361BAA2DADEDFDB819AB9AEF562
-:10B7D000606870F1DABAA2DFD9BAA2FAB9A382928C
-:10B7E000DB31BAA2D9BAA2F8DF85A4D0C1BBAD8340
-:10B7F000C2C5C7B8A2DFDFDFBAA0DFDFDFD8D8F16C
-:10B80000B8AAB38DB4980D355DB2B6BAAF8C96199F
-:10B810008F9FA70E161EB49AB8AA872C547CBAA480
-:10B82000B08AB691325676B28494A4C808CDD8B8FE
-:10B83000B4B0F19982A82D557D98A80E161EA22CA1
-:10B84000547C92A4F02C5078F184A898C4CDFCD8F4
-:10B850000DDBA8FC2DF3D9BAA6F8DABAA6DED8BA61
-:10B86000B2B68696A6D0F3C841DAA6C8F8D8B0B466
-:10B87000B882A892F52C548898F135D9F418D8F1EB
-:10B88000A2D0F8F9A884D9C7DFF8F883C5DADF6950
-:10B89000DF83C1D8F40114F1A8824EA884F311D13A
-:10B8A00082F5D992289788F109F41C1CD884A8F352
-:10B8B000C0F9D1D99782F129F40DD8F3F9F9D1D98A
-:10B8C00082F4C203D8DEDF1AD8F1A2FAF9A884986C
-:10B8D000D9C7DFF8F8F883C7DADF69DFF883C3D8A0
-:10B8E000F40114F198A8822EA884F311D182F5D91D
-:10B8F00092509788F109F41CD884A8F3C0F8F9D1C4
-:10B90000D99782F149F40DD8F3F9F9D1D982F4C469
-:10B9100003D8DEDFD8F1AD8898CCA809F9D9829296
-:10B92000A8F57CF1883ACF944A6E98DB6931DAAD9C
-:10B93000F2DEF9D88795A8F221D1DAA5F9F417D962
-:10B94000F1AE8ED0C0C3AE82C684C3A88595C8A50B
-:10B9500088F2C0F1F4010EF18E9EA8C63E56F55451
-:10B96000F18872F40115F19845856EF58E9E048874
-:10B97000F142985A8E9E068869F4011CF1981E11B6
-:10B9800008D0F504F11E970202983625DBF9D98517
-:10B99000A5F3C1DA85A5F3DFD88595A8F309DAA563
-:10B9A000FAD88292A8F578F1881A849F268898217F
-:10B9B000DAF41DF3D8879F39D1AFD9DFDFFBF9F473
-:10B9C0000CF3D8FAD0F8DAF9F9D0DFD9F9D8F40BBA
-:10B9D000D8F3879F39D1AFD9DFDFF41DF3D8FAFC54
-:10B9E000A869F9F9AFD0DADEFAD9F88F9FA8F1CCBF
-:10B9F000F398DB45D9AFDFD0F8D8F18F9FA8CAF311
-:10BA00008809DAAF8FCBF8D8F2AD978D0CD9A5DFC6
-:10BA1000F9BAA6F3FAF412F2D8950DD1D9BAA6F371
-:10BA2000FADAA5F2C1BAA6F3DFD8F1BAB2B68696B1
-:10BA3000A6D0CAF349DAA6CBF8D8B0B4B8D8AD844A
-:10BA4000F2C0DFF18FCBC3A8B2B68696C8C1CBC314
-:10BA5000F3B0B48898A821DB718D9D71859521D9AB
-:10BA6000ADF2FAD88597A828D9F408D8F28D29DA4A
-:10BA7000F405D9F285A4C2F2D8A88D9401D1D9F4E5
-:10BA800011F2D88721D8F40AD8F28498A8C801D135
-:10BA9000D9F411D8F3A4C8BBAFD0F2DEF8F8F8F8A7
-:10BAA000F8F8F8F8D8F1B8F6B5B9B08A95A3DE3C45
-:10BAB000A3D9F8D85CA3D9F8D87CA3D9F8D8F8F9D9
-:10BAC000D1A5D9DFDAFAD8B18530F7D9DED8F83088
-:10BAD000ADDADED8F2B48C99A32D557DA083DFDFDB
-:10BAE000DFB591A0F629D9FBD8A0FC29D9FAD8A0B6
-:10BAF000D051D9F8D8FC51D9F9D879D9FBD8A0D0F0
-:10BB0000FC79D9FAD8A1F9F9F9F9F9A0DADFDFDF80
-:10BB1000D8A1F8F8F8F8F8ACDEF8ADDE8393AC2CD9
-:10BB2000547CF1A8DFDFDFF69D2CDAA0DFD9FADB49
-:10BB30002DF8D8A850DAA0D0DED9D0F8F8F8DB5527
-:10BB4000F8D8A878DAA0D0DFD9D0FAF8F8F8F8DB7E
-:10BB50007DF8D89CA88CF530DB38D9D0DEDFA0D0BA
-:10BB6000DEDFD8A848DB58D9DFD0DEA0DFD0DED8B2
-:10BB7000A868DB70D9DFDFA0DFDFD8F1A888902CC0
-:10BB8000547C98A8D05C38D1DAF2AE8CDFF9D8B00A
-:10BB900087A8C1C1B188A8C6F9F9DA36D8A8F9DAF8
-:10BBA00036D8A8F9DA36D8A8F9DA36D8A8F9DA36C4
-:10BBB000D8F78D9DADF818DAF2AEDFD8F7ADFA30D0
-:10BBC000D9A4DEF9D8F2AEDEFAF983A7D9C3C5C786
-:10BBD000F1889BA77AADF7DEDFA4F8849408A797D5
-:10BBE000F300AEF29819A488C6A39488F632DFF267
-:10BBF0008393DB09D9F2AADFD8D8AEF8F9D1DAF30A
-:10BC0000A4DEA7F1889B7AD8F38494AE19F9DAAA56
-:10BC1000F1DFD8A881C0C3C5C7A39283F628ADDEE3
-:10BC2000D9F8D8A350ADD9F8D8A378ADD9F8D8F8B9
-:10BC3000F9D1A1DADEC3C5C7D8A18194F818F2B052
-:10BC400089ACC3C5C7F1D8B8B4B09786A8319B06F4
-:10BC50009907AB9728889BF00C201440B0B4B8F03B
-:10BC6000A88A9A285078B79BA829517924705944FA
-:10BC70006938644831F1BBAB88002C547CF0B38B3D
-:10BC8000B8A804285078F1B088B49726A85998BB72
-:10BC9000ABB38B02264666B0B8F08A9CA8295179CE
-:10BCA0008B2951798A2470598B2058718A446938BC
-:10BCB0008B3940688A6448318B30496088F1AC0028
-:10BCC0002C547CF08CA804285078F1889726A85929
-:10BCD00098AC8C02264666F0899CA829517924707C
-:10BCE00059446938644831A98809205970AB113822
-:10BCF0004069A8193148608CA83C415C207C00F167
-:10BD000087981986A86E767EA999882D557DD8B119
-:10BD1000B5B9A3DFDFDFAED0DFAAD0DEF2ABF8F932
-:10BD2000D9B087C4AAF1DFDFBBAFDFDFB9D8B1F18B
-:10BD3000A3978E60DFB084F2C8F8F9D9DED8938576
-:10BD4000F14AB183A308B5839A0810B79F10D8F1C0
-:10BD5000B0BAAEB08AC2B2B68E9EF1FBD9F41DD88D
-:10BD6000F9D90CF1D8F8F8AD61D9AEFBD8F40CF1E3
-:10BD7000D8F8F8AD19D9AEFBDFD8F416F1D8F8AD84
-:10BD80008D61D9F4F4ACF59C9C8DDF2BBAB6AEFA7C
-:10BD9000F8F40BD8F1AED0F8AD51DAAEFAF8F1D82C
-:10BDA000B9B1B6A3839C08B9B1839AB5AAC0FD30D6
-:10BDB00083B79F10B58B93F20202D1ABDADED8F1D4
-:10BDC000B080BAABC0C3B284C1C3D8B1B9F38BA33E
-:10BDD00091B609B4D9ABDEB0879CB9A3DDF1B38BC2
-:10BDE0008B8B8B8BB087A3A3A3A3B28BB69BF2A341
-:10BDF000A3A3A3A3A3A3A3A3A3F1B087B59AA3F37B
-:10BE00009BA3A3DCBAACDFB9A3A3A3A3A3A3A3A35F
-:10BE1000A3A3A3A3A3A3A3A3D8D8D8BBB3B7F1AAC2
-:10BE2000F9DAFFD9809AAA28B48098A720B7978713
-:10BE3000A86688F07951F1902C870CA781976293BE
-:10BE4000F071716085940129517990A5F1284C6CAD
-:10BE5000870C95188578A38390284C6C886CD8F350
-:10BE6000A28200F210A8921980A2F2D926D8F188F5
-:10BE7000A84DD948D896A83980D93CD89580A839FA
-:10BE8000A68698D92CDA87A72CD8A8899519A980D5
-:10BE9000D938D8A88939A980DA3CD8A82EA83990F1
-:10BEA000D90CD8A8953198D90CD8A809D9FFD801B0
-:10BEB000DAFFD89539A9DA26FFD890A80D8999A874
-:10BEC00010809821DA2ED88999A83180DA2ED8A846
-:10BED00086963180DA2ED8A8873180DA2ED8A882CB
-:10BEE00092F34180F1D92ED8A882F31980F1D92E8E
-:10BEF000D882ACF3C0A28022F1A62EA72EA9229848
-:10BF0000A829DAACDEFFD8A2F22AF1A92E8292A8E3
-:10BF1000F23180A696F1D900AC8C9C0C30ACDED00E
-:10BF2000DEFFD88C9CACD010ACDE8092A2F24C82AA
-:10BF3000A8F1CAF235F19688A6D900D8F1FF010020
-:10BF400002000400060008000A000C001000200097
-:10BF50004000800000010101010307010000080406
-:10BF600002040801010100000000010203040102B3
-:10BF70000304060708090000555555555555C53F9A
-:10BF80007D6FEB0312D6D4BF5544880E55C1C93F0F
-:10BF90003B8F68B52882A4BF88B20175E0EF493FA6
-:10BFA00009F7FD0DE13D023F4B2D8A1C273A03C0E6
-:10BFB000C88A599CE52A004059018D1B6C06E6BFD2
-:10BFC00082922EB1C5B8B33F4FBB610567ACDD3F70
-:10BFD000182D4454FB21E93F9BF681D20B73EF3FB0
-:10BFE000182D4454FB21F93FE2652F227F2B7A3C28
-:10BFF000075C143326A6813CBDCBF07A8807703CE1
-:10C00000075C143326A6913CC4EB98999999C9BF53
-:10C01000711623FEC671BCBF6D9A74AFF2B0B3BF88
-:10C020009AFDDE522DDEADBF2F6C6A2C44B4A2BF48
-:10C030000D5555555555D53FFF8300922449C23FB4
-:10C040006E204CC5CD45B73F513DD0A0660DB13FE8
-:10C05000EB0D76244B7BA93F11DA22E33AAD903FFA
-:10C06000000000000000000050726F6475637420CF
-:10C0700049442072656164206173203020696E64D8
-:10C0800069636174657320646576696365206973AB
-:10C090002065697468657220696E636F6D70617484
-:10C0A00069626C65206F7220616E204D505533308F
-:10C0B00035302E0A00000000D8C00008000000241F
-:10C0C0006C000000807D000844C100086C00002462
-:10C0D00044070000907D0008020000006800000096
-:10C0E000D1000000D00000006800000069000000DE
-:10C0F000F4B2000812B300080000000000000000C5
-:10C10000000000000000000000000000000000002F
-:10C11000000000000000000020B3000800FF000045
-:10C1200000FF0000000100000000000010000000FF
-:10C13000010000000090D0030090D0030000000038
-:04C1400000000000FB
+:1019E000D8E7000008B500BF0949096841F00201C5
+:1019F000074A11601146096801F00201009100BF19
+:101A000000BF044909680143024A116008BD000093
+:101A1000F44402580404005810B504460CB90120DF
+:101A200010BD94F8410028B9002084F840002046F9
+:101A300000F0D8F9242084F841002068006820F0E4
+:101A4000010021680860606820F07060216808610A
+:101A50002068806820F4004021688860E0680128E0
+:101A600005D1A06840F400402168886004E0A068C7
+:101A700040F4044021688860E068022806D12068AC
+:101A8000406840F400602168486005E020684068D4
+:101A900020F40060216848602068406813490843CA
+:101AA000216848602068C06820F400402168C86050
+:101AB000D4E904010843A16940EA01202168C86013
+:101AC000D4E907010843216808602068006840F0F5
+:101AD00001002168086000206064202084F8410033
+:101AE0000020206384F8420000BF99E700800002D4
+:101AF0002DE9F8430446894616461F46DDF8208046
+:101B000094F84100202873D100BF94F840000128C8
+:101B100002D10220BDE8F883012084F8400000BF14
+:101B2000FFF7F0FE054619230122D1032046009558
+:101B300003F0A8FE08B10120ECE7222084F8410060
+:101B4000102084F84200002060646662678560634C
+:101B5000608DFF280CD9FF2020853C48009094F828
+:101B600028204FF080734946204603F06FFE0BE0BB
+:101B7000608D20853548009094F828204FF0007340
+:101B80004946204603F062FE3FE02A464146204691
+:101B900003F0BAFE08B10120BCE72068406A616A20
+:101BA0000870606A401C6062208D401E2085608D38
+:101BB000401E6085608D40B3208D30BB43460022BF
+:101BC00080212046009503F05DFE08B10120A1E7C9
+:101BD000608DFF280DD9FF2020850020009094F80B
+:101BE00028204FF080734946204603F02FFE0CE07A
+:101BF0002AE0608D20850020009094F828204FF086
+:101C000000734946204603F021FE608D0028BCD1B8
+:101C10002A464146204603F0D9FE08B1012079E763
+:101C200020202168C861206840680949084021686F
+:101C30004860202084F84100002084F8420000BF62
+:101C400084F8400000BF65E7022063E700240080BD
+:101C500000E800FE2DE9F84F04468A4617469846EC
+:101C6000DDF8289094F84100202878D100BF94F83E
+:101C70004000012802D10220BDE8F88F012084F83D
+:101C8000400000BFFFF73EFE054619230122D103A5
+:101C90002046009503F0F6FD08B10120ECE7212075
+:101CA00084F84100102084F84200002060646762DC
+:101CB000A4F82A806063608DFF2804D9FF20208566
+:101CC0004FF0807603E0608D20854FF00076208D08
+:101CD000C0B1606A007821688862606A401C6062F6
+:101CE000608D401E6085208D401E20853B48009001
+:101CF00094F82800401CC2B233465146204603F0F7
+:101D0000A5FD08E03548009094F828203346514658
+:101D1000204603F09BFD3FE02A464946204603F05B
+:101D200085FE08B10120A7E7606A00782168886213
+:101D3000606A401C6062608D401E6085208D401E80
+:101D40002085608D40B3208D30BB4B460022802122
+:101D50002046009503F096FD10B101208CE73AE093
+:101D6000608DFF280CD9FF2020850020009094F87A
+:101D700028204FF080735146204603F067FD0BE0AA
+:101D8000608D20850020009094F828204FF000738B
+:101D90005146204603F05AFD608D0028BCD12A46EA
+:101DA0004946204603F012FE08B1012064E72020D6
+:101DB0002168C86120684068094908402168486076
+:101DC000202084F84100002084F8420000BF84F8FD
+:101DD000400000BF50E702204EE7000000200080D6
+:101DE00000E800FE10B5B8B00446142132A8FEF792
+:101DF000DAFAC02102A8FEF7D6FA674920688842BD
+:101E000036D108210020CDE90210239002A801F06C
+:101E1000A7FA08B1FEF743FF00BF6048006840F032
+:101E200002005E4908600846006800F00200019068
+:101E300000BF00BF4FF4C0703290122033900020DA
+:101E4000349035900420369032A95548FFF750FC65
+:101E500000BF52480830006840F400104F49083174
+:101E600008600846006800F40010019000BF91E08F
+:101E70004C492068884237D108200021CDE9020171
+:101E80000020239002A801F06BFA08B1FEF707FFCB
+:101E900000BF4248006840F0020040490860084620
+:101EA000006800F00200019000BF00BF4FF44060E6
+:101EB00032901220339000203490359004203690D8
+:101EC00032A93748FFF714FC00BF344808300068D7
+:101ED00040F480003149083108600846006800F489
+:101EE0008000019000BF55E02F492068884251D101
+:101EF00008210020CDE90210239002A801F030FA59
+:101F000008B1FEF7CCFE00BF2448006840F0040092
+:101F1000224908600846006800F00400019000BFF4
+:101F200000BF00BF0846006840F001000860084696
+:101F3000006800F00100019000BF00BF4FF4007086
+:101F40003290122033900020349035900420369047
+:101F500032A91648FFF7CCFB4FF480703290122064
+:101F600033900020349035900420369032A91048E8
+:101F7000FFF7BEFB00BF09480830006840F40000CE
+:101F80000649083108600846006800F40000019026
+:101F900000BF00BF38B010BD00540040E0440258FC
+:101FA0000004025800580040005C0040000802583D
+:101FB00000000258034800680349097808440149B1
+:101FC00008607047480000245000002410B503202A
+:101FD00000F0A8F802F052FA10490968C1F3032191
+:101FE0000F4A515C01F01F0120FA01F40B48006810
+:101FF00000F00F001146085C00F01F0024FA00F00A
+:1020000008490860084804600F2000F00FF808B184
+:10201000012010BD00F036F80020FAE718440258FD
+:1020200006BD0008580000245400002470B5044682
+:102030001148007808B9012070BD0F4800784FF4AE
+:102040007A71B1FBF0F00D490968B1FBF0F5284653
+:1020500002F056FF08B10120EEE7102C07D2002253
+:102060002146501E00F020F80548046001E00120E0
+:10207000E2E70020E0E700005000002454000024C4
+:102080004C00002408B500BF0648006840F002007C
+:10209000044908600846006800F00200009000BF94
+:1020A00000BF08BDF44402582DE9F05F80460D469C
+:1020B000164605F033FB074639462A46334601F0FB
+:1020C0000700C0F1070ABAF1040F02D94FF0040A61
+:1020D00001E0C0F1070AD14600F1040ABAF1070F86
+:1020E00002D24FF0000A01E0A0F1030AD4464FF0FB
+:1020F000010A0AFA09FAAAF1010A0AEA020A0AFA24
+:102100000CFA4FF0010B0BFA0CFBABF1010B0BEAD5
+:10211000030B4AEA0B042146404605F007FBBDE8E5
+:10212000F09F000000BF00F00702064B19684FF651
+:10213000FF031940044B0B4343EA0221014B196092
+:1021400000BF70470CED00E00000FA0570B50446D2
+:1021500015480068C0F3800048B91348006800F0D3
+:102160000700A04201D0012070BD0020FCE70E480E
+:10217000006820F0070020430B490860FFF7C2FB0E
+:10218000054607E0FFF7BEFB401BB0F57A7F01D99B
+:102190000120E9E7044808380068C0F3403000280F
+:1021A000F0D00020E0E700000C480258F8B50446E3
+:1021B000FFF7A8FB06460CB90120F8BD206A4028AD
+:1021C00000D000BF94F8410038B9204600F046F82E
+:1021D00041F28831204600F00FF92068006820F4B1
+:1021E000F851A068401E41EA002021680860A06CF8
+:1021F0003346002220210090204604F076F8054660
+:1022000035BB2179E06840EA0160E1690843216A51
+:102210000843216809680F4A114008432168086093
+:10222000208A616941EA0040A16908432168496840
+:10223000094A11400843216848602068006840F05E
+:1022400001002168086000206064012084F84100DA
+:102250002846B2E72FFFFF00FEF8E0FF10B5B8B048
+:102260000446142132A8FEF79EF8C02102A8FEF70A
+:102270009AF85A49206888427ED14FF000710020B8
+:10228000CDE90210159002A801F06AF808B1FEF736
+:1022900006FD00BF5248006840F480405049086085
+:1022A0000846006800F48040019000BF00BF00BFF6
+:1022B0004B480C30006840F0100049490C31086070
+:1022C0000846006800F01000019000BF00BF00BF8A
+:1022D0000846006840F0010008600846006800F009
+:1022E0000100019000BF00BF00BF0846006840F039
+:1022F000020008600846006800F00200019000BF7C
+:1023000000BF00BF0846006840F0080008600846AB
+:10231000006800F00800019000BF00BF00BF084641
+:10232000006840F0040008600846006800F00400FF
+:10233000019000BF00BF04203290022033900020A3
+:10234000349035900920369032A92648FFF7D0F90D
+:10235000022032903390002034903590092036903E
+:1023600032A92148FFF7C4F90420329002203390AB
+:1023700000203490359000E02EE00920369032A9FC
+:102380001A48FFF7B5F94FF40060329002203390FD
+:102390000020349035900920369032A91448FFF778
+:1023A000A7F94FF4806032900220339000203490DF
+:1023B00035900920369032A90E48FFF799F9402050
+:1023C0003290022033900020349035900A203690CD
+:1023D00032A90648FFF78CF938B010BD0050005202
+:1023E000D444025800100258000002580004025859
+:1023F000000C0258000802588164704710B501F0C3
+:10240000F3FF05490968C1F30211044A515C01F068
+:102410001F01C84010BD00002044025806BD00083E
+:1024200070B50146844D2D6805F00303824D2D687B
+:10243000C5F30510804D2D1D2D6805F001047E4D5E
+:102440000C352D68C5F3CC0515FB04F501EE105ACB
+:10245000B8EE411AF0EE410A00286FD023B1012BEB
+:102460004ED0022B6BD16BE0734D283D2D68C5F328
+:1024700040153DB3704D283D2D68C5F3C1066F4D25
+:1024800025FA06F201EE102AF8EE411A01EE100AC2
+:10249000B8EE411A81EE812A9FED691AC0EE811AC9
+:1024A000654D08352D68C5F3080501EE105AB8EEE4
+:1024B000411A31EE811AF7EE001A31EE211A22EE9E
+:1024C000010A1CE001EE100AB8EE411ADFED5D1AB8
+:1024D00081EE812A9FED5A1AC0EE811A564D0835B9
+:1024E0002D68C5F3080501EE105AB8EE411A31EE19
+:1024F000811AF7EE001A31EE211A22EE010A5BE092
+:1025000001EE100AB8EE411ADFED4F1A81EE812A72
+:102510009FED4B1AC0EE811A474D08352D68C5F363
+:10252000080501EE105AB8EE411A31EE811AF7EEA5
+:10253000001A31EE211A22EE010A3DE077E01DE09B
+:1025400001EE100AB8EE411A9FED402AC2EE011AC0
+:102550009FED3B1A80EE812A374D08352D68C5F373
+:10256000080501EE105AB8EE411A32EE011AB7EE24
+:10257000002A31EE021A21EE810A1DE001EE100A56
+:10258000B8EE411ADFED2F1A81EE812A9FED2C1A49
+:10259000C0EE811A284D08352D68C5F3080501EEF7
+:1025A000105AB8EE411A31EE811AF7EE001A31EEE8
+:1025B000211A22EE010A00BF00BF1F4D08352D6809
+:1025C000C5F3462501EE105AB8EE411AF7EE001A8F
+:1025D00031EE211AC0EE011ABCEEE11A81ED001AAB
+:1025E000154D08352D68C5F3064501EE105AB8EEB5
+:1025F000411AF7EE001A31EE211AC0EE011ABCEEB4
+:10260000E11A81ED011A0C4D08352D68C5F30665F8
+:1026100001EE105AB8EE411AF7EE001A31EE211A07
+:10262000C0EE011ABCEEE11A81ED021A03E00025AA
+:102630000D604D608D6070BD284402580090D0033D
+:10264000000000460024744C0024744A20BCBE4B99
+:1026500070B50146844D2D6805F00303824D2D6849
+:10266000C5F30530804D2D1D2D68C5F300147E4D3A
+:1026700014352D68C5F3CC0515FB04F501EE105A91
+:10268000B8EE411AF0EE410A00286FD023B1012BB9
+:102690004ED0022B6BD16BE0734D283D2D68C5F3F6
+:1026A00040153DB3704D283D2D68C5F3C1066F4DF3
+:1026B00025FA06F201EE102AF8EE411A01EE100A90
+:1026C000B8EE411A81EE812A9FED691AC0EE811A97
+:1026D000654D10352D68C5F3080501EE105AB8EEAA
+:1026E000411A31EE811AF7EE001A31EE211A22EE6C
+:1026F000010A1CE001EE100AB8EE411ADFED5D1A86
+:1027000081EE812A9FED5A1AC0EE811A564D10357E
+:102710002D68C5F3080501EE105AB8EE411A31EEE6
+:10272000811AF7EE001A31EE211A22EE010A5BE05F
+:1027300001EE100AB8EE411ADFED4F1A81EE812A40
+:102740009FED4B1AC0EE811A474D10352D68C5F329
+:10275000080501EE105AB8EE411A31EE811AF7EE73
+:10276000001A31EE211A22EE010A3DE077E01DE069
+:1027700001EE100AB8EE411A9FED402AC2EE011A8E
+:102780009FED3B1A80EE812A374D10352D68C5F339
+:10279000080501EE105AB8EE411A32EE011AB7EEF2
+:1027A000002A31EE021A21EE810A1DE001EE100A24
+:1027B000B8EE411ADFED301A81EE812A9FED2C1A16
+:1027C000C0EE811A284D10352D68C5F3080501EEBD
+:1027D000105AB8EE411A31EE811AF7EE001A31EEB6
+:1027E000211A22EE010A00BF00BF1F4D10352D68CF
+:1027F000C5F3462501EE105AB8EE411AF7EE001A5D
+:1028000031EE211AC0EE011ABCEEE11A81ED001A78
+:10281000154D10352D68C5F3064501EE105AB8EE7A
+:10282000411AF7EE001A31EE211AC0EE011ABCEE81
+:10283000E11A81ED011A0C4D10352D68C5F30665BE
+:1028400001EE105AB8EE411AF7EE001A31EE211AD5
+:10285000C0EE011ABCEEE11A81ED021A03E0002578
+:102860000D604D608D6070BD284402580090D0030B
+:10287000000000460024744C0024744A20BCBE4B67
+:1028800070B50146844D2D6805F00303824D2D6817
+:10289000C5F30550804D2D1D2D68C5F300247E4DD8
+:1028A0001C352D68C5F3CC0515FB04F501EE105A57
+:1028B000B8EE411AF0EE410A00286FD023B1012B87
+:1028C0004ED0022B6BD16BE0734D283D2D68C5F3C4
+:1028D00040153DB3704D283D2D68C5F3C1066F4DC1
+:1028E00025FA06F201EE102AF8EE411A01EE100A5E
+:1028F000B8EE411A81EE812A9FED691AC0EE811A65
+:10290000654D18352D68C5F3080501EE105AB8EE6F
+:10291000411A31EE811AF7EE001A31EE211A22EE39
+:10292000010A1CE001EE100AB8EE411ADFED5D1A53
+:1029300081EE812A9FED5A1AC0EE811A564D183544
+:102940002D68C5F3080501EE105AB8EE411A31EEB4
+:10295000811AF7EE001A31EE211A22EE010A5BE02D
+:1029600001EE100AB8EE411ADFED4F1A81EE812A0E
+:102970009FED4B1AC0EE811A474D18352D68C5F3EF
+:10298000080501EE105AB8EE411A31EE811AF7EE41
+:10299000001A31EE211A22EE010A3DE077E01DE037
+:1029A00001EE100AB8EE411A9FED402AC2EE011A5C
+:1029B0009FED3B1A80EE812A374D18352D68C5F3FF
+:1029C000080501EE105AB8EE411A32EE011AB7EEC0
+:1029D000002A31EE021A21EE810A1DE001EE100AF2
+:1029E000B8EE411ADFED301A81EE812A9FED2C1AE4
+:1029F000C0EE811A284D18352D68C5F3080501EE83
+:102A0000105AB8EE411A31EE811AF7EE001A31EE83
+:102A1000211A22EE010A00BF00BF1F4D18352D6894
+:102A2000C5F3462501EE105AB8EE411AF7EE001A2A
+:102A300031EE211AC0EE011ABCEEE11A81ED001A46
+:102A4000154D18352D68C5F3064501EE105AB8EE40
+:102A5000411AF7EE001A31EE211AC0EE011ABCEE4F
+:102A6000E11A81ED011A0C4D18352D68C5F3066584
+:102A700001EE105AB8EE411AF7EE001A31EE211AA3
+:102A8000C0EE011ABCEEE11A81ED021A03E0002546
+:102A90000D604D608D6070BD284402580090D003D9
+:102AA000000000460024744C0024744A20BCBE4B35
+:102AB0002DE9F04389B006460F464FF4807186EA4F
+:102AC0000100384370D1F748006800F00709B9F1F8
+:102AD000050F65D2DFE809F0031221623000F148EA
+:102AE0005038006800F00070B0F1007F04D106A8F3
+:102AF000FFF796FC079C00E0002453E0E9485038BB
+:102B0000006800F00060B0F1006F04D103A8FFF787
+:102B10009FFD039C00E0002444E0E2485038006838
+:102B200000F00050B0F1005F04D16846FFF7A8FE46
+:102B3000009C00E0002435E0DA48001F006800F047
+:102B40004055D8485038006800F00400042809D1E6
+:102B500045B9D44850380068C0F3C101D24820FAC2
+:102B600001F41AE0CF485038006800F48070B0F5E6
+:102B7000807F04D1B5F1805F01D1CC4C0DE0C94814
+:102B80005038006800F40030B0F5003F04D1B5F1D2
+:102B9000005F01D1C64C00E0002403E0C54C01E019
+:102BA000002400BFD4E3FFE74FF4007186EA010080
+:102BB00038437AD1BB48006800F4E079B9F1800F5E
+:102BC0002CD006DCB9F1000F0AD0B9F1400F69D161
+:102BD00015E0B9F1C00F63D0B9F5807F62D12CE068
+:102BE000B0485038006800F00070B0F1007F04D1A8
+:102BF00006A8FFF715FC079C00E0002454E0A94854
+:102C00005038006800F00060B0F1006F04D103A8F4
+:102C1000FFF71EFD039C00E0002445E0A14850386A
+:102C2000006800F00050B0F1005F04D16846FFF783
+:102C300027FE009C00E0002436E09A48001F006850
+:102C400000F0405597485038006800F00400042810
+:102C500009D145B9934850380068C0F3C101924882
+:102C600020FA01F41BE08F485038006800F48070AF
+:102C7000B0F5807F04D1B5F1805F01D18B4C0EE0BF
+:102C800088485038006800F40030B0F5003F05D1A6
+:102C9000B5F1005F02D1864C01E006E0002403E0BC
+:102CA000844C01E0002400BF52E34FF4806186EAC7
+:102CB000010038437BD17B480830006800F460098C
+:102CC000B9F5800F2CD006DCB9F1000F0AD0B9F5A8
+:102CD000001F69D115E0B9F5C00F63D0B9F5000F39
+:102CE00062D12CE06F485038006800F00070B0F1FD
+:102CF000007F04D106A8FFF793FB079C00E00024A7
+:102D000054E068485038006800F00060B0F1006F8F
+:102D100004D103A8FFF79CFC039C00E0002445E0DD
+:102D200060485038006800F00050B0F1005F04D1F6
+:102D30006846FFF7A5FD009C00E0002436E05948F6
+:102D4000001F006800F0405556485038006800F0F9
+:102D50000400042809D145B9524850380068C0F32E
+:102D6000C101514820FA01F41BE04E485038006878
+:102D700000F48070B0F5807F04D1B5F1805F01D19F
+:102D80004A4C0EE047485038006800F40030B0F577
+:102D9000003F05D1B5F1005F02D1454C01E006E0EE
+:102DA000002403E0434C01E0002400BFD0E24FF4D4
+:102DB000006186EA0100384373D13A480830006860
+:102DC00000F0E069B9F1007F2CD006DCB9F1000F0A
+:102DD0000AD0B9F1807F75D115E0B9F1407F6FD08D
+:102DE000B9F1806F6ED12CE02E485038006800F0A9
+:102DF0000070B0F1007F04D106A8FFF711FB079C1B
+:102E000000E0002460E027485038006800F00060CF
+:102E1000B0F1006F04D103A8FFF71AFC039C00E097
+:102E2000002451E01F485038006800F00050B0F115
+:102E3000005F04D16846FFF723FD009C00E00024FA
+:102E400042E01848001F006800F04055154850380F
+:102E5000006800F00400042809D145B91148503831
+:102E60000068C0F3C101104820FA01F427E00D48C2
+:102E70005038006800F48070B0F5807F04D1B5F15F
+:102E8000805F01D1094C1AE006485038006800F410
+:102E90000030B0F5003F11D1B5F1005F0ED1044C08
+:102EA0000DE012E0504402580090D00300093D00AC
+:102EB00040787D010080BB0004E001E0002403E0D5
+:102EC000F74C01E0002400BF42E24FF4805186EA53
+:102ED000010038437AD1F348006800F4E048B8F5BF
+:102EE000005F2CD006DCB8F1000F0AD0B8F5805F87
+:102EF00069D115E0B8F5405F63D0B8F5804F62D175
+:102F00002CE0E8485038006800F00070B0F1007F15
+:102F100004D106A8FFF784FA079C00E0002454E0DF
+:102F2000E0485038006800F00060B0F1006F04D154
+:102F300003A8FFF78DFB039C00E0002445E0D9487F
+:102F40005038006800F00050B0F1005F04D16846CE
+:102F5000FFF796FC009C00E0002436E0D148001FFB
+:102F6000006800F04055CF485038006800F0040079
+:102F7000042809D145B9CB4850380068C0F3C101D5
+:102F8000C94820FA01F41BE0C6485038006800F434
+:102F90008070B0F5807F04D1B5F1805F01D1C34C62
+:102FA0000EE0C0485038006800F40030B0F5003F33
+:102FB00005D1B5F1005F02D1BD4C01E006E000246F
+:102FC00003E0B74C01E0002400BFC1E14FF4005121
+:102FD00086EA0100384367D1B248006800F4E0286F
+:102FE000B8F5403F33D009DCB8F1000F0DD0B8F58B
+:102FF000803F0ED0B8F5003F53D119E0B8F5802FCF
+:1030000037D0B8F5A02F4CD13FE001F013FA0446B9
+:1030100049E0A4485038006800F00060B0F1006F4B
+:1030200004D103A8FFF714FB049C00E000243AE05D
+:103030009C485038006800F00050B0F1005F04D1A7
+:103040006846FFF71DFC019C00E000242BE095483A
+:103050005038006800F00400042808D19148503826
+:103060000068C0F3C101904820FA01F400E0002498
+:1030700019E08C485038006800F48070B0F5807F0B
+:1030800001D18A4C00E000240DE0864850380068E9
+:1030900000F40030B0F5003F01D1854C00E0002481
+:1030A00001E0002400BF53E14FF4002186EA010053
+:1030B000384361D17B480830006800F44038B8F1EB
+:1030C000000F06D0B8F5803F12D0B8F5003F50D1C0
+:1030D0001DE074485038006800F00060B0F1006FE7
+:1030E00004D103A8FFF7B4FA039C00E0002442E0F7
+:1030F0006C485038006800F00050B0F1005F04D117
+:103100006846FFF7BDFB029C00E0002433E0654801
+:10311000001F006800F0405562485038006800F019
+:103120000400042809D145B95E4850380068C0F34E
+:10313000C1015D4820FA01F41AE05A48503800688D
+:1031400000F48070B0F5807F04D1B5F1805F01D1CB
+:10315000564C0DE053485038006800F40030B0F58C
+:10316000003F04D1B5F1005F01D1514C00E00024D3
+:1031700001E0002400BFEBE04FF4803186EA01005B
+:1031800038432CD14748001F006800F48038B8F15C
+:10319000000F03D0B8F5803F1ED10EE041485038F3
+:1031A000006800F00070B0F1007F04D106A8FFF7BE
+:1031B00037F9079C00E0002410E03A4850380068D6
+:1031C00000F00060B0F1006F04D103A8FFF740FAEF
+:1031D000059C00E0002401E0002400BFB8E04FF4AB
+:1031E000804186EA0100384372D12E4808300068D9
+:1031F00000F0E048B8F1405F33D009DCB8F1000FCF
+:103200000DD0B8F1805F0ED0B8F1005F5DD119E04C
+:10321000B8F1804F37D0B8F1A04F56D14AE0FFF750
+:10322000EDF8044653E01F485038006800F0006095
+:10323000B0F1006F04D103A8FFF70AFA049C00E084
+:10324000002444E017485038006800F00050B0F106
+:10325000005F04D16846FFF713FB019C00E00024E7
+:1032600035E010485038006800F00400042808D108
+:103270000C4850380068C0F3C1010B4820FA01F433
+:1032800000E0002423E007485038006800F4807014
+:10329000B0F5807F01D1054C00E0002417E017E075
+:1032A0000080BB00504402580090D00300093D004C
+:1032B00040787D012848006800F40030B0F5003FF8
+:1032C00001D1264C00E0002401E0002400BF3FE0D3
+:1032D0004FF4004186EA0100384338D11E4850308F
+:1032E000006800F04058B8F1000F06D0B8F1805FD8
+:1032F0000ED0B8F1005F27D118E01748006800F43D
+:103300000030B0F5003F01D1144C00E000241DE076
+:103310001148006800F00070B0F1007F04D106A8E9
+:10332000FFF77EF8079C00E000240FE00A480068E1
+:1033300000F00060B0F1006F04D103A8FFF788F936
+:10334000049C00E0002401E0002400BF00E0002411
+:10335000204609B0BDE8F0830044025840787D0162
+:103360002DE9F04104460025A8464FF00062D4E95B
+:10337000001011400020134659404040014331D114
+:10338000A06E48B1B0F5801F0DD0B0F5001F11D070
+:10339000B0F5401F16D114E0F948006840F4003041
+:1033A000F749086010E0022104F1080002F0C4FFB0
+:1033B000054609E0022104F1280003F06FF80546F4
+:1033C00002E001E0012500BF00BF55B9EC48243000
+:1033D000006820F44010A16E0843E94924310860D8
+:1033E00000E0A8464FF48073D4E900101940002093
+:1033F0005940404001432ED1A06D05281BD2DFE883
+:1034000000F0030A11181900DD48006840F400308C
+:10341000DB49086011E0002104F1080002F08CFF94
+:1034200005460AE0002104F1280003F037F80546BC
+:1034300003E002E001E0012500BF00BF55B9D0481C
+:103440002430006820F00700A16D0843CC492431E6
+:10345000086000E0A8464FF40073D4E9001019405A
+:10346000002059404040014334D1E06D802818D0FD
+:1034700003DC40B140281DD10CE0C02818D0B0F5C5
+:10348000807F17D115E0BE48006840F40030BC4989
+:10349000086011E0002104F1080002F04DFF05462C
+:1034A0000AE0002104F1280002F0F8FF054603E0DD
+:1034B00002E001E0012500BF00BF55B9B04824304B
+:1034C000006820F4E070E16D0843AD4924310860E4
+:1034D00000E0A8464FF48063D4E9001019400020B2
+:1034E00059404040014339D1D4F8A800B0F5800FCD
+:1034F0001AD004DC50B1B0F5001F1ED10DE0B0F5BC
+:10350000C00F18D0B0F5000F17D115E09C48006827
+:1035100040F400309A49086011E0002104F10800ED
+:1035200002F00AFF05460AE0002104F1280002F03B
+:10353000B5FF054603E002E001E0012500BF00BF42
+:103540005DB98F482C30006820F46000D4F8A810D2
+:1035500008438B492C31086000E0A8464FF4006214
+:10356000D4E9001011400020134659404040014367
+:1035700039D1D4F8AC00B0F1007F1AD004DC50B1DE
+:10358000B0F1807F1ED10DE0B0F1407F18D0B0F1D6
+:10359000806F17D115E07A48006840F40030784910
+:1035A000086011E0002104F1080002F0C5FE0546A4
+:1035B0000AE0002104F1280002F070FF054603E054
+:1035C00002E001E0012500BF00BF5DB96C482C306E
+:1035D000006820F0E060D4F8AC10084368492C3152
+:1035E000086000E0A8464FF00073D4E900011840DD
+:1035F000002158404940084328D1E06CA8B1102868
+:1036000004D0202809D0302810D10DE05C48006893
+:1036100040F400305A4908600AE0022104F1080031
+:1036200002F08AFE054603E002E001E0012500BF4A
+:1036300000BF55B952482030006820F03000E16CDE
+:1036400008434F492031086000E0A8464FF48053FA
+:10365000D4E900101940002059404040014337D1BF
+:10366000206EB0F5005F1AD004DC50B1B0F5805F79
+:103670001ED10DE0B0F5405F18D0B0F5804F17D1E6
+:1036800015E03F48006840F400303D49086011E013
+:10369000002104F1080002F04FFE05460AE0002177
+:1036A00004F1280002F0FAFE054603E002E001E022
+:1036B000012500BF00BF55B931482430006820F40F
+:1036C000E040216E08432E492431086000E0A846FE
+:1036D0004FF40053D4E900101940002059404040F5
+:1036E000014335D1606EB0F5403F1ED007DC68B1B4
+:1036F000B0F5803F0BD0B0F5003F19D10EE0B0F52A
+:10370000802F13D0B0F5A02F12D110E012E00121CC
+:1037100004F1080002F010FE05460BE0012104F15F
+:10372000280002F0BBFE054604E003E002E001E0F1
+:10373000012500BF00BF55B911482430006820F4AE
+:10374000E020616E08430E492431086000E0A8467D
+:103750004FF48043D4E9000118400021584049400B
+:10376000084337D1D4F8B000B0F1405F20D009DC75
+:1037700078B1B0F1805F0DD0B0F1005F1BD110E0E7
+:103780002C440258B0F1804F13D0B0F1A04F12D1A9
+:1037900010E012E0012104F1080002F0CDFD054621
+:1037A0000BE0012104F1280002F078FE054604E058
+:1037B00003E002E001E0012500BF00BF4DB9FE4873
+:1037C000006820F0E040D4F8B0100843FA490860DF
+:1037D00000E0A8464FF40042D4E900101140002058
+:1037E000134659404040014329D1206FB0B1B0F198
+:1037F000805F03D0B0F1005F11D108E0EE482C38B3
+:10380000006840F40030EC492C39086009E00121DF
+:1038100004F1080002F090FD054602E001E00125F8
+:1038200000BF00BF55B9E4480838006820F0405098
+:10383000216F0843E0490839086000E0A8464FF0CE
+:103840008072D4E9001011400020134659404040D6
+:1038500001432AD1A06CB8B1012804D002280BD0B2
+:10386000032812D10FE0D4482C38006840F400300F
+:10387000D1492C3908600AE0022104F1080002F065
+:103880005BFD054603E002E001E0012500BF00BF4B
+:1038900055B9C9480C38006820F00300A16C0843F2
+:1038A000C5490C39086000E0A8464FF48002D4E90D
+:1038B00000011040002113465840494008437DD183
+:1038C000BE48006840F48070BC490860FEF71AF8F2
+:1038D000064606E0FEF716F8801B642801D903258A
+:1038E00005E0B648006800F480700028F2D000BF00
+:1038F00085BBB1481830006800F44070B4F8B410CB
+:1039000001F44071884213D0AB481830006820F4AD
+:103910004077A9481830006840F48030A649183133
+:1039200008600846006820F4803008600846076098
+:10393000D4F8B400B0F5807F15D1FDF7E3FF06465B
+:1039400009E0FDF7DFFF801B41F28831884202D990
+:10395000032507E038E0984818300068C0F34000BD
+:103960000028EED000BF55BB00BFB4F8B40000F48F
+:103970004070B0F5407F0ED18F484838006820F481
+:103980007C518F4AD4F8B400104041EA10108A49A3
+:103990004839086007E088484838006820F47C50BF
+:1039A000854948390860844818300068B4F8B41074
+:1039B000C1F30B0108438049183101E005E001E043
+:1039C000086002E0A84600E0A8460122D4E9000110
+:1039D00010400021134658404940084330D1E06F61
+:1039E00018281AD005DC48B1082808D0102817D1AB
+:1039F0000CE0202812D0282812D110E012E001217A
+:103A000004F1080002F098FC05460BE0012104F1E6
+:103A1000280002F043FD054604E003E002E001E077
+:103A2000012500BF00BF55B96348001F006820F0A2
+:103A30003800E16F08436049091F086000E0A846AC
+:103A40000222D4E9000110400021134658404940A9
+:103A5000084329D1A06F062816D2DFE800F003043E
+:103A60000B12131412E0012104F1080002F064FCAF
+:103A700005460BE0012104F1280002F00FFD054688
+:103A800004E003E002E001E0012500BF00BF55B9FA
+:103A90004948001F006820F00700A16F084346490D
+:103AA000091F086000E0A8460423D4E9001019406B
+:103AB000002059404040014329D1D4F89400062801
+:103AC00016D2DFE800F003040B12131412E00121F8
+:103AD00004F1080002F030FC05460BE0012104F17E
+:103AE000280002F0DBFC054604E003E002E001E010
+:103AF000012500BF00BF4DB92F48006820F0070026
+:103B0000D4F8941008432C49086000E0A84620230C
+:103B1000D4E900011840002158404940084337D1FA
+:103B2000D4F89000B0F1405F1ED007DC68B1B0F16E
+:103B3000805F0BD0B0F1005F19D10EE0B0F1804F83
+:103B400013D0B0F1A04F12D110E012E0002104F127
+:103B5000080002F0F1FB05460BE0022104F1280009
+:103B600002F09CFC054604E003E002E001E00125D0
+:103B700000BF00BF5DB91048001F006820F0E040A2
+:103B8000D4F8901008430C49091F086000E0A846CB
+:103B90004023D4E90010194000205940404001431F
+:103BA0003CD1D4F89C00B0F5406F25D00EDCA0B11C
+:103BB000B0F5806F12D005E0584402580048025812
+:103BC000FFFCFF0FB0F5006F19D10EE0B0F5805F7C
+:103BD00013D0B0F5A05F12D110E012E0002104F183
+:103BE000080002F0A9FB05460BE0022104F12800C1
+:103BF00002F054FC054604E003E002E001E0012588
+:103C000000BF00BF4DB9FE48006820F4E050D4F872
+:103C10009C100843FA49086000E0A8468023D4E9D4
+:103C200000101940002059404040014335D1D4F8DC
+:103C3000A000B0F5C04F1ED007DC68B1B0F5005F42
+:103C40000BD0B0F5804F19D10EE0B0F5004F13D076
+:103C5000B0F5204F12D110E012E0002104F108006D
+:103C600002F06AFB05460BE0022104F1280002F095
+:103C700015FC054604E003E002E001E0012500BF79
+:103C800000BF4DB9DE48006820F46040D4F8A010B1
+:103C90000843DB49086000E0A8460823D4E9001087
+:103CA0001940002059404040014317D1D4F8840006
+:103CB000B0F5805F07D1022104F1280002F0EEFB8D
+:103CC00008B14FF00108CE48001F006820F44050B2
+:103CD000D4F884100843CA49091F08601023D4E9A6
+:103CE00000101940002059404040014315D1D4F83C
+:103CF0009800B0F5807F07D1022104F1280002F07E
+:103D0000CDFB08B14FF00108BD48006820F44070B9
+:103D1000D4F898100843BA4908604FF40022D4E957
+:103D2000000110400021134658404940084327D164
+:103D3000D4F8A40030B1B0F5803F0AD0B0F5003F10
+:103D40000FD10DE0002104F1080002F0F5FA05465C
+:103D500009E0022104F1280002F0A0FB054602E080
+:103D600001E0012500BF00BF4DB9A548006820F45F
+:103D70004030D4F8A4100843A149086000E0A846E8
+:103D80004FF48023D4E900011840002158404940F5
+:103D900008432DD1D4F88800B0F5801F06D0B0F5C7
+:103DA000001F0CD0B0F5401F11D10FE094482C3803
+:103DB000006840F4003092492C39086009E0012184
+:103DC00004F1280002F06AFB054602E001E001254B
+:103DD00000BF00BF5DB98A48001F006820F4401092
+:103DE000D4F8881008438649091F086000E0A846F7
+:103DF0004FF48032D4E900011040002113465840AE
+:103E00004940084325D1206D18B1B0F5803F10D14D
+:103E100008E07B482C38006840F4003078492C39A1
+:103E2000086008E0022104F1080002F085FA054666
+:103E300001E0012500BF00BF55B971480C3800688A
+:103E400020F48030216D08436D490C39086000E092
+:103E5000A8464FF00052D4E900101140002013464C
+:103E600059404040014307D1022104F1280002F0EB
+:103E700015FB08B14FF001084FF40033D4E90001FD
+:103E80001840002158404940084329D1D4F8800007
+:103E9000A0B1B0F5807F06D0B0F5007F0CD0B0F5B2
+:103EA000407F0CD109E056482C38006840F40030BF
+:103EB00053492C39086004E003E002E001E00125E9
+:103EC00000BF00BF5DB94E48001F006820F440707D
+:103ED000D4F8801008434A49091F086000E0A8464A
+:103EE0004FF48012D4E900101140002013465940CD
+:103EF0004040014309D142480838006820F00040A2
+:103F0000616F08433E49083908604FF08052D4E998
+:103F100000101140002013465940404001430AD18F
+:103F200037484838006820F48040D4F8B810084377
+:103F30003349483908604FF40012D4E900101140A9
+:103F40000020134659404040014309D12C4808380D
+:103F5000006820F08070E16E084329490839086044
+:103F60004FF08042D4E90010114000201346594020
+:103F70004040014311D100BF21484838006820F477
+:103F800000401F494839086008460068D4F8BC1052
+:103F900008431B494839086000BF4FF00042D4E98C
+:103FA000001011400020134659404040014309D100
+:103FB00013480C38006820F04050616D08431049E8
+:103FC0000C3908604FF40002D4E9001011400020C1
+:103FD00013465940404001430AD10948001F006878
+:103FE00020F44000D4F88C1008430549091F0860EC
+:103FF000012300216068184001224940504001E03F
+:1040000058440258014306D104F1080002F094F923
+:10401000054605B1A84602220021606810404940CB
+:104020005040014307D1012104F1080002F084F956
+:10403000054605B1A8460423002061681940042202
+:1040400040405140084307D1022104F1080002F02A
+:1040500073F9054605B1A846082300216068184099
+:10406000082249405040014306D104F1280002F0E3
+:1040700015FA054605B1A8461022002160681040D7
+:1040800049405040014307D1012104F1280002F0CA
+:1040900005FA054605B1A8462022002061681140B6
+:1040A00040405140084307D1022104F1280002F0AA
+:1040B000F5F9054605B1A846B8F1000F02D1002078
+:1040C000BDE8F0810120FBE72DE9F04104460D46F3
+:1040D00014B90120BDE8F081BD48006800F00F0070
+:1040E000A8420ED2BA48006820F00F002843B84911
+:1040F00008600846006800F00F00A84201D00120C7
+:10410000E8E7207800F0040004280ED1B1492069C6
+:10411000096801F07001884207D9AE48006820F0B4
+:10412000700021690843AB490860207800F008005E
+:10413000082811D1A749091D6069096801F07001BB
+:10414000884209D9A348001D006820F07000616909
+:104150000843A049091D0860207800F010001028CD
+:1041600011D19C49091DA069096801F4E0618842E8
+:1041700009D99848001D006820F4E060A16908434F
+:104180009449091D0860207800F02000202811D1F2
+:1041900090490831E069096801F07001884209D945
+:1041A0008C480830006820F07000E16908438949B4
+:1041B00008310860207800F0020002280ED18549FD
+:1041C000E068096801F00F01884207D9814800685A
+:1041D00020F00F00E16808437E490860207800F075
+:1041E0000100002850D07B48006820F47060A1686E
+:1041F0000843784908606068022807D17548183874
+:104200000068C0F34040F8B9012063E76068032804
+:1042100007D1704818380068C0F34060A0B9012089
+:1042200058E76068012807D16A4818380068C0F369
+:10423000002048B901204DE7664818380068C0F3EF
+:10424000800008B9012045E762480838006820F07E
+:104250000700616808435F4908390860FDF752FBB1
+:10426000064608E0FDF74EFB801B41F2883188428C
+:1042700001D903202EE757480838006800F03800BD
+:104280006168B0EBC10FEDD1207800F00200022888
+:104290000ED15049E068096801F00F01884207D249
+:1042A0004C48006820F00F00E16808434949086065
+:1042B0004748006800F00F00A8420ED94448006843
+:1042C00020F00F002843424908600846006800F0CB
+:1042D0000F00A84201D00120FCE6207800F0040085
+:1042E00004280ED13B492069096801F07001884219
+:1042F00007D23848006820F070002169084335492A
+:104300000860207800F00800082811D13149091D03
+:104310006069096801F07001884209D22D48001DCA
+:10432000006820F07000616908432A49091D08608F
+:10433000207800F01000102811D12649091DA0692D
+:10434000096801F4E061884209D22248001D006832
+:1043500020F4E060A16908431E49091D0860207827
+:1043600000F02000202811D11A490831E0690968BD
+:1043700001F07001884209D216480830006820F028
+:104380007000E169084313490831086000F076F8CD
+:1043900010490968C1F303210F4A515C01F01F0164
+:1043A00020FA01F70B48006800F00F001146085C86
+:1043B00000F01F0027FA00F008490860084807606D
+:1043C00008480068FDF732FE8046404682E600005D
+:1043D000002000521844025806BD0008580000246E
+:1043E000540000244C00002410B500F047F80D499B
+:1043F0000968C1F303210C4A515C01F01F0120FA46
+:1044000001F40848006800F00F001146085C00F055
+:104410001F0024FA00F005490860054804600846BA
+:10442000006810BD1844025806BD0008580000245A
+:104430005400002400B5FFF7D7FF05490968C1F310
+:104440000211044A515C01F01F01C84000BD000088
+:104450001C44025806BD000800B5FFF7C5FF05491A
+:104460000968C1F30221044A515C01F01F01C840F0
+:1044700000BD00001C44025806BD0008F0B5824E85
+:10448000366806F0380636B1082E15D0102E15D035
+:10449000182E7DD114E07C4E103E3668C6F34016CF
+:1044A00046B1794E103E3668C6F3C107774E26FAFC
+:1044B00007F000E07548E5E07548E3E07548E1E0A5
+:1044C000714E1836366806F003046F4E183636689B
+:1044D000C6F305116C4E1C36366806F001056A4EAF
+:1044E00024363668C6F3CC0616FB05F601EE106AD4
+:1044F000B8EE410A002971D024B1012C50D0022C11
+:104500006DD16DE0604E103E3668C6F340163EB386
+:104510005D4E103E3668C6F3C1075C4E26FA07F3BF
+:1045200001EE103AF8EE411A01EE101AB8EE411AF7
+:1045300081EE812A9FED581AC0EE011A524E2036A4
+:104540003668C6F3080601EE106AB8EE411A31EE7D
+:10455000811AF7EE001A31EE211A62EE010A1EE00E
+:1045600001EE101AB8EE411ADFED4C1A81EE812AE5
+:104570009FED491AC0EE011A434E20363668C6F345
+:10458000080601EE106AB8EE411A31EE811A00E019
+:1045900076E0F7EE001A31EE211A62EE010A5BE0D6
+:1045A00001EE101AB8EE411A9FED3D2AC2EE011A33
+:1045B0009FED391A80EE012A334E20363668C6F355
+:1045C000080601EE106AB8EE411A32EE011AB7EE93
+:1045D000002A31EE021A61EE810A3DE04EE01DE054
+:1045E00001EE101AB8EE411ADFED2E1A81EE812A83
+:1045F0009FED291AC0EE011A234E20363668C6F305
+:10460000080601EE106AB8EE411A31EE811AF7EE93
+:10461000001A31EE211A62EE010A1DE001EE101AB5
+:10462000B8EE411A9FED1E2AC2EE011A9FED1A1A2A
+:1046300080EE012A144E20363668C6F3080601EED5
+:10464000106AB8EE411A32EE011AB7EE002A31EEC6
+:10465000021A61EE810A00BF00BF0B4E2036366899
+:10466000C6F34626721C01EE102AB8EE411AC0EEBF
+:10467000811ABCEEE11A11EE100A00E0002001E000
+:10468000034800BF00BFF0BD104402580090D003A3
+:1046900000093D0040787D01000000460024744C74
+:1046A0000024744A20BCBE4B2DE9F047044614B9DF
+:1046B0000120BDE8F087207800F00100002870D0CC
+:1046C000FA48006800F03808F8481830D0F8009030
+:1046D000B8F1100F06D0B8F1180F0FD109F0030090
+:1046E00002280BD1F14810380068C0F34040002880
+:1046F0006AD06068002867D10120DAE700BF6068EF
+:10470000B0F5803F08D1E9481038006840F48030A7
+:10471000E649103908602EE0606868B9E34810384F
+:10472000006820F48030E1491039086008460068CC
+:1047300020F4802008601EE06068B0F5A02F0DD145
+:10474000DA481038006840F48020D84910390860F1
+:104750000846006840F4803008600CE0D348103808
+:10476000006820F48030D14910390860084600689C
+:1047700020F48020086000BF606898B1FDF7C2F89F
+:10478000054606E0FDF7BEF8401B642801D903206A
+:104790008FE7C64810380068C0F340400028F1D0C9
+:1047A00012E012E0FDF7AEF8054606E0FDF7AAF8C4
+:1047B000401B642801D903207BE7BC4810380068FF
+:1047C000C0F340400028F1D100BF207800F0020083
+:1047D000022874D1B548006800F03808B348183092
+:1047E000D0F80090B8F1000F05D0B8F1180F56D1ED
+:1047F00009F00300D0BBAD4810380068C0F380005A
+:1048000018B1E06808B9012053E7A84810380068DB
+:1048100020F01900E1680843A44910390860FDF749
+:1048200071F8054606E0FDF76DF8401B022801D936
+:1048300003203EE79D4810380068C0F38000002840
+:10484000F1D000BFFDF758F841F2030188421AD8B1
+:10485000206940280BD195480C38006820F47C3042
+:1048600040F4003091490C39086017E017E08F4898
+:104870000C38006820F47C30216940EA01308B4913
+:104880000C3908600AE089480C38006820F0FE40C6
+:10489000217C40EA016085490C39086066E0E068E7
+:1048A00088B382481038006820F01900E168084396
+:1048B0007E4910390860FDF725F8054607E056E007
+:1048C000FDF720F8401B022801D90320F1E67748C4
+:1048D00010380068C0F380000028F1D000BFFDF759
+:1048E0000BF841F2030188421AD8206940280BD105
+:1048F0006E480C38006820F47C3040F400306B497E
+:104900000C39086017E017E068480C38006820F49C
+:104910007C30216940EA013064490C3908600AE0C2
+:1049200062480C38006820F0FE40217C40EA0160BB
+:104930005E490C39086019E05C481038006820F0C6
+:1049400001005A4910390860FCF7DCFF054606E013
+:10495000FCF7D8FF401B022801D90320A9E65348E1
+:1049600010380068C0F380000028F1D100BF207823
+:1049700000F0100010287CD14C48006800F0380886
+:104980004A481830D0F80090B8F1080F06D0B8F1B6
+:10499000180F3DD109F00300012839D143481038E0
+:1049A0000068C0F3002020B1E069802801D0012018
+:1049B0007FE600BFFCF7A0FF41F2030188421AD84E
+:1049C000206A20280AD139480C38006820F0F840C5
+:1049D00040F0804035490C39086018E033480C3805
+:1049E000006820F0F84094F8201040EA81602F49D8
+:1049F0000C3908600BE02D48001F006820F07C5047
+:104A000094F8201040EA01602849091F086066E018
+:104A1000E06978B325481038006840F080002349E9
+:104A200010390860FCF76EFF054606E0FCF76AFFE8
+:104A3000401B022801D903203BE61C4810380068BF
+:104A4000C0F300200028F1D000BFFCF755FF41F271
+:104A5000030188421CD8206A20280CD113480C3846
+:104A6000006820F0F84040F0804010490C390860A0
+:104A70001AE035E01CE00D480C38006820F0F840E2
+:104A800094F8201040EA816008490C3908600BE076
+:104A90000648001F006820F07C5094F8201040EA7F
+:104AA00001600249091F086019E000001044025823
+:104AB000FA48006820F08000F8490860FCF722FFFF
+:104AC000054606E0FCF71EFF401B022801D9032023
+:104AD000EFE5F2480068C0F300200028F2D100BFE3
+:104AE000207800F00800082836D16069D0B1EB4882
+:104AF0007430006840F00100E84974310860FCF748
+:104B000001FF054606E0FCF7FDFE401B022801D927
+:104B10000320CEE5E14874300068C0F3400000286F
+:104B2000F1D019E0DD487430006820F00100DB4965
+:104B300074310860FCF7E6FE054606E0FCF7E2FE8D
+:104B4000401B022801D90320B3E5D4487430006823
+:104B5000C0F340000028F1D1207800F02000202888
+:104B600030D1A069B8B1CD48006840F48050CB493D
+:104B70000860FCF7C7FE054606E0FCF7C3FE401BD5
+:104B8000022801D9032094E5C4480068C0F34030EE
+:104B90000028F2D016E0C148006820F48050BF49D8
+:104BA0000860FCF7AFFE054606E0FCF7ABFE401BD5
+:104BB000022801D903207CE5B8480068C0F34030E2
+:104BC0000028F2D1207800F0040004287DD1B448F8
+:104BD000006840F48070B2490860FCF793FE054617
+:104BE00006E0FCF78FFE401B642801D9032060E536
+:104BF000AB48006800F480700028F2D000BFA068C5
+:104C0000012808D1A5487030006840F00100A34990
+:104C1000703108602DE0A06868B9A0487030006865
+:104C200020F001009D49703108600846006820F0BE
+:104C3000040008601DE0A06805280DD19748703079
+:104C4000006840F00400954970310860084600682B
+:104C500040F0010008600CE090487030006820F0DF
+:104C600001008E49703108600846006820F0040099
+:104C7000086000BFA068A0B1FCF744FE054608E04C
+:104C8000FCF740FE401B41F28831884201D90320E5
+:104C90000FE5824870300068C0F340000028EFD074
+:104CA00013E0FCF72FFE054608E0FCF72BFE401B47
+:104CB00041F28831884201D90320FAE47748703004
+:104CC0000068C0F340000028EFD1606A00287DD062
+:104CD00072481030006800F03800182877D0606AF9
+:104CE000022875D16D48006820F080706B4908601B
+:104CF000FCF708FE054606E0FCF704FE401B022810
+:104D000001D90320D5E465480068C0F3406000285D
+:104D1000F2D100BFD4E90A1041EA00105F492831FE
+:104D2000096840F2F332914308435C492831086036
+:104D3000208E401EC0F30800616B491E4FF47E4276
+:104D400002EA41210843218F491ED20102EA0141B2
+:104D500008433C21095D491E120202EA0161084331
+:104D60004E493031086000BF081F006820F0010084
+:104D7000091F08604948343000684FF6F8718843CD
+:104D8000A16C40EAC10045493431086043482C30E9
+:104D9000006820F00C00216C084340492C31086069
+:104DA0000846006820F00200616C08433B492C3142
+:104DB00008600846006840F48030086008460068D3
+:104DC00040F4003008600846006802E093E038E0F4
+:104DD0001FE040F4802008600846006840F00100B1
+:104DE00008602E48006840F080702C490860FCF78D
+:104DF00089FD054606E0FCF785FD401B022801D928
+:104E0000032056E425480068C0F340600028F2D033
+:104E100071E02248006820F0807020490860FCF7AB
+:104E200071FD054606E0FCF76DFD401B022801D927
+:104E300003203EE419480068C0F340600028F2D126
+:104E400059E0164828300768144830300668606A10
+:104E5000012821D007F00301A06A81421CD1C7F3C9
+:104E60000511E06A884217D1C6F30801206B401E85
+:104E7000814211D1606B401EC6F3462188420BD19E
+:104E8000A06B401EC6F30641884205D1E06B401E70
+:104E9000C6F30661884205D001200AE400440258A6
+:104EA0000048025815480068C0F3CC07A06CB8420F
+:104EB00021D012480838006820F001000F49083955
+:104EC0000860FCF71FFD054600BFFCF71BFD401BFB
+:104ED000FBD00A4800684FF6F8718843A16C40EA9D
+:104EE000C1000649086005480838006840F0010024
+:104EF00002490839086000204AE40000344402589E
+:104F000070B504462546681EB0F1807F01D30120AC
+:104F10000FE0681E4FF0E02148610F214FF0FF3095
+:104F200002F004FC00204FF0E021886107200861B6
+:104F3000002070BD10B50346002200BF93F83C006E
+:104F4000012801D1022010BD012083F83C0000BFE0
+:104F500022F0FF00CC6840EA040222F440708C6822
+:104F600040EA040222F480604C6840EA040222F421
+:104F700000600C6840EA040222F480500C6940EAA8
+:104F8000040222F400504C6940EA040222F48040FA
+:104F90008C6A40EA040222F470200C8B40EA04423E
+:104FA0000F4C1868A04203D00E4C1868A0420ED1D6
+:104FB00022F470008C8C40EA045222F08070CC699C
+:104FC00040EA040222F000700C6A40EA0402186809
+:104FD000426400BF002083F83C0000BF00BFB2E77E
+:104FE000000001400004014030B502460B4600BFFE
+:104FF00092F83C00012801D1022030BD012082F846
+:105000003C0000BF022082F83D0010684168106833
+:105010008468214D1068A84203D0204D1068A84232
+:1050200003D121F470015868014321F07001186820
+:10503000014310684160184D1068A8421BD01068E9
+:10504000B0F1804F17D0164D1068A84213D0154DFF
+:105050001068A8420FD0144D1068A8420BD00F4D15
+:105060001068A84207D0114D1068A84203D0104D17
+:105070001068A84205D124F08004986804431068A1
+:105080008460012082F83D0000BF002082F83C00CF
+:1050900000BF00BFB1E70000000001400004014074
+:1050A0000004004000080040000C004000180040D0
+:1050B0000040014010B586B00446142101A8FBF75A
+:1050C00072F93149206888421CD100BF2F4800681E
+:1050D00040F010002D4908600846006800F01000FC
+:1050E000009000BF00BF4FF4D44001900220029016
+:1050F0000020039004900120059001A92448FCF7AA
+:10510000F7FA3FE02349206888421BD100BF1F48BF
+:10511000006840F004001D4908600846006800F07F
+:105120000400009000BF00BFC02001900220029048
+:105130000020039004900220059001A91648FCF776
+:10514000D7FA1FE01549206888421BD100BF0F48DD
+:10515000006840F008000D4908600846006800F04B
+:105160000800009000BF00BF4FF4405001900220A3
+:1051700002900020039004900220059001A90848A5
+:10518000FCF7B6FA06B010BD00000140E04402583A
+:1051900000100258000400400008025800080040B7
+:1051A000000C02582DE9F04104460D461646002732
+:1051B00000BF94F83C00012802D10220BDE8F08134
+:1051C000012084F83C0000BF0C2E51D005DC4EB10C
+:1051D000042E1ED0082E7AD133E0102E60D0142E6B
+:1051E000F9D175E02946206801F04AFC2068806901
+:1051F00040F00800216888612068806920F0040080
+:10520000216888612068806929690843216888616C
+:1052100078E02946206801F089FC2068806940F424
+:105220000060216888612068806920F480602168BE
+:10523000886120688069296940EA012021688861C5
+:1052400060E02946206801F0CBFC2068C06940F08E
+:1052500008002168C8612068C06920F00400216846
+:10526000C8612068C069296908432168C86149E0AC
+:105270002946206801F00EFD2068C06940F40060F6
+:105280002168C8612068C06920F480602168C86115
+:105290002068C069296940EA01202168C86131E0BD
+:1052A0002946206801F030FD2068406D40F008007C
+:1052B000216848652068406D20F004002168486539
+:1052C0002068406D29690843216848651AE017E0A5
+:1052D0002946206801F050FD2068406D40F40060D0
+:1052E000216848652068406D20F480602168486529
+:1052F0002068406D296940EA01202168486501E085
+:10530000012700BF00BF00BF002084F83C0000BFA1
+:10531000384653E710B504460CB9012010BD94F887
+:105320003D0028B9002084F83C00204600F02AF80F
+:10533000022084F83D00211D206801F033FB01208C
+:1053400084F8480000BF84F83E0001213F20015549
+:10535000402001554120015542200155432001556F
+:1053600000BF00BF012084F84400452001554620BD
+:1053700001554720015500BF012084F83D00002061
+:10538000CCE7000008B51D4A016891420DD100BF6D
+:105390001B49096841F00101194A11601146096869
+:1053A00001F00101009100BF27E0164A0168914217
+:1053B0000FD100BF12490839096841F00201104AB3
+:1053C000083A11601146096801F00201009100BF1E
+:1053D00013E00D4A016891420FD100BF0849083916
+:1053E000096841F00401064A083A1160114609684B
+:1053F00001F00401009100BF00BF08BD00000140A2
+:10540000F04402580004004000080040014600BF7C
+:1054100091F88400012801D102207047012081F811
+:10542000840000BF2420C1F888000868026808686A
+:10543000006820F001000B68186022F00052002084
+:105440004866086802602020C1F8880000BF00207C
+:1054500081F8840000BF00BFDFE770B504460D4649
+:1054600000BF94F88400012801D1022070BD012002
+:1054700084F8840000BF2420C4F8880020680668EF
+:105480002068006820F001002168086020688068BA
+:1054900020F06060284321688860204601F0A4FC69
+:1054A000206806602020C4F8880000BF002084F82F
+:1054B000840000BF00BFD9E770B504460D4600BFA9
+:1054C00094F88400012801D1022070BD012084F8E5
+:1054D000840000BF2420C4F8880020680668206883
+:1054E000006820F00100216808602068806820F0D2
+:1054F0006040284321688860204601F075FC2068E0
+:1055000006602020C4F8880000BF002084F88400D2
+:1055100000BF00BFD9E710B504460CB9012010BD8B
+:10552000A06900B100E000BFD4F8880028B90020CD
+:1055300084F88400204600F02BF82420C4F888006A
+:105540002068006820F0010021680860A06A10B19E
+:10555000204601F075FC204601F09AFD012800D19B
+:10556000DDE72068406820F49040216848602068AA
+:10557000806820F02A00216888602068006840F078
+:10558000010021680860204601F0D6FCC7E7000052
+:1055900010B5B8B00446142132A8FAF704FFC021B0
+:1055A00002A8FAF700FF1E492068884235D102217F
+:1055B0000020CDE90210209002A8FDF7D1FE08B12D
+:1055C000FBF76DFB00BF1748006840F40030154939
+:1055D00008600846006800F40030019000BF00BF7A
+:1055E00000BF10480838006840F008000D4908392D
+:1055F00008600846006800F00800019000BF00BF86
+:1056000060203290022033900020349035900720A3
+:10561000369032A90448FCF76BF838B010BD000092
+:1056200000440040E8440258000C02582DE9F84FAD
+:1056300004460E4617469946D4F88800202854D1CF
+:1056400006B117B90120BDE8F88F00205434E0639B
+:1056500021206063FCF756F9824627806780543C1E
+:10566000A068B0F5805F04D1206910B90025B0466C
+:1056700002E035464FF0000820E05346002280212A
+:105680002046CDF8009001F0C9FF20B12020C4F8D9
+:1056900088000320D7E745B9B8F80000C0F3080038
+:1056A0002168886208F1020803E02878216888628E
+:1056B0006D1CB4F85600401EA4F85600B4F856000D
+:1056C0000028DAD15346002240212046CDF8009030
+:1056D00001F0A4FF20B12020C4F888000320B2E725
+:1056E0002020C4F888000020ADE70220ABE700BF0F
+:1056F000FEE701688969C1F3400111B10021026828
+:1057000091620168896901F0010129B9016889691B
+:1057100041F0010102689161704700002DE9F74FE7
+:1057200004460E4600272068D0F818800025DDF8D2
+:10573000089008F01000102845D12168C86134E0B5
+:10574000701C90B3FCF7DEF8A0EB0900B04200D863
+:105750005EBB2068406800F4804A94F842B020683C
+:105760008069C0F3C03070B1BAF5804F0BD0BBF187
+:10577000200F08D02068406840F4804021684860CD
+:10578000FCF7C0F8814609E0FCF7BCF8A0EB090083
+:10579000192803D945F02005012705E02068806914
+:1057A000C0F340100028EFD000BF20688069C0F32C
+:1057B000401008B9002FC3D017B920202168C86154
+:1057C00045F0040501272068D0F8188008F480709F
+:1057D000B0F5807F06D145F001054FF48070216857
+:1057E000C861012708F48060B0F5806F06D145F0EC
+:1057F00008054FF480602168C861012708F4007033
+:10580000B0F5007F06D145F002054FF40070216825
+:10581000C8610127AFB12046FFF76BFF20684068E1
+:105820000949084021684860606C28436064202072
+:1058300084F84100002084F8420000BF84F8400052
+:1058400000BF3846BDE8FE8F00E800FEF0B5059CBD
+:10585000C1F309064FF47F0707EA02473E431E43A0
+:10586000264326F00045066876684FF4806707EA0D
+:10587000545767F0FC2747F4C047BE432E430768E0
+:105880007E60F0BD2DE9F04104460D4617461E46E8
+:10589000DDF818802BE0424631462046FFF73EFFF8
+:1058A00010B10120BDE8F081701C00B3FCF72AF8AC
+:1058B000A0EB0800B04200D8CEB92068806928402B
+:1058C000A84201D1012000E00020B8420FD1606C55
+:1058D00040F020006064202084F84100002084F81B
+:1058E000420000BF84F8400000BF0120DAE72068D2
+:1058F00080692840A84201D1012000E00020B84280
+:10590000C9D00020CEE700002DE9F04104460E4644
+:10591000174600254EE03A4631462046FFF7FEFE88
+:1059200000B1012520688069C0F3401030B32DBB61
+:1059300020688069C0F3800010B1208D00B100257F
+:1059400020688069C0F30010C8B110202168C861C8
+:105950000420606420202168C861206840681A49DA
+:10596000084021684860202084F84100002084F825
+:10597000420000BF84F8400000BF012501E0002084
+:105980006064FBF7BFFFC01BB04200D896B98DB969
+:1059900020688069C0F3800060B9606C40F020002E
+:1059A0006064202084F8410000BF002084F840009B
+:1059B00000BF012520688069C0F3800008B9002D70
+:1059C000A9D02846BDE8F08100E800FE70B5044685
+:1059D0000D46164622E0324629462046FFF79EFE37
+:1059E00008B1012070BDFBF78DFF801BA84200D8D5
+:1059F000A5B920688069C0F3401078B9606C40F0A8
+:105A000020006064202084F84100002084F84200D7
+:105A100000BF84F8400000BF0120E3E720688069F0
+:105A2000C0F340100028D6D00020DBE770B5044654
+:105A30000D46164624E0324629462046FFF76EFE04
+:105A400008B1012070BD681CD0B1FBF75BFF801B63
+:105A5000A84200D8A5B920688069C0F3400078B991
+:105A6000606C40F020006064202084F84100002039
+:105A700084F8420000BF84F8400000BF0120E1E745
+:105A800020688069C0F340000028D4D00020D9E706
+:105A9000FFB581B0044615461E464048047840488C
+:105AA0000068012825D1002040EA4400C7B242F234
+:105AB0001070012302AA394600903A48FCF7CAF850
+:105AC00028B139A001F002FE012005B0F0BD01208F
+:105AD00000EB4400C7B242F210702B463246394602
+:105AE00000903048FCF704F810B134A001F0EEFD4E
+:105AF00051E02B480068022824D1002040EA4400ED
+:105B0000C7B242F21070012302AA39460090304811
+:105B1000FCF7A0F820B124A001F0D8FD0120D4E7C3
+:105B2000012000EB4400C7B242F210702B4632460F
+:105B3000394600902648FBF7DBFF10B11FA001F0AB
+:105B4000C5FD28E016480068032824D1002040EA5B
+:105B50004400C7B242F21070012302AA39460090F5
+:105B60001C48FCF777F820B10FA001F0AFFD012031
+:105B7000ABE7012000EB4400C7B242F210702B46A5
+:105B80003246394600901348FBF7B2FF10B10BA024
+:105B900001F09CFD00BF00BF97E700003800002423
+:105BA00044000024E80000242B2B777269746520E0
+:105BB00062797465206661696C0D0A002D2D72652D
+:105BC00061642062797465206661696C0D0A000069
+:105BD0003C010024900100242DE9FF4105460E46BA
+:105BE00014461F4629480578002040EA4500C5B202
+:105BF00000200190029003908DF8046000BF04E043
+:105C00003A5C411C01AB5A54401CA042F8DB2048CE
+:105C10000068012811D142F21070631C01AA2946C4
+:105C200000901C48FCF716F800282CD01AA001F0B0
+:105C30004DFD012004B0BDE8F08115480068022840
+:105C40000ED142F21070631C01AA29460090184838
+:105C5000FCF700F8B8B110A001F038FD0120E9E729
+:105C60000B48006803280ED142F21070631C01AA91
+:105C7000294600900F48FBF7EDFF20B106A001F088
+:105C800025FD0120D6E70020D4E7000038000024DD
+:105C900044000024E80000242B2B777269746520EF
+:105CA0006C656E2062797465206661696C0D0A000E
+:105CB0003C0100249001002401468868C0F3C00024
+:105CC00070470146886800F0010070470146886807
+:105CD00000F00100704701468868C0F3007070470B
+:105CE00001468868C0F38000704701468868C0F3A9
+:105CF0008000704770B500F11404C1F3406504EBF7
+:105D000085031C68C1F304560725B540AC43C1F3B5
+:105D1000045502FA05F52C431C6070BD826822F020
+:105D2000E0720A43826070472DE9FC4104460D464B
+:105D30001646124908786B4606224321FFF7A8FE53
+:105D40000746BFB99DF801009DF8001040EA012008
+:105D500000B220809DF803009DF8021040EA012067
+:105D600000B228809DF805009DF8041040EA01204B
+:105D700000B230803846BDE8FC81000038000024C5
+:105D800000B58BB00020089009900A901C2101A852
+:105D9000FAF709FB1E481F490860002048600021EF
+:105DA0001C488160C16004210161002101754175B9
+:105DB000012181610021017741628162C162016339
+:105DC000416380F83810FBF7C5FA08B1FAF767FFAE
+:105DD0000020089008A90F48FAF764FF08B1FAF705
+:105DE0005EFF0D48019006200290002003900B48B2
+:105DF000049004200590002006908DF81D0001A954
+:105E00000448FBF701F808B1FAF749FF0BB000BDF1
+:105E100000200240840000240800900C0000FF478E
+:105E200000B587B0142102A8FAF7BDFA00BF3948BF
+:105E3000006840F01000374908600846006800F02C
+:105E40001000019000BF00BF00BF0846006840F08E
+:105E5000040008600846006800F00400019000BFDC
+:105E600000BF00BF0846006840F080000860084698
+:105E7000006800F08000019000BF00BF00BF08462E
+:105E8000006840F0010008600846006800F001006A
+:105E9000019000BF00BF00BF0846006840F002004C
+:105EA00008600846006800F00200019000BF00BFD3
+:105EB00000BF0846006840F0080008600846006817
+:105EC00000F00800019000BF00BF002242F2020172
+:105ED0001148FBF70BFD002208211048FBF706FDD7
+:105EE00042F20200029001200390002004900590ED
+:105EF00002A90948FBF7FCFB08200290012003904F
+:105F000000200490059002A90448FBF7F1FB07B0BC
+:105F100000BD0000E044025800080258000002588A
+:105F200010B5134813490860134848600021114810
+:105F300081600121C1600021016141618161C16114
+:105F40000162FBF769FD08B1FAF7A9FE00210948D3
+:105F5000FBF7DEFC08B1FAF7A2FE00210548FBF7CB
+:105F60000CFD08B1FAF79BFE0120FBF73BFD10BDCD
+:105F700000540040E80000244212400010B51348CD
+:105F800013490860134848600021114881600121CD
+:105F9000C1600021016141618161C1610162FBF762
+:105FA0003BFD08B1FAF77BFE00210948FBF7B0FC86
+:105FB00008B1FAF774FE00210548FBF7DEFC08B1D2
+:105FC000FAF76DFE0220FBF70DFD10BD00580040F2
+:105FD0003C0100244212400010B5134813490860E8
+:105FE000134848600021114881600121C1600021EF
+:105FF000016141618161C1610162FBF70DFD08B181
+:10600000FAF74DFE00210948FBF782FC08B1FAF7C8
+:1060100046FE00210548FBF7B0FC08B1FAF73FFE49
+:106020000420FBF7DFFC10BD005C00409001002461
+:106030004212400010B50B480B490860FF20486031
+:106040000121094881600021C16001210161002115
+:1060500041618161C1610162FCF7A8F808B1FAF7FA
+:106060001EFE10BD00500052E401002400B595B0A2
+:1060700000201290139014901C210BA8FAF793F9AA
+:106080002C216846FAF78FF932483349086000201E
+:1060900048600021304881604FF6FF71C1600021E7
+:1060A000016141618161FFF735F908B1FAF7F7FD48
+:1060B000002012901390149012A92748FEF794FF25
+:1060C00008B1FAF7ECFD60200B9000200C900D90C9
+:1060D0000E900F901090119000220BA91E48FFF710
+:1060E00061F808B1FAF7DBFD04220BA91A48FFF7A3
+:1060F00059F808B1FAF7D3FD08220BA91648FFF7A3
+:1061000051F808B1FAF7CBFD0C220BA91248FFF7A2
+:1061100049F808B1FAF7C3FD002000900190029001
+:10612000039004904FF400500590002006900790D3
+:106130004FF000700890002009900A9069460648C8
+:10614000FEF7F8FE08B1FAF7AAFD0348FEF7B2FF22
+:1061500015B000BD000001403002002400B58BB036
+:106160000020089009900A901C2101A8FAF71BF959
+:106170001B481C49086000204860002119488160C4
+:106180004FF6FF71C160002101618161FFF7C2F824
+:1061900008B1FAF784FD002008900A9008A9114878
+:1061A000FEF722FF08B1FAF77AFD60200190002087
+:1061B000029003900590002201A90A48FEF7F2FF21
+:1061C00008B1FAF76CFD042201A90648FEF7EAFFC0
+:1061D00008B1FAF764FD0348FEF76CFF0BB000BD91
+:1061E000000400407C02002400B58BB00020089021
+:1061F00009900A901C2101A8FAF7D5F81B481C4900
+:106200000860002048600021194881604FF6FF7146
+:10621000C160002101618161FFF77CF808B1FAF7E4
+:106220003EFD002008900A9008A91148FEF7DCFE08
+:1062300008B1FAF734FD602001900020029003902D
+:106240000590002201A90A48FEF7ACFF08B1FAF751
+:1062500026FD042201A90648FEF7A4FF08B1FAF7BB
+:106260001EFD0348FEF726FF0BB000BD00080040EE
+:10627000C802002410B51848184908604FF461207E
+:106280004860002115488160C16001610C214161B5
+:1062900000218161C1610162416200200F49886271
+:1062A0000846FFF738F908B1FAF7F9FC00210B4866
+:1062B000FFF702F908B1FAF7F2FC00210748FFF7EF
+:1062C000CCF808B1FAF7EBFC0448FFF79FF808B1E7
+:1062D000FAF7E5FC10BD0000004400401403002460
+:1062E00000BFFEE700BFFEE770472DE9F04104461E
+:1062F0000E4617469846069D12E0681C80B1FBF7D3
+:1063000001FBA0EB0800A84200D84DB9042084F896
+:106310004100606C40F0010060640120BDE8F08144
+:1063200020688068304008B1012000E00020B842B9
+:10633000E3D10020F2E700002DE9F04104460E46CB
+:1063400000275548006800F00300032802D101200F
+:10635000BDE8F08150482838006820F080604E4940
+:1063600028390860FBF7CEFA054606E0FBF7CAFAC3
+:10637000401B022801D90320EAE747482838006873
+:10638000C0F3C0600028F1D100BF4348006820F48A
+:106390007C30216840EA01303F490860A088401EF7
+:1063A000C0F30800A168491E4FF47E4202EA412171
+:1063B0000843A189491ED20102EA01410843217C18
+:1063C000491E120202EA0161084333491031086094
+:1063D00000BF3148001D006820F0C000616908431B
+:1063E0002D49091D08600846006820F02000A169B9
+:1063F00008432949091D08600846006820F010007C
+:1064000008602548143000684FF6F8718843E16948
+:1064100040EAC1002049143108601F48001D00688F
+:1064200040F010001C49091D08602EB9084600689C
+:1064300040F40020086012E0012E08D11648001D2B
+:10644000006840F480101449091D086007E01248F4
+:10645000001D006840F400100F49091D08600E4837
+:106460002838006840F080600B4928390860FBF745
+:1064700049FA054606E0FBF745FA401B022801D918
+:10648000032065E7044828380068C0F3C06000288E
+:10649000F1D038465CE70000284402582DE9F0416D
+:1064A00004460E4600275548006800F00300032804
+:1064B00002D10120BDE8F08150482838006820F062
+:1064C00080504E4928390860FBF71CFA054606E063
+:1064D000FBF718FA401B022801D90320EAE74748D6
+:1064E00028380068C0F340700028F1D100BF43484D
+:1064F000006820F07C70218840EA01503F49086024
+:10650000A088401EC0F30800A168491E4FF47E42D7
+:1065100002EA41210843A189491ED20102EA014150
+:106520000843217C491E120202EA016108433349F3
+:106530001831086000BF3148001D006820F4406039
+:10654000616908432D49091D08600846006820F468
+:106550000070A16908432949091D086008460068C0
+:1065600020F48070086025481C3000684FF6F871F0
+:106570008843E16940EAC10020491C3108601F4896
+:10658000001D006840F480701C49091D08602EB988
+:106590000846006840F48000086012E0012E08D12F
+:1065A0001648001D006840F400001449091D0860E9
+:1065B00007E01248001D006840F080700F49091D77
+:1065C00008600E482838006840F080500B49283990
+:1065D0000860FBF797F9054606E0FBF793F9401BC7
+:1065E000022801D9032065E7044828380068C0F371
+:1065F00040700028F1D038465CE70000284402587B
+:10660000F0B52DED048B8DB004460D461646B7EE61
+:10661000000AF0EE409A9FED670AB0EE408A9FEDC7
+:10662000650AF0EE408A9FED630AB0EE409A06A834
+:1066300008A907AB02AACDE9001009A90BA802F02E
+:1066400043FA074627B101200DB0BDEC048BF0BD25
+:10665000BDF8200000F4807000287CD09DED020A77
+:10666000B8EEC00B9FED541B80EE012BB7EEC20BB2
+:10667000F0EE409A9DED030AB8EEC00B9FED4E1B65
+:1066800080EE012BB7EEC20BB0EE408A9DED040AFE
+:10669000B8EEC00B9FED481B80EE012BB7EEC20B8E
+:1066A000F0EE408A9DED050AB8EEC00B9FED421B4F
+:1066B00080EE012BB7EEC20BB0EE409AB8EE001A96
+:1066C00028EE011A21EE091AF0EE001A69EEA11A5D
+:1066D00001EEA81AB7EEC11AB0EE410B01F03CF87A
+:1066E000B7EEC00BB7EEC00A9FED351B20EE010BD5
+:1066F000B7EEC00B84ED000AB8EE002A28EE022A9D
+:1067000022EE082AF0EE002A68EEA22A02EEE82A1B
+:10671000F7EE002A32EE222AB7EEC22AB0EE421B72
+:10672000B0EE002A28EE822A22EE092AF0EE002A94
+:1067300069EEA22A02EE882AB7EEC22AB0EE420B18
+:1067400001F00EFAB7EEC00BB7EEC00A9FED1C1BAE
+:1067500020EE010B00E02BE0B7EEC00B85ED000A48
+:1067600029EEA92A08EE082A08EEE82A09EE492AA5
+:10677000B7EEC22AB0EE421B28EE282A09EE892A7B
+:10678000F0EE002A22EE222AB7EEC22AB0EE420B29
+:1067900001F0E6F9B7EEC00BB7EEC00A9FED081B9B
+:1067A00020EE010BB7EEC00B86ED000A00204BE790
+:1067B000022049E700000000000000000000D04176
+:1067C0006666666666A64C40704710B5FBF7F2FB3E
+:1067D00010BD000000B59DB04C210AA8F9F7E3FDFB
+:1067E000202102A8F9F7DFFD0220FBF7AFFC00BF74
+:1067F000002001902A48006820F001002849086024
+:106800000846006800F0010001902648006840F446
+:106810004040244908600846006800F44040019068
+:1068200000BF00BF00BF1F48006800F40050B0F573
+:10683000005FF8D102200A9001200D9040200E90B8
+:1068400002201390002114910421159132211691F8
+:1068500002211791189119910C211A9100211B9175
+:106860001C910AA8FDF720FF08B1FAF718FA3F209B
+:1068700002900320039000200490082005904020FF
+:10688000069007900001089040200990022102A87C
+:10689000FDF71AFC08B1FAF702FA1DB000BD0000BE
+:1068A0002C040058184802583448006840F470001E
+:1068B000324908603248006800F00F00072806D20D
+:1068C0002F48006820F00F00C01D2D4908602D489A
+:1068D000006840F001002B49086000202949103170
+:1068E000086028480068284908402649086024486C
+:1068F000006800F00F00072806D92148006820F042
+:106900000F00C01D1E49086000201E491831086094
+:10691000091D0860091D08601C481A4928310860D3
+:106920001B48091D08601B48091D08600020091D3F
+:1069300008601848091D08600020091D08601548F6
+:10694000091D08600020091D08600E48006820F439
+:1069500080200C49086000200A49603108600E4818
+:1069600000686FF30F00B0F1005F02D201200B4905
+:10697000086043F2D2000A490860704788ED00E0E1
+:1069800000200052004402587FEDF6EA00020202A5
+:106990000000FF01800201010010005C088100512D
+:1069A0000040005210B502682D4B98420ED0B0F155
+:1069B000804F0BD02B4B984208D02B4B984205D0E0
+:1069C0002A4B984202D02A4B984203D122F07002FF
+:1069D0004B681A43224B984217D0B0F1804F14D025
+:1069E000204B984211D0204B98420ED01F4B98421A
+:1069F0000BD01F4B984208D01E4B984205D01E4B1F
+:106A0000984202D01D4B984203D122F44072CB68C9
+:106A10001A4322F080034C6943EA040202608B6847
+:106A2000C3620B6883620E4B98420BD0104B9842A6
+:106A300008D0104B984205D00F4B984202D00F4B14
+:106A4000984201D10B69036301234361036903F099
+:106A500001031BB1036923F00103036110BD0000B2
+:106A6000000001400004004000080040000C00400D
+:106A70000004014000400140004401400048014042
+:106A800030B5026A056A25F001050562436884692C
+:106A9000204D2C4024F003040D682C4322F0020208
+:106AA0008D682A431C4DA84200D10FE01B4DA8421F
+:106AB00000D10BE01A4DA84200D107E0194DA842C1
+:106AC00000D103E0184DA84206D100BF22F0080211
+:106AD000CD682A4322F004020F4DA8420BD00F4D7F
+:106AE000A84208D00E4DA84205D00E4DA84202D0B3
+:106AF0000D4DA84207D123F4807323F400734D6930
+:106B00002B438D692B43436084614D68456302626A
+:106B100030BD00008FFFFEFF000001400004014077
+:106B200000400140004401400048014030B5026A85
+:106B3000056A25F01005056243688469224D2C40E2
+:106B400024F440740D6844EA052422F020028D6884
+:106B500042EA05121D4DA84200D10FE01C4DA8428B
+:106B600000D10BE01B4DA84200D100BF1A4DA84236
+:106B700000D100BF194DA84207D106E022F08002E3
+:106B8000CD6842EA051222F04002104DA8420BD017
+:106B90000F4DA84208D00F4DA84205D00E4DA84277
+:106BA00002D00E4DA84209D123F4806323F4006380
+:106BB0004D6943EA85038D6943EA85034360846137
+:106BC0004D688563026230BDFF8FFFFE000001400B
+:106BD00000040140004001400044014000480140E1
+:106BE00030B5026A056A25F4807505624368C46998
+:106BF000224D2C4024F003040D682C4322F4007233
+:106C00008D6842EA05221E4DA84200D10FE01D4DBD
+:106C1000A84200D10BE01C4DA84200D100BF1B4D83
+:106C2000A84200D100BF1A4DA84207D106E022F4C5
+:106C30000062CD6842EA052222F48062104DA8422B
+:106C40000BD0104DA84208D00F4DA84205D00F4DD3
+:106C5000A84202D00E4DA84209D123F4805323F458
+:106C600000534D6943EA05138D6943EA05134360F8
+:106C7000C4614D68C563026230BD00008FFFFEFF36
+:106C80000000014000040140004001400044014078
+:106C90000048014030B5036A056A25F48055056255
+:106CA0004468C269124D2A4022F440720D6842EADB
+:106CB000052223F400538D6843EA05330D4DA842A5
+:106CC0000BD00D4DA84208D00C4DA84205D00C4D5C
+:106CD000A84202D00B4DA84204D124F480444D694F
+:106CE00044EA85144460C2614D680564036230BDA6
+:106CF000FF8FFFFE00000140000401400040014002
+:106D0000004401400048014030B5026A056A25F49C
+:106D1000803505624368446D114D2C400D682C434D
+:106D200022F400320D8942EA05420E4DA8420BD0F2
+:106D30000D4DA84208D00D4DA84205D00C4DA842DB
+:106D400002D00C4DA84204D123F480334D6943EAAC
+:106D50000523436044654D688565026230BD0000CF
+:106D60008FFFFEFF00000140000401400040014091
+:106D7000004401400048014030B5026A056A25F42C
+:106D8000801505624368446D114D2C400D6844EA3E
+:106D9000052422F400120D8942EA05520D4DA84245
+:106DA0000BD00D4DA84208D00C4DA84205D00C4D7B
+:106DB000A84202D00B4DA84204D123F480234D6990
+:106DC00043EA8523436044654D68C565026230BD72
+:106DD000FF8FFFFE00000140000401400040014021
+:106DE000004401400048014070B5456E2DB90125B1
+:106DF000A0F86A50A0F868501CE010231024056821
+:106E0000AD68C5F342610568AD686A0F0A4DAD5CB7
+:106E100015FB04F5094EB65C95FBF6F5A0F86A5033
+:106E2000054D6D5C15FB03F5044E765C95FBF6F5A0
+:106E3000A0F8685070BD0000F6BC0008FEBC000859
+:106E400090F8281001F00801082907D10168496865
+:106E500021F40041826B11430268516090F82810C0
+:106E600001F0010139B10168496821F40031C26AB9
+:106E700011430268516090F8281001F002010229C4
+:106E800007D10168496821F48031026B114302681F
+:106E9000516090F8281001F00401042907D101681D
+:106EA000496821F48021426B11430268516090F8D7
+:106EB000281001F01001102907D10168896821F418
+:106EC0008051C26B11430268916090F8281001F064
+:106ED0002001202907D10168896821F40051026C42
+:106EE00011430268916090F8281001F04001402998
+:106EF00013D10168496821F48011426C1143026882
+:106F00005160416CB1F5801F07D10168496821F4D7
+:106F1000C001826C11430268516090F8281001F0A2
+:106F20008001802907D10168496821F40021C26CE1
+:106F3000114302685160704738B504460020C4F818
+:106F40009000FAF7DFFC05462068006800F00800B2
+:106F5000082821D16FF07E402B4600224FF400110B
+:106F60000090204600F05AFBB0B100BF00BF21687E
+:106F700051E8001F21F08000226842E8000100294A
+:106F8000F5D100BF2020C4F8880000BF002084F89D
+:106F9000840000BF032038BD2068006800F00400B2
+:106FA000042830D16FF07E402B4600224FF4800140
+:106FB0000090204600F032FB28B300BF00BF2168DC
+:106FC00051E8001F21F49070226842E80001002976
+:106FD000F5D100BF00BF00BF2168083151E8001F94
+:106FE00021F001002168083141E80002002AF3D1B4
+:106FF00000BF2020C4F88C0000BF002084F884006B
+:1070000000BF0320C7E72020C4F88800C4F88C0024
+:107010000020E066206700BF84F8840000BF00BF46
+:10702000B9E7000000BF00BF026852E8002F22F459
+:107030009071036843E80012002AF5D100BF00BF39
+:1070400000BF0268083252E8002F104B02EA030129
+:107050000268083242E80013002BF2D100BFC16E73
+:1070600001290CD100BF00BF026852E8002F22F0B6
+:107070001001036843E80012002AF5D100BF202167
+:10708000C0F88C100021C16641677047FEFFFFEF1A
+:107090002DE9F04F89B0054600200890F84928688E
+:1070A000884200D100E000BF2969A86808436969E7
+:1070B0000843E96940EA010828680068F149084086
+:1070C00040EA0800296808602868406820F44050B9
+:1070D000E968084329684860D5F81880E8492868B5
+:1070E000884202D0286A40EA080828688068E64991
+:1070F000084040EA0800296888602868C06A20F0D3
+:107100000F00696A08432968C86200BFDF49286820
+:10711000884220D1DE48006800F03800182811D0DD
+:1071200005DC48B1082809D0102811D108E0202832
+:107130000AD028280CD109E001240BE0042409E03E
+:10714000082407E0102405E0202403E0402401E0A7
+:10715000802400BFF8E0CF492868884219D1CC4884
+:10716000006800F00700062810D2DFE800F00305F1
+:1071700007090B0D00240BE0042409E0082407E0B4
+:10718000102405E0202403E0402401E0802400BF17
+:10719000DAE0C1492868884219D1BD48006800F08A
+:1071A0000700062810D2DFE800F0030507090B0DE1
+:1071B00000240BE0042409E0082407E0102405E083
+:1071C000202403E0402401E0802400BFBCE0B34958
+:1071D0002868884219D1AE48006800F007000628E8
+:1071E00010D2DFE800F0030507090B0D00240BE0C7
+:1071F000042409E0082407E0102405E0202403E02B
+:10720000402401E0802400BF9EE0A5492868884210
+:1072100019D19F48006800F00700062810D2DFE867
+:1072200000F0030507090B0D00240BE0042409E01E
+:10723000082407E0102405E0202403E0402401E0B6
+:10724000802400BF80E097492868884220D1904878
+:10725000006800F03800182811D005DC48B1082873
+:1072600009D0102811D108E020280AD028280CD1F4
+:1072700009E001240BE0042409E0082407E01024BD
+:1072800005E0202403E0402401E0802400BF5BE00F
+:1072900085492868884219D17D48006800F00700B8
+:1072A000062810D2DFE800F0030507090B0D0024C3
+:1072B0000BE0042409E0082407E0102405E0202462
+:1072C00003E0402401E0802400BF3DE077492868C6
+:1072D000884219D16E48006800F00700062810D2D5
+:1072E000DFE800F0030507090B0D00240BE0042480
+:1072F00009E0082407E0102405E0202403E04024EE
+:1073000001E0802400BF1FE05D49286888421AD14F
+:107310005F48001D006800F00700062810D2DFE873
+:1073200000F0030507090B0D02240BE0042409E01B
+:10733000082407E0102405E0202403E0402401E0B5
+:10734000802400BF00E0802400BF4D4928688842A7
+:107350007DD1102C1AD006DC022C09D0042C0BD0C5
+:10736000082C29D10DE0202C21D0402C24D120E064
+:10737000FBF744F8064623E005A8FBF769F9069EEB
+:107380001EE002A8FBF77CFA039E19E0404854383F
+:107390000068C0F3401040B13D4854380068C0F365
+:1073A000C101434820FA01F600E0414E08E0414E99
+:1073B00006E04FF4004603E000260120089000BFDD
+:1073C00000BF002E10D03C49686A31F81000B6FBAF
+:1073D000F0F9686800EB4000484503D8686800038E
+:1073E000484502D20120089003E13349686A31F828
+:1073F00010C06246002330461946F8F76BFF4FF481
+:10740000807300228446ACFB030B01FB03B10CFB31
+:10741000021C69684908034659184CEB0200CDE983
+:107420000010D5F804C06246002308460199F8F719
+:1074300051FF0746B7F5407F06D3B7F5801F03D24B
+:107440002868C760D5E002E001200890D1E0E86933
+:10745000B0F5004F7BD1082C39D005DC5CB1012C94
+:107460002CD0042C4CD12DE0102C35D0202C42D027
+:10747000402C45D141E0FCF7DDFF064644E000002A
+:10748000000C0058F369FFCFFFF4FF11001001401A
+:10749000544402580044004000480040004C004062
+:1074A000005000400014014000780040007C004083
+:1074B0000090D00300093D00DEBC0008FCF7CCFFC3
+:1074C000064621E005A8FBF7C3F8069E1CE002A8CB
+:1074D000FBF7D6F9039E17E04C480068C0F3401054
+:1074E00038B14A480068C0F3C101494820FA01F6A2
+:1074F00000E0474E08E0474E06E04FF4004603E048
+:1075000000260120089000BF00BFFEB14249686A12
+:1075100031F81000B6FBF0F04000696800EB510054
+:10752000B0FBF1F7102F0FD3B7F5803F0CD24FF619
+:10753000F07007EA000AC7F342004AEA000A286826
+:10754000C0F80CA055E002E00120089051E0082CA2
+:107550001AD005DC5CB1012C0DD0042C2DD10EE02D
+:10756000102C16D0202C23D0402C26D122E0FCF762
+:1075700061FF064625E0FCF76FFF064621E005A8FF
+:10758000FBF766F8069E1CE002A8FBF779F9039E5C
+:1075900017E01E480068C0F3401038B11B4800686F
+:1075A000C0F3C1011A4820FA01F600E0184E08E0C5
+:1075B000184E06E04FF4004603E000260120089034
+:1075C00000BF00BFAEB11449686A31F81000B6FBC5
+:1075D000F0F0696800EB5100B0FBF1F7102F06D313
+:1075E000B7F5803F03D2B8B22968C86001E0012036
+:1075F00008900120A5F86A00A5F8680000206867D7
+:10760000A867089809B0BDE8F08F00000044025850
+:107610000090D00300093D00DEBC00082DE9F041D8
+:1076200004460D4617469846069E41E0701C002809
+:107630003ED0FAF767F9A0EB0800B04200D816B9BF
+:107640000320BDE8F0812068006800F0040070B3FA
+:10765000802D2DD0402D2BD02068C069C0F3C000F4
+:1076600078B10820216808622046FFF7DBFC08207B
+:10767000C4F8900000BF002084F8840000BF0120FF
+:10768000DFE72068C069C0F3C02080B14FF400601C
+:10769000216808622046FFF7C5FC2020C4F890004E
+:1076A00000BF002084F8840000BF0320C9E7FFE783
+:1076B0002068C0692840A84201D1012000E00020D4
+:1076C000B842B3D00020BCE700BFFEE70FB4054BC3
+:1076D00010B503A9044A029800F056FC10BC5DF8EE
+:1076E00014FB0000B59300085C00002403B401986B
+:1076F0004100009850EAC12018BF04204A0D18BF6D
+:1077000040F0010040F2FF72B2EB515F08BF40F061
+:107710000200012808BF052002B070470248006837
+:10772000C0F30220704700000CED00E010B5002807
+:1077300004DB0A07130E054A135406E00A07140E69
+:10774000034A00F00F031B1FD45410BD00E400E0F7
+:1077500018ED00E00000000070B56B482DED020B45
+:107760002DED0A8B82B00D9D25F000449FED68BB86
+:107770009FED699B84422EDBA4F140510C98A1F14E
+:107780007F6108430FD06648844202DC18D10C9810
+:10779000B0B19DED0C0B02B0BDEC0A8B02B0BDE8A0
+:1077A000704000F0F9BA9DED0C0B9DED0C1B20EE26
+:1077B0000B0B01EE090B02B0BDEC0A8B02B070BDE1
+:1077C000012000F019FB02B0BDEC0A8B02B0BDE84D
+:1077D000704000F0E9BA53489FED538B844230DA91
+:1077E0009DED0C0BB4F1795F0ADA51EC100BFFF749
+:1077F0007DFF042808BF00F0E3FA9DED0C0BDAE7EB
+:1078000020EE009B4A480621B0EE490B784400F078
+:107810008BFA20EE09AB4748B0EE490B04217844BF
+:1078200000F082FA09EE008B8AEE080B8DED000B5A
+:107830009DED0C0B9DED0C1B9DED002B01EE020B45
+:10784000B9E79DED0C0B51EC100B01F0A7FD41ECDD
+:10785000100B9FED391B3A4838EE400B06218DED99
+:10786000000B20EE01ABB0EE4A0B784400F05CFA5E
+:1078700020EE0ACB3348B0EE4A0B0421784400F0E6
+:1078800053FA0AEE008B51EC1A0B03F0CDFB41ECDE
+:10789000110B2D489FED2E2BA0420EDC8CEE080B19
+:1078A0008DED000B9DED003BB0EE410B01EE030BA7
+:1078B00010EE029B3BEE490B21E08DED001B0020FA
+:1078C00000909DED000B9DED003B00EE43AB31EED3
+:1078D000000B21EE021B8AEE003B8CEE080B03EE40
+:1078E000429B9DED003B11EE009B9FED1B1BB0EEFC
+:1078F000410B03EE420B39EE400B31EE400B002DF5
+:10790000D8BFB1EE400B56E70000F03F000000008A
+:10791000182D4454FB21F93F075C143326A6913CF3
+:107920000000F07F0000E03F000000000000F03F9A
+:107930000845000026450000000000000000E03F70
+:10794000AA440000C84400003333EF3F00000000A9
+:107950000000000000000040182D4454FB21E93FC6
+:1079600070B565482DED020B2DED048B059D25F0BE
+:107970000044A04218DC6148844202DC0AD1049829
+:1079800040B19DED040BBDEC048B02B0BDE870402E
+:1079900000F002BA002DCCBF9FED590B9FED5A0BA2
+:1079A000BDEC048B02B070BD5948A04215DD5948AA
+:1079B000A042D8BF4FF0FF3455DD9DED040B51ECD4
+:1079C000100BFFF793FE042808BF00F0F9F99DEDB6
+:1079D000040BBDEC048B02B070BD9DED040B51ECAB
+:1079E000100B01F0DBFCCDE904014B489FED4C0B83
+:1079F000A0421CDD4C48A0420BDD9DED042B002471
+:107A00009FED4B1B12EE010B32EE011B80EE012BA2
+:107A100027E09DED041B9DED042B012431EE401B5E
+:107A200032EE000B81EE002B8DED042B1BE0424863
+:107A3000A0420FDD9DED042B02249FED411B9DED27
+:107A4000043B32EE412B03EE010B82EE001B8DED69
+:107A5000041B08E09DED040B9FED3B1B032481EE0E
+:107A6000002B8DED042B9DED040B3948062120EEF3
+:107A7000009B29EE098BB0EE480B784400F054F9D6
+:107A800020EE099B3348B0EE480B0521784400F006
+:107A90004BF920EE080B002C0BDA9DED042B39EE90
+:107AA000001B9DED040BBDEC048B02B002EE410BFC
+:107AB00070BD2948784439EE000B00EBC4009DED01
+:107AC000042B90ED001B254812EE001B9DED040BCE
+:107AD00031EE400B784400EBC400002D90ED001B0C
+:107AE00031EE400BB8BFB1EE400BBDEC048B02B0E1
+:107AF00070BD000000000000000010440000F07F96
+:107B0000182D4454FB21F93F182D4454FB21F9BF93
+:107B10000000DC3F0000203E0000F33F00000000BA
+:107B2000000000000000F03F0000E63F0000000001
+:107B30000000000000000040008003400000000042
+:107B4000000000000000F83F000000000000F0BF4F
+:107B50005243000018430000D04200009042000051
+:107B600070B5614E2DED040B2DED048B82B0DDF868
+:107B700024C0DDE907235C422CF000411C4341EAAC
+:107B8000D474069D22F00040B44205D86C422C43C8
+:107B900040EAD474B4420BD99DED081B9DED060B51
+:107BA00002B0BDEC048B04B0BDE8704000F0F7B843
+:107BB000ACF14054A4F17F641C430BD0022404EACE
+:107BC000AC7444EAD27405439FED498B9FED4A2B78
+:107BD0000DD016E09DED060B51EC100B00F0B8FD3A
+:107BE00041EC100B02B0BDEC048B04B070BD002C56
+:107BF00014BF012C9DED060BF4D0022C2ED0032CCB
+:107C00002FD00B439FED3E1B9FED3F0B0AD0B1429F
+:107C10001DD1B04209D121F0804120F0804009916E
+:107C2000079014E0002ADDDA15E0394B7B44002C84
+:107C300008BF93ED000BD5D0012C04BF93ED000BD2
+:107C4000B1EE400BCED0022C08D0032C09D0B042AC
+:107C50000AD1002AC6DAB0EE410BC3E7B0EE480BFA
+:107C6000C0E7B0EE420BBDE7401A00159FED2A9B1E
+:107C70003C28C8BF8DED000B15DCBCF1000FBCBF6C
+:107C800010F13C0F8DED009B0DDB9DED061B9DED76
+:107C9000082B81EE020B51EC100B01F07FFB00F082
+:107CA00057FDCDE9000194B1012C0CD09DED001BD6
+:107CB0009FED1B0B022C31EE400B0CBF38EE400B3E
+:107CC00030EE480B8EE7019880F0004001909DED6A
+:107CD000000BB4EE490BF1EE10FA04BF022000F0E5
+:107CE0008BF89DED000B7DE70000F07F00000000A9
+:107CF000182D4454FB210940182D4454FB2109C080
+:107D0000182D4454FB21F9BF182D4454FB21F93F91
+:107D1000D041000000000000000000000000000052
+:107D2000075C143326A6A13C491E00EBC102B0EE4D
+:107D3000401B92ED000B31F006020DD0491E00EB06
+:107D4000C102B0EE403B92ED002B31F00602B0EEE6
+:107D5000420B03EE010BF1D1022914D004290AD001
+:107D6000062918BF704790ED0A2B00EE012B90ED0D
+:107D7000080B02EE010B90ED062B00EE012B90EDAF
+:107D8000040B02EE010B90ED022B00EE012B90EDA7
+:107D9000000B02EE010B704730EE000B704730EE27
+:107DA000010B7047000000009FED031B81EE010BEB
+:107DB000704700000000000000000000000000000C
+:107DC0009FED030B20EE000B704700000000000049
+:107DD000000000000000001002E008C8121F08C1E7
+:107DE000002AFAD170477047002001E001C1121F3C
+:107DF000002AFBD17047000001490860704700006D
+:107E0000600000242DE9FF5F82B00021DDE904302D
+:107E1000020DDDF840B0034318D044F61050A2F232
+:107E2000FF3242431514119801281FD0A5EB0B0017
+:107E3000401C5FEA000A4FF000064E4FDFF8389111
+:107E4000B046504615D5CAF1000413E0119801243C
+:107E50004AA3012801D16FEA0B010298119AC0E9E7
+:107E60000031C0E9024206B0BDE8F09FCBF100004E
+:107E7000DFE704460021404A491842EB0450CDE9AF
+:107E8000001012E0E00707D032463B464046494624
+:107E9000F8F77DFB8046894632463B461046194638
+:107EA000F8F775FB06460F466410002CEAD1DDE9B1
+:107EB0000401DDE90023BAF1000F06DAF8F767FBE9
+:107EC00042464B46F8F763FB05E0F8F7D2FB424623
+:107ED0004B46F8F7CEFB04460E460022284BF8F737
+:107EE0004FFC03D84FF0FF30014607E00022254B3E
+:107EF00020463146F8F7A4FAF8F72AFC102409E0E6
+:107F0000002C0ADB0A220023F8F7E4F9039B303245
+:107F10001A55641E50EA0102F2D1641C039AC4F19E
+:107F200011031444119A012A03D0012208430DD1F0
+:107F30000AE0084304D000204FF0110B119072E7C3
+:107F4000A3EB0B056D1E0DE05B4504DD4FF0000259
+:107F500005F1010504E003DA4FF00002A5F1010587
+:107F6000002AECD002981199C0E90231C0E900451D
+:107F700079E70000000014400000F03F30000000EE
+:107F80000000F0430000E03F2DE9FF4F95B09A4616
+:107F9000884606460025EEE1252877D100242746AD
+:107FA000F94A0121039400E0044316F8013F203B05
+:107FB00001FA03F01042F7D130782A2811D06FF07F
+:107FC0002F033078A0F13002092A16D8039A44F022
+:107FD000020402EB820203EB42021044761C03907F
+:107FE000EFE758F8042B0392002A03DA504244F4D6
+:107FF0000054039044F00204761C30782E2816D1E9
+:1080000016F8010F44F004042A280DD06FF02F0257
+:108010003078A0F13003092B09D807EB870302EB76
+:108020004303C718761CF3E758F8047B761C3078B6
+:108030006C280FD006DC4C2817D068280DD06A2891
+:1080400014D104E0742810D07A280FD10DE044F444
+:1080500000140AE044F4801401E044F440147278FF
+:10806000824202D104F58014761C761C3078662892
+:108070000BD013DC582877D009DC002875D04528B0
+:10808000F6D04628F4D047281AD193E118E06328A7
+:1080900035D0642879D0652812D18BE1702873D04F
+:1080A00008DC6728F1D069286FD06E280DD06F28C2
+:1080B00006D1ACE073282CD0752874D0782853D022
+:1080C0005246179990476D1C54E1C4F302500228A0
+:1080D00009D003280DD0D8F8001004280DD00D6069
+:1080E00008F1040846E1D8F80010EA17C1E9005287
+:1080F000F6E7D8F800100D80F2E70D70F0E718F8F9
+:10810000041B8DF8001000208DF80100EB460120C3
+:1081100003E058F804BB4FF0FF3061074FF0000157
+:1081200002D40DE009F101018946B9420FDA814517
+:10813000F8DB1BF809100029F4D108E009F101016E
+:1081400089468142FADB1BF809100029F6D1039811
+:108150005346A0EB090721463846179A00F080FAEB
+:10816000284400EB090507E044E008E10DE01BF8B6
+:10817000010B524617999047B9F10109F7D25346BE
+:1081800021463846179AF2E039E00A21C4F3025238
+:108190004FF0000B0091022A06D058F8040BC117CB
+:1081A000032A09D00AE023E008F1070020F00702C3
+:1081B000F2E80201904605E000B2C117042A01D19D
+:1081C00040B2C117002906DA0A460021404261EB9D
+:1081D00002012D2202E0220504D52B228DF8042075
+:1081E000012203E0E20701D02022F7E7914657E0A1
+:1081F0000A2100E010214FF0000B00910BE010214C
+:108200004FF0000B44F004040827009103E008201D
+:108210004FF0000B0090C4F30252022A05D058F828
+:10822000040B0021032A08D008E008F1070020F021
+:108230000702F2E80201904603E080B2042A00D16E
+:10824000C0B24FF0000922072AD53278702A07D031
+:10825000DDF800C08CF0100C5CEA0B0C05D00EE0D1
+:1082600040228DF80420012208E050EA010306D0E4
+:1082700030238DF804308DF8052002229146009BB2
+:1082800083F0080353EA0B030AD150EA010201D13B
+:10829000620705D530228DF804204FF001097F1EBA
+:1082A0003278582A04D039A20C920CAA02920BE020
+:1082B0003BA2F9E75B46009AF8F70CF80C9B9B5C35
+:1082C000029A521E0292137050EA0102F2D10298F1
+:1082D00004A9081A00F1200B600702D524F48034A9
+:1082E00000E001275F4502DDA7EB0B0000E0002066
+:1082F00000EB0B01009003984944401A0390E003FF
+:1083000006D453462146179A039800F0A9F905446C
+:10831000002706E001A85246C05D179990476D1CE2
+:108320007F1C4F45F6DBE0030CD553462146179AD8
+:10833000039800F095F9054404E03020524617995F
+:1083400090476D1C0099481E00900029F5DC08E05C
+:108350000298029952460078491C02911799904759
+:108360006D1CBBF10001ABF1010BF1DC5BE100F036
+:1083700065F90544761C307800287FF40DAE19B0FD
+:108380002846BDE8F08F0000092801003031323363
+:108390003435363738396162636465660000000041
+:1083A000303132333435363738394142434445462B
+:1083B00000000000600700D4062708F1070020F045
+:1083C0000700F0E80223804603F0004C5FEA0C004F
+:1083D00001D097A009E0200501D596A005E0E007AF
+:1083E00001D095A001E0AFF24C001390307823F05B
+:1083F000004365280CD006DC452809D046281DD04E
+:1084000047287FD13BE0662818D067287AD136E02C
+:108410000021112F01DB112000E0781CCDE90001C3
+:1084200004A90CA8FFF7EEFCDDE90D010C9A4FF052
+:10843000000B07F10109109200914EE04FF000404F
+:108440000097CDE9011004A90CA8FFF7DBFCDDE9DA
+:108450000D020C9B0F994FF0000B91461093009268
+:1084600011B9791C00EB0109B7EB090003D4C0F185
+:10847000FF3B07F10109A9EB0700019042E0012F42
+:1084800000DA01270021112F01DD112000E038461C
+:10849000CDE9000104A90CA8FFF7B4FCDDE90D014A
+:1084A0000C9A00914FF0000BB946109221070FD49F
+:1084B000009A4A4503DA914601E0A9F10109B9F1B0
+:1084C000010F05DD109AA9F10101515C3029F4D0AA
+:1084D000B84202DA10F1040F03DA0121CDE90110EC
+:1084E00010E0002803DC8344A9EB000102E0411CFA
+:1084F000494500DD8946A0EB0B00401C01904FF080
+:1085000000400290200705D40198484502DB4FF057
+:10851000FF30019000208DF84B0002980DF14B07C1
+:10852000B0F1004F25D002200C902B200D90029826
+:1085300000280CDA404202902D200D9007E00A211D
+:108540000298F7F748FF3031029007F8011D0C99A7
+:10855000481E0C900029F2DC02980028EFD1791E09
+:108560000D980870307800F0200040F0450007F8C2
+:10857000020D11A8C01BC01D02901398007800B115
+:10858000012000EB0901019801EBE0710298014420
+:108590000398401A401E0390E00306D45346214638
+:1085A000179A039800F05CF805441398007818B106
+:1085B0005246179990476D1CE00323D55346214638
+:1085C000179A039800F04CF805441BE0BBF1000F2C
+:1085D00007DB0098584504DD1098179910F80B0038
+:1085E00001E0179930205246904701980BF1010B9A
+:1085F000401E05F10105019004D12E205246179925
+:1086000090476D1CB9F10001A9F10109DEDC05E01C
+:1086100017F8010B5246179990476D1C0299481E96
+:1086200002900029F4DC53462146179A03989EE6EF
+:108630002D0000002B000000200000002DE9F0417B
+:10864000044600251E461746880404D405E0394632
+:108650002020B0476D1C641EF9D52846BDE8F08186
+:108660002DE9F041044600251E469046C80301D579
+:10867000302700E02027880404D505E0414638462D
+:10868000B0476D1C641EF9D52846BDE8F081000096
+:10869000F0B52DED028B83B006460F4600256846E7
+:1086A00000F096FE002448E056F8241057F82420E5
+:1086B000881A002801DB014600E0414200EE101A52
+:1086C000B8EEC00ADFED200A80EE208A684600EB93
+:1086D000840090ED000AB5EEC00AF1EE10FA19D050
+:1086E000684600EB8400D0ED000A88EE200AF7EE21
+:1086F000000A70EE608A00BFB0EEE80A1348D0EDC1
+:10870000090AB4EEE00AF1EE10FA15DD0120A040EE
+:10871000054311E00D4890ED070AB4EEC80AF1EEEA
+:1087200010FA06DC90ED080AB4EEC80AF1EE10FA71
+:1087300002D20120A0400543641C032CB4DB284670
+:1087400003B0BDEC028BF0BD00008047C0B0000854
+:1087500010B541EC100BFFF703F951EC100B10BDF5
+:108760002DE9F0410446E07800F0C006E07800F022
+:108770003F05607800F0010098B1EF102846E91736
+:1087800005EB5171C910A5EBC101491C01F0FF08AF
+:108790000B48006820B10A484146026838469047B5
+:1087A00000BF607800F0080030B10548406818B19B
+:1087B000B011034A516888470020BDE8F0810000ED
+:1087C0006400002438B5044664B120208DF8000010
+:1087D00028208DF8010030208DF8020038208DF817
+:1087E000030004E0A32204216846F7F7D5FD6A469A
+:1087F000042140F69E2002F089FA01F073FE38BD94
+:108800003EB5044602208DF80000CA208DF8010014
+:10881000E3208DF8020009208DF803006A46042148
+:10882000682002F073FAA3208DF8000004F04000E5
+:1088300048B1C0208DF80100C8208DF80200C22088
+:108840008DF8030006E0A3208DF801008DF80200EA
+:108850008DF8030004F4C07048B1C4208DF8040002
+:10886000CC208DF80500C6208DF8060006E0A32078
+:108870008DF804008DF805008DF80600A3208DF812
+:1088800007008DF808008DF809006A460A2140F6B5
+:10889000A72002F03BFA04F0030018B120208DF865
+:1088A000000002E0D8208DF800006A46012140F661
+:1088B000B62002F02BFA04F0200018B1012000F0DD
+:1088C000ADF802E0002000F0A9F804F4C07008B38D
+:1088D00004F4807060B1B2208DF800008B208DF818
+:1088E0000100B6208DF802009B208DF803000BE0FC
+:1088F000B0208DF8000080208DF80100B4208DF8A4
+:10890000020090208DF803006A46042140F6A22060
+:1089100002F0FCF904F0010020B3F8208DF800000B
+:108920006A4601214FF40B6002F0F0F9FA210720AA
+:1089300000F02EFC072000F0F5FB012000F015FCF4
+:10894000642000F005FD4FF4FA7000F014FDC8211A
+:10895000304800F0A5FB282000F0BEFB0A2000F004
+:10896000CEFB08E0D8208DF800006A4601214FF4C4
+:108970000B6002F0CBF904F0020018B1D9208DF899
+:10898000000002E0D8208DF800006A46012140F284
+:108990003D7002F0BBF904F0040018B1012000F0B2
+:1089A00069F802E0002000F065F804F0100018B14A
+:1089B0000120FFF707FF02E00020FFF703FF44F06C
+:1089C00008001549488101F08DFD00201249887387
+:1089D00004F0400018B10846807B801D887304F4C1
+:1089E000C07020B10C48807B801D0B49887304F057
+:1089F000140020B10848807B10300749887304F0C8
+:108A0000030020B10448807B001D034988730020C7
+:108A10003EBD000009E3CA02640000243EB50446DE
+:108A20006CB10EA1D1E900208968CDE90020029146
+:108A30006A4609214FF4976002F068F93EBD0AA228
+:108A4000D2E900109268CDE9010200916A4609213D
+:108A50004FF4976002F05AF9F0E70000B8AAB38D1E
+:108A6000B4980D355D000000B8AAAAAAB088C3C5A5
+:108A7000C700000038B5044664B1C0208DF800007E
+:108A8000C2208DF80100C4208DF80200C6208DF8A8
+:108A9000030004E08B2204216846F7F77DFC6A4658
+:108AA000042140F6982002F031F901F01BFD38BD99
+:108AB00010B5C8234FF48062024940F6F63001F049
+:108AC000A5FB10BDE8B000082DE9F04F8DB00746BA
+:108AD000884615469946DDE9166B00240020308053
+:108AE0006B49887B5A4605A901F05CFC18B1601EF1
+:108AF0000DB0BDE8F08F6648807A00F014000028C1
+:108B000067D09DF8140000069DF8151040EA01405A
+:108B10009DF8161040EA01209DF8171008432860C0
+:108B20009DF8180000069DF8191040EA01409DF8D4
+:108B30001A1040EA01209DF81B10084368609DF858
+:108B40001C0000069DF81D1040EA01409DF81E1013
+:108B500040EA01209DF81F100843A8609DF82000FE
+:108B600000069DF8211040EA01409DF8221040EADD
+:108B700001209DF823100843E86004F11000C4B2FE
+:108B8000286800140190686800140290A868001416
+:108B90000390E8680014049001984043029901FB97
+:108BA0000100039901FB0100049901FB010ABAF1DC
+:108BB000706F02DBBAF1885F05DD01F093FC0020E5
+:108BC0003080401E94E7B6F9000040F48070308099
+:108BD00000BF2F48807A00F0400020B305A9601C38
+:108BE000085C095D40EA012000B2A8F8000005A970
+:108BF000E01C095C05AAA01C105C41EA002000B240
+:108C0000A8F8020005A9601D095C201D105C41EA5E
+:108C1000002000B2A8F80400A01DC4B2B6F90000FC
+:108C200040F0080030801A48408900F4C07008B352
+:108C300005A9601C085C095D40EA012000B238808B
+:108C400005A9E01C095C05AAA01C105C41EA0020F3
+:108C500000B2788005A9601D095C201D105C41EA06
+:108C6000002000B2B880A01DC4B2B6F9000040F0E8
+:108C7000700030800648807A00F0030018B105A922
+:108C80000819FFF76DFD484600F040FE00202FE771
+:108C90006400002470B588B0064601A801F000F910
+:108CA000BDF804000021C90341EA5045C40300BFD8
+:108CB0004448007A00F0030056F82000059041482F
+:108CC000007A00F0040010B10598404205903D483C
+:108CD000007AC0F3C10056F8200006903948007AA7
+:108CE00000F0200010B10698404206903548007A06
+:108CF000C0F3811056F8200007903248008900F434
+:108D0000807010B10798404207900598C117A0FBEA
+:108D1000042301FB043100FB0510810041EA92703D
+:108D200005900698C117A0FB042301FB043100FB4A
+:108D30000510810041EA927006900798C117A0FBC8
+:108D4000042301FB043100FB0510810041EA92700D
+:108D500007900598000E8DF808000598000C8DF816
+:108D600009000598000A8DF80A000598C0B28DF830
+:108D70000B000698000E8DF80C000698000C8DF87C
+:108D80000D000698000A8DF80E000698C0B28DF806
+:108D90000F000798000E8DF810000798000C8DF852
+:108DA00011000798000A8DF812000798C0B28DF8DC
+:108DB000130002AA0C214FF4257001F0A7FF08B0A0
+:108DC00070BD00006400002430B585B0044616A2D2
+:108DD00007CA02AB07C3C82C03DD4FF0FF3005B054
+:108DE00030BDC82090FBF4F0401E85B2280A8DF8F3
+:108DF0000000E8B28DF801006A46022140F2162018
+:108E000001F084FF10B14FF0FF30E8E702AA0C2117
+:108E100040F6C12001F07AFF10B14FF0FF30DEE7DD
+:108E2000044884810020DAE7FEF2ABC4AAF1DFDF58
+:108E3000BBAFDFDF640000241FB504464848007A5A
+:108E400000F0030054F8200001904548007A00F03B
+:108E5000040010B10198404201904148007AC0F3EB
+:108E6000C10054F8200002903D48007A00F0200034
+:108E700010B10298404202903948007AC0F3811044
+:108E800054F8200003903648008900F4807010B137
+:108E90000398404203903349019880FB0101800F01
+:108EA00040EA810001902F49029880FB0110820066
+:108EB00042EA917002902B49039880FB01108200D6
+:108EC00042EA917003900198000E8DF8000001981D
+:108ED000000C8DF801000198000A8DF8020001983D
+:108EE000C0B28DF803006A4604214FF4747001F09B
+:108EF0000DFF18B14FF0FF3004B010BD0298000E06
+:108F00008DF800000298000C8DF801000298000A0C
+:108F10008DF802000298C0B28DF803006A46042161
+:108F20004FF4757001F0F2FE10B14FF0FF30E3E73F
+:108F30000398000E8DF800000398000C8DF80100D6
+:108F40000398000A8DF802000398C0B28DF8030060
+:108F50006A4604214FF4767001F0D8FECCE7000099
+:108F60006400002409E3CA0210B586B0044647A095
+:108F70000068039046A00068029046A00068019037
+:108F800045A00068009004F0030003A9085C8DF878
+:108F9000140003A8C4F3C101405C8DF8150003A8B8
+:108FA000C4F38111405C8DF8160004F0030002A99F
+:108FB000085C8DF8100002A8C4F3C101405C8DF874
+:108FC000110002A8C4F38111405C8DF8120005AABB
+:108FD000032140F2264001F099FE18B14FF0FF3016
+:108FE00006B010BD04AA032140F22A4001F08EFE13
+:108FF00010B14FF0FF30F3E701980590009804900E
+:1090000004F0040058B19DF8140040F001008DF800
+:1090100014009DF8100040F001008DF8100004F0DD
+:10902000200058B19DF8150040F001008DF81500A2
+:109030009DF8110040F001008DF8110004F48070DB
+:1090400058B19DF8160040F001008DF816009DF80B
+:10905000120040F001008DF8120005AA03214FF420
+:10906000886001F053FE10B14FF0FF30B8E704AA5A
+:10907000032140F2314001F049FE10B14FF0FF30C2
+:10908000AEE7064804810020AAE700004CCD6C0042
+:109090000CC92C0036567600264666006400002473
+:1090A000F8B505460E464FF47A7095FBF0F000FBDC
+:1090B00006F4200E8DF80000200C8DF80100200A27
+:1090C0008DF80200E0B28DF803006A4604214FF4E7
+:1090D000AE7001F01BFEF8BD38B50446052094FBC8
+:1090E000F0F084B220128DF80000E0B28DF801009B
+:1090F0006A4602214FF4AD7001F008FE38BD38B564
+:109100000446052094FBF0F084B220128DF8000094
+:10911000E0B28DF801006A4602214FF4AC7001F014
+:10912000F5FD38BD38B504460020009004F001007C
+:1091300020B19DF8000040F03000009004F00200E3
+:1091400020B19DF8000040F00C00009004F00400F5
+:1091500020B19DF8000040F0030000906A46012114
+:109160004FF4A47001F0D2FD38BD38B50446012C8F
+:1091700001DA012402E0042C00DD0424601EC0B2E8
+:1091800000906A46012140F24F1001F0BFFD38BD4A
+:10919000F0B52DED028B83B006460F4606F00700B2
+:1091A00010B1B7F5C86F05DD4FF0FF3003B0BDEC6F
+:1091B000028BF0BD00EE107AB8EE400ADFED5B0ADC
+:1091C00080EE208A01A800F045FE9DF804000228E8
+:1091D00006D0042817D0082828D010284CD138E011
+:1091E0009FED530A28EE000ABCEEC00A10EE100AEA
+:1091F00084B29FED500A28EE000ABCEEC00A10EEC1
+:10920000100A85B23BE09FED4C0A28EE000ABCEE46
+:10921000C00A10EE100A84B29FED480A28EE000A38
+:10922000BCEEC00A10EE100A85B228E09FED440A99
+:1092300028EE000ABCEEC00A10EE100A84B29FEDC0
+:10924000410A28EE000ABCEEC00A10EE100A85B2F0
+:1092500015E09FED3D0A28EE000ABCEEC00A10EEB4
+:10926000100A84B29FED390A28EE000ABCEEC00A4B
+:1092700010EE100A85B202E04FF0FF3096E700BF13
+:1092800020128DF80800E0B28DF8090028128DF840
+:109290000A00E8B28DF80B0006F00100A0B102AAA6
+:1092A00002214FF4EA7001F031FD10B14FF0FF30B0
+:1092B0007CE70DF10A0202214FF4927001F026FDC5
+:1092C00010B14FF0FF3071E706F00200A0B102AA22
+:1092D00002214FF4EC7001F019FD10B14FF0FF3096
+:1092E00064E70DF10A0202214FF4947001F00EFDC3
+:1092F00010B14FF0FF3059E706F00400A0B102AA08
+:1093000002214FF4EE7001F001FD10B14FF0FF307B
+:109310004CE70DF10A0202214FF4967001F0F6FCC1
+:1093200010B14FF0FF3041E700203FE70000484315
+:109330000000804600004046000000460000C04596
+:109340000000804500004045000000450000C0448A
+:1093500038B50446052094FBF0F085B228128DF84C
+:109360000000E8B28DF801006A4602214FF4EF7068
+:1093700001F0CCFC38BD38B50446052094FBF0F074
+:1093800085B228128DF80000E8B28DF801006A4617
+:1093900002214FF4ED7001F0B9FC38BD82B0CDE987
+:1093A000000121F0004001909DED000B02B051EC56
+:1093B000100B704713B50C464FF6FF730122694638
+:1093C0000248FCF733F900981CBD00001403002488
+:1093D0007CB505462E494968087801AB04220D2169
+:1093E000FCF756FB08B107207CBD9DF80700C0F3D1
+:1093F00001109DF8041001F0E00140EAE1008DF851
+:1094000000009DF80700C0F381009DF8051001F0F1
+:10941000E00140EAE1008DF801009DF8070000F04E
+:1094200003009DF8061001F0E00140EAE1008DF82C
+:109430000200002427E01DF8040030B99FED150A52
+:1094400005EB840080ED000A1BE09FED130A05EB9D
+:10945000840080ED000A0BE005EB840090ED000A2B
+:10946000DFED0E0A20EE200A05EB840080ED000AF5
+:109470001DF80400401EC0B20DF804000028EBD116
+:1094800000BF601CC4B2032CD5DB0020ACE7000099
+:1094900000000024000000007B14AE3E1D5A843FF3
+:1094A0002DE9F04F87B005460C46914601208DF816
+:1094B000100000208DF81100FE4A1268517DFD4A0F
+:1094C0005268107804AB0222FCF786FB20B14FF003
+:1094D000FF3007B0BDE8F08FC820F8F7F5F800209E
+:1094E0008DF81000F34A1268517CF24A52681078E5
+:1094F00004AB0122FCF770FB10B14FF0FF30E8E73E
+:10950000EC4A12685179EB4A5268107804AB012298
+:10951000FCF762FB10B14FF0FF30DAE7E54A126862
+:10952000517DE44A5268107804AB0122FCF754FBE9
+:1095300010B14FF0FF30CCE7DE4A1268917EDD4A71
+:109540005268107804AB0122FCF746FB10B14FF0D3
+:10955000FF30BEE7D74A12681179D64A52681078B0
+:1095600004AB0122FCF738FB10B14FF0FF30B0E73D
+:109570000C208DF81000CF4A12681179CD4A52683C
+:10958000107804AB0122FCF727FB10B14FF0FF303D
+:109590009FE70F20F8F798F8C648806A407A8DF860
+:1095A0001000C44A12689178C24A5268107804AB1D
+:1095B0000122FCF711FB10B14FF0FF3089E7BD48E5
+:1095C000806A007A8DF81000BA4A12685178B94A58
+:1095D0005268107804AB0122FCF7FEFA10B14FF08C
+:1095E000FF3076E7B9F1000F07D0B248806A807A81
+:1095F00040F0E0008DF8100004E0AE48806A807A08
+:109600008DF81000AB4A12689179AA4A5268107816
+:1096100004AB0122FCF7E0FA10B14FF0FF3058E73D
+:10962000B9F1000F07D0A348806AC07A40F0E0008B
+:109630008DF8100003E0A048C07A8DF810009D4A14
+:109640001268D1799B4A5268107804AB0122FCF76A
+:10965000C3FA10B14FF0FF303BE7B9F1000F02D071
+:10966000C820F8F731F840208DF81000914A1268B0
+:109670001179904A5268107804AB0122FCF7ACFAD9
+:1096800010B14FF0FF3024E778208DF81000894AA0
+:1096900012685179874A5268107804AB0122FCF7AE
+:1096A0009BFA10B14FF0FF3013E783498889F8F730
+:1096B0000BF800208DF810007E4A126851797D4A1F
+:1096C0005268107804AB0122FCF786FA10B14FF013
+:1096D000FF30FEE6774A1268117B764A52681078AE
+:1096E00004AB0222FCF7D4F910B14FF0FF30F0E6E2
+:1096F0009DF811009DF8101040EA012B0C209BFBF7
+:10970000F0F0C6B20020A86068602860A0606060C9
+:109710002060824665E0674A1268517B654A52685C
+:10972000107804AB0C22FCF7B3F910B14FF0FF3006
+:10973000CFE69DF811009DF8101040EA012000B21C
+:10974000ADF808009DF813009DF8121040EA0120C2
+:1097500000B2ADF80A009DF815009DF8141040EA1B
+:10976000012000B2ADF80C00BDF9081020680844D3
+:109770002060BDF90A10606808446060BDF90C10F3
+:10978000A0680844A0609DF817009DF8161040EAF4
+:10979000012000B2ADF800009DF819009DF81810E6
+:1097A00040EA012000B2ADF802009DF81B009DF8D0
+:1097B0001A1040EA012000B2ADF80400BDF9001013
+:1097C000286808442860BDF9021068680844686089
+:1097D000BDF90410A8680844A8600AF1010000F06F
+:1097E000FF0AB24597DB3448D0F800C02868C1179B
+:1097F000090441EA10410704624600233846F6F79F
+:109800009AFD32460023CDE90201F6F794FD286067
+:109810002948D0F800C06868C117090441EA10411E
+:109820000704624600233846F6F785FD32460023DA
+:10983000CDE90201F6F77FFD68601F48D0F800C04F
+:10984000A868C117090441EA1041070462460023D1
+:109850003846F6F770FD32460023CDE90201F6F7EF
+:109860006AFDA8601448D0F804C02068C117090434
+:1098700041EA10410704624600233846F6F75BFDD3
+:1098800032460023CDE90201F6F755FD20600A4873
+:10989000D0F804C06068C117090441EA1041070408
+:1098A000624600233846F6F746FD32460023CDE9EE
+:1098B000020103E000000024C0B00008F6F73BFD01
+:1098C00060601148D0F804C0A068C117090441EADB
+:1098D00010410704624600233846F6F72CFD324655
+:1098E0000023CDE90201F6F726FDA060A06800285C
+:1098F00004DDA068A0F58030A06003E0A06800F55A
+:109900008030A0600020E4E5C0B0000810B5044637
+:10991000F7F7F8FF2060002010BD0000012001498A
+:10992000C870704774000024F0B52DED048B81B031
+:1099300006460F4600253F49496808786B460322D2
+:109940000D21FCF7A5F820B1072001B0BDEC048B78
+:10995000F0BD9DF8000000F01F008DF800009DF89C
+:10996000010000F01F008DF801009DF8020000F0DA
+:109970001F008DF80200002457E056F8241057F815
+:109980002420881A002801DB014600E0414200EE55
+:10999000101AB8EEC00ADFED280A80EE208A1DF802
+:1099A000040070B3254890ED000AB8EE400ADFEDE0
+:1099B000240A80EE801AB0EE419A05E09FED210A5C
+:1099C00029EE000AB0EE409A1DF80400401EC0B215
+:1099D0000DF804000028F1D188EE090AF7EE000A1C
+:1099E00070EE608A00BFB0EEE80A1448D0ED060AB7
+:1099F000B4EEE00AF1EE10FA16DD0120A0400543B6
+:109A000012E0FFE70D4890ED040AB4EEC80AF1EE4B
+:109A100010FA06DC90ED050AB4EEC80AF1EE10FA71
+:109A200002D20120A0400543641C032CA5DB28467C
+:109A30008BE700000000002400008047C0B0000851
+:109A400000B04C4554E3853F014691F90020002ABF
+:109A500001DD00201EE091F90020002A01DA042037
+:109A600018E091F90120002A01DD012012E091F9AE
+:109A70000120002A01DA05200CE091F90220002AD9
+:109A800001DD022006E091F90220002A01DA062019
+:109A900000E0072070470000B8B0F8F797FAFCF72D
+:109AA00099FEFCF7BDF9FCF76BF9FCF739FAFCF706
+:109AB000C1FAFCF7DBFAFCF751FBFCF795FBFCF76E
+:109AC000D9FBFCF75BFAFCF787FA6920AE4908601E
+:109AD000D320AE490860D220AD4908600120AD49CD
+:109AE0000860F6F79BFF6820A7490860D120A749C6
+:109AF0000860D020A64908600120A6490860F6F752
+:109B00008DFF6820A0490860D120A0490860D020BE
+:109B10009F49086002209F490860F6F77FFF69208F
+:109B200099490860D32099490860D2209849086073
+:109B3000022098490860F6F771FF69209249086091
+:109B4000D32092490860D2209149086003209149AE
+:109B50000860F6F763FF68208B490860D1208B49C5
+:109B60000860D0208A49086003208A490860F6F717
+:109B700055FF8948F8F71AFB012404E1012C7DD137
+:109B8000692081490860D32080490860D22080493B
+:109B9000086001207F49086035AA36A937A8FCF77C
+:109BA0002FFD054623AA24A925A8FCF7BDF87BA014
+:109BB000DDE923322599FDF789FD9DED260AB7EEF3
+:109BC000C00A8DED200B9DED270AB7EEC00A8DED82
+:109BD0001E0B9DED280AB7EEC00A8DED1C0B9DED06
+:109BE000290AB7EEC00A8DED1A0B9DED2A0AB7EED1
+:109BF000C00A8DED180B9DED2B0AB7EEC00A8DED56
+:109C0000160B9DED2C0AB7EEC00A8DED140B9DEDE1
+:109C10002D0AB7EEC00A8DED120B9DED2E0AB7EEA0
+:109C2000C00A8DED100B9DED2F0AB7EEC00A8DED29
+:109C30000E0B9DED300AB7EEC00A8DED0C0B9DEDBD
+:109C4000310AB7EEC00A8DED0A0B9DED320AB7EE70
+:109C5000C00A8DED080B9DED330AB7EEC00A8DEDFD
+:109C6000060B9DED340AB7EEC00A8DED040B9DED99
+:109C7000350AB7EEC00A8DED020B00E010E09DED55
+:109C8000360AB7EEC00A8DED000B9DED370AB7EE30
+:109C9000C00A53EC102B44A0FDF718FD02246DE020
+:109CA000022C13D1682038490860D1203749086058
+:109CB000D0203749086001203649086032AA33A90C
+:109CC00034A8FCF79DFC0546032457E0032C13D170
+:109CD00068202D490860D1202C490860D0202C49EB
+:109CE000086002202B4908602FAA30A931A8FCF790
+:109CF00087FC0546042441E0042C13D16920224945
+:109D00000860D32021490860D22021490860022040
+:109D1000204908602CAA2DA92EA8FCF771FC054645
+:109D200005242BE0052C13D1682017490860D120A9
+:109D300016490860D02016490860032015490860BC
+:109D400029AA2AA92BA8FCF75BFC0546062415E0E6
+:109D5000062C13D169200C490860D3200B490860F8
+:109D6000D2200B49086003200A49086026AA27A9C7
+:109D700028A8FCF745FC0546012400BF0122510339
+:109D80001748F7F7B3FDF9E6380000243C0000243B
+:109D90004000002444000024E401002425642C2514
+:109DA000642C25640000000025662C25662C2566A1
+:109DB0002C25662C25662C25662C25662C25662CE4
+:109DC00025662C25662C25662C25662C25662C25DB
+:109DD000662C25662C25662C25662C25660D0A002A
+:109DE0000008025870B50446002624F00104184803
+:109DF00090F8240008B1002070BD1548807A10B991
+:109E00004FF0FF30F8E71248057C807A2040104977
+:109E100008740846007CA04202D04FF0FF3600E0F4
+:109E2000002614B90A48007D18B1012001F0B4F8E9
+:109E300002E0002001F0B0F83CB100F053FB20B18B
+:109E4000034805744FF0FF30D6E73046D4E70000F2
+:109E50000000002401461148407A30B1012807D0A3
+:109E6000022808D003280CD108E0022008700BE07B
+:109E70000420087008E00820087005E01020087031
+:109E800002E04FF0FF30704700BF0448C07C18B1BB
+:109E900008784006000E08700020F4E70000002457
+:109EA00001461348407A30B1012808D002280AD070
+:109EB000032810D10BE04FF4804008800EE041F6FB
+:109EC0009C7008800AE04FF48050088006E04FF450
+:109ED0000060088002E04FF0FF30704700BF044888
+:109EE000C07C10B10888401008800020F5E7000011
+:109EF0000000002401460248007C087000207047E2
+:109F00000000002401460F48007A30B1012807D034
+:109F1000022809D003280FD10AE0FA2008800EE0B9
+:109F20004FF4FA7008800AE04FF47A70088006E077
+:109F30004FF4FA60088002E00020088000BF00BFF4
+:109F4000002070470000002401461248007A30B11A
+:109F5000012809D002280CD0032814D10EE09FED6F
+:109F60000E0A81ED000A11E09FED0C0A81ED000A56
+:109F70000CE09FED0B0A81ED000A07E09FED090A56
+:109F800081ED000A02E04FF0FF30704700BF002073
+:109F9000FBE70000000000240000034300008342B0
+:109FA000333303423333834101461248C07A0828D1
+:109FB00017D2DFE800F01704070A0D101318BC20B1
+:109FC000088013E06220088010E02A2008800DE05D
+:109FD000142008800AE00A20088007E00520088095
+:109FE00004E000BF00BF0020088000BF00BF0020C9
+:109FF00070470000000000240146064890F8240045
+:10A0000010B14FF0FF3070470248C089088000202F
+:10A01000F9E70000000000247CB5054680208DF89B
+:10A020000000664A1268517D644A526810786B4697
+:10A030000122FBF7D1FD10B14FF0FF307CBD642051
+:10A04000F7F742FB00208DF800005C4A1268517D52
+:10A050005A4A526810786B460122FBF7BDFD10B1D9
+:10A060004FF0FF30EAE7554A1268517E534A526872
+:10A0700010786B460622FBF70BFD10B14FF0FF3056
+:10A08000DCE79DF80500C007400F9DF8031001F0C4
+:10A09000010140EA41009DF8011001F0010140EA90
+:10A0A000010494B1012C03D101214448C17431E071
+:10A0B000022C03D100214148C1742BE0214640A06D
+:10A0C000FDF704FB4FF0FF30B8E73C4A1268D17847
+:10A0D0003A4A526810786B460122FBF7D9FC10B15E
+:10A0E0004FF0FF30AAE79DF8000000F00F042CB9F4
+:10A0F0003D48FDF7EBFA4FF0FF309FE7042C06D107
+:10A100003AA0FDF7E3FA01212C48C17402E00021D6
+:10A110002A48C174FF2129488172FF20274908720B
+:10A12000FF2126484172C1724FF6FF71C181FF21A4
+:10A13000017481740121017380F82210002180F8DC
+:10A140002310417501751630016041608160163839
+:10A1500080F8241080F82510C1844FF4FA6000F0D4
+:10A1600063FC10B14FF0FF3068E7022000F02CFBD9
+:10A1700010B14FF0FF3061E72A2000F0CFFC10B1A2
+:10A180004FF0FF305AE7322000F00AFD10B14FF0D7
+:10A19000FF3053E70020FFF725FE10B14FF0FF30EE
+:10A1A0004CE7002000F052FB10B14FF0FF3045E7C4
+:10A1B000002000F043FD002040E7000000000024E4
+:10A1C000556E737570706F7274656420736F66740A
+:10A1D000776172652070726F647563742072657642
+:10A1E0002025642E0A00000008BE000848616C6645
+:10A1F0002073656E73697469766974792070617211
+:10A200007420666F756E642E0A0000002DE9F0431D
+:10A2100085B005460E4690469946294890F8250097
+:10A2200020B14FF0FF3005B0BDE8F08316B94FF014
+:10A23000FF30F8E7002423E0281B102801DD102060
+:10A2400000E0281B87B232193946204600F05EFD37
+:10A2500010B14FF0FF30E6E701AA3946204600F082
+:10A2600001F910B14FF0FF30DDE730193A4601A98E
+:10A27000F6F7A4F810B16FF00100D4E7E01984B24A
+:10A28000AC42D9DB4FEA28208DF8000008F0FF002F
+:10A290008DF801000A4A1268517F094A5268107805
+:10A2A0006B460222FBF798FC10B14FF0FF30BAE783
+:10A2B0000121034880F82510A0F826900020B2E77D
+:10A2C0000000002438B50446282C02DD4FF0FF3092
+:10A2D00038BDDCB9002000F0EBFB00208DF8000059
+:10A2E00007208DF801002E4A1268517D2C4A5268D1
+:10A2F00010786B460222FBF76FFC10B14FF0FF3075
+:10A30000E6E70021264801750020E1E7012000F082
+:10A31000CFFB20208DF80000012C06D100208DF805
+:10A320000100052000F0FAFB17E0052C06DC0120F7
+:10A330008DF80100052000F0F1FB0EE0142C06DC86
+:10A3400002208DF801000A2000F0E8FB05E0032060
+:10A350008DF80100142000F0E1FB9DF801000721B9
+:10A3600001EB8010C0B28DF801000D4A1268517DDA
+:10A370000B4A526810786B460222FBF72DFC10B195
+:10A380004FF0FF30A4E708210548817200210173D6
+:10A39000012101750020FFF725FD002098E700004E
+:10A3A00000000024F8B504460F4616462C4890F8E5
+:10A3B000240010B94FF0FF30F8BD2948807A10B959
+:10A3C0004FF0FF30F8E7264A1268117B244A5268A2
+:10A3D00010786B460222FBF75BFB10B14FF0FF30A9
+:10A3E000EAE79DF801009DF8001040EA0125A5422A
+:10A3F00003DA00203070401EDEE7194840684088CC
+:10A40000B5EB600F17DD164A1268D17C144A52680A
+:10A4100010786B460122FBF73BFB10B14FF0FF3089
+:10A42000CAE79DF8000000F0100020B100F05AF8D3
+:10A430006FF00100C0E7E2B2094B1B68597B084B83
+:10A440005B6818783B46FBF723FB10B14FF0FF30F9
+:10A45000B2E795FBF4F0401E30700020ACE700003E
+:10A4600000000024F8B504460D46164616B94FF014
+:10A47000FF30F8BD1A48807A10B94FF0FF30F8E786
+:10A4800020128DF80000E0B28DF801009DF8010067
+:10A490002844134949684989884202DD4FF0FF305A
+:10A4A000E7E70F4A1268D17E0D4A526810786B4672
+:10A4B0000222FBF791FB10B14FF0FF30D9E7EAB26F
+:10A4C000074B1B68197E064B5B6818783346FBF711
+:10A4D000DFFA10B14FF0FF30CBE70020C9E70000F2
+:10A4E0000000002408B57048807A10B94FF0FF30A2
+:10A4F00008BD002000906C4A1268517C6A4A52687C
+:10A5000010786B460122FBF767FB10B14FF0FF306C
+:10A51000EEE7654A12685179634A526810786B46D3
+:10A520000122FBF759FB10B14FF0FF30E0E75E4A24
+:10A53000126811795C4A526810786B460122FBF769
+:10A540004BFB10B14FF0FF30D2E7574890F8240092
+:10A55000002853D00C200090534A12681179524AB7
+:10A56000526810786B460122FBF736FB10B14FF0B2
+:10A57000FF30BDE73220F7F7A7F8C02000904A4827
+:10A58000807A00F0010020B19DF8000040F020002A
+:10A590000090454A12681179434A526810786B4618
+:10A5A0000122FBF719FB10B14FF0FF30A0E73E4846
+:10A5B000407C10B10220009001E0002000903A4A57
+:10A5C0001268517C384A526810786B460122FBF7BA
+:10A5D00003FB10B14FF0FF308AE700200090324AB1
+:10A5E00012685179304A526810786B460122FBF7A5
+:10A5F000F3FA002855D04FF0FF3079E7042000909F
+:10A60000294A12681179284A526810786B4601224B
+:10A61000FBF7E2FA10B14FF0FF3069E72248807C87
+:10A6200020B92148807A00F0010010B94020009044
+:10A6300001E0602000901C4A126811791A4A5268A1
+:10A6400010786B460122FBF7C7FA10B14FF0FF30CC
+:10A650004EE73220F7F738F81348407C10B101205C
+:10A66000009001E0002000900F4A1268517C0E4AD1
+:10A67000526810786B460122FBF7AEFA10B14FF02A
+:10A68000FF3035E7084A12685179074A5268107856
+:10A69000054B10330122FBF79FFA10B14FF0FF304A
+:10A6A00026E7002024E70000000000242DE9F04FF9
+:10A6B0008DB083460F4602200C90424890F824004B
+:10A6C00020B1002000F068F9012600E0002603A870
+:10A6D000FFF718FC05A8FFF7BDFB01A8FFF764FC16
+:10A6E00002A8FFF789FC374890F80AA004A8FFF7F2
+:10A6F00001FC002407E0002239465846FEF7D0FE50
+:10A7000000B902E0641C022CF5DB00BF022C01D171
+:10A71000002528E0002407E0012206A909A8FEF789
+:10A72000BFFE00B902E0641C022CF5DB00BF022C66
+:10A7300001D1002517E006A93846FDF7A9FF00F072
+:10A74000FF0809A95846FFF7EFF800F0FF090025B8
+:10A75000B9F1000F01D145F00105B8F1000F01D1A9
+:10A7600045F0020500BFFF2016490872FF21154879
+:10A770004172C1724FF6FF71C181FF218172017474
+:10A7800001210173BDF80C0000F04EF99DF8140092
+:10A7900000F01AF8BDF8040000F0C0F9BDF8080098
+:10A7A00000F0FEF9504600F049FA9DF81000FFF75E
+:10A7B00019FB16B1012000F0EFF828460DB0BDE8F6
+:10A7C000F08F00000000002438B504461E48807A4F
+:10A7D00010B94FF0FF3038BD022C06D0042C07D042
+:10A7E000082C08D0102C0CD108E0002000900BE0C1
+:10A7F0000820009008E01020009005E0182000904C
+:10A8000002E04FF0FF30E6E700BF0F48407A9DF8C6
+:10A810000010B0EBE10F01D10020DCE70A4A12681A
+:10A82000D179094A526810786B460122FBF7D4F9B6
+:10A8300010B14FF0FF30CEE79DF80000C110024884
+:10A8400041720020C7E700000000002438B504462C
+:10A850005048807CA04201D1002038BD002C46D059
+:10A860004C4A126811794B4A526810786B460122A3
+:10A87000FBF70EF910B14FF0FF30EEE79DF8000046
+:10A8800020F020000090434A12681179414A526832
+:10A8900010786B460122FBF79FF910B14FF0FF30A3
+:10A8A000DBE70320F6F710FF02200090394890F80C
+:10A8B000220020B19DF8000040F080000090354853
+:10A8C00090F8230020B19DF8000040F03000009087
+:10A8D000304A1268D17D2F4A526810786B460122A7
+:10A8E000FBF77AF9002851D04FF0FF30B5E7294A3D
+:10A8F00012681179274A526810786B460122FBF7DB
+:10A90000C7F810B14FF0FF30A7E72248807A00F077
+:10A91000010028B19DF8000040F02000009004E004
+:10A920009DF8000020F0200000901A4A126811796A
+:10A93000184A526810786B460122FBF74DF910B1A6
+:10A940004FF0FF3089E70320F6F7BEFE114890F87C
+:10A95000220010B18020009001E0002000900D48FE
+:10A9600090F8230020B19DF8000040F030000090E6
+:10A97000084A1268D17D074A526810786B46012256
+:10A98000FBF72AF910B14FF0FF3066E701488474F5
+:10A99000002062E70000002438B50446214890F802
+:10A9A0002400A04201D1002038BD24B31D4890F8F6
+:10A9B000250010B94FF0FF30F6E7002000F0ECFA68
+:10A9C0000020FFF743FF1749C88C00F0E9F800208A
+:10A9D00000901449496808786B4601222321FBF74F
+:10A9E000FBF801210F4880F82410012000F0D4FA70
+:10A9F000FFF778FD13E0002000F0CEFA0948007C54
+:10AA000000900849496808786B4601222321FBF72A
+:10AA1000E3F80021034880F82410FFF763FD0020CD
+:10AA2000C2E700000000002438B504461F48807AC1
+:10AA300010B94FF0FF3038BDFA2C09D0B4F5FA7FC9
+:10AA400009D0B4F57A7F09D0B4F5FA6F0CD108E0DB
+:10AA5000002000900BE00820009008E010200090FB
+:10AA600005E01820009002E04FF0FF30E3E700BF60
+:10AA70000E48007A9DF80010B0EBE10F01D10020E4
+:10AA8000D9E70A4A12689179084A526810786B46E9
+:10AA90000122FBF7A1F810B14FF0FF30CBE79DF892
+:10AAA0000000C010014908720020C4E70000002423
+:10AAB00038B50446184890F82300A04201D1002080
+:10AAC00038BD14B13020009001E000200090124801
+:10AAD000807C20B19DF8000040F0020000900E48FC
+:10AAE00090F8220020B19DF8000040F08000009016
+:10AAF000094A1268D17D084A526810786B460122D3
+:10AB0000FBF76AF810B14FF0FF30D9E7024880F840
+:10AB100023400020D4E700000000002438B504469C
+:10AB20001E48807A10B94FF0FF3038BDBC2C02DBD4
+:10AB30000120009015E0622C02DB0220009010E062
+:10AB40002A2C02DB032000900BE0142C02DB0420F3
+:10AB5000009006E00A2C02DB0520009001E00620B0
+:10AB600000900E48C07A9DF80010884201D1002064
+:10AB7000DBE70A4A12689178084A526810786B46F7
+:10AB80000122FBF729F810B14FF0FF30CDE79DF817
+:10AB900000100248C1720020C7E700000000002436
+:10ABA00038B504462448807A10B94FF0FF3038BDDC
+:10ABB000214890F8240010B14FF0FF30F7E71E480D
+:10ABC000007D50B134B1282C04DCE0B2FFF77AFBF1
+:10ABD0000020ECE70020FFF775FB042C01DA0424C9
+:10ABE00004E0B4F57A7F01DD4FF47A744FF47A70A3
+:10ABF00090FBF4F0401EC0B200900F4A12685178EA
+:10AC00000D4A526810786B460122FAF7E5FF10B141
+:10AC10004FF0FF30CBE79DF80000401C4FF47A71F5
+:10AC200091FBF0F081B20448C1810146C989481006
+:10AC3000FFF774FF0020BAE70000002438B504468F
+:10AC400004F0700010B10120009005E014B1002064
+:10AC5000009001E0402000902B4A1268517D2A4A62
+:10AC6000526810786B460122FAF7B6FF20B1002136
+:10AC700025488172481E38BD9DF8000020F0400133
+:10AC8000214801730020009004F0400020B99DF895
+:10AC9000000040F00400009004F0200020B99DF86E
+:10ACA000000040F00200009004F0100020B99DF870
+:10ACB000000040F00100009004F0080020B99DF869
+:10ACC000000040F0380000900F4A1268917D0E4A53
+:10ACD000526810786B460122FAF77EFF20B10021FE
+:10ACE00009488172481EC6E724B1082C02D0002012
+:10ACF000FFF7DEFE04488472002101753220F6F76A
+:10AD0000E3FC0020B7E7000000000024F8B504468B
+:10AD10000D46164616B94FF0FF30F8BD1A48807A36
+:10AD200010B94FF0FF30F8E720128DF80000E0B2C4
+:10AD30008DF801009DF801002844134949684989AC
+:10AD4000884202DD4FF0FF30E7E70F4A1268D17EFC
+:10AD50000D4A526810786B460222FAF73DFF10B197
+:10AD60004FF0FF30D9E7EAB2074B1B68197E064B5C
+:10AD70005B6818783346FAF72FFF10B14FF0FF30B9
+:10AD8000CBE70020C9E700000000002410B58AB01E
+:10AD90000020099003A906A8FFF788FC0446072CA9
+:10ADA0003FD102A8FFF7D0F89DED060AB8EEC00A21
+:10ADB000DDED020A20EE200ABDEEC00A8DED060A86
+:10ADC0009DED070AB8EEC00ADDED020A20EE200A6A
+:10ADD000BDEEC00A8DED070A9DED080AB8EEC00A67
+:10ADE000DDED020A20EE200ABDEEC00A8DED080A54
+:10ADF00006A8FEF721F801A8FFF752F8BDF80410E5
+:10AE0000039848430390BDF8041004984843049005
+:10AE1000BDF8041005984843059003A8FDF73AFFD4
+:10AE200000BF74208DF82400E0B28DF8250009A938
+:10AE3000062000F002F80AB010BD70B586B00546D5
+:10AE40000C46142101A8F5F7AEFA24208DF8040071
+:10AE50008DF805500DB1012D17D120460188090A42
+:10AE60008DF8061001788DF807104188090A8DF8D1
+:10AE7000081081788DF809108188090A8DF80A1068
+:10AE800001798DF80B10082683E0022D3ED1204673
+:10AE90000168090E8DF806100168090C8DF807107D
+:10AEA0000188090A8DF8081001788DF809104168A9
+:10AEB000090E8DF80A104168090C8DF80B10818875
+:10AEC000090A8DF80C1001798DF80D108168090EB2
+:10AED0008DF80E108168090C8DF80F100189090A90
+:10AEE0008DF81010017A8DF81110C168090E8DF8D7
+:10AEF0001210C168090C8DF813108189090A8DF8A8
+:10AF00001410017B8DF81510122642E0032D07D195
+:10AF100020788DF8060060788DF80700042638E068
+:10AF2000042D04D120788DF80600032631E0052D8C
+:10AF300020D120460168090E8DF806100168090C21
+:10AF40008DF807100188090A8DF8081001788DF82E
+:10AF500009104168090E8DF80A104168090C8DF836
+:10AF60000B108188090A8DF80C1001798DF80D10ED
+:10AF70000A260EE0062D0CD120788DF806006078A8
+:10AF80008DF80700A0788DF80800E0788DF80900AA
+:10AF9000062606B070BD000038B50446214890F87A
+:10AFA0002400C0B114B10220009001E00020009004
+:10AFB0001C4A1268517C1B4A526810786B46012269
+:10AFC000FAF70AFE10B14FF0FF3038BD9DF80010BF
+:10AFD0001448417423E01348807A10B94FF0FF30D1
+:10AFE000F3E724B10F48407C08B10020EDE714B12D
+:10AFF0000120009001E0002000900A4A1268517C74
+:10B00000084A526810786B460122FAF7E5FD10B144
+:10B010004FF0FF30D9E79DF800100248417400203E
+:10B02000D3E700000000002400B541EC100B2DED2B
+:10B03000028B83B0B1EEC08B18EE100A18EE901A96
+:10B040008DED008B002818BF0120084320F0004040
+:10B05000C0F17F6000F1E040C00F14D010EE101A74
+:10B0600010EE900A8DED000B002918BF0121084356
+:10B0700020F00040C0F17F6000F1E040C00F04BF4D
+:10B080000120FCF7B9FE51EC180B03B0BDEC028BAC
+:10B0900000BD000075191A0C6A231B1C00001F203C
+:10B0A0007274433B4138393A006B6C376F06246D3C
+:10B0B0006E706800000476005401F7FD0001000086
+:10B0C00083000000000800000001001832000500A5
+:10B0D000000020410000D242295C0F3E9A99993E1F
+:10B0E0003333733F295C0F3E0000700000000024E2
+:10B0F000000000020003000000650054FFEF0000A4
+:10B10000FA80000B12820001030C30C30E8C8CE914
+:10B1100014D5400213710F8E3883F8833000F88302
+:10B12000258EF8833000F883FFFFFFFF0FFEA9D6BE
+:10B13000240004001A8279A10000003CFFFF0000F7
+:10B140000010000038836FA2003E03304000000072
+:10B1500002CAE3093E800000200000000000000059
+:10B160004000000060000000000C0000000C186EA1
+:10B17000000006920A16C0DFFFFF0256FD8CD3774F
+:10B18000FFE1C496E0C5BEAA00000000FFFF0B2B44
+:10B1900000001657000003594000000000001DFA8F
+:10B1A00000026C1D000000003FFFDFEB003EB3B665
+:10B1B000000D227800002F3C00000000001942B56D
+:10B1C000000039A20000B365D90E9FC91DCF4C34D1
+:10B1D00030000000500000003BB67AE80064000038
+:10B1E00000C8000000000000100000001000FA92EB
+:10B1F0001000225E000D229F0001000000320000BE
+:10B20000FF46000063D400001000000004D60000D8
+:10B2100004CC000004CC00000000107200000040CC
+:10B22000000000000000000000060002000500070A
+:10B2300000000000006400000000000000000005A5
+:10B240000005006400200000000000000000000075
+:10B25000000040000000030000000032F8980000E9
+:10B26000FF650000830F0000FF9BFC000000000052
+:10B2700000000000000000000000000000000000CE
+:10B2800000000000000000000000000000000000BE
+:10B290000000000000001000400000000000000658
+:10B2A0000000B26A000200000001FB830068000099
+:10B2B00000D9FC007CF1FF83000000000065000065
+:10B2C000006403E80064002800000025000000007E
+:10B2D00016A000000000100000001000002F000069
+:10B2E000000001F40000100000280000FFFF45816D
+:10B2F000FFFFFA720000000000000000004400059B
+:10B300000005BAC6004778A2000000010000000056
+:10B3100000000600000000140000254D002F706D95
+:10B32000000005AE000C02D000000000000000008C
+:10B330000000000000000000001B000000000000F2
+:10B340000000000000000000006400000008000091
+:10B3500000000000000000000000000000000000ED
+:10B3600000000000000000000000000000000000DD
+:10B3700000000000000000000000000000000000CD
+:10B3800000000000000000000000000000000000BD
+:10B3900000000000000000000000000000000000AD
+:10B3A0000000000000000000001B00000000000082
+:10B3B00000000000000E000E00000AC7000400009C
+:10B3C00000000032FFFFFF9C00000B2B000000027A
+:10B3D0000000000100000064FFE500000000000024
+:10B3E000000000000000000000000001000000005C
+:10B3F000000100000000000000018000000180004A
+:10B4000000018000002426D300000000000000009E
+:10B41000000600100096003C000000000000000044
+:10B4200000000000000000000C0A4E68CDCF770934
+:10B4300050166759C619CE820000000000000000B7
+:10B4400000000000000000000000000000000000FC
+:10B4500017D7840003000000000000000000000077
+:10B46000C7938F9D1E1B1C190000000000000000E8
+:10B4700000000000000000000000000000000000CC
+:10B4800002031885000040000000000300000003D4
+:10B49000000000000000000040000000000000006C
+:10B4A000000000000000000000000000000000009C
+:10B4B000000000000000000000000000000000008C
+:10B4C000000000000000000000000000677DDF7E3B
+:10B4D00072902E554CF6E688000000000000000037
+:10B4E0000000000000000000D8DCB4B8B0D8B9AB50
+:10B4F000F3F8FAB3B7BB8E9EAEF132F51BF1B4B8D8
+:10B50000B08097F1A9DFDFDFAADFDFDFF2AAC5CDC8
+:10B51000C7A90CC92C97F1A989264666B28999A9B1
+:10B520002D557DB0B08AA896365676F1BAA3B4B23E
+:10B5300080C0B8A89711B28398BAA3F02408441029
+:10B540006418B2B9B49883F1A329557DBAB5B1A3F3
+:10B550008393F0002850F5B2B6AA839328547CF167
+:10B56000B9A3829361BAA2DADEDFDB819AB9AEF5C4
+:10B57000606870F1DABAA2DFD9BAA2FAB9A38292EE
+:10B58000DB31BAA2D9BAA2F8DF85A4D0C1BBAD83A2
+:10B59000C2C5C7B8A2DFDFDFBAA0DFDFDFD8D8F1CE
+:10B5A000B8AAB38DB4980D355DB2B6BAAF8C961902
+:10B5B0008F9FA70E161EB49AB8AA872C547CBAA4E3
+:10B5C000B08AB691325676B28494A4C808CDD8B861
+:10B5D000B4B0F19982A82D557D98A80E161EA22C04
+:10B5E000547C92A4F02C5078F184A898C4CDFCD857
+:10B5F0000DDBA8FC2DF3D9BAA6F8DABAA6DED8BAC4
+:10B60000B2B68696A6D0F3C841DAA6C8F8D8B0B4C8
+:10B61000B882A892F52C548898F135D9F418D8F14D
+:10B62000A2D0F8F9A884D9C7DFF8F883C5DADF69B2
+:10B63000DF83C1D8F40114F1A8824EA884F311D19C
+:10B6400082F5D992289788F109F41C1CD884A8F3B4
+:10B65000C0F9D1D99782F129F40DD8F3F9F9D1D9EC
+:10B6600082F4C203D8DEDF1AD8F1A2FAF9A88498CE
+:10B67000D9C7DFF8F8F883C7DADF69DFF883C3D802
+:10B68000F40114F198A8822EA884F311D182F5D97F
+:10B6900092509788F109F41CD884A8F3C0F8F9D126
+:10B6A000D99782F149F40DD8F3F9F9D1D982F4C4CC
+:10B6B00003D8DEDFD8F1AD8898CCA809F9D98292F9
+:10B6C000A8F57CF1883ACF944A6E98DB6931DAADFF
+:10B6D000F2DEF9D88795A8F221D1DAA5F9F417D9C5
+:10B6E000F1AE8ED0C0C3AE82C684C3A88595C8A56E
+:10B6F00088F2C0F1F4010EF18E9EA8C63E56F554B4
+:10B70000F18872F40115F19845856EF58E9E0488D6
+:10B71000F142985A8E9E068869F4011CF1981E1118
+:10B7200008D0F504F11E970202983625DBF9D98579
+:10B73000A5F3C1DA85A5F3DFD88595A8F309DAA5C5
+:10B74000FAD88292A8F578F1881A849F26889821E1
+:10B75000DAF41DF3D8879F39D1AFD9DFDFFBF9F4D5
+:10B760000CF3D8FAD0F8DAF9F9D0DFD9F9D8F40B1C
+:10B77000D8F3879F39D1AFD9DFDFF41DF3D8FAFCB6
+:10B78000A869F9F9AFD0DADEFAD9F88F9FA8F1CC21
+:10B79000F398DB45D9AFDFD0F8D8F18F9FA8CAF373
+:10B7A0008809DAAF8FCBF8D8F2AD978D0CD9A5DF29
+:10B7B000F9BAA6F3FAF412F2D8950DD1D9BAA6F3D4
+:10B7C000FADAA5F2C1BAA6F3DFD8F1BAB2B6869614
+:10B7D000A6D0CAF349DAA6CBF8D8B0B4B8D8AD84AD
+:10B7E000F2C0DFF18FCBC3A8B2B68696C8C1CBC377
+:10B7F000F3B0B48898A821DB718D9D71859521D90E
+:10B80000ADF2FAD88597A828D9F408D8F28D29DAAC
+:10B81000F405D9F285A4C2F2D8A88D9401D1D9F447
+:10B8200011F2D88721D8F40AD8F28498A8C801D197
+:10B83000D9F411D8F3A4C8BBAFD0F2DEF8F8F8F809
+:10B84000F8F8F8F8D8F1B8F6B5B9B08A95A3DE3CA7
+:10B85000A3D9F8D85CA3D9F8D87CA3D9F8D8F8F93B
+:10B86000D1A5D9DFDAFAD8B18530F7D9DED8F830EA
+:10B87000ADDADED8F2B48C99A32D557DA083DFDF3D
+:10B88000DFB591A0F629D9FBD8A0FC29D9FAD8A018
+:10B89000D051D9F8D8FC51D9F9D879D9FBD8A0D052
+:10B8A000FC79D9FAD8A1F9F9F9F9F9A0DADFDFDFE3
+:10B8B000D8A1F8F8F8F8F8ACDEF8ADDE8393AC2C3C
+:10B8C000547CF1A8DFDFDFF69D2CDAA0DFD9FADBAC
+:10B8D0002DF8D8A850DAA0D0DED9D0F8F8F8DB558A
+:10B8E000F8D8A878DAA0D0DFD9D0FAF8F8F8F8DBE1
+:10B8F0007DF8D89CA88CF530DB38D9D0DEDFA0D01D
+:10B90000DEDFD8A848DB58D9DFD0DEA0DFD0DED814
+:10B91000A868DB70D9DFDFA0DFDFD8F1A888902C22
+:10B92000547C98A8D05C38D1DAF2AE8CDFF9D8B06C
+:10B9300087A8C1C1B188A8C6F9F9DA36D8A8F9DA5A
+:10B9400036D8A8F9DA36D8A8F9DA36D8A8F9DA3626
+:10B95000D8F78D9DADF818DAF2AEDFD8F7ADFA3032
+:10B96000D9A4DEF9D8F2AEDEFAF983A7D9C3C5C7E8
+:10B97000F1889BA77AADF7DEDFA4F8849408A79737
+:10B98000F300AEF29819A488C6A39488F632DFF2C9
+:10B990008393DB09D9F2AADFD8D8AEF8F9D1DAF36C
+:10B9A000A4DEA7F1889B7AD8F38494AE19F9DAAAB9
+:10B9B000F1DFD8A881C0C3C5C7A39283F628ADDE46
+:10B9C000D9F8D8A350ADD9F8D8A378ADD9F8D8F81C
+:10B9D000F9D1A1DADEC3C5C7D8A18194F818F2B0B5
+:10B9E00089ACC3C5C7F1D8B8B4B09786A8319B0657
+:10B9F0009907AB9728889BF00C201440B0B4B8F09E
+:10BA0000A88A9A285078B79BA8295179247059445C
+:10BA10006938644831F1BBAB88002C547CF0B38B9F
+:10BA2000B8A804285078F1B088B49726A85998BBD4
+:10BA3000ABB38B02264666B0B8F08A9CA829517930
+:10BA40008B2951798A2470598B2058718A4469381E
+:10BA50008B3940688A6448318B30496088F1AC008A
+:10BA60002C547CF08CA804285078F1889726A8598B
+:10BA700098AC8C02264666F0899CA82951792470DE
+:10BA800059446938644831A98809205970AB113884
+:10BA90004069A8193148608CA83C415C207C00F1C9
+:10BAA00087981986A86E767EA999882D557DD8B17C
+:10BAB000B5B9A3DFDFDFAED0DFAAD0DEF2ABF8F995
+:10BAC000D9B087C4AAF1DFDFBBAFDFDFB9D8B1F1EE
+:10BAD000A3978E60DFB084F2C8F8F9D9DED89385D9
+:10BAE000F14AB183A308B5839A0810B79F10D8F123
+:10BAF000B0BAAEB08AC2B2B68E9EF1FBD9F41DD8F0
+:10BB0000F9D90CF1D8F8F8AD61D9AEFBD8F40CF145
+:10BB1000D8F8F8AD19D9AEFBDFD8F416F1D8F8ADE6
+:10BB20008D61D9F4F4ACF59C9C8DDF2BBAB6AEFADE
+:10BB3000F8F40BD8F1AED0F8AD51DAAEFAF8F1D88E
+:10BB4000B9B1B6A3839C08B9B1839AB5AAC0FD3038
+:10BB500083B79F10B58B93F20202D1ABDADED8F136
+:10BB6000B080BAABC0C3B284C1C3D8B1B9F38BA3A0
+:10BB700091B609B4D9ABDEB0879CB9A3DDF1B38B24
+:10BB80008B8B8B8BB087A3A3A3A3B28BB69BF2A3A3
+:10BB9000A3A3A3A3A3A3A3A3A3F1B087B59AA3F3DD
+:10BBA0009BA3A3DCBAACDFB9A3A3A3A3A3A3A3A3C2
+:10BBB000A3A3A3A3A3A3A3A3D8D8D8BBB3B7F1AA25
+:10BBC000F9DAFFD9809AAA28B48098A720B7978776
+:10BBD000A86688F07951F1902C870CA78197629321
+:10BBE000F071716085940129517990A5F1284C6C10
+:10BBF000870C95188578A38390284C6C886CD8F3B3
+:10BC0000A28200F210A8921980A2F2D926D8F18857
+:10BC1000A84DD948D896A83980D93CD89580A8395C
+:10BC2000A68698D92CDA87A72CD8A8899519A98037
+:10BC3000D938D8A88939A980DA3CD8A82EA8399053
+:10BC4000D90CD8A8953198D90CD8A809D9FFD80112
+:10BC5000DAFFD89539A9DA26FFD890A80D8999A8D6
+:10BC600010809821DA2ED88999A83180DA2ED8A8A8
+:10BC700086963180DA2ED8A8873180DA2ED8A8822D
+:10BC800092F34180F1D92ED8A882F31980F1D92EF0
+:10BC9000D882ACF3C0A28022F1A62EA72EA92298AA
+:10BCA000A829DAACDEFFD8A2F22AF1A92E8292A846
+:10BCB000F23180A696F1D900AC8C9C0C30ACDED071
+:10BCC000DEFFD88C9CACD010ACDE8092A2F24C820D
+:10BCD000A8F1CAF235F19688A6D900D8F1FF010083
+:10BCE00002000400060008000A000C0010002000FA
+:10BCF0004000800000010101010307010000080469
+:10BD00000204080101010000000001020304010215
+:10BD10000304060708090000555555555555C53FFC
+:10BD20007D6FEB0312D6D4BF5544880E55C1C93F71
+:10BD30003B8F68B52882A4BF88B20175E0EF493F08
+:10BD400009F7FD0DE13D023F4B2D8A1C273A03C048
+:10BD5000C88A599CE52A004059018D1B6C06E6BF34
+:10BD600082922EB1C5B8B33F4FBB610567ACDD3FD2
+:10BD7000182D4454FB21E93F9BF681D20B73EF3F12
+:10BD8000182D4454FB21F93FE2652F227F2B7A3C8A
+:10BD9000075C143326A6813CBDCBF07A8807703C43
+:10BDA000075C143326A6913CC4EB98999999C9BFB6
+:10BDB000711623FEC671BCBF6D9A74AFF2B0B3BFEB
+:10BDC0009AFDDE522DDEADBF2F6C6A2C44B4A2BFAB
+:10BDD0000D5555555555D53FFF8300922449C23F17
+:10BDE0006E204CC5CD45B73F513DD0A0660DB13F4B
+:10BDF000EB0D76244B7BA93F11DA22E33AAD903F5D
+:10BE0000000000000000000050726F647563742031
+:10BE100049442072656164206173203020696E643A
+:10BE2000696361746573206465766963652069730D
+:10BE30002065697468657220696E636F6D706174E6
+:10BE400069626C65206F7220616E204D50553330F1
+:10BE500035302E0A0000000078BE000800000024E3
+:10BE600064000000D87D0008DCBE000864000024E7
+:10BE700044070000E87D000894B00008B2B0000854
+:10BE800000000000000000000000000000000000B2
+:10BE900000000000000000000000000000000000A2
+:10BEA000C0B0000800FF000000FF0000000100001B
+:10BEB00068000000D1000000D00000000100000078
+:10BEC0000000000010000000010000000090D003FE
+:0CBED0000090D003000000000000000003
 :040000050800029954
 :00000001FF

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 259 - 240
MDK-ARM/SmartGlove/SmartGlove.htm


+ 3 - 3
MDK-ARM/SmartGlove/SmartGlove.lnp

@@ -1,5 +1,8 @@
 --cpu Cortex-M7.fp.dp
 "smartglove\startup_stm32h750xx.o"
+"smartglove\inv_mpu.o"
+"smartglove\inv_mpu_dmp_motion_driver.o"
+"smartglove\mpu6050.o"
 "smartglove\main.o"
 "smartglove\gpio.o"
 "smartglove\adc.o"
@@ -9,9 +12,6 @@
 "smartglove\usart.o"
 "smartglove\stm32h7xx_it.o"
 "smartglove\stm32h7xx_hal_msp.o"
-"smartglove\inv_mpu.o"
-"smartglove\inv_mpu_dmp_motion_driver.o"
-"smartglove\mpu6050.o"
 "smartglove\stm32h7xx_hal_adc.o"
 "smartglove\stm32h7xx_hal_adc_ex.o"
 "smartglove\stm32h7xx_hal_rcc.o"

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 589 - 587
MDK-ARM/SmartGlove/SmartGlove.map


+ 84 - 84
MDK-ARM/SmartGlove/SmartGlove_SmartGlove.dep

@@ -1,7 +1,17 @@
 Dependencies for Project 'SmartGlove', Target 'SmartGlove': (DO NOT MODIFY !)
 CompilerVersion: 5060960::V5.06 update 7 (build 960)::.\ARMCC
-F (startup_stm32h750xx.s)(0x663C6F16)(--cpu Cortex-M7.fp.dp -g --apcs=interwork --pd "__MICROLIB SETA 1"

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

--pd "__UVISION_VERSION SETA 536" --pd "_RTE_ SETA 1" --pd "STM32H750xx SETA 1" --pd "_RTE_ SETA 1"

--list startup_stm32h750xx.lst --xref -o smartglove\startup_stm32h750xx.o --depend smartglove\startup_stm32h750xx.d)
-F (../Core/Src/main.c)(0x663E0BF1)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\main.o --omf_browse smartglove\main.crf --depend smartglove\main.d)
+F (startup_stm32h750xx.s)(0x664043B7)(--cpu Cortex-M7.fp.dp -g --apcs=interwork --pd "__MICROLIB SETA 1"

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

--pd "__UVISION_VERSION SETA 536" --pd "_RTE_ SETA 1" --pd "STM32H750xx SETA 1" --pd "_RTE_ SETA 1"

--list startup_stm32h750xx.lst --xref -o smartglove\startup_stm32h750xx.o --depend smartglove\startup_stm32h750xx.d)
+F (..\Core\imu\dmpKey.h)(0x617B5AA4)()
+F (..\Core\imu\dmpmap.h)(0x617B5AA4)()
+F (..\Core\imu\inv_mpu.c)(0x617B5AA4)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\inv_mpu.o --omf_browse smartglove\inv_mpu.crf --depend smartglove\inv_mpu.d)
+I (D:\keil5\ARM\ARMCC\include\stdio.h)(0x60252374)
+I (D:\keil5\ARM\ARMCC\include\stdint.h)(0x6025237E)
+I (D:\keil5\ARM\ARMCC\include\stdlib.h)(0x60252374)
+I (D:\keil5\ARM\ARMCC\include\string.h)(0x6025237E)
+I (D:\keil5\ARM\ARMCC\include\math.h)(0x60252378)
+I (..\Core\imu\inv_mpu.h)(0x617B5AA4)
+I (..\Core\imu\MPU6050.h)(0x617B5AA4)
+I (../Core/Inc/i2c.h)(0x663C6F14)
 I (../Core/Inc/main.h)(0x663C7C90)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
@@ -10,7 +20,6 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_def.h)(0x661E8971)
 I (../Drivers/CMSIS/Device/ST/STM32H7xx/Include/stm32h7xx.h)(0x661E8971)
 I (../Drivers/CMSIS/Device/ST/STM32H7xx/Include/stm32h750xx.h)(0x661E8971)
 I (../Drivers/CMSIS/Include/core_cm7.h)(0x661E88AB)
-I (D:\keil5\ARM\ARMCC\include\stdint.h)(0x6025237E)
 I (../Drivers/CMSIS/Include/cmsis_version.h)(0x661E88AB)
 I (../Drivers/CMSIS/Include/cmsis_compiler.h)(0x661E88AB)
 I (../Drivers/CMSIS/Include/cmsis_armcc.h)(0x661E88AB)
@@ -18,7 +27,6 @@ I (../Drivers/CMSIS/Include/mpu_armv7.h)(0x661E88AB)
 I (../Drivers/CMSIS/Device/ST/STM32H7xx/Include/system_stm32h7xx.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h)(0x661E8971)
 I (D:\keil5\ARM\ARMCC\include\stddef.h)(0x6025237E)
-I (D:\keil5\ARM\ARMCC\include\math.h)(0x60252378)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_rcc_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_gpio.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_gpio_ex.h)(0x661E8971)
@@ -42,17 +50,19 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-I (../Core/Inc/adc.h)(0x661E833E)
-I (../Core/Inc/i2c.h)(0x663C6F14)
-I (../Core/Inc/quadspi.h)(0x661E833F)
-I (../Core/Inc/tim.h)(0x661E833F)
-I (../Core/Inc/usart.h)(0x661E833F)
-I (../Core/Inc/gpio.h)(0x661E833E)
-I (..\Core\imu\MPU6050.h)(0x663DF9EE)
-I (..\Core\imu\inv_mpu.h)(0x617B5AA4)
+F (..\Core\imu\inv_mpu.h)(0x617B5AA4)()
+F (..\Core\imu\inv_mpu_dmp_motion_driver.c)(0x617B5AA4)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\inv_mpu_dmp_motion_driver.o --omf_browse smartglove\inv_mpu_dmp_motion_driver.crf --depend smartglove\inv_mpu_dmp_motion_driver.d)
 I (D:\keil5\ARM\ARMCC\include\stdio.h)(0x60252374)
-F (../Core/Src/gpio.c)(0x663C6F13)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\gpio.o --omf_browse smartglove\gpio.crf --depend smartglove\gpio.d)
-I (../Core/Inc/gpio.h)(0x661E833E)
+I (D:\keil5\ARM\ARMCC\include\stdint.h)(0x6025237E)
+I (D:\keil5\ARM\ARMCC\include\stdlib.h)(0x60252374)
+I (D:\keil5\ARM\ARMCC\include\string.h)(0x6025237E)
+I (D:\keil5\ARM\ARMCC\include\math.h)(0x60252378)
+I (..\Core\imu\inv_mpu.h)(0x617B5AA4)
+I (..\Core\imu\inv_mpu_dmp_motion_driver.h)(0x617B5AA4)
+I (..\Core\imu\dmpKey.h)(0x617B5AA4)
+I (..\Core\imu\dmpmap.h)(0x617B5AA4)
+I (..\Core\imu\MPU6050.h)(0x617B5AA4)
+I (../Core/Inc/i2c.h)(0x663C6F14)
 I (../Core/Inc/main.h)(0x663C7C90)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
@@ -61,7 +71,6 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_def.h)(0x661E8971)
 I (../Drivers/CMSIS/Device/ST/STM32H7xx/Include/stm32h7xx.h)(0x661E8971)
 I (../Drivers/CMSIS/Device/ST/STM32H7xx/Include/stm32h750xx.h)(0x661E8971)
 I (../Drivers/CMSIS/Include/core_cm7.h)(0x661E88AB)
-I (D:\keil5\ARM\ARMCC\include\stdint.h)(0x6025237E)
 I (../Drivers/CMSIS/Include/cmsis_version.h)(0x661E88AB)
 I (../Drivers/CMSIS/Include/cmsis_compiler.h)(0x661E88AB)
 I (../Drivers/CMSIS/Include/cmsis_armcc.h)(0x661E88AB)
@@ -69,7 +78,6 @@ I (../Drivers/CMSIS/Include/mpu_armv7.h)(0x661E88AB)
 I (../Drivers/CMSIS/Device/ST/STM32H7xx/Include/system_stm32h7xx.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h)(0x661E8971)
 I (D:\keil5\ARM\ARMCC\include\stddef.h)(0x6025237E)
-I (D:\keil5\ARM\ARMCC\include\math.h)(0x60252378)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_rcc_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_gpio.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_gpio_ex.h)(0x661E8971)
@@ -93,8 +101,10 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (../Core/Src/adc.c)(0x663C4ADE)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\adc.o --omf_browse smartglove\adc.crf --depend smartglove\adc.d)
-I (../Core/Inc/adc.h)(0x661E833E)
+F (..\Core\imu\inv_mpu_dmp_motion_driver.h)(0x617B5AA4)()
+F (..\Core\imu\MPU6050.c)(0x664042CD)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\mpu6050.o --omf_browse smartglove\mpu6050.crf --depend smartglove\mpu6050.d)
+I (..\Core\imu\MPU6050.h)(0x617B5AA4)
+I (../Core/Inc/i2c.h)(0x663C6F14)
 I (../Core/Inc/main.h)(0x663C7C90)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
@@ -135,8 +145,11 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (../Core/Src/i2c.c)(0x663C6F14)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\i2c.o --omf_browse smartglove\i2c.crf --depend smartglove\i2c.d)
-I (../Core/Inc/i2c.h)(0x663C6F14)
+I (..\Core\imu\inv_mpu.h)(0x617B5AA4)
+I (D:\keil5\ARM\ARMCC\include\stdio.h)(0x60252374)
+I (..\Core\imu\inv_mpu_dmp_motion_driver.h)(0x617B5AA4)
+F (..\Core\imu\MPU6050.h)(0x617B5AA4)()
+F (../Core/Src/main.c)(0x6640468D)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\main.o --omf_browse smartglove\main.crf --depend smartglove\main.d)
 I (../Core/Inc/main.h)(0x663C7C90)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
@@ -177,8 +190,17 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (../Core/Src/quadspi.c)(0x661E833F)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\quadspi.o --omf_browse smartglove\quadspi.crf --depend smartglove\quadspi.d)
+I (../Core/Inc/adc.h)(0x661E833E)
+I (../Core/Inc/i2c.h)(0x663C6F14)
 I (../Core/Inc/quadspi.h)(0x661E833F)
+I (../Core/Inc/tim.h)(0x661E833F)
+I (../Core/Inc/usart.h)(0x661E833F)
+I (../Core/Inc/gpio.h)(0x661E833E)
+I (../Core/imu/MPU6050.h)(0x617B5AA4)
+I (../Core/imu/inv_mpu.h)(0x617B5AA4)
+I (D:\keil5\ARM\ARMCC\include\stdio.h)(0x60252374)
+F (../Core/Src/gpio.c)(0x663C6F13)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\gpio.o --omf_browse smartglove\gpio.crf --depend smartglove\gpio.d)
+I (../Core/Inc/gpio.h)(0x661E833E)
 I (../Core/Inc/main.h)(0x663C7C90)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
@@ -219,8 +241,8 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (../Core/Src/tim.c)(0x661E833F)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\tim.o --omf_browse smartglove\tim.crf --depend smartglove\tim.d)
-I (../Core/Inc/tim.h)(0x661E833F)
+F (../Core/Src/adc.c)(0x663C4ADE)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\adc.o --omf_browse smartglove\adc.crf --depend smartglove\adc.d)
+I (../Core/Inc/adc.h)(0x661E833E)
 I (../Core/Inc/main.h)(0x663C7C90)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
@@ -261,8 +283,8 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (../Core/Src/usart.c)(0x663C4ADF)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\usart.o --omf_browse smartglove\usart.crf --depend smartglove\usart.d)
-I (../Core/Inc/usart.h)(0x661E833F)
+F (../Core/Src/i2c.c)(0x663ED18D)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\i2c.o --omf_browse smartglove\i2c.crf --depend smartglove\i2c.d)
+I (../Core/Inc/i2c.h)(0x663C6F14)
 I (../Core/Inc/main.h)(0x663C7C90)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
@@ -303,7 +325,8 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (../Core/Src/stm32h7xx_it.c)(0x661E833F)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_it.o --omf_browse smartglove\stm32h7xx_it.crf --depend smartglove\stm32h7xx_it.d)
+F (../Core/Src/quadspi.c)(0x661E833F)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\quadspi.o --omf_browse smartglove\quadspi.crf --depend smartglove\quadspi.d)
+I (../Core/Inc/quadspi.h)(0x661E833F)
 I (../Core/Inc/main.h)(0x663C7C90)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
@@ -344,8 +367,8 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-I (../Core/Inc/stm32h7xx_it.h)(0x661E833F)
-F (../Core/Src/stm32h7xx_hal_msp.c)(0x661E833F)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_msp.o --omf_browse smartglove\stm32h7xx_hal_msp.crf --depend smartglove\stm32h7xx_hal_msp.d)
+F (../Core/Src/tim.c)(0x661E833F)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\tim.o --omf_browse smartglove\tim.crf --depend smartglove\tim.d)
+I (../Core/Inc/tim.h)(0x661E833F)
 I (../Core/Inc/main.h)(0x663C7C90)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
@@ -386,17 +409,8 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (..\Core\imu\dmpKey.h)(0x663E02F9)()
-F (..\Core\imu\dmpmap.h)(0x617B5AA4)()
-F (..\Core\imu\inv_mpu.c)(0x663E0988)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\inv_mpu.o --omf_browse smartglove\inv_mpu.crf --depend smartglove\inv_mpu.d)
-I (D:\keil5\ARM\ARMCC\include\stdio.h)(0x60252374)
-I (D:\keil5\ARM\ARMCC\include\stdint.h)(0x6025237E)
-I (D:\keil5\ARM\ARMCC\include\stdlib.h)(0x60252374)
-I (D:\keil5\ARM\ARMCC\include\string.h)(0x6025237E)
-I (D:\keil5\ARM\ARMCC\include\math.h)(0x60252378)
-I (..\Core\imu\inv_mpu.h)(0x617B5AA4)
-I (..\Core\imu\MPU6050.h)(0x663DF9EE)
-I (../Core/Inc/i2c.h)(0x663C6F14)
+F (../Core/Src/usart.c)(0x664043B5)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\usart.o --omf_browse smartglove\usart.crf --depend smartglove\usart.d)
+I (../Core/Inc/usart.h)(0x661E833F)
 I (../Core/Inc/main.h)(0x663C7C90)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
@@ -405,6 +419,7 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_def.h)(0x661E8971)
 I (../Drivers/CMSIS/Device/ST/STM32H7xx/Include/stm32h7xx.h)(0x661E8971)
 I (../Drivers/CMSIS/Device/ST/STM32H7xx/Include/stm32h750xx.h)(0x661E8971)
 I (../Drivers/CMSIS/Include/core_cm7.h)(0x661E88AB)
+I (D:\keil5\ARM\ARMCC\include\stdint.h)(0x6025237E)
 I (../Drivers/CMSIS/Include/cmsis_version.h)(0x661E88AB)
 I (../Drivers/CMSIS/Include/cmsis_compiler.h)(0x661E88AB)
 I (../Drivers/CMSIS/Include/cmsis_armcc.h)(0x661E88AB)
@@ -412,6 +427,7 @@ I (../Drivers/CMSIS/Include/mpu_armv7.h)(0x661E88AB)
 I (../Drivers/CMSIS/Device/ST/STM32H7xx/Include/system_stm32h7xx.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h)(0x661E8971)
 I (D:\keil5\ARM\ARMCC\include\stddef.h)(0x6025237E)
+I (D:\keil5\ARM\ARMCC\include\math.h)(0x60252378)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_rcc_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_gpio.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_gpio_ex.h)(0x661E8971)
@@ -435,19 +451,7 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (..\Core\imu\inv_mpu.h)(0x617B5AA4)()
-F (..\Core\imu\inv_mpu_dmp_motion_driver.c)(0x617B5AA4)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\inv_mpu_dmp_motion_driver.o --omf_browse smartglove\inv_mpu_dmp_motion_driver.crf --depend smartglove\inv_mpu_dmp_motion_driver.d)
-I (D:\keil5\ARM\ARMCC\include\stdio.h)(0x60252374)
-I (D:\keil5\ARM\ARMCC\include\stdint.h)(0x6025237E)
-I (D:\keil5\ARM\ARMCC\include\stdlib.h)(0x60252374)
-I (D:\keil5\ARM\ARMCC\include\string.h)(0x6025237E)
-I (D:\keil5\ARM\ARMCC\include\math.h)(0x60252378)
-I (..\Core\imu\inv_mpu.h)(0x617B5AA4)
-I (..\Core\imu\inv_mpu_dmp_motion_driver.h)(0x617B5AA4)
-I (..\Core\imu\dmpKey.h)(0x663E02F9)
-I (..\Core\imu\dmpmap.h)(0x617B5AA4)
-I (..\Core\imu\MPU6050.h)(0x663DF9EE)
-I (../Core/Inc/i2c.h)(0x663C6F14)
+F (../Core/Src/stm32h7xx_it.c)(0x661E833F)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_it.o --omf_browse smartglove\stm32h7xx_it.crf --depend smartglove\stm32h7xx_it.d)
 I (../Core/Inc/main.h)(0x663C7C90)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
@@ -456,6 +460,7 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_def.h)(0x661E8971)
 I (../Drivers/CMSIS/Device/ST/STM32H7xx/Include/stm32h7xx.h)(0x661E8971)
 I (../Drivers/CMSIS/Device/ST/STM32H7xx/Include/stm32h750xx.h)(0x661E8971)
 I (../Drivers/CMSIS/Include/core_cm7.h)(0x661E88AB)
+I (D:\keil5\ARM\ARMCC\include\stdint.h)(0x6025237E)
 I (../Drivers/CMSIS/Include/cmsis_version.h)(0x661E88AB)
 I (../Drivers/CMSIS/Include/cmsis_compiler.h)(0x661E88AB)
 I (../Drivers/CMSIS/Include/cmsis_armcc.h)(0x661E88AB)
@@ -463,6 +468,7 @@ I (../Drivers/CMSIS/Include/mpu_armv7.h)(0x661E88AB)
 I (../Drivers/CMSIS/Device/ST/STM32H7xx/Include/system_stm32h7xx.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h)(0x661E8971)
 I (D:\keil5\ARM\ARMCC\include\stddef.h)(0x6025237E)
+I (D:\keil5\ARM\ARMCC\include\math.h)(0x60252378)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_rcc_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_gpio.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_gpio_ex.h)(0x661E8971)
@@ -486,10 +492,8 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (..\Core\imu\inv_mpu_dmp_motion_driver.h)(0x617B5AA4)()
-F (..\Core\imu\MPU6050.c)(0x663DFDFF)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\mpu6050.o --omf_browse smartglove\mpu6050.crf --depend smartglove\mpu6050.d)
-I (..\Core\imu\MPU6050.h)(0x663DF9EE)
-I (../Core/Inc/i2c.h)(0x663C6F14)
+I (../Core/Inc/stm32h7xx_it.h)(0x661E833F)
+F (../Core/Src/stm32h7xx_hal_msp.c)(0x661E833F)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_msp.o --omf_browse smartglove\stm32h7xx_hal_msp.crf --depend smartglove\stm32h7xx_hal_msp.d)
 I (../Core/Inc/main.h)(0x663C7C90)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
@@ -530,11 +534,7 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-I (..\Core\imu\inv_mpu.h)(0x617B5AA4)
-I (D:\keil5\ARM\ARMCC\include\stdio.h)(0x60252374)
-I (..\Core\imu\inv_mpu_dmp_motion_driver.h)(0x617B5AA4)
-F (..\Core\imu\MPU6050.h)(0x663DF9EE)()
-F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_adc.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_adc.o --omf_browse smartglove\stm32h7xx_hal_adc.crf --depend smartglove\stm32h7xx_hal_adc.d)
+F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_adc.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_adc.o --omf_browse smartglove\stm32h7xx_hal_adc.crf --depend smartglove\stm32h7xx_hal_adc.d)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_rcc.h)(0x661E8971)
@@ -574,7 +574,7 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_adc_ex.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_adc_ex.o --omf_browse smartglove\stm32h7xx_hal_adc_ex.crf --depend smartglove\stm32h7xx_hal_adc_ex.d)
+F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_adc_ex.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_adc_ex.o --omf_browse smartglove\stm32h7xx_hal_adc_ex.crf --depend smartglove\stm32h7xx_hal_adc_ex.d)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_rcc.h)(0x661E8971)
@@ -614,7 +614,7 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rcc.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_rcc.o --omf_browse smartglove\stm32h7xx_hal_rcc.crf --depend smartglove\stm32h7xx_hal_rcc.d)
+F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rcc.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_rcc.o --omf_browse smartglove\stm32h7xx_hal_rcc.crf --depend smartglove\stm32h7xx_hal_rcc.d)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_rcc.h)(0x661E8971)
@@ -654,7 +654,7 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rcc_ex.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_rcc_ex.o --omf_browse smartglove\stm32h7xx_hal_rcc_ex.crf --depend smartglove\stm32h7xx_hal_rcc_ex.d)
+F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rcc_ex.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_rcc_ex.o --omf_browse smartglove\stm32h7xx_hal_rcc_ex.crf --depend smartglove\stm32h7xx_hal_rcc_ex.d)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_rcc.h)(0x661E8971)
@@ -694,7 +694,7 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_flash.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_flash.o --omf_browse smartglove\stm32h7xx_hal_flash.crf --depend smartglove\stm32h7xx_hal_flash.d)
+F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_flash.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_flash.o --omf_browse smartglove\stm32h7xx_hal_flash.crf --depend smartglove\stm32h7xx_hal_flash.d)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_rcc.h)(0x661E8971)
@@ -734,7 +734,7 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_flash_ex.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_flash_ex.o --omf_browse smartglove\stm32h7xx_hal_flash_ex.crf --depend smartglove\stm32h7xx_hal_flash_ex.d)
+F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_flash_ex.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_flash_ex.o --omf_browse smartglove\stm32h7xx_hal_flash_ex.crf --depend smartglove\stm32h7xx_hal_flash_ex.d)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_rcc.h)(0x661E8971)
@@ -774,7 +774,7 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_gpio.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_gpio.o --omf_browse smartglove\stm32h7xx_hal_gpio.crf --depend smartglove\stm32h7xx_hal_gpio.d)
+F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_gpio.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_gpio.o --omf_browse smartglove\stm32h7xx_hal_gpio.crf --depend smartglove\stm32h7xx_hal_gpio.d)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_rcc.h)(0x661E8971)
@@ -814,7 +814,7 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_hsem.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_hsem.o --omf_browse smartglove\stm32h7xx_hal_hsem.crf --depend smartglove\stm32h7xx_hal_hsem.d)
+F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_hsem.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_hsem.o --omf_browse smartglove\stm32h7xx_hal_hsem.crf --depend smartglove\stm32h7xx_hal_hsem.d)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_rcc.h)(0x661E8971)
@@ -854,7 +854,7 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_dma.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_dma.o --omf_browse smartglove\stm32h7xx_hal_dma.crf --depend smartglove\stm32h7xx_hal_dma.d)
+F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_dma.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_dma.o --omf_browse smartglove\stm32h7xx_hal_dma.crf --depend smartglove\stm32h7xx_hal_dma.d)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_rcc.h)(0x661E8971)
@@ -894,7 +894,7 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_dma_ex.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_dma_ex.o --omf_browse smartglove\stm32h7xx_hal_dma_ex.crf --depend smartglove\stm32h7xx_hal_dma_ex.d)
+F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_dma_ex.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_dma_ex.o --omf_browse smartglove\stm32h7xx_hal_dma_ex.crf --depend smartglove\stm32h7xx_hal_dma_ex.d)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_rcc.h)(0x661E8971)
@@ -934,7 +934,7 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_mdma.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_mdma.o --omf_browse smartglove\stm32h7xx_hal_mdma.crf --depend smartglove\stm32h7xx_hal_mdma.d)
+F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_mdma.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_mdma.o --omf_browse smartglove\stm32h7xx_hal_mdma.crf --depend smartglove\stm32h7xx_hal_mdma.d)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_rcc.h)(0x661E8971)
@@ -974,7 +974,7 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pwr.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_pwr.o --omf_browse smartglove\stm32h7xx_hal_pwr.crf --depend smartglove\stm32h7xx_hal_pwr.d)
+F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pwr.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_pwr.o --omf_browse smartglove\stm32h7xx_hal_pwr.crf --depend smartglove\stm32h7xx_hal_pwr.d)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_rcc.h)(0x661E8971)
@@ -1014,7 +1014,7 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pwr_ex.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_pwr_ex.o --omf_browse smartglove\stm32h7xx_hal_pwr_ex.crf --depend smartglove\stm32h7xx_hal_pwr_ex.d)
+F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pwr_ex.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_pwr_ex.o --omf_browse smartglove\stm32h7xx_hal_pwr_ex.crf --depend smartglove\stm32h7xx_hal_pwr_ex.d)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_rcc.h)(0x661E8971)
@@ -1054,7 +1054,7 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_cortex.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_cortex.o --omf_browse smartglove\stm32h7xx_hal_cortex.crf --depend smartglove\stm32h7xx_hal_cortex.d)
+F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_cortex.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_cortex.o --omf_browse smartglove\stm32h7xx_hal_cortex.crf --depend smartglove\stm32h7xx_hal_cortex.d)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_rcc.h)(0x661E8971)
@@ -1094,7 +1094,7 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal.o --omf_browse smartglove\stm32h7xx_hal.crf --depend smartglove\stm32h7xx_hal.d)
+F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal.o --omf_browse smartglove\stm32h7xx_hal.crf --depend smartglove\stm32h7xx_hal.d)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_rcc.h)(0x661E8971)
@@ -1134,7 +1134,7 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_i2c.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_i2c.o --omf_browse smartglove\stm32h7xx_hal_i2c.crf --depend smartglove\stm32h7xx_hal_i2c.d)
+F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_i2c.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_i2c.o --omf_browse smartglove\stm32h7xx_hal_i2c.crf --depend smartglove\stm32h7xx_hal_i2c.d)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_rcc.h)(0x661E8971)
@@ -1174,7 +1174,7 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_i2c_ex.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_i2c_ex.o --omf_browse smartglove\stm32h7xx_hal_i2c_ex.crf --depend smartglove\stm32h7xx_hal_i2c_ex.d)
+F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_i2c_ex.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_i2c_ex.o --omf_browse smartglove\stm32h7xx_hal_i2c_ex.crf --depend smartglove\stm32h7xx_hal_i2c_ex.d)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_rcc.h)(0x661E8971)
@@ -1214,7 +1214,7 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_exti.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_exti.o --omf_browse smartglove\stm32h7xx_hal_exti.crf --depend smartglove\stm32h7xx_hal_exti.d)
+F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_exti.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_exti.o --omf_browse smartglove\stm32h7xx_hal_exti.crf --depend smartglove\stm32h7xx_hal_exti.d)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_rcc.h)(0x661E8971)
@@ -1254,7 +1254,7 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_qspi.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_qspi.o --omf_browse smartglove\stm32h7xx_hal_qspi.crf --depend smartglove\stm32h7xx_hal_qspi.d)
+F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_qspi.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_qspi.o --omf_browse smartglove\stm32h7xx_hal_qspi.crf --depend smartglove\stm32h7xx_hal_qspi.d)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_rcc.h)(0x661E8971)
@@ -1294,7 +1294,7 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_tim.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_tim.o --omf_browse smartglove\stm32h7xx_hal_tim.crf --depend smartglove\stm32h7xx_hal_tim.d)
+F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_tim.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_tim.o --omf_browse smartglove\stm32h7xx_hal_tim.crf --depend smartglove\stm32h7xx_hal_tim.d)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_rcc.h)(0x661E8971)
@@ -1334,7 +1334,7 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_tim_ex.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_tim_ex.o --omf_browse smartglove\stm32h7xx_hal_tim_ex.crf --depend smartglove\stm32h7xx_hal_tim_ex.d)
+F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_tim_ex.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_tim_ex.o --omf_browse smartglove\stm32h7xx_hal_tim_ex.crf --depend smartglove\stm32h7xx_hal_tim_ex.d)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_rcc.h)(0x661E8971)
@@ -1374,7 +1374,7 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_uart.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_uart.o --omf_browse smartglove\stm32h7xx_hal_uart.crf --depend smartglove\stm32h7xx_hal_uart.d)
+F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_uart.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_uart.o --omf_browse smartglove\stm32h7xx_hal_uart.crf --depend smartglove\stm32h7xx_hal_uart.d)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_rcc.h)(0x661E8971)
@@ -1414,7 +1414,7 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_uart_ex.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_uart_ex.o --omf_browse smartglove\stm32h7xx_hal_uart_ex.crf --depend smartglove\stm32h7xx_hal_uart_ex.d)
+F (../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_uart_ex.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\stm32h7xx_hal_uart_ex.o --omf_browse smartglove\stm32h7xx_hal_uart_ex.crf --depend smartglove\stm32h7xx_hal_uart_ex.d)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h)(0x661E8971)
 I (../Core/Inc/stm32h7xx_hal_conf.h)(0x661E833F)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_rcc.h)(0x661E8971)
@@ -1454,7 +1454,7 @@ I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim_ex.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h)(0x661E8971)
 I (../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart_ex.h)(0x661E8971)
-F (../Core/Src/system_stm32h7xx.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ..\Core\imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\system_stm32h7xx.o --omf_browse smartglove\system_stm32h7xx.crf --depend smartglove\system_stm32h7xx.d)
+F (../Core/Src/system_stm32h7xx.c)(0x661E8971)(--c99 --gnu -c --cpu Cortex-M7.fp.dp -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc -I ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I ../Drivers/CMSIS/Include -I ../Core/imu

-I.\RTE\_SmartGlove

-I"D:\keil5 pack\ARM\CMSIS\5.8.0\CMSIS\Core\Include"

-I"D:\keil5 pack\Keil\STM32H7xx_DFP\3.1.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include"

-D__UVISION_VERSION="536" -D_RTE_ -DSTM32H750xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32H750xx

-o smartglove\system_stm32h7xx.o --omf_browse smartglove\system_stm32h7xx.crf --depend smartglove\system_stm32h7xx.d)
 I (../Drivers/CMSIS/Device/ST/STM32H7xx/Include/stm32h7xx.h)(0x661E8971)
 I (../Drivers/CMSIS/Device/ST/STM32H7xx/Include/stm32h750xx.h)(0x661E8971)
 I (../Drivers/CMSIS/Include/core_cm7.h)(0x661E88AB)

BIN
MDK-ARM/SmartGlove/adc.o


BIN
MDK-ARM/SmartGlove/gpio.o


BIN
MDK-ARM/SmartGlove/i2c.crf


BIN
MDK-ARM/SmartGlove/i2c.o


Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels