2021-10-26 13:07:48 索煒達電子 782
項目編號:E1815
文件大?。?91K
源碼說明:帶中文注釋
開發(fā)環(huán)境:C編譯器
簡要概述
功能:
利用mpu6050內(nèi)嵌的dmp得到歐拉角,并顯示在lcd上。
說明:
1)姿態(tài)解算的坐標軸由dmp_use.c里的旋轉矩陣決定,原點由上電復位時姿態(tài)決定。
2)mpu6050每次得到數(shù)據(jù)后會在中斷引腳上產(chǎn)生一次脈沖,可以將其中斷引腳接到單片機,利
用外部中斷得到所有輸出的數(shù)據(jù),我暫時懶得寫了,就在hardware下建了一個文件,用得
到的時候再弄。
3)eMPL組下的文件是稍作修改的官方庫,用戶無需調用。dmp_use.c是將官方的部分程序移植
并稍作修改的用戶直接調用的函數(shù),用戶可以通過這些函數(shù)直接獲得歐拉角。mpu6050.c是
我自己基于寄存器寫的文件,可以初始化mpu6050、得到原始數(shù)據(jù)、修改部分寄存器配置。
4)此處的延時函數(shù)是中斷方式的systick定時器產(chǎn)生的,其精確度比我寫的不用中斷的延時更
精確,還能獲得時間戳,但使用的記得初始化、根據(jù)情況設置中斷優(yōu)先級,在中斷中調用此
延時函數(shù)請務必謹慎,可能會卡死。
5)在dmp_use.c中有系統(tǒng)軟件復位的方法
占用資源:
LCD部分,懶得說了
PA8 I2C時鐘線
PC9 I2C數(shù)據(jù)線
目錄│文件列表:
└ 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