官方库源文件:
1 移植官方6个库文件
2 修改inv_mpu.h中结构体
// 新增 void (*tmp)(void);
struct int_param_s {
#if defined EMPL_TARGET_MSP430 || defined MOTION_DRIVER_TARGET_MSP430
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;
#elif defined EMPL_TARGET_STM32L
void (*cb)(void);
#endif
void (*tmp)(void);
};
3 修改inv_mpu.c
// 步骤二:注释掉
#ifndef EMPL_TARGET_STM32L
// if (int_param)
// reg_int_cb(int_param);
4 修改 inv_mpu_motion_driver.c
// 注释 __no_operation();
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();
5 keil中增加宏定义
STM32F103_DMP,MPU6050,EMPL,MPL_LOG_NDEBUG=1
6 移植核心[修改inv_mpu.c|inv_mpu_motion_driver.c]
#if defined STM32F103_DMP
#include "mpu.h"
#define i2c_write MPU_Write_Len
#define i2c_read MPU_Read_Len
#define delay_ms HAL_Delay
#define get_ms get_ms_count
#define log_i printf
#define log_e printf
#define min(a,b) ((a<b)?a:b)