FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
Loading...
Searching...
No Matches
devices::rfid::Grove125KHzRFIDReaderWiegandEXT< 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

 Grove125KHzRFIDReaderWiegandEXT ()
 Construct a new Grove 125KHz RFID Reader instance in Wiegand mode, where wires are connected to board::ExternalInterruptPin 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::ExternalInterruptPin DATA0_, board::ExternalInterruptPin DATA1_>
class devices::rfid::Grove125KHzRFIDReaderWiegandEXT< DATA0_, DATA1_ >

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

This implementation needs 2 EXT pins from the MCU. If your design does not allow this, then you may use Grove125KHzRFIDReaderWiegandPCI 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_INT_ISR() macro.

Note
Wiegand mode is activated with a jumper on the device.
Template Parameters
DATA0_the EXT pin used to connect to Grove device DATA0 (white) wire.
DATA1_the EXT pin used to connect to Grove device DATA1 (yellow) wire.
See also
Grove125KHzRFIDReaderWiegandPCI
REGISTER_GROVE_RFID_READER_INT_ISR()

Definition at line 252 of file grove_rfid_reader.h.

Member Typedef Documentation

◆ 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 263 of file grove_rfid_reader.h.

Constructor & Destructor Documentation

◆ Grove125KHzRFIDReaderWiegandEXT()

devices::rfid::Grove125KHzRFIDReaderWiegandEXT< DATA0_, DATA1_ >::Grove125KHzRFIDReaderWiegandEXT ( )
inline

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

Definition at line 277 of file grove_rfid_reader.h.

Member Function Documentation

◆ begin()

void devices::rfid::Grove125KHzRFIDReaderWiegandEXT< 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 292 of file grove_rfid_reader.h.

◆ end()

void devices::rfid::Grove125KHzRFIDReaderWiegandEXT< 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 303 of file grove_rfid_reader.h.

◆ has_data()

bool devices::rfid::Grove125KHzRFIDReaderWiegandEXT< 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 316 of file grove_rfid_reader.h.

◆ get_data()

void devices::rfid::Grove125KHzRFIDReaderWiegandEXT< 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 334 of file grove_rfid_reader.h.

Friends And Related Function Documentation

◆ isr_handler_grove

friend struct isr_handler_grove
friend

Definition at line 362 of file grove_rfid_reader.h.

Member Data Documentation

◆ DATA_BITS

constexpr uint8_t devices::rfid::Grove125KHzRFIDReaderWiegandEXT< 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 271 of file grove_rfid_reader.h.


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