![](/media/cache/profiles/a7bf3f5462cc82062e41b3a2262e1a21.50x50_q85.jpg)
Wiegand compatible RFID reader class
Revision 1:024f831fa51e, committed 2014-01-19
- Comitter:
- pwheels
- Date:
- Sun Jan 19 14:19:09 2014 +0000
- Parent:
- 0:033aa4854957
- Commit message:
- no detail
Changed in this revision
diff -r 033aa4854957 -r 024f831fa51e main.cpp
diff -r 033aa4854957 -r 024f831fa51e mbed.bld --- a/mbed.bld Thu Feb 03 18:48:04 2011 +0000 +++ b/mbed.bld Sun Jan 19 14:19:09 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/9a9732ce53a1 +http://mbed.org/users/mbed_official/code/mbed/builds/4c0c40fd0593 \ No newline at end of file
diff -r 033aa4854957 -r 024f831fa51e wiegand.h --- a/wiegand.h Thu Feb 03 18:48:04 2011 +0000 +++ b/wiegand.h Sun Jan 19 14:19:09 2014 +0000 @@ -32,6 +32,7 @@ */ #include "mbed.h" +#define W_PULSES 26 class Wiegand { public: @@ -46,11 +47,11 @@ * Interrupt driven signal from data0 data line */ void data_0() { - if (_pulses == 26) { + if (_pulses == W_PULSES) { clear(); } _wiegand = ((_wiegand << 1) & 0x3ffffff) + 0x00; - if (_pulses < 13) { + if (_pulses < W_PULSES / 2) { _e_par = (_e_par & 0x01); } else { _e_par = (_e_par & 0x01); @@ -62,11 +63,11 @@ * Interrupt driven signal from data1 data line */ void data_1() { - if (_pulses == 26) { + if (_pulses == W_PULSES) { clear(); } _wiegand = ((_wiegand << 1) & 0x3ffffff) + 0x01; - if (_pulses < 13) { + if (_pulses < W_PULSES / 2) { _o_par = (_o_par & 0x01) + 0x01; } else { _o_par = (_o_par & 0x01) + 0x01; @@ -93,7 +94,7 @@ * returns true if we have read all pulses and we have proper parity for both data halves */ bool readable() { - if (( _pulses == 26) && (_e_par == 0) && (_o_par == 1)) { + if (( _pulses == W_PULSES) && (_e_par == 0) && (_o_par == 1)) { return true; } else { return false;