移植MPU6050 DMP到uCOS II中,出现如下错误,求高手指点迷津

2019-07-14 22:21发布

源代码inv_mpu.c中应该是没有错误的,直接copy过来的

..eMPLinv_mpu.c(344): error:  #40: expected an identifier
  };
..eMPLinv_mpu.c(666): error:  #20: identifier "st" is undefined
      if (st.chip_cfg.dmp_on) {
..eMPLinv_mpu.c(671): warning:  #223-D: function "i2c_write" declared implicitly
          if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &tmp))
..eMPLinv_mpu.c(683): warning:  #223-D: function "i2c_write" declared implicitly
          if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &tmp))
..eMPLinv_mpu.c(699): error:  #20: identifier "st" is undefined
      for (ii = 0; ii < st.hw->num_reg; ii++) {
..eMPLinv_mpu.c(702): warning:  #223-D: function "i2c_read" declared implicitly
          if (i2c_read(st.hw->addr, ii, 1, &data))
..eMPLinv_mpu.c(718): error:  #20: identifier "st" is undefined
      if (reg == st.reg->fifo_r_w || reg == st.reg->mem_r_w)
..eMPLinv_mpu.c(722): warning:  #223-D: function "i2c_read" declared implicitly
      return i2c_read(st.hw->addr, reg, 1, data);
..eMPLinv_mpu.c(745): warning:  #223-D: function "i2c_write" declared implicitly
      if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, &(data[0])))
..eMPLinv_mpu.c(745): error:  #20: identifier "st" is undefined
      if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, &(data[0])))
..eMPLinv_mpu.c(740): warning:  #177-D: variable "rev" was declared but never referenced
      unsigned char data[6], rev;
..eMPLinv_mpu.c(882): warning:  #223-D: function "i2c_write" declared implicitly
          if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 2, tmp))
..eMPLinv_mpu.c(882): error:  #20: identifier "st" is undefined
          if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 2, tmp))
..eMPLinv_mpu.c(941): error:  #20: identifier "st" is undefined
      st.chip_cfg.sensors = INV_XYZ_ACCEL;
..eMPLinv_mpu.c(959): error:  #20: identifier "st" is undefined
      if (!(st.chip_cfg.sensors & INV_XYZ_GYRO))
..eMPLinv_mpu.c(962): warning:  #223-D: function "i2c_read" declared implicitly
      if (i2c_read(st.hw->addr, st.reg->raw_gyro, 6, tmp))
..eMPLinv_mpu.c(968): warning:  #223-D: function "get_ms" declared implicitly
          get_ms(timestamp);
..eMPLinv_mpu.c(982): error:  #20: identifier "st" is undefined
      if (!(st.chip_cfg.sensors & INV_XYZ_ACCEL))
..eMPLinv_mpu.c(985): warning:  #223-D: function "i2c_read" declared implicitly
      if (i2c_read(st.hw->addr, st.reg->raw_accel, 6, tmp))
..eMPLinv_mpu.c(991): warning:  #223-D: function "get_ms" declared implicitly
          get_ms(timestamp);
..eMPLinv_mpu.c(1006): error:  #20: identifier "st" is undefined
      if (!(st.chip_cfg.sensors))
..eMPLinv_mpu.c(1009): warning:  #223-D: function "i2c_read" declared implicitly
      if (i2c_read(st.hw->addr, st.reg->temp, 2, tmp))
..eMPLinv_mpu.c(1013): warning:  #223-D: function "get_ms" declared implicitly
          get_ms(timestamp);
..eMPLinv_mpu.c(1038): warning:  #223-D: function "i2c_read" declared implicitly
      if (i2c_read(st.hw->addr, 3, 3, data))
..eMPLinv_mpu.c(1038): error:  #20: identifier "st" is undefined
      if (i2c_read(st.hw->addr, 3, 3, data))
..eMPLinv_mpu.c(1066): warning:  #223-D: function "i2c_write" declared implicitly
      if (i2c_write(st.hw->addr, 0x06, 6, data))
..eMPLinv_mpu.c(1079): error:  #20: identifier "st" is undefined
      if (!(st.chip_cfg.sensors))
..eMPLinv_mpu.c(1083): warning:  #223-D: function "i2c_write" declared implicitly
      if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &data))
..eMPLinv_mpu.c(1139): error:  #20: identifier "st" is undefined
      switch (st.chip_cfg.gyro_fsr) {
..eMPLinv_mpu.c(1168): error:  #20: identifier "st" is undefined
      if (!(st.chip_cfg.sensors))
..eMPLinv_mpu.c(1190): warning:  #223-D: function "i2c_write" declared implicitly
      if (i2c_write(st.hw->addr, st.reg->gyro_cfg, 1, &data))
..eMPLinv_mpu.c(1203): error:  #20: identifier "st" is undefined
      switch (st.chip_cfg.accel_fsr) {
..eMPLinv_mpu.c(1233): error:  #20: identifier "st" is undefined
      if (!(st.chip_cfg.sensors))
..eMPLinv_mpu.c(1255): warning:  #223-D: function "i2c_write" declared implicitly
      if (i2c_write(st.hw->addr, st.reg->accel_cfg, 1, &data))
..eMPLinv_mpu.c(1268): error:  #20: identifier "st" is undefined
      switch (st.chip_cfg.lpf) {
..eMPLinv_mpu.c(1306): error:  #20: identifier "st" is undefined
      if (!(st.chip_cfg.sensors))
..eMPLinv_mpu.c(1324): warning:  #223-D: function "i2c_write" declared implicitly
      if (i2c_write(st.hw->addr, st.reg->lpf, 1, &data))
..eMPLinv_mpu.c(1337): error:  #20: identifier "st" is undefined
      if (st.chip_cfg.dmp_on)
..eMPLinv_mpu.c(1354): error:  #20: identifier "st" is undefined
      if (!(st.chip_cfg.sensors))
..eMPLinv_mpu.c(1377): warning:  #223-D: function "i2c_write" declared implicitly
          if (i2c_write(st.hw->addr, st.reg->rate_div, 1, &data))
..eMPLinv_mpu.c(1443): error:  #20: identifier "st" is undefined
      switch (st.chip_cfg.gyro_fsr) {
..eMPLinv_mpu.c(1469): error:  #20: identifier "st" is undefined
      switch (st.chip_cfg.accel_fsr) {
..eMPLinv_mpu.c(1501): error:  #20: identifier "st" is undefined
      sensors[0] = st.chip_cfg.fifo_enable;
..eMPLinv_mpu.c(1522): error:  #20: identifier "st" is undefined
      if (st.chip_cfg.dmp_on)
..eMPLinv_mpu.c(1558): error:  #20: identifier "st" is undefined
      if (st.chip_cfg.sensors)
..eMPLinv_mpu.c(1588): warning:  #223-D: function "i2c_write" declared implicitly
      if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, &data)) {
..eMPLinv_mpu.c(1588): error:  #20: identifier "st" is undefined
      if (i2c_write(st.hw->addr, st.reg->pwr_mgmt_1, 1, &data)) {
..eMPLinv_mpu.c(1655): error:  #20: identifier "st" is undefined
      if (!st.chip_cfg.sensors)
..eMPLinv_mpu.c(1657): warning:  #223-D: function "i2c_read" declared implicitly
      if (i2c_read(st.hw->addr, st.reg->dmp_int_status, 2, tmp))
..eMPLinv_mpu.c(1689): error:  #20: identifier "st" is undefined
      if (st.chip_cfg.dmp_on)
..eMPLinv_mpu.c(1707): warning:  #223-D: function "i2c_read" declared implicitly
      if (i2c_read(st.hw->addr, st.reg->fifo_count_h, 2, data))
..eMPLinv_mpu.c(1722): warning:  #223-D: function "get_ms" declared implicitly
      get_ms((unsigned long*)timestamp);
..eMPLinv_mpu.c(1767): error:  #20: identifier "st" is undefined
      if (!st.chip_cfg.dmp_on)
..eMPLinv_mpu.c(1772): warning:  #223-D: function "i2c_read" declared implicitly
      if (i2c_read(st.hw->addr, st.reg->fifo_count_h, 2, tmp))
..eMPLinv_mpu.c(1804): error:  #20: identifier "st" is undefined
      if (st.chip_cfg.bypass_mode == bypass_on)
..eMPLinv_mpu.c: 25 warnings, 30 errors
".myled.axf" - 30 Error(s), 25 Warning(s).

友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。