0

On ESP32 I'm trying to build the Minimal I2C example of the MFRC522 library: But I get errors on the first declarations:

TwoWire i2cBus = TwoWire(0);
MFRC522_I2C dev = MFRC522_I2C(RST_PIN, 0x28, i2cBus);
MFRC522 mfrc522 = MFRC522(dev); // <--- error

Here the build output:

src/rfid.cpp:6:30: error: no matching function for call to 'MFRC522::MFRC522(MFRC522_I2C&)'
 MFRC522 mfrc522 = MFRC522(dev);
 ^
In file included from include/rfid.h:5,
 from src/rfid.cpp:1:
.pio/libdeps/MyProject/MFRC522-spi-i2c-uart-async/src/MFRC522.h:348:2: note: candidate: 'MFRC522::MFRC522(byte, byte)'
 MFRC522(byte chipSelectPin, byte resetPowerDownPin);
 ^~~~~~~
.pio/libdeps/MyProject/MFRC522-spi-i2c-uart-async/src/MFRC522.h:348:2: note: candidate expects 2 arguments, 1 provided
.pio/libdeps/MyProject/MFRC522-spi-i2c-uart-async/src/MFRC522.h:347:2: note: candidate: 'MFRC522::MFRC522(byte)'
 MFRC522(byte resetPowerDownPin);
 ^~~~~~~
.pio/libdeps/MyProject/MFRC522-spi-i2c-uart-async/src/MFRC522.h:347:2: note: no known conversion for argument 1 from 'MFRC522_I2C' to 'byte' {aka 'unsigned char'}
.pio/libdeps/MyProject/MFRC522-spi-i2c-uart-async/src/MFRC522.h:346:2: note: candidate: 'MFRC522::MFRC522()'
 MFRC522() DEPRECATED_MSG("use MFRC522(MFRC522_BUS_DEVICE bus_device)");
 ^~~~~~~
.pio/libdeps/MyProject/MFRC522-spi-i2c-uart-async/src/MFRC522.h:346:2: note: candidate expects 0 arguments, 1 provided
.pio/libdeps/MyProject/MFRC522-spi-i2c-uart-async/src/MFRC522.h:343:2: note: candidate: 'MFRC522::MFRC522(MFRC522_BUS_DEVICE*)'
 MFRC522(MFRC522_BUS_DEVICE * dev);
 ^~~~~~~
.pio/libdeps/MyProject/MFRC522-spi-i2c-uart-async/src/MFRC522.h:343:2: note: no known conversion for argument 1 from 'MFRC522_I2C' to 'MFRC522_BUS_DEVICE*'
In file included from include/rfid.h:5,
 from src/rfid.cpp:1:
.pio/libdeps/MyProject/MFRC522-spi-i2c-uart-async/src/MFRC522.h:152:7: note: candidate: 'constexpr MFRC522::MFRC522(const MFRC522&)'
 class MFRC522 {
 ^~~~~~~
.pio/libdeps/MyProject/MFRC522-spi-i2c-uart-async/src/MFRC522.h:152:7: note: no known conversion for argument 1 from 'MFRC522_I2C' to 'const MFRC522&'
.pio/libdeps/MyProject/MFRC522-spi-i2c-uart-async/src/MFRC522.h:152:7: note: candidate: 'constexpr MFRC522::MFRC522(MFRC522&&)'
.pio/libdeps/MyProject/MFRC522-spi-i2c-uart-async/src/MFRC522.h:152:7: note: no known conversion for argument 1 from 'MFRC522_I2C' to 'MFRC522&&'

Unfortunately there is no way to open an issue on the repository. Why the official example does not work?

UPDATE

Here the compatibility declaration for ESP32:

enter image description here

asked Feb 11, 2023 at 11:16
4
  • @VE7JRO they declare the compatibility for ESP32, see the picture in the question updated Commented Feb 11, 2023 at 19:38
  • @VE7JRO It returns: error: cannot convert 'MFRC522_I2C' to 'MFRC522_I2C*' in initialization Commented Feb 11, 2023 at 20:43
  • Guys, why the downvote? Without an explanation how can I improve my question? I did my homework: minimal and reproducible example, show effort to solve the issue by myself, complete output message. What else do you want? Commented Feb 15, 2023 at 20:10
  • you use a fork a of fork. the library is poorly maintained. use MFRC522 mfrc522 = MFRC522(&dev); Commented Mar 26, 2023 at 17:14

1 Answer 1

-1

if you look, it says, "Candidate expects 2 inputs, one provided."

so in the arduino IDE hover over the function and see what it expects.

(What your putting in MFRC522(byte resetPowerDownPin); what it expects: MFRC522(byte resetPowerDownPin, Something else);)

answered Feb 15, 2023 at 22:49
2
  • What it expects is in the declaration of the constructor: github.com/MakerSpaceLeiden/rfid/blob/master/src/…. And is MFRC522_BUS_DEVICE * dev Commented Feb 16, 2023 at 11:10
  • I'm not putting any byte Commented Feb 16, 2023 at 11:11

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.