jrowberg / i2cdevlib

I2C device library collection for AVR/Arduino or other C++-based MCUs
http://www.i2cdevlib.com
3.95k stars 7.51k forks source link

Deprecated type in avr-libc 1.8.0 #142

Closed kerny3d closed 9 years ago

kerny3d commented 9 years ago

The Arduino version of the i2cdevlib can not be built on avr-lib 1.8.0+ (on Arduino IDE 1.0.5). The problem is caused by deprecated data types in that version of avr-lib. An example log of Arduino IDE is the following:

In file included from test.ino:20:0: Arduino/libraries/MPU9150/MPU9150_9Axis_MotionApps41.h:124:7: error: 'prog_uchar' does not name a type const prog_uchar dmpMemory[MPU9150_DMP_CODE_SIZE] PROGMEM = { ^ Arduino/libraries/MPU9150/MPU9150_9Axis_MotionApps41.h:265:7: error: 'prog_uchar' does not name a type const prog_uchar dmpConfig[MPU9150_DMP_CONFIG_SIZE] PROGMEM = { ^ Arduino/libraries/MPU9150/MPU9150_9Axis_MotionApps41.h:315:7: error: 'prog_uchar' does not name a type const prog_uchar dmpUpdates[MPU9150_DMP_UPDATES_SIZE] PROGMEM = {

As written on:

http://www.nongnu.org/avr-libc/user-manual/group__avr__pgmspace.html#gaa475b6b81fd8b34de45695da1da523b6

A workaround can be to define the macro PROG_TYPES_COMPAT before the inclusion of <avr/pgmspace.h> but i think this can be a problem in Arduino IDE.

A possible solution can be to change types of problematic variables in the original source code of the library.

jrowberg commented 9 years ago

This has just been solved in a merged pull request from @Bonobo79. Thanks!

Boobies commented 9 years ago

Are you sure this has been fixed? I'm getting the same error with the latest revision (#159) and Arduino 1.6.3 for Windows.

EDIT: I took a look at the merged pull request and found the problem: It fixed MPU6050_9Axis_MotionApps41.h but not MPU9150_9Axis_MotionApps41.h. You seem to be accepting pull requests without keeping them in sync. You should check both of their histories and do a little maintenance job. If I were you, when I was done doing that, I would merge the two MPU's because this split makes no sense; it only creates problems like this one.

Cheers, Bogdan

Boobies commented 9 years ago

If I merge the code for the two MPU's, will you accept it? I want to know if it's worth wasting my time with or if I should just fix the MPU9150 code for my particular project.