To use the node in your project you should have the cesars/rc522 library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.
C++ implementation
#pragma XOD require "https://github.com/cesar-s/MFRC522"
#include <SPI.h>
#include <MFRC522.h>
node {
static_assert(isValidDigitalPort(constant_input_SDA), "must be a valid digital port");
static_assert(isValidDigitalPort(constant_input_RST), "must be a valid digital port");
meta{
using Type = MFRC522*;
}
uint8_t mem[sizeof(MFRC522)];
void evaluate(Context ctx) {
if (!isSettingUp()) return;
Type rfid = new (mem) MFRC522(constant_input_SDA, constant_input_RST);
SPI.begin();
rfid->begin();
emitValue<output_522U0027>(ctx, rfid);
}
}