PN532 NFC library for Seeed Studio's NFC Shield
Fork of PN532 by
Diff: PN532Interface.h
- Revision:
- 1:b8cab5222fd0
- Parent:
- 0:9c6b9280c0e1
- Child:
- 3:4189a10038e6
--- a/PN532Interface.h Tue Oct 08 08:33:22 2013 +0000 +++ b/PN532Interface.h Thu Oct 17 06:37:26 2013 +0000 @@ -3,6 +3,8 @@ #ifndef __PN532_INTERFACE_H__ #define __PN532_INTERFACE_H__ +#include <stdint.h> + #define PN532_PREAMBLE (0x00) #define PN532_STARTCODE1 (0x00) #define PN532_STARTCODE2 (0xFF) @@ -19,14 +21,15 @@ #define PN532_NO_SPACE (-4) #define REVERSE_BITS_ORDER(b) b = (b & 0xF0) >> 4 | (b & 0x0F) << 4; \ - b = (b & 0xCC) >> 2 | (b & 0x33) << 2; \ - b = (b & 0xAA) >> 1 | (b & 0x55) << 1 + b = (b & 0xCC) >> 2 | (b & 0x33) << 2; \ + b = (b & 0xAA) >> 1 | (b & 0x55) << 1 -class PN532Interface { +class PN532Interface +{ public: virtual void begin() = 0; virtual void wakeup() = 0; - + /** * @brief write a command and check ack * @param buf command to write, not contain prefix and suffix @@ -35,7 +38,7 @@ * not 0 failed */ virtual int8_t writeCommand(const uint8_t buf[], uint8_t len) = 0; - + /** * @brief read the response of a command, strip prefix and suffix * @param buf to contain the response data @@ -44,7 +47,7 @@ * @return >=0 length of response without prefix and suffix * <0 failed to read response */ - virtual int16_t readResponse(uint8_t buf[], uint8_t len, uint16_t timeout = 1000) = 0; + virtual int16_t readResponse(uint8_t buf[], uint8_t len, uint16_t timeout = 1000) = 0; }; #endif