FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
Loading...
Searching...
No Matches
devices::rfid::Grove125KHzRFIDReaderWiegandPCI< DATA0_, DATA1_ > Class Template Reference

Support for seeedstudio Grove 125KHz RFID Reader in Wiegand mode. More...

#include <fastarduino/devices/grove_rfid_reader.h>

Public Types

using DATA_TYPE = typename protocols::Wiegand::DATA_TYPE
 The data type used to return data read from the Grove device. More...
 

Public Member Functions

 Grove125KHzRFIDReaderWiegandPCI ()
 Construct a new Grove 125KHz RFID Reader instance in Wiegand mode, where wires are connected to board::InterruptPin pins. More...
 
void begin ()
 Start operations of the device. More...
 
void end ()
 Stop operations of the device. More...
 
bool has_data ()
 Check if data from Grove device is ready to read and valid (correct parity). More...
 
void get_data (DATA_TYPE &data)
 Get complete data as a DATA_TYPE value (integral type) from the Grove device. More...
 

Static Public Attributes

static constexpr uint8_t DATA_BITS = protocols::Wiegand::DATA_BITS
 The actual number of bits of data in DATA_TYPE. More...
 

Friends

struct isr_handler_grove
 

Detailed Description

template<board::InterruptPin DATA0_, board::InterruptPin DATA1_>
class devices::rfid::Grove125KHzRFIDReaderWiegandPCI< DATA0_, DATA1_ >

Support for seeedstudio Grove 125KHz RFID Reader in Wiegand mode.

This implementation needs 2 PCI pins from the MCU. If your design allows, you may better use Grove125KHzRFIDReaderWiegandEXT instead.

Pinout:

  • red cable: +5V
  • black cable: GND
  • white cable: DATA0
  • yellow cable: DATA1

In Wiegand mode, the device provides only 3 bytes from a RFID tag. From experiment, these 3 bytes are the 3rd to 5th bytes from the tag, as read from the Grove device in UART mode.

For this API to be fully functional, you must register the right ISR in your program, through REGISTER_GROVE_RFID_READER_PCI_ISR() macro.

Warning
Both PCI pins must be on the same Port.
Note
Wiegand mode is activated with a jumper on the device.
Template Parameters
DATA0_the PCI pin used to connect to Grove device DATA0 (white) wire.
DATA1_the PCI pin used to connect to Grove device DATA1 (yellow) wire.
See also
Grove125KHzRFIDReaderWiegandEXT
REGISTER_GROVE_RFID_READER_PCI_ISR()

Definition at line 394 of file grove_rfid_reader.h.

Member Typedef Documentation

◆ DATA_TYPE

template<board::InterruptPin DATA0_, board::InterruptPin DATA1_>
using devices::rfid::Grove125KHzRFIDReaderWiegandPCI< DATA0_, DATA1_ >::DATA_TYPE = typename protocols::Wiegand::DATA_TYPE

The data type used to return data read from the Grove device.

This may be larger than what is actually needed.

Definition at line 413 of file grove_rfid_reader.h.

Constructor & Destructor Documentation

◆ Grove125KHzRFIDReaderWiegandPCI()

template<board::InterruptPin DATA0_, board::InterruptPin DATA1_>
devices::rfid::Grove125KHzRFIDReaderWiegandPCI< DATA0_, DATA1_ >::Grove125KHzRFIDReaderWiegandPCI ( )
inline

Construct a new Grove 125KHz RFID Reader instance in Wiegand mode, where wires are connected to board::InterruptPin pins.

Definition at line 427 of file grove_rfid_reader.h.

Member Function Documentation

◆ begin()

template<board::InterruptPin DATA0_, board::InterruptPin DATA1_>
void devices::rfid::Grove125KHzRFIDReaderWiegandPCI< DATA0_, DATA1_ >::begin ( )
inline

Start operations of the device.

From here, all data received from the Grove device will be read and stored.

See also
end()

Definition at line 443 of file grove_rfid_reader.h.

◆ end()

template<board::InterruptPin DATA0_, board::InterruptPin DATA1_>
void devices::rfid::Grove125KHzRFIDReaderWiegandPCI< DATA0_, DATA1_ >::end ( )
inline

Stop operations of the device.

From here, any data received from the Grove device will be lost.

See also
begin()

Definition at line 453 of file grove_rfid_reader.h.

◆ has_data()

template<board::InterruptPin DATA0_, board::InterruptPin DATA1_>
bool devices::rfid::Grove125KHzRFIDReaderWiegandPCI< DATA0_, DATA1_ >::has_data ( )
inline

Check if data from Grove device is ready to read and valid (correct parity).

In this situation, your program can call get_data() to receive the complete access data (read from an RFID tag).

See also
get_data()

Definition at line 465 of file grove_rfid_reader.h.

◆ get_data()

template<board::InterruptPin DATA0_, board::InterruptPin DATA1_>
void devices::rfid::Grove125KHzRFIDReaderWiegandPCI< DATA0_, DATA1_ >::get_data ( DATA_TYPE data)
inline

Get complete data as a DATA_TYPE value (integral type) from the Grove device.

In Wiegand mode only 3 bytes are available from the tag read by Grove device.

Note
this method will clear data read from Grove device and will allow for starting to read a new RFID tag. This means 2 consecutive calls will not return the same value (except if the same tag is used 2 times on the device).
Parameters
datareference to be fed from device data; or 0 if no data was read from the device (no tag present since last call to get_data()).
See also
has_data()

Definition at line 483 of file grove_rfid_reader.h.

Friends And Related Function Documentation

◆ isr_handler_grove

template<board::InterruptPin DATA0_, board::InterruptPin DATA1_>
friend struct isr_handler_grove
friend

Definition at line 510 of file grove_rfid_reader.h.

Member Data Documentation

◆ DATA_BITS

template<board::InterruptPin DATA0_, board::InterruptPin DATA1_>
constexpr uint8_t devices::rfid::Grove125KHzRFIDReaderWiegandPCI< DATA0_, DATA1_ >::DATA_BITS = protocols::Wiegand::DATA_BITS
staticconstexpr

The actual number of bits of data in DATA_TYPE.

This does not include parity bits which do not hold any access control data. The actual bits are always the LSB in DATA_TYPE, other bits (HSB) are set to 0.

Definition at line 421 of file grove_rfid_reader.h.


The documentation for this class was generated from the following file: