Wiegand.h

Never trust a card read blindly. Compute parity and reject invalid packets:

Developed by the now-defunct Wiegand Corporation, the protocol became the de facto standard for card readers. It uses two data lines: (D0) and Data 1 (D1). wiegand.h

When a card is presented to a reader, the reader transmits a stream of bits. Unlike UART (Serial) which uses a single wire and a defined baud rate, Wiegand uses two wires to communicate asynchronously. Never trust a card read blindly

Wiegand::Wiegand() instance = this; _rawCode = 0; _bitCount = 0; _frameComplete = false; _rawCode = 0

bool Wiegand::validateParity26() bool evenParityOK = (__builtin_parity((_rawCode >> 1) & 0xFF) == ((_rawCode >> 25) & 1)); bool oddParityOK = (__builtin_parity((_rawCode >> 9) & 0xFFFF) == ((_rawCode >> 24) & 1)); return evenParityOK && oddParityOK;