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

Fix requestFrom ambiguous call in readAckFrame #129

Open
wants to merge 1 commit into
base: arduino
Choose a base branch
from

Conversation

JEphron
Copy link

@JEphron JEphron commented Jun 19, 2022

I was unable to compile this library for an Arduino Nano Every

~/Documents/Arduino/libraries/PN532_I2C/PN532_I2C.cpp: In member function 'int8_t PN532_I2C::readAckFrame()':
~/Documents/Arduino/libraries/PN532_I2C/PN532_I2C.cpp:221:74: error: call of overloaded 'requestFrom(int, unsigned int)' is ambiguous
         if (_wire->requestFrom(PN532_I2C_ADDRESS, (sizeof(PN532_ACK) + 1)))
                                                                          ^
In file included from ~/Documents/Arduino/libraries/PN532_I2C/PN532_I2C.h:8:0,
                 from ~/Documents/Arduino/libraries/PN532_I2C/PN532_I2C.cpp:5:
~/Library/Arduino15/packages/arduino/hardware/megaavr/1.8.7/libraries/Wire/src/Wire.h:61:12: note: candidate: virtual size_t TwoWire::requestFrom(uint8_t, size_t)
     size_t requestFrom(uint8_t, size_t);
            ^~~~~~~~~~~
~/Library/Arduino15/packages/arduino/hardware/megaavr/1.8.7/libraries/Wire/src/Wire.h:63:12: note: candidate: size_t TwoWire::requestFrom(int, int)
     size_t requestFrom(int, int);
            ^~~~~~~~~~~
exit status 1
Error compiling for board Arduino Nano Every.

This resolves the ambiguous overload by casting the size to int.

On Arduino Mega AVR platforms, the call to TwoWire::requestFrom
was being typechecked as
   requestFrom(int, unsigned int)
which was ambiguous between two overloads:
    TwoWire::requestFrom(uint8_t, size_t)
and
    TwoWire::requestFrom(int, int)
@Cincinnatu
Copy link

Hello. I will check soon whether this is effective and reasonable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PN532 Label for PN532 Pull request Label for pull requests UAY Unassigned yet
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

3 participants