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.

Dependents:   PN532_ReadUid Nfctest2

Committer:
dotnfc
Date:
Tue Sep 13 06:17:35 2016 +0000
Revision:
1:b5922b3b3257
Parent:
0:db8030e71f55
Remove ununsed files.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dotnfc 0:db8030e71f55 1
dotnfc 0:db8030e71f55 2
dotnfc 0:db8030e71f55 3 #ifndef __SNEP_H__
dotnfc 0:db8030e71f55 4 #define __SNEP_H__
dotnfc 0:db8030e71f55 5
dotnfc 0:db8030e71f55 6 #include "llcp.h"
dotnfc 0:db8030e71f55 7
dotnfc 0:db8030e71f55 8 #define SNEP_DEFAULT_VERSION 0x10 // Major: 1, Minor: 0
dotnfc 0:db8030e71f55 9
dotnfc 0:db8030e71f55 10 #define SNEP_REQUEST_PUT 0x02
dotnfc 0:db8030e71f55 11 #define SNEP_REQUEST_GET 0x01
dotnfc 0:db8030e71f55 12
dotnfc 0:db8030e71f55 13 #define SNEP_RESPONSE_SUCCESS 0x81
dotnfc 0:db8030e71f55 14 #define SNEP_RESPONSE_REJECT 0xFF
dotnfc 0:db8030e71f55 15
dotnfc 0:db8030e71f55 16 class SNEP {
dotnfc 0:db8030e71f55 17 public:
dotnfc 0:db8030e71f55 18 SNEP(PN532Interface &interface) : llcp(interface) {
dotnfc 0:db8030e71f55 19 headerBuf = llcp.getHeaderBuffer(&headerBufLen);
dotnfc 0:db8030e71f55 20 };
dotnfc 0:db8030e71f55 21
dotnfc 0:db8030e71f55 22 /**
dotnfc 0:db8030e71f55 23 * @brief write a SNEP packet, the packet should be less than (255 - 2 - 3) bytes
dotnfc 0:db8030e71f55 24 * @param buf the buffer to contain the packet
dotnfc 0:db8030e71f55 25 * @param len lenght of the buffer
dotnfc 0:db8030e71f55 26 * @param timeout max time to wait, 0 means no timeout
dotnfc 0:db8030e71f55 27 * @return >0 success
dotnfc 0:db8030e71f55 28 * =0 timeout
dotnfc 0:db8030e71f55 29 * <0 failed
dotnfc 0:db8030e71f55 30 */
dotnfc 0:db8030e71f55 31 int8_t write(const uint8_t *buf, uint8_t len, uint16_t timeout = 0);
dotnfc 0:db8030e71f55 32
dotnfc 0:db8030e71f55 33 /**
dotnfc 0:db8030e71f55 34 * @brief read a SNEP packet, the packet will be less than (255 - 2 - 3) bytes
dotnfc 0:db8030e71f55 35 * @param buf the buffer to contain the packet
dotnfc 0:db8030e71f55 36 * @param len lenght of the buffer
dotnfc 0:db8030e71f55 37 * @param timeout max time to wait, 0 means no timeout
dotnfc 0:db8030e71f55 38 * @return >=0 length of the packet
dotnfc 0:db8030e71f55 39 * <0 failed
dotnfc 0:db8030e71f55 40 */
dotnfc 0:db8030e71f55 41 int16_t read(uint8_t *buf, uint8_t len, uint16_t timeout = 0);
dotnfc 0:db8030e71f55 42
dotnfc 0:db8030e71f55 43 private:
dotnfc 0:db8030e71f55 44 LLCP llcp;
dotnfc 0:db8030e71f55 45 uint8_t *headerBuf;
dotnfc 0:db8030e71f55 46 uint8_t headerBufLen;
dotnfc 0:db8030e71f55 47 };
dotnfc 0:db8030e71f55 48
dotnfc 0:db8030e71f55 49 #endif // __SNEP_H__