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
Diff: PN532_IF/PN532_HSU.h
- Revision:
- 0:db8030e71f55
diff -r 000000000000 -r db8030e71f55 PN532_IF/PN532_HSU.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PN532_IF/PN532_HSU.h Tue Sep 13 06:01:19 2016 +0000 @@ -0,0 +1,30 @@ + +#ifndef __PN532_HSU_H__ +#define __PN532_HSU_H__ + +#include "PN532Interface.h" +#include "Arduino.h" + +#define PN532_HSU_DEBUG + +#define PN532_HSU_READ_TIMEOUT (1000) + +class PN532_HSU : public PN532Interface { +public: + PN532_HSU(HardwareSerial &serial); + + virtual void begin(); + virtual void wakeup(); + virtual int8_t writeCommand(const uint8_t *header, uint8_t hlen, const uint8_t *body = 0, uint8_t blen = 0); + virtual int16_t readResponse(uint8_t buf[], uint8_t len, uint16_t timeout); + +private: + HardwareSerial* _serial; + uint8_t command; + + int8_t readAckFrame(); + + int8_t receive(uint8_t *buf, int len, uint16_t timeout=PN532_HSU_READ_TIMEOUT); +}; + +#endif