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

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

#include <fastarduino/devices/grove_rfid_reader.h>

Public Types

using UART = UART_
 The UART type used to communicate with the Grove device. More...
 

Public Member Functions

 Grove125KHzRFIDReaderUART (UART &uart)
 Construct a new Grove 125KHz RFID Reader UART instance. 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. More...
 
void get_data (char *data, uint8_t size)
 Get complete data as ASCII C-string from the Grove device. More...
 

Detailed Description

template<typename UART_>
class devices::rfid::Grove125KHzRFIDReaderUART< UART_ >

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

Pinout:

  • red cable: +5V
  • black cable: GND
  • white cable: TX (probably not needed)
  • yellow cable: RX

In general, it is preferred to use Wiegand mode rather than UART mode on the Grove device because:

  1. It does not use UART (whether hardware or software)
  2. It is more efficient in terms of ISR usage
Warning
Although UART_ may be a software UART implementation, it is not recommend to do so, because current FastArduino software UART implementation is not optimized for slow rates such as 9600bps as used by Grove device.
Note
It is unclear, from original documentation and code examples, whether this module can write tags or not. Hence we consider writing is not possible and hence white cable is also useless to connect in UART mode.
Template Parameters
UART_the UART_ class to use to access the Grove device; this may be hardware or software, this may be either UART or UARX (UATX not used).
See also
Grove125KHzRFIDReaderWiegandEXT
Grove125KHzRFIDReaderWiegandPCI

Definition at line 118 of file grove_rfid_reader.h.

Member Typedef Documentation

◆ UART

template<typename UART_ >
using devices::rfid::Grove125KHzRFIDReaderUART< UART_ >::UART = UART_

The UART type used to communicate with the Grove device.

Definition at line 128 of file grove_rfid_reader.h.

Constructor & Destructor Documentation

◆ Grove125KHzRFIDReaderUART()

template<typename UART_ >
devices::rfid::Grove125KHzRFIDReaderUART< UART_ >::Grove125KHzRFIDReaderUART ( UART uart)
inlineexplicit

Construct a new Grove 125KHz RFID Reader UART instance.

Parameters
uartthe UART to use for communicating with the Grove device; the caller shall just care about instantiation, this Grove125KHzRFIDReaderUART instance will handle everything else on uart.

Definition at line 137 of file grove_rfid_reader.h.

Member Function Documentation

◆ begin()

template<typename UART_ >
void devices::rfid::Grove125KHzRFIDReaderUART< UART_ >::begin ( )
inline

Start operations of the device.

From here, all data received from the Grove device will be read into UART buffer.

See also
end()

Definition at line 149 of file grove_rfid_reader.h.

◆ end()

template<typename UART_ >
void devices::rfid::Grove125KHzRFIDReaderUART< UART_ >::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 160 of file grove_rfid_reader.h.

◆ has_data()

template<typename UART_ >
bool devices::rfid::Grove125KHzRFIDReaderUART< UART_ >::has_data ( )
inline

Check if data from Grove device is ready to read.

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

Note
Actually this method will return true as soon as the first character transmitted by the Grove device is ready, even if the remaining caharacters have not been received yet. get_data() will wait for and read the remaining characters if needed.
See also
get_data()

Definition at line 178 of file grove_rfid_reader.h.

◆ get_data()

template<typename UART_ >
void devices::rfid::Grove125KHzRFIDReaderUART< UART_ >::get_data ( char *  data,
uint8_t  size 
)
inline

Get complete data as ASCII C-string from the Grove device.

Data is displayable in ASCII as an hexadecimal representation of RFID tag actual data, e.g. "0F0024ADC442".

On UARX wire, the data transmitted by Grove device is embedded between special ASCII STX (0x02) and ETX (0x03); those markers are removed from returned data.

Note
with tags used for tests, data read was 12 characters long (6 bytes formatted as hexadecimal ASCII string); it is not clear yet, whether other tags might produce different sizes on the Grove device.
this method might change in the future, depending on Grove device behavior on different types of RFID tags.
Warning
this method will block until data is available and complete! Call has_data() first, to ensure data will be available.
Parameters
datadata buffer to be fed from device data
sizesize of data ; this will typically depend on RFID tags that you use; do not forget to add 1 character ofr the ending \\0.

Definition at line 206 of file grove_rfid_reader.h.


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