-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRfidReader.h
More file actions
49 lines (38 loc) · 856 Bytes
/
RfidReader.h
File metadata and controls
49 lines (38 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
* "Drinks" RFID Terminal
* Buy sodas with your company badge!
*
* Benoit Blanchon 2014 - MIT License
* https://github.com/bblanchon/DrinksRfidTerminal
*/
#ifndef _RFIDREADER_H
#define _RFIDREADER_H
#include <MFRC522.h>
#include "Pins.h"
class RfidReader
{
public:
//RfidReader() : mfrc522(PIN_RFID_SS, PIN_RFID_RESET) //testing a new version of the MFRC522 library,,no need for reset !
RfidReader() : mfrc522()
{
}
void begin()
{
//mfrc522.PCD_Init();
mfrc522.PCD_Init(PIN_RFID_SS,UINT8_MAX);
}
void restart()
{
mfrc522.PCD_Reset();
digitalWrite(PIN_RFID_RESET, LOW); //Hard reset
begin();
}
char* tryRead();
private:
byte parseHexNibble(char);
byte parseHexByte(char*);
byte computeCheckSum(char*);
char buffer[21];
MFRC522 mfrc522;
};
#endif