Wiegand.h

// Configuration structure typedef struct uint8_t pin_d0; uint8_t pin_d1; uint32_t bit_timeout_us; // Max gap between bits (e.g., 2500) uint32_t packet_timeout_us; // Gap to finalize packet (e.g., 15000) bool pullup_enable; // Use internal pullups? wiegand_config_t;

// Public API void wiegand_init(const wiegand_config_t *config); void wiegand_set_callback(wiegand_callback_t cb); void wiegand_reset(void); bool wiegand_available(void); uint32_t wiegand_get_facility(void); uint32_t wiegand_get_card(void); int wiegand_get_bit_count(void); wiegand.h

Introduction If you’ve ever worked with a proximity card reader (125kHz or 13.56MHz), a fingerprint scanner, or an old-school magnetic stripe swipe, you’ve almost certainly encountered the Wiegand protocol. In the embedded world, the wiegand.h header file represents the standard interface for driving these devices via GPIO on microcontrollers like Arduino, ESP32, STM32, or Raspberry Pi Pico. // Max gap between bits (e.g.