ID12 RFID library for reading 125KHz RFID tags
Dependents: ID12RFID_HelloWorld MyFinalDerbot RFID_CatDoor TweetRFID ... more
ID12RFID.h
00001 /* mbed ID12 RFID Library 00002 * Copyright (c) 2007-2010, sford, http://mbed.org 00003 * 00004 * Permission is hereby granted, free of charge, to any person obtaining a copy 00005 * of this software and associated documentation files (the "Software"), to deal 00006 * in the Software without restriction, including without limitation the rights 00007 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00008 * copies of the Software, and to permit persons to whom the Software is 00009 * furnished to do so, subject to the following conditions: 00010 * 00011 * The above copyright notice and this permission notice shall be included in 00012 * all copies or substantial portions of the Software. 00013 * 00014 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00015 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00016 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00017 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00018 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00019 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00020 * THE SOFTWARE. 00021 */ 00022 00023 #ifndef MBED_ID12RFID_H 00024 #define MBED_ID12RFID_H 00025 00026 #include "mbed.h" 00027 00028 /** An interface for the ID-12 RFID reader device 00029 * 00030 * @code 00031 * // Print RFID tag numbers 00032 * 00033 * #include "mbed.h" 00034 * #include "ID12RFID.h" 00035 * 00036 * ID12RFID rfid(p10); // serial rx 00037 * 00038 * int main() { 00039 * while(1) { 00040 * if(rfid.readable()) { 00041 * printf("RFID Tag number : %d\n", rfid.read()); 00042 * } 00043 * } 00044 * } 00045 * @endcode 00046 */ 00047 class ID12RFID { 00048 00049 public: 00050 /** Create an ID12 RFID interface, connected to the specified Serial rx port 00051 * 00052 * @param rx Recieve pin 00053 */ 00054 ID12RFID(PinName rx); 00055 00056 /** Non blocking function to determine if an ID has been received 00057 * 00058 * @return Non zero value when the device is readable 00059 */ 00060 int readable(); 00061 00062 /** A blocking function that will return a tag ID when available 00063 * 00064 * @return The ID tag value 00065 */ 00066 int read(); 00067 00068 private: 00069 Serial _rfid; 00070 00071 }; 00072 00073 #endif
Generated on Tue Jul 12 2022 18:54:21 by 1.7.2