-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathWiegandNG.h
37 lines (32 loc) · 1.08 KB
/
WiegandNG.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
#ifndef _WIEGAND_NG_H
#define _WIEGAND_NG_H
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
class WiegandNG {
private:
static void ReadD0();
static void ReadD1();
static volatile unsigned long _lastPulseTime; // time last bits received
static volatile unsigned int _bitCounted; // number of bits arrived at Interrupt pins
static unsigned int _bufferSize; // memory (bytes) allocated for buffer
unsigned int _bitAllocated; // wiegand bits required
unsigned int _packetGap; // gap between wiegand packet in millisecond
static volatile unsigned char * _buffer; // buffer for data retention
public:
bool begin(unsigned int bits, unsigned int packetGap=25); // default packetGap is 25ms
bool begin(uint8_t pinD0, uint8_t pinD1, unsigned int bits, unsigned int packetGap);
bool available();
void clear();
void pause();
unsigned int getBitCounted();
unsigned int getBitAllocated();
unsigned int getBufferSize();
unsigned int getPacketGap();
volatile unsigned char *getRawData();
WiegandNG();
~WiegandNG();
};
#endif