C/C++ Question need helep wrap i2c mfrc522

tzfpg

Active Member
Licensed User
Longtime User
i try to wrap the i2c mfrc522 library, i start with simple function LogVersion.
after wrap i get the erro when use it.

error code:
B4X:
B4R Version: 2.51
Parsing code.    (0.00s)
Compiling code.    (0.02s)
Building project    (0.03s)
Compiling & deploying Ino project (LOLIN(WEMOS) D1 R2 & mini - COM5)    Error
Loading configuration...
Initializing packages...
Preparing boards...
Verifying...
In file included from C:\Users\drago\OneDrive\Desktop\rMFRC522\Test1\Objects\bin\sketch\B4RDefines.h:25:0,
                 from C:\Users\drago\OneDrive\Desktop\rMFRC522\Test1\Objects\src\src.ino:1:
rI2CMFRC522.h:11:4: error: 'MFRC522_I2C' does not name a type
    MFRC522_I2C rfid;
    ^
In file included from C:\Users\drago\OneDrive\Desktop\rMFRC522\Test1\Objects\bin\sketch\B4RDefines.h:25:0,
                 from C:\Users\drago\OneDrive\Desktop\rMFRC522\Test1\Objects\bin\sketch\B4RArduino.cpp:1:
rI2CMFRC522.h:11:4: error: 'MFRC522_I2C' does not name a type
    MFRC522_I2C rfid;
    ^
In file included from C:\Users\drago\OneDrive\Desktop\rMFRC522\Test1\Objects\bin\sketch\B4RDefines.h:25:0,
                 from C:\Users\drago\OneDrive\Desktop\rMFRC522\Test1\Objects\bin\sketch\B4RCore.cpp:1:
rI2CMFRC522.h:11:4: error: 'MFRC522_I2C' does not name a type
    MFRC522_I2C rfid;
    ^
In file included from C:\Users\drago\OneDrive\Desktop\rMFRC522\Test1\Objects\bin\sketch\B4RDefines.h:25:0,
                 from C:\Users\drago\OneDrive\Desktop\rMFRC522\Test1\Objects\bin\sketch\b4r_main.cpp:1:
rI2CMFRC522.h:11:4: error: 'MFRC522_I2C' does not name a type
    MFRC522_I2C rfid;
    ^
In file included from C:\Users\drago\OneDrive\Desktop\rMFRC522\Test1\Objects\bin\sketch\B4RDefines.h:25:0,
                 from C:\Users\drago\OneDrive\Desktop\rMFRC522\Test1\Objects\bin\sketch\Scheduler.cpp:2:
rI2CMFRC522.h:11:4: error: 'MFRC522_I2C' does not name a type
    MFRC522_I2C rfid;
    ^
In file included from C:\Users\drago\OneDrive\Desktop\rMFRC522\Test1\Objects\bin\sketch\B4RDefines.h:25:0,
                 from C:\Users\drago\OneDrive\Desktop\rMFRC522\Test1\Objects\bin\sketch\B4RStream.cpp:1:
rI2CMFRC522.h:11:4: error: 'MFRC522_I2C' does not name a type
    MFRC522_I2C rfid;
    ^
In file included from C:\Users\drago\OneDrive\Desktop\rMFRC522\Test1\Objects\bin\sketch\B4RDefines.h:25:0,
                 from C:\Users\drago\OneDrive\Desktop\rMFRC522\Test1\Objects\bin\sketch\rI2CMFRC522.cpp:1:
rI2CMFRC522.h:11:4: error: 'MFRC522_I2C' does not name a type
    MFRC522_I2C rfid;
    ^
exit status 1
C:\Users\drago\OneDrive\Desktop\rMFRC522\Test1\Objects\bin\sketch\rI2CMFRC522.cpp: In member function 'void B4R::I2CMFRC522::Initialize(Byte, B4R::SubVoidArrayByte)':
rI2CMFRC522.cpp:6:19: error: 'rfid' was not declared in this scope
   rfid(chipAddress);
                   ^
C:\Users\drago\OneDrive\Desktop\rMFRC522\Test1\Objects\bin\sketch\rI2CMFRC522.cpp: In member function 'void B4R::I2CMFRC522::LogVersion()':
rI2CMFRC522.cpp:14:3: error: 'rfid' was not declared in this scope
   rfid.PICC_DumpToSerial();
   ^

i attach the library. Hope someone can help me.
 

Attachments

  • rI2CMFRC522.zip
    25.3 KB · Views: 484

Laurent95

Active Member
Licensed User
Longtime User

Hello all,

@tzfpg :
Indeed, compiler indicate you what's wrong, there aren't class named MFRC522_I2C but a class named MFRC522.
I think in more that you need to change your code, you need to read all to understand better the things.
I didn't tested anything, just reading at all, and i'm not a God in C++, but the class is named like that not like the library name.

Regards.
 
Last edited:

tzfpg

Active Member
Licensed User
Longtime User
Thank you all for yours replied. I already successful wrap the library.
Now testing the library with the hardware, i'll share the library later.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…