mfrc522-dev

cesars/mfrc522/mfrc522-dev

No description
mfrc522-dev
@/mfrc522-dev
SDAport
RSTport
mfrc522-dev
DEV
DONE
SDA
RST
DONEpulse
Fires on reading complete
DEV@/mfrc522-dev
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);
}