-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathWiegandMega2560.h
65 lines (50 loc) · 1.52 KB
/
WiegandMega2560.h
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef _WIEGAND_H
#define _WIEGAND_H
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#define D0PinA 2 // Arduino Pin 2 Hardware interrupt
#define D1PinA 3 // Arduino Pin 3 Hardware interrupt
#define D0PinB 21 // Arduino Pin 20 Hardware interrupt
#define D1PinB 20 // Arduino Pin 21 Hardware interrupt
#define D0PinC 19 // Arduino Pin 19 Hardware interrupt
#define D1PinC 18 // Arduino Pin 18 Hardware interrupt
class WIEGAND {
public:
WIEGAND();
void begin(bool GateA, bool GateB, bool GateC);
bool available();
unsigned long getCode();
int getWiegandType();
int getGateActive();
private:
static void ReadD0A();
static void ReadD1A();
static void ReadD0B();
static void ReadD1B();
static void ReadD0C();
static void ReadD1C();
static bool DoWiegandConversion ();
static unsigned long GetCardId (unsigned long *codehigh, unsigned long *codelow, char bitlength);
static unsigned long _sysTick;
static unsigned long _lastWiegand;
static int _GateActive;
static unsigned long _cardTempHighA;
static unsigned long _cardTempA;
static int _bitCountA;
static int _wiegandTypeA;
static unsigned long _codeA;
static unsigned long _cardTempHighB;
static unsigned long _cardTempB;
static int _bitCountB;
static int _wiegandTypeB;
static unsigned long _codeB;
static unsigned long _cardTempHighC;
static unsigned long _cardTempC;
static int _bitCountC;
static int _wiegandTypeC;
static unsigned long _codeC;
};
#endif