Wire.h signature uint8_t requestFrom(uint8_t, uint8_t); (and others) missing

Wire.h in the ArduinoCore-megaavr misses signatures which are used in the ArduinoCore

In the megaavr core for the Every you see

    size_t requestFrom(uint8_t, size_t);
    size_t requestFrom(uint8_t, size_t, bool);
    size_t requestFrom(int, int);
    size_t requestFrom(int, int, int);

in the "Default" Wire.h from ArduinoCore-avr/Wire.h at master · arduino/ArduinoCore-avr · GitHub

    uint8_t requestFrom(uint8_t, uint8_t);
    uint8_t requestFrom(uint8_t, uint8_t, uint8_t);
    uint8_t requestFrom(uint8_t, uint8_t, uint32_t, uint8_t, uint8_t);
    uint8_t requestFrom(int, int);
    uint8_t requestFrom(int, int, int);

This miss match can throw warnings in libraries using the interface according to the the Arduino-Core - which i consider as "standard" and how to do ...

example

#include <Wire.h>

void foo()
{
  uint8_t address = 1;
  Wire.requestFrom(address, (uint8_t)1);
}

void setup() {
  Wire.begin();
}

void loop() {
}

brings


C:\Daten\myrepository\Arduino\Forum no SVN\sketch_sep18a\sketch_sep18a.ino: In function 'void foo()':
C:\Daten\myrepository\Arduino\Forum no SVN\sketch_sep18a\sketch_sep18a.ino:7:41: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
     Wire.requestFrom(address, (uint8_t)1);
                                         ^
In file included from C:\Daten\myrepository\Arduino\Forum no SVN\sketch_sep18a\sketch_sep18a.ino:2:0:
C:\Users\werner\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\libraries\Wire\src/Wire.h:63:12: note: candidate 1: size_t TwoWire::requestFrom(int, int)
     size_t requestFrom(int, int);
            ^~~~~~~~~~~
C:\Users\werner\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\libraries\Wire\src/Wire.h:61:12: note: candidate 2: virtual size_t TwoWire::requestFrom(uint8_t, size_t)
     size_t requestFrom(uint8_t, size_t);
            ^~~~~~~~~~~

I can't open an Issue on github, maybe some can hand over that ...

1 Like

It is a known problem and mentioned on this forum before.
In my opinion, the source code should be as simple as possible and the library should deal with the different options and not limit the user. The megaavr is better, but I still don't like it.

Some get carried away, and think that the more extra nonsense there is, the better it is.

Good (in my opinion):

Wire.requestFrom( 0x68, 14);

Bad (in my opinion):

Wire.requestFrom( (uint_8½)0x68, (oct)🤡🤡🤡, (int)(reinterpret_cast<bool>( maybe true));

If you can formulate the problem in a broader perspective, then I'm happy to make a Issue on Github.

1 Like

The topic came across in the German forum, out of a 3rd party library GitHub - pololu/vl53l1x-arduino: Pololu Arduino library for VL53L1X time-of-flight distance sensor
Uno compiles fine, Every throws a warning.

But it's not to blame 3rd party librarys. Imho at least Arduino should be consistent between their own libraries.

I can't formulate it in a broader perspective. I just see the the differences and the impact on many other libraries. Therefore I formulated that the de facto standard signatures are missing in an Arduino library.

If you have any chance to open an issue I appreciate your efforts, I don't know why, but i don't get the "Submit new Issue" button reacting after pressing.

If you go here: https://github.com/arduino/Arduino/issues and click on
afbeelding
then it should work. If it doesn't, then try another browser, or without add-ons or without VPN.
And give a link to the Issue here on this forum.

... interesting on Arduino repo it worked. My first try was in ArduinoCore-megaavr.

How ever, here it is.

Issue

MegaCoreX can also be used with the Nano Every. In my opinion it is better maintained than the ArduinoCore-megaavr and has some additional useful features.

The Wire.h library included in MegaCoreX contains

uint8_t requestFrom(uint8_t address, size_t quantity, bool sendStop);
uint8_t requestFrom(int address, int quantity, int sendStop);
uint8_t requestFrom(uint8_t address, size_t quantity);
uint8_t requestFrom(uint8_t address, uint8_t quantity);
uint8_t requestFrom(int address, int quantity);

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.