Skip to content

Wire compatibility #8

@NWItaly

Description

@NWItaly

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;
}

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