PN532 Driver library This library provides an abstract API to drive the pn532 nfc chip, with I2C/HSU/SPI interface. Its based on the Seeed Studio's Arduino version.
HardwareSerial.h@2:ae258f195bbd, 2020-06-26 (annotated)
- Committer:
- maximemau
- Date:
- Fri Jun 26 09:16:19 2020 +0000
- Revision:
- 2:ae258f195bbd
- Parent:
- 0:db8030e71f55
lib_pn532
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dotnfc | 0:db8030e71f55 | 1 | /* |
dotnfc | 0:db8030e71f55 | 2 | Copyright (c) 2011 Arduino. All right reserved. |
dotnfc | 0:db8030e71f55 | 3 | |
dotnfc | 0:db8030e71f55 | 4 | This library is free software; you can redistribute it and/or |
dotnfc | 0:db8030e71f55 | 5 | modify it under the terms of the GNU Lesser General Public |
dotnfc | 0:db8030e71f55 | 6 | License as published by the Free Software Foundation; either |
dotnfc | 0:db8030e71f55 | 7 | version 2.1 of the License, or (at your option) any later version. |
dotnfc | 0:db8030e71f55 | 8 | |
dotnfc | 0:db8030e71f55 | 9 | This library is distributed in the hope that it will be useful, |
dotnfc | 0:db8030e71f55 | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
dotnfc | 0:db8030e71f55 | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
dotnfc | 0:db8030e71f55 | 12 | See the GNU Lesser General Public License for more details. |
dotnfc | 0:db8030e71f55 | 13 | |
dotnfc | 0:db8030e71f55 | 14 | You should have received a copy of the GNU Lesser General Public |
dotnfc | 0:db8030e71f55 | 15 | License along with this library; if not, write to the Free Software |
dotnfc | 0:db8030e71f55 | 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
dotnfc | 0:db8030e71f55 | 17 | */ |
dotnfc | 0:db8030e71f55 | 18 | |
dotnfc | 0:db8030e71f55 | 19 | #ifndef __HARDWARESERIAL_H |
dotnfc | 0:db8030e71f55 | 20 | #define __HARDWARESERIAL_H |
dotnfc | 0:db8030e71f55 | 21 | |
dotnfc | 0:db8030e71f55 | 22 | #include "mbed.h" |
dotnfc | 0:db8030e71f55 | 23 | #include <inttypes.h> |
dotnfc | 0:db8030e71f55 | 24 | #include "BufferedSerial.h" |
dotnfc | 0:db8030e71f55 | 25 | |
dotnfc | 0:db8030e71f55 | 26 | |
dotnfc | 0:db8030e71f55 | 27 | class HardwareSerial : public BufferedSerial |
dotnfc | 0:db8030e71f55 | 28 | { |
dotnfc | 0:db8030e71f55 | 29 | public: |
dotnfc | 0:db8030e71f55 | 30 | HardwareSerial (PinName tx, PinName rx) : BufferedSerial (tx, rx) { |
dotnfc | 0:db8030e71f55 | 31 | |
dotnfc | 0:db8030e71f55 | 32 | } |
dotnfc | 0:db8030e71f55 | 33 | //virtual void begin(unsigned long) = 0; |
dotnfc | 0:db8030e71f55 | 34 | //virtual void end() = 0; |
dotnfc | 0:db8030e71f55 | 35 | //virtual int available(void) = 0; |
dotnfc | 0:db8030e71f55 | 36 | //virtual int peek(void) = 0; |
dotnfc | 0:db8030e71f55 | 37 | //virtual int read(void) = 0; |
dotnfc | 0:db8030e71f55 | 38 | //virtual void flush(void) = 0; |
dotnfc | 0:db8030e71f55 | 39 | // inline size_t write(uint8_t val) { |
dotnfc | 0:db8030e71f55 | 40 | // putc (val); |
dotnfc | 0:db8030e71f55 | 41 | // return 1; |
dotnfc | 0:db8030e71f55 | 42 | // } |
dotnfc | 0:db8030e71f55 | 43 | |
dotnfc | 0:db8030e71f55 | 44 | // inline size_t write(const uint8_t *buffer, size_t size) { |
dotnfc | 0:db8030e71f55 | 45 | // size_t i ; |
dotnfc | 0:db8030e71f55 | 46 | // for (i = 0; i < size; i ++) |
dotnfc | 0:db8030e71f55 | 47 | // putc (buffer[i]); |
dotnfc | 0:db8030e71f55 | 48 | // |
dotnfc | 0:db8030e71f55 | 49 | // return size; |
dotnfc | 0:db8030e71f55 | 50 | // } |
dotnfc | 0:db8030e71f55 | 51 | |
dotnfc | 0:db8030e71f55 | 52 | //using Print::write; // pull in write(str) and write(buf, size) from Print |
dotnfc | 0:db8030e71f55 | 53 | //virtual operator bool() = 0; |
dotnfc | 0:db8030e71f55 | 54 | }; |
dotnfc | 0:db8030e71f55 | 55 | |
dotnfc | 0:db8030e71f55 | 56 | extern void serialEventRun(void) __attribute__((weak)); |
dotnfc | 0:db8030e71f55 | 57 | |
dotnfc | 0:db8030e71f55 | 58 | #endif // __HARDWARESERIAL_H |
dotnfc | 0:db8030e71f55 | 59 |