Newer
Older
Card9-Skyworks / firmware / core / rfid.h
@zhang zhang on 13 Feb 2015 677 bytes added RFID class
#ifndef RFID_H__
#define RFID_H__

#include "Arduino.h"


class RFID
{
    static uint8_t skeletonKey[8];
    static uint8_t skeletonKeyLength;
    uint8_t uid[8];  // Buffer to store the returned UID
    uint8_t uidLength;                    // Length of the UID (4 or 7 bytes depending on ISO14443A card type)
    unsigned long previousPollMillis;
public:
    RFID():uidLength(0),previousPollMillis(0){}
    void Init();
    void Poll();
    bool Found()
    {
        return uidLength != 0;
    }
    uint8_t* GetUid(uint8_t &len)
    {
        len = uidLength;
        return uid;
    }
    bool SkeletonKey();
    void Next()
    {
        uidLength = 0;
    }
};

#endif