ID12RFID library, quickly modified to use interrupt driven reception instead so it doesn\'t block

Dependents:   m3pi_WiiRacing m3pi_RFIDReader

Embed: (wiki syntax)

« Back to documentation index

ID12RFID Class Reference

ID12RFID Class Reference

An interface for the ID-12 RFID reader device, using serial interrupts to avoid blocking. More...

#include <ID12RFID.h>

Public Member Functions

 ID12RFID (PinName rx)
 Create an ID12 RFID interface, connected to the specified Serial rx port.
int readable ()
 Non blocking function to determine if an ID has been received.
int read ()
 A blocking function that will return a tag ID when available.

Detailed Description

An interface for the ID-12 RFID reader device, using serial interrupts to avoid blocking.

 // Print RFID tag numbers
 
 #include "mbed.h"
 #include "ID12RFID.h"
 
 ID12RFID rfid(p10); // serial rx
 
 int main() {
     while(1) {
         if(rfid.readable()) {
             printf("RFID Tag number : %d\n", rfid.read());             
         }
     }
 }

Definition at line 47 of file ID12RFID.h.


Constructor & Destructor Documentation

ID12RFID ( PinName  rx )

Create an ID12 RFID interface, connected to the specified Serial rx port.

Parameters:
rxRecieve pin

Definition at line 29 of file ID12RFID.cpp.


Member Function Documentation

int read (  )

A blocking function that will return a tag ID when available.

Returns:
The ID tag value

Definition at line 61 of file ID12RFID.cpp.

int readable (  )

Non blocking function to determine if an ID has been received.

Returns:
Non zero value when the device is readable

Definition at line 57 of file ID12RFID.cpp.