之前在做mpu的dmp,用的是IAR编译器。由于换了
单片机,所以转战了keil,于是准备把dmp相关的.c .h加入到keil的工程,结果编译出了一堆问题,大部分都是left side of asn-op not an lvalue.以及各种syntax错误。相关的引脚定义什么的我都改过来了,结果依然有一堆这种错误。不知道为什么。
举个例子:
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);
每行都有错误,错误是:syntax error near 'L', syntax error near ')'
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);
这个的错误是,'>>',bad operand type
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;
他们的错误就是left side of asn-op not an lvalue.
实在不解!向各位大神求解!感谢!
-
放到最开始?你是说#include下面么?
一周热门 更多>