To use the node in your project you should have the cesars/mfrc522 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"
{{#global}}
#include <SPI.h>
#include <MFRC522.h>
{{/global}}
struct State {
uint8_t mem[sizeof(MFRC522)];
};
using Type = MFRC522*;
{{ GENERATED_CODE }}
void evaluate(Context ctx) {
if (!isSettingUp())
return;
auto state = getState(ctx);
Type rfid = new (state->mem) MFRC522(getValue<input_SDA>(ctx),getValue<input_RST>(ctx));
SPI.begin();
rfid->begin();
Serial.println("Looking for MFRC522...");
emitValue<output_DONE>(ctx, 1);
emitValue<output_DEV>(ctx, rfid);
}