Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wire compatibility #8

Open
NWItaly opened this issue Oct 24, 2023 · 0 comments
Open

Wire compatibility #8

NWItaly opened this issue Oct 24, 2023 · 0 comments

Comments

@NWItaly
Copy link

NWItaly commented Oct 24, 2023

Hi, when I compile a sketch with Arduino IDE I receive the following warning:

In file included from ...\Arduino\libraries\SparkFun_MPL3115A2_Altitude_and_Pressure_Sensor_Breakout\src\SparkFunMPL3115A2.cpp:36:0:
...\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src/Wire.h: In member function 'float MPL3115A2::readAltitude()':
...\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src/Wire.h:68:13: note: candidate 1: uint8_t TwoWire::requestFrom(int, int)
     uint8_t requestFrom(int, int);
             ^~~~~~~~~~~
...\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src/Wire.h:65:13: note: candidate 2: uint8_t TwoWire::requestFrom(uint8_t, uint8_t)
     uint8_t requestFrom(uint8_t, uint8_t);
             ^~~~~~~~~~~

I would like to suggest to change the call requestFrom to use number in uint8_t format. _I2Caddress is already in right format, so second parameter must to be modified.

Example:

if (_i2cPort->requestFrom(_I2Caddress, 3) != 3) { // Request three bytes
   return -999;
}

become

if (_i2cPort->requestFrom(_I2Caddress, 0x03) != 3) { // Request three bytes
   return -999;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant