Skip to content

Error compiling when using I2Cdevlib #175

@mundodisco8

Description

@mundodisco8

Hi,

I'm facing issues when trying to use I2Cdevlib in my project for the arduino Zero. Apparently, their library is expecting a constant named BUFFER_LENGTH to be present in Wire.h. This constant is present in the AVR version of the library, but not on the SAMD version. The compiler throws the following message

D:\Joel\Desktop\Dropbox\Arduino\libraries\I2Cdev\I2Cdev.cpp: In static member function 'static int8_t I2Cdev::readBytes(uint8_t, uint8_t, uint8_t, uint8_t*, uint16_t)':

D:\Joel\Desktop\Dropbox\Arduino\libraries\I2Cdev\I2Cdev.cpp:276:62: error: 'BUFFER_LENGTH' was not declared in this scope

             for (uint8_t k = 0; k < length; k += min(length, BUFFER_LENGTH)) {

                                                              ^

C:\Users\Joel\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.7\cores\arduino/Arduino.h:96:24: note: in definition of macro 'min'

 #define min(a,b) ((a)<(b)?(a):(b))

Some code that produces this output is the following:

#include<Wire.h>
#include "MPU6050_6Axis_MotionApps20.h" // for the MPU6050

void setup(){
}

void loop(){
}

I have the latest versions of the library, the IDE (1.6.12) and the boards (1.6.8).

I opened an issue on their repo (jrowberg/i2cdevlib#271), but I think that it might be also relevant to post one here. If you think it is not, please feel free to close it. In any case, would you be able to suggest a value for BUFFER_LENGTH? Is there a reason why not to use 32 as in the AVR version? I'm trying to use a MPU6050 accelerometer, that has a 1024 bytes buffer, in case that BUFFER_LENGTH is related to the buffer length of the target device.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions