Call of overloaded 'write(int)' is ambiguous
kordeiro opened this issue · 4 comments
kordeiro commented
I get the following error: (PN532_HSU\PN532_HSU.cpp:21:21: error: call of overloaded 'write(int)' is ambiguous) when trying to use the PN532_HSU lib.
#include <PN532_HSU.h>
PN532_HSU pn532_interface(Serial1);
PN532 nfc(pn532_interface);
void setup(void) {
Serial.begin(115200);
Serial.println("Hello!");
nfc.begin();
uint32_t versiondata = nfc.getFirmwareVersion();
if (! versiondata) {
Serial.print("Didn't find PN53x board");
while (1); // halt
}
// Got ok data, print it out!
Serial.print("Found chip PN5"); Serial.println((versiondata>>24) & 0xFF, HEX);
Serial.print("Firmware ver. "); Serial.print((versiondata>>16) & 0xFF, DEC);
Serial.print('.'); Serial.println((versiondata>>8) & 0xFF, DEC);
// configure board to read RFID tags
nfc.SAMConfig();
Serial.println("Waiting for an ISO14443A Card ...");
}
Am I doing something wrong?
I am using Platform IO, and an Arduino Due
Ariel-International commented
Solved!
In library file PN5323_HSU.cpp one must specify data type every time an integer is used, pecause it could be a pointer, which is not.
Example from line 16 on:
`
void PN532_HSU::wakeup()
{
_serial->write(0x55); //_serial->write((byte)0x55);
_serial->write(0x55); //_serial->write((byte)0x55);
_serial->write(uint8_t(0x00)); //_serial->write((byte)0x00);
_serial->write(uint8_t(0x00)); //_serial->write((byte)0x00);
_serial->write(uint8_t(0x00)); //_serial->write((byte)0x00);
`
Line 52 is correct: _serial->write(uint8_t(PN532_PREAMBLE));
But line 60 again is not: _serial->write(PN532_HOSTTOPN532);
This error shows up only in some platforms, ie. SAMD.
It's a different compiler with different requirements.
kordeiro commented
Thanks so much! I will give it a try this evening 👍