用于EagleEye3.0 规则集漏报和误报测试的示例项目,项目收集于github和gitee
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
2.3 KiB

5 months ago
#include "stm32f10x.h"
#include "inv_mpu.h"
#include "inv_mpu_dmp_motion_driver.h"
#include "mpu6050.h"
#include "lcd.h"
#include "led.h"
#include "MpuDisplay.h"
float pitch,roll,yaw; //ŷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
short accx,accy,accz; //<EFBFBD><EFBFBD><EFBFBD>ٶȴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
short gyrox,gyroy,gyroz; //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
short temp; //<EFBFBD><EFBFBD>
short num;
void MpuDisplay(void)
{
if(mpu_dmp_get_data(&pitch,&roll,&yaw)==0)
{
temp=MPU_Get_Temperature(); //<EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD>ֵ
MPU_Get_Accelerometer(&accx,&accy,&accz); //<EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٶȴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
MPU_Get_Gyroscope(&gyrox,&gyroy,&gyroz); //<EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if(temp<0)
{
LCD_ShowChar(30+48,140,'-',16,0); //<EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
temp=-temp; //תΪ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}else LCD_ShowChar(30+48,140,' ',16,0); //ȥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
LCD_ShowNum(30+48+8,140,temp/100,3,16); //<EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
LCD_ShowNum(30+48+40,140,temp%10,1,16); //<EFBFBD><EFBFBD>ʾС<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
accx=accx*0.598; // mm/s^2
if(accx<0)
{
LCD_ShowChar(30+48,160,'-',16,0);
accx=-accx;
}else LCD_ShowChar(30+48,160,' ',16,0);
LCD_ShowNum(30+48+8,160,accx/100,3,16);
LCD_ShowNum(30+48+40,160,accx%10,1,16);
accy=accy*0.598; // mm/s^2
if(accy<0)
{
LCD_ShowChar(30+48,180,'-',16,0);
accy=-accy;
}else LCD_ShowChar(30+48,180,' ',16,0);
LCD_ShowNum(30+48+8,180,accy/100,3,16);
LCD_ShowNum(30+48+40,180,accy%10,1,16);
gyroz=gyroz/16.4;
if(gyroz<0)
{
LCD_ShowChar(30+48,200,'-',16,0);
gyroz=-gyroz;
}else LCD_ShowChar(30+48,200,' ',16,0);
LCD_ShowNum(30+48+8,200,gyroz/100,3,16);
LCD_ShowNum(30+48+40,200,gyroz%10,1,16);
num=pitch*10;
if(num<0)
{
LCD_ShowChar(30+48,220,'-',16,0);
num=-num;
}else LCD_ShowChar(30+48,220,' ',16,0);
LCD_ShowNum(30+48+8,220,num/10,3,16);
LCD_ShowNum(30+48+40,220,num%10,1,16);
num=roll*10;
if(num<0)
{
LCD_ShowChar(30+48,240,'-',16,0);
num=-num;
}else LCD_ShowChar(30+48,240,' ',16,0);
LCD_ShowNum(30+48+8,240,num/10,3,16);
LCD_ShowNum(30+48+40,240,num%10,1,16);
num=yaw*10;
if(num<0)
{
LCD_ShowChar(30+48,260,'-',16,0);
num=-num;
}else LCD_ShowChar(30+48,260,' ',16,0);
LCD_ShowNum(30+48+8,260,num/10,3,16);
LCD_ShowNum(30+48+40,260,num%10,1,16);
LED0=!LED0;//LED<EFBFBD><EFBFBD>˸
}
}