【E1815】基于STM32F4的MPU6050官方库移植

2021-10-26 13:07:48      索炜达电子      542     

项目编号:E1815

文件大小:591K

源码说明:带中文注释

开发环境:C编译器

简要概述

功能:

利用mpu6050内嵌的dmp得到欧拉角,并显示在lcd上。

说明:

1)姿态解算的坐标轴由dmp_use.c里的旋转矩阵决定,原点由上电复位时姿态决定。

2)mpu6050每次得到数据后会在中断引脚上产生一次脉冲,可以将其中断引脚接到单片机,利

   用外部中断得到所有输出的数据,我暂时懒得写了,就在hardware下建了一个文件,用得

   到的时候再弄。

3)eMPL组下的文件是稍作修改的官方库,用户无需调用。dmp_use.c是将官方的部分程序移植

   并稍作修改的用户直接调用的函数,用户可以通过这些函数直接获得欧拉角。mpu6050.c是

   我自己基于寄存器写的文件,可以初始化mpu6050、得到原始数据、修改部分寄存器配置。

4)此处的延时函数是中断方式的systick定时器产生的,其精确度比我写的不用中断的延时更

   精确,还能获得时间戳,但使用的记得初始化、根据情况设置中断优先级,在中断中调用此

   延时函数请务必谨慎,可能会卡死。

5)在dmp_use.c中有系统软件复位的方法

占用资源:

LCD部分,懒得说了

PA8 I2C时钟线

PC9 I2C数据线

目录│文件列表:

 └ stm32-f4-mpu6050

    │ readme.txt

    ├ CORE

    │  │ core_cm4.h

    │  │ core_cm4_simd.h

    │  │ core_cmFunc.h

    │  └ core_cmInstr.h

    ├ eMPL

    │  │ dmpKey.h

    │  │ dmpmap.h

    │  │ inv_mpu.c

    │  │ inv_mpu.h

    │  │ inv_mpu_dmp_motion_driver.c

    │  └ inv_mpu_dmp_motion_driver.h

    ├ HARDWARE

    │  ├ LCD

    │  │  │ FONT.H

    │  │  │ lcd.c

    │  │  └ lcd.h

    │  ├ Mpu6050

    │  │  │ dmp_exti.c

    │  │  │ dmp_exti.h

    │  │  │ dmp_use.c

    │  │  │ dmp_use.h

    │  │  │ mpu6050.c

    │  │  └ mpu6050.h

    │  └ SOFT_I2C

    │     │ iic.c

    │     └ iic.h

    ├ LIBRARY

    │  ├ inc

    │  │  │ misc.h

    │  │  │ stm32f4xx_adc.h

    │  │  │ stm32f4xx_can.h

    │  │  │ stm32f4xx_crc.h

    │  │  │ stm32f4xx_cryp.h

    │  │  │ stm32f4xx_dac.h

    │  │  │ stm32f4xx_dbgmcu.h

    │  │  │ stm32f4xx_dcmi.h

    │  │  │ stm32f4xx_dma.h

    │  │  │ stm32f4xx_dma2d.h

    │  │  │ stm32f4xx_exti.h

    │  │  │ stm32f4xx_flash.h

    │  │  │ stm32f4xx_flash_ramfunc.h

    │  │  │ stm32f4xx_fmc.h

    │  │  │ stm32f4xx_fsmc.h

    │  │  │ stm32f4xx_gpio.h

    │  │  │ stm32f4xx_hash.h

    │  │  │ stm32f4xx_i2c.h

    │  │  │ stm32f4xx_iwdg.h

    │  │  │ stm32f4xx_ltdc.h

    │  │  │ stm32f4xx_pwr.h

    │  │  │ stm32f4xx_rcc.h

    │  │  │ stm32f4xx_rng.h

    │  │  │ stm32f4xx_rtc.h

    │  │  │ stm32f4xx_sai.h

    │  │  │ stm32f4xx_sdio.h

    │  │  │ stm32f4xx_spi.h

    │  │  │ stm32f4xx_syscfg.h

    │  │  │ stm32f4xx_tim.h

    │  │  │ stm32f4xx_usart.h

    │  │  └ stm32f4xx_wwdg.h

    │  └ src

    │     │ misc.c

    │     │ stm32f4xx_adc.c

    │     │ stm32f4xx_can.c

    │     │ stm32f4xx_crc.c

    │     │ stm32f4xx_cryp.c

    │     │ stm32f4xx_cryp_aes.c

    │     │ stm32f4xx_cryp_des.c

    │     │ stm32f4xx_cryp_tdes.c

    │     │ stm32f4xx_dac.c

    │     │ stm32f4xx_dbgmcu.c

    │     │ stm32f4xx_dcmi.c

    │     │ stm32f4xx_dma.c

    │     │ stm32f4xx_dma2d.c

    │     │ stm32f4xx_exti.c

    │     │ stm32f4xx_flash.c

    │     │ stm32f4xx_flash_ramfunc.c

    │     │ stm32f4xx_fmc.c

    │     │ stm32f4xx_fsmc.c

    │     │ stm32f4xx_gpio.c

    │     │ stm32f4xx_hash.c

    │     │ stm32f4xx_hash_md5.c

    │     │ stm32f4xx_hash_sha1.c

    │     │ stm32f4xx_i2c.c

    │     │ stm32f4xx_iwdg.c

    │     │ stm32f4xx_ltdc.c

    │     │ stm32f4xx_pwr.c

    │     │ stm32f4xx_rcc.c

    │     │ stm32f4xx_rng.c

    │     │ stm32f4xx_rtc.c

    │     │ stm32f4xx_sai.c

    │     │ stm32f4xx_sdio.c

    │     │ stm32f4xx_spi.c

    │     │ stm32f4xx_syscfg.c

    │     │ stm32f4xx_tim.c

    │     │ stm32f4xx_usart.c

    │     └ stm32f4xx_wwdg.c

    ├ start_up

    │  │ startup_stm32f401xx.s

    │  │ startup_stm32f40xx.s

    │  │ startup_stm32f40_41xxx.s

    │  │ startup_stm32f411xe.s

    │  │ startup_stm32f427x.s

    │  │ startup_stm32f427_437xx.s

    │  └ startup_stm32f429_439xx.s

    ├ USER

    │  │ EventRecorderStub.scvd

    │  │ main.c

    │  │ mydelay.c

    │  │ mydelay.h

    │  │ stm32f4xx.h

    │  │ stm32f4xx_conf.h

    │  │ stm32f4xx_it.c

    │  │ stm32f4xx_it.h

    │  │ system_stm32f4xx.c

    │  │ system_stm32f4xx.h

    │  │ template.uvguix.xiao

    │  │ template.uvoptx

    │  │ template.uvprojx

    │  ├ DebugConfig

    │  │  └ Target_1_STM32F407ZGTx.dbgconf

    │  └ Objects

    │     └ template.hex

    └ USMART

       │ readme.txt

       │ sys.c

       │ sys.h

       │ usart.c

       │ usart.h

       │ usmart.c

       │ usmart.h

       │ usmart_config.c

       │ usmart_str.c

       └ usmart_str.h

TAGMPU6050
  • 8 次
  • 1 分