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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers PN532_HSU.h Source File

PN532_HSU.h

00001 
00002 #ifndef __PN532_HSU_H__
00003 #define __PN532_HSU_H__
00004 
00005 #include "PN532Interface.h"
00006 #include "Arduino.h"
00007 
00008 #define PN532_HSU_DEBUG
00009 
00010 #define PN532_HSU_READ_TIMEOUT                      (1000)
00011 
00012 class PN532_HSU : public PN532Interface {
00013 public:
00014     PN532_HSU(HardwareSerial &serial);
00015     
00016     virtual void begin();
00017     virtual void wakeup();
00018     virtual int8_t writeCommand(const uint8_t *header, uint8_t hlen, const uint8_t *body = 0, uint8_t blen = 0);
00019     virtual int16_t readResponse(uint8_t buf[], uint8_t len, uint16_t timeout);
00020     
00021 private:
00022     HardwareSerial* _serial;
00023     uint8_t command;
00024     
00025     int8_t readAckFrame();
00026     
00027     int8_t receive(uint8_t *buf, int len, uint16_t timeout=PN532_HSU_READ_TIMEOUT);
00028 };
00029 
00030 #endif