Beispiel fuer das Auslesen von RFID Tags mittels RFID Reader

Dependencies:   MFRC522 mbed

ReaderTags
RFID ReaderRFID Tags

RFID (engl. radio-frequency identification - „Identifizierung mit Hilfe elektromagnetischer Wellen“) bezeichnet eine Technologie für Sender-Empfänger-Systeme zum automatischen und berührungslosen Identifizieren und Lokalisieren von Objekten (Produkte - Lebewesen) mit Radiowellen.

Ein RFID-System besteht aus einem Transponder (umgangssprachlich auch Funketikett genannt), der sich am oder im Gegenstand bzw. Lebewesen befindet und einen kennzeichnenden Code enthält, sowie einem Lesegerät zum Auslesen dieser Kennung.

RFID-Transponder können so klein wie ein Reiskorn sein und implantiert werden, etwa bei Menschen oder Haustieren.

Die Kopplung geschieht durch vom Lesegerät erzeugte magnetische Wechselfelder geringer Reichweite oder durch hochfrequente Radiowellen. Damit werden nicht nur Daten übertragen, sondern auch der Transponder mit Energie versorgt.

Der RFID Reader benötigt die MFRC522 Library. Der Reader wir via SPI angesprochen. Auf den Shields ist ein entsprechender Steckplatz vorgesehen.

Anwendungen

  • Fahrzeugidentifikation
  • Banknoten
  • Bezahlkarten
  • Identifizierung von Personen
  • Textilien und Bekleidung
  • Tieridentifikation
  • Waren- und Bestandsmanagement
  • Müllentsorgung
  • Zutrittskontrolle und Zeitkontrolle

Der RFID Reader hat einen eigenen Steckplatz oben auf dem Shield

Committer:
marcel1691
Date:
Fri Mar 25 17:07:01 2016 +0000
Revision:
4:00eaa9fcd3ef
Parent:
3:8725b25bcb6f
undo

Who changed what in which revision?

UserRevisionLine numberNew contents of line
marcel1691 3:8725b25bcb6f 1 /***********************************
marcel1691 3:8725b25bcb6f 2 This is a our graphics core library, for all our displays.
marcel1691 3:8725b25bcb6f 3 We'll be adapting all the
marcel1691 3:8725b25bcb6f 4 existing libaries to use this core to make updating, support
marcel1691 3:8725b25bcb6f 5 and upgrading easier!
marcel1691 3:8725b25bcb6f 6
marcel1691 3:8725b25bcb6f 7 Adafruit invests time and resources providing this open source code,
marcel1691 3:8725b25bcb6f 8 please support Adafruit and open-source hardware by purchasing
marcel1691 3:8725b25bcb6f 9 products from Adafruit!
marcel1691 3:8725b25bcb6f 10
marcel1691 3:8725b25bcb6f 11 Written by Limor Fried/Ladyada for Adafruit Industries.
marcel1691 3:8725b25bcb6f 12 BSD license, check license.txt for more information
marcel1691 3:8725b25bcb6f 13 All text above must be included in any redistribution
marcel1691 3:8725b25bcb6f 14 ****************************************/
marcel1691 3:8725b25bcb6f 15
marcel1691 3:8725b25bcb6f 16 /*
marcel1691 3:8725b25bcb6f 17 * Modified by Neal Horman 7/14/2012 for use in mbed
marcel1691 3:8725b25bcb6f 18 */
marcel1691 3:8725b25bcb6f 19
marcel1691 3:8725b25bcb6f 20 #ifndef _ADAFRUIT_GFX_H_
marcel1691 3:8725b25bcb6f 21 #define _ADAFRUIT_GFX_H_
marcel1691 3:8725b25bcb6f 22
marcel1691 3:8725b25bcb6f 23 #include "Adafruit_GFX_Config.h"
marcel1691 3:8725b25bcb6f 24
marcel1691 3:8725b25bcb6f 25 static inline void swap(int16_t &a, int16_t &b)
marcel1691 3:8725b25bcb6f 26 {
marcel1691 3:8725b25bcb6f 27 int16_t t = a;
marcel1691 3:8725b25bcb6f 28
marcel1691 3:8725b25bcb6f 29 a = b;
marcel1691 3:8725b25bcb6f 30 b = t;
marcel1691 3:8725b25bcb6f 31 }
marcel1691 3:8725b25bcb6f 32
marcel1691 3:8725b25bcb6f 33 #ifndef _BV
marcel1691 3:8725b25bcb6f 34 #define _BV(bit) (1<<(bit))
marcel1691 3:8725b25bcb6f 35 #endif
marcel1691 3:8725b25bcb6f 36
marcel1691 3:8725b25bcb6f 37 #define BLACK 0
marcel1691 3:8725b25bcb6f 38 #define WHITE 1
marcel1691 3:8725b25bcb6f 39
marcel1691 3:8725b25bcb6f 40 /**
marcel1691 3:8725b25bcb6f 41 * This is a Text and Graphics element drawing class.
marcel1691 3:8725b25bcb6f 42 * These functions draw to the display buffer.
marcel1691 3:8725b25bcb6f 43 *
marcel1691 3:8725b25bcb6f 44 * Display drivers should be derived from here.
marcel1691 3:8725b25bcb6f 45 * The Display drivers push the display buffer to the
marcel1691 3:8725b25bcb6f 46 * hardware based on application control.
marcel1691 3:8725b25bcb6f 47 *
marcel1691 3:8725b25bcb6f 48 */
marcel1691 3:8725b25bcb6f 49 class Adafruit_GFX : public Stream
marcel1691 3:8725b25bcb6f 50 {
marcel1691 3:8725b25bcb6f 51 public:
marcel1691 3:8725b25bcb6f 52 Adafruit_GFX(int16_t w, int16_t h)
marcel1691 3:8725b25bcb6f 53 : _rawWidth(w)
marcel1691 3:8725b25bcb6f 54 , _rawHeight(h)
marcel1691 3:8725b25bcb6f 55 , _width(w)
marcel1691 3:8725b25bcb6f 56 , _height(h)
marcel1691 3:8725b25bcb6f 57 , cursor_x(0)
marcel1691 3:8725b25bcb6f 58 , cursor_y(0)
marcel1691 3:8725b25bcb6f 59 , textcolor(WHITE)
marcel1691 3:8725b25bcb6f 60 , textbgcolor(BLACK)
marcel1691 3:8725b25bcb6f 61 , textsize(1)
marcel1691 3:8725b25bcb6f 62 , rotation(0)
marcel1691 3:8725b25bcb6f 63 , wrap(true)
marcel1691 3:8725b25bcb6f 64 {};
marcel1691 3:8725b25bcb6f 65
marcel1691 3:8725b25bcb6f 66 /// Paint one BLACK or WHITE pixel in the display buffer
marcel1691 3:8725b25bcb6f 67 // this must be defined by the subclass
marcel1691 3:8725b25bcb6f 68 virtual void drawPixel(int16_t x, int16_t y, uint16_t color) = 0;
marcel1691 3:8725b25bcb6f 69 // this is optional
marcel1691 3:8725b25bcb6f 70 virtual void invertDisplay(bool i) {};
marcel1691 3:8725b25bcb6f 71
marcel1691 3:8725b25bcb6f 72 // Stream implementation - provides printf() interface
marcel1691 3:8725b25bcb6f 73 // You would otherwise be forced to use writeChar()
marcel1691 3:8725b25bcb6f 74 virtual int _putc(int value) { return writeChar(value); };
marcel1691 3:8725b25bcb6f 75 virtual int _getc() { return -1; };
marcel1691 3:8725b25bcb6f 76
marcel1691 3:8725b25bcb6f 77 #ifdef GFX_WANT_ABSTRACTS
marcel1691 3:8725b25bcb6f 78 // these are 'generic' drawing functions, so we can share them!
marcel1691 3:8725b25bcb6f 79
marcel1691 3:8725b25bcb6f 80 /** Draw a Horizontal Line
marcel1691 3:8725b25bcb6f 81 * @note GFX_WANT_ABSTRACTS must be defined in Adafruit_GFX_config.h
marcel1691 3:8725b25bcb6f 82 */
marcel1691 3:8725b25bcb6f 83 virtual void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
marcel1691 3:8725b25bcb6f 84 /** Draw a rectangle
marcel1691 3:8725b25bcb6f 85 * @note GFX_WANT_ABSTRACTS must be defined in Adafruit_GFX_config.h
marcel1691 3:8725b25bcb6f 86 */
marcel1691 3:8725b25bcb6f 87 virtual void drawRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
marcel1691 3:8725b25bcb6f 88 /** Fill the entire display
marcel1691 3:8725b25bcb6f 89 * @note GFX_WANT_ABSTRACTS must be defined in Adafruit_GFX_config.h
marcel1691 3:8725b25bcb6f 90 */
marcel1691 3:8725b25bcb6f 91 virtual void fillScreen(uint16_t color);
marcel1691 3:8725b25bcb6f 92
marcel1691 3:8725b25bcb6f 93 /** Draw a circle
marcel1691 3:8725b25bcb6f 94 * @note GFX_WANT_ABSTRACTS must be defined in Adafruit_GFX_config.h
marcel1691 3:8725b25bcb6f 95 */
marcel1691 3:8725b25bcb6f 96 void drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color);
marcel1691 3:8725b25bcb6f 97 void drawCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername, uint16_t color);
marcel1691 3:8725b25bcb6f 98
marcel1691 3:8725b25bcb6f 99 /** Draw and fill a circle
marcel1691 3:8725b25bcb6f 100 * @note GFX_WANT_ABSTRACTS must be defined in Adafruit_GFX_config.h
marcel1691 3:8725b25bcb6f 101 */
marcel1691 3:8725b25bcb6f 102 void fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color);
marcel1691 3:8725b25bcb6f 103 void fillCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername, int16_t delta, uint16_t color);
marcel1691 3:8725b25bcb6f 104
marcel1691 3:8725b25bcb6f 105 /** Draw a triangle
marcel1691 3:8725b25bcb6f 106 * @note GFX_WANT_ABSTRACTS must be defined in Adafruit_GFX_config.h
marcel1691 3:8725b25bcb6f 107 */
marcel1691 3:8725b25bcb6f 108 void drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color);
marcel1691 3:8725b25bcb6f 109 /** Draw and fill a triangle
marcel1691 3:8725b25bcb6f 110 * @note GFX_WANT_ABSTRACTS must be defined in Adafruit_GFX_config.h
marcel1691 3:8725b25bcb6f 111 */
marcel1691 3:8725b25bcb6f 112 void fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color);
marcel1691 3:8725b25bcb6f 113
marcel1691 3:8725b25bcb6f 114 /** Draw a rounded rectangle
marcel1691 3:8725b25bcb6f 115 * @note GFX_WANT_ABSTRACTS must be defined in Adafruit_GFX_config.h
marcel1691 3:8725b25bcb6f 116 */
marcel1691 3:8725b25bcb6f 117 void drawRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color);
marcel1691 3:8725b25bcb6f 118 /** Draw and fill a rounded rectangle
marcel1691 3:8725b25bcb6f 119 * @note GFX_WANT_ABSTRACTS must be defined in Adafruit_GFX_config.h
marcel1691 3:8725b25bcb6f 120 */
marcel1691 3:8725b25bcb6f 121 void fillRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color);
marcel1691 3:8725b25bcb6f 122 /** Draw a bitmap
marcel1691 3:8725b25bcb6f 123 * @note GFX_WANT_ABSTRACTS must be defined in Adafruit_GFX_config.h
marcel1691 3:8725b25bcb6f 124 */
marcel1691 3:8725b25bcb6f 125 void drawBitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t color);
marcel1691 3:8725b25bcb6f 126 #endif
marcel1691 3:8725b25bcb6f 127
marcel1691 3:8725b25bcb6f 128 #if defined(GFX_WANT_ABSTRACTS) || defined(GFX_SIZEABLE_TEXT)
marcel1691 3:8725b25bcb6f 129 /** Draw a line
marcel1691 3:8725b25bcb6f 130 * @note GFX_WANT_ABSTRACTS or GFX_SIZEABLE_TEXT must be defined in Adafruit_GFX_config.h
marcel1691 3:8725b25bcb6f 131 */
marcel1691 3:8725b25bcb6f 132 virtual void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color);
marcel1691 3:8725b25bcb6f 133 /** Draw a vertical line
marcel1691 3:8725b25bcb6f 134 * @note GFX_WANT_ABSTRACTS or GFX_SIZEABLE_TEXT must be defined in Adafruit_GFX_config.h
marcel1691 3:8725b25bcb6f 135 */
marcel1691 3:8725b25bcb6f 136 virtual void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
marcel1691 3:8725b25bcb6f 137 /** Draw and fill a rectangle
marcel1691 3:8725b25bcb6f 138 * @note GFX_WANT_ABSTRACTS or GFX_SIZEABLE_TEXT must be defined in Adafruit_GFX_config.h
marcel1691 3:8725b25bcb6f 139 */
marcel1691 3:8725b25bcb6f 140 virtual void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
marcel1691 3:8725b25bcb6f 141 #endif
marcel1691 3:8725b25bcb6f 142
marcel1691 3:8725b25bcb6f 143 /// Draw a text character at a specified pixel location
marcel1691 3:8725b25bcb6f 144 void drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t bg, uint8_t size);
marcel1691 3:8725b25bcb6f 145 /// Draw a text character at the text cursor location
marcel1691 3:8725b25bcb6f 146 size_t writeChar(uint8_t);
marcel1691 3:8725b25bcb6f 147
marcel1691 3:8725b25bcb6f 148 /// Get the width of the display in pixels
marcel1691 3:8725b25bcb6f 149 inline int16_t width(void) { return _width; };
marcel1691 3:8725b25bcb6f 150 /// Get the height of the display in pixels
marcel1691 3:8725b25bcb6f 151 inline int16_t height(void) { return _height; };
marcel1691 3:8725b25bcb6f 152
marcel1691 3:8725b25bcb6f 153 /// Set the text cursor location, based on the size of the text
marcel1691 3:8725b25bcb6f 154 inline void setTextCursor(int16_t x, int16_t y) { cursor_x = x; cursor_y = y; };
marcel1691 3:8725b25bcb6f 155 #if defined(GFX_WANT_ABSTRACTS) || defined(GFX_SIZEABLE_TEXT)
marcel1691 3:8725b25bcb6f 156 /** Set the size of the text to be drawn
marcel1691 3:8725b25bcb6f 157 * @note Make sure to enable either GFX_SIZEABLE_TEXT or GFX_WANT_ABSTRACTS
marcel1691 3:8725b25bcb6f 158 */
marcel1691 3:8725b25bcb6f 159 inline void setTextSize(uint8_t s) { textsize = (s > 0) ? s : 1; };
marcel1691 3:8725b25bcb6f 160 #endif
marcel1691 3:8725b25bcb6f 161 /// Set the text foreground and background colors to be the same
marcel1691 3:8725b25bcb6f 162 inline void setTextColor(uint16_t c) { textcolor = c; textbgcolor = c; }
marcel1691 3:8725b25bcb6f 163 /// Set the text foreground and background colors independantly
marcel1691 3:8725b25bcb6f 164 inline void setTextColor(uint16_t c, uint16_t b) { textcolor = c; textbgcolor = b; };
marcel1691 3:8725b25bcb6f 165 /// Set text wraping mode true or false
marcel1691 3:8725b25bcb6f 166 inline void setTextWrap(bool w) { wrap = w; };
marcel1691 3:8725b25bcb6f 167
marcel1691 3:8725b25bcb6f 168 /// Set the display rotation, 1, 2, 3, or 4
marcel1691 3:8725b25bcb6f 169 void setRotation(uint8_t r);
marcel1691 3:8725b25bcb6f 170 /// Get the current rotation
marcel1691 3:8725b25bcb6f 171 inline uint8_t getRotation(void) { rotation %= 4; return rotation; };
marcel1691 3:8725b25bcb6f 172
marcel1691 3:8725b25bcb6f 173 protected:
marcel1691 3:8725b25bcb6f 174 int16_t _rawWidth, _rawHeight; // this is the 'raw' display w/h - never changes
marcel1691 3:8725b25bcb6f 175 int16_t _width, _height; // dependent on rotation
marcel1691 3:8725b25bcb6f 176 int16_t cursor_x, cursor_y;
marcel1691 3:8725b25bcb6f 177 uint16_t textcolor, textbgcolor;
marcel1691 3:8725b25bcb6f 178 uint8_t textsize;
marcel1691 3:8725b25bcb6f 179 uint8_t rotation;
marcel1691 3:8725b25bcb6f 180 bool wrap; // If set, 'wrap' text at right edge of display
marcel1691 3:8725b25bcb6f 181 };
marcel1691 3:8725b25bcb6f 182
marcel1691 3:8725b25bcb6f 183 #endif