PN532 NFC library for Seeed Studio's NFC Shield

Fork of PN532 by Yihui Xiong

Files at this revision

API Documentation at this revision

Comitter:
screamer
Date:
Tue Mar 25 16:00:44 2014 +0000
Parent:
4:0774b8298eb8
Child:
7:26c1b3b6c192
Commit message:
Improved documentation

Changed in this revision

PN532.h Show annotated file Show diff for this revision Revisions of this file
PN532Interface.h Show annotated file Show diff for this revision Revisions of this file
llcp.h Show annotated file Show diff for this revision Revisions of this file
mac_link.h Show annotated file Show diff for this revision Revisions of this file
snep.h Show annotated file Show diff for this revision Revisions of this file
--- a/PN532.h	Thu Nov 21 04:41:47 2013 +0000
+++ b/PN532.h	Tue Mar 25 16:00:44 2014 +0000
@@ -108,6 +108,9 @@
 #define PN532_GPIO_P34                      (4)
 #define PN532_GPIO_P35                      (5)
 
+/**
+ * The PN532 class
+ */
 class PN532
 {
 public:
@@ -123,12 +126,12 @@
     bool setPassiveActivationRetries(uint8_t maxRetries);
 
     /**
-    * @brief    Init PN532 as a target
-    * @param    timeout max time to wait, 0 means no timeout
-    * @return   > 0     success
-    *           = 0     timeout
-    *           < 0     failed
-    */
+     * @brief    Init PN532 as a target
+     * @param    timeout max time to wait, 0 means no timeout
+     * @return   > 0     success
+     *           = 0     timeout
+     *           < 0     failed
+     */
     int8_t tgInitAsTarget(uint16_t timeout = 0);
     int8_t tgInitAsTarget(const uint8_t* command, const uint8_t len, const uint16_t timeout = 0);
 
--- a/PN532Interface.h	Thu Nov 21 04:41:47 2013 +0000
+++ b/PN532Interface.h	Tue Mar 25 16:00:44 2014 +0000
@@ -24,6 +24,9 @@
                                       b = (b & 0xCC) >> 2 | (b & 0x33) << 2; \
                                       b = (b & 0xAA) >> 1 | (b & 0x55) << 1
 
+/**
+ * The PN532Interface class
+ */
 class PN532Interface
 {
 public:
@@ -31,24 +34,24 @@
     virtual void wakeup() = 0;
 
     /**
-    * @brief    write a command and check ack
-    * @param    header  packet header
-    * @param    hlen    length of header
-    * @param    body    packet body
-    * @param    blen    length of body
-    * @return   0       success
-    *           not 0   failed
-    */
+     * @brief    write a command and check ack
+     * @param    header  packet header
+     * @param    hlen    length of header
+     * @param    body    packet body
+     * @param    blen    length of body
+     * @return   0       success
+     *           not 0   failed
+     */
     virtual int8_t writeCommand(const uint8_t *header, uint8_t hlen, const uint8_t *body = 0, uint8_t blen = 0) = 0;
 
     /**
-    * @brief    read the response of a command, strip prefix and suffix
-    * @param    buf     to contain the response data
-    * @param    len     lenght to read
-    * @param    timeout max time to wait, 0 means no timeout
-    * @return   >=0     length of response without prefix and suffix
-    *           <0      failed to read response
-    */
+     * @brief    read the response of a command, strip prefix and suffix
+     * @param    buf     to contain the response data
+     * @param    len     lenght to read
+     * @param    timeout max time to wait, 0 means no timeout
+     * @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;
 };
 
--- a/llcp.h	Thu Nov 21 04:41:47 2013 +0000
+++ b/llcp.h	Tue Mar 25 16:00:44 2014 +0000
@@ -8,6 +8,9 @@
 #define LLCP_DEFAULT_DSAP     0x04
 #define LLCP_DEFAULT_SSAP     0x20
 
+/**
+ * The LLCP class
+ */
 class LLCP {
 public:
 	LLCP(PN532Interface &interface) : link(interface) {
@@ -17,12 +20,12 @@
 	};
 
 	/**
-    * @brief    Actiave PN532 as a target
-    * @param    timeout max time to wait, 0 means no timeout
-    * @return   > 0     success
-    *           = 0     timeout
-    *           < 0     failed
-    */
+     * @brief    Actiave PN532 as a target
+     * @param    timeout max time to wait, 0 means no timeout
+     * @return   > 0     success
+     *           = 0     timeout
+     *           < 0     failed
+     */
 	int8_t activate(uint16_t timeout = 0);
 
     int8_t waitForConnection(uint16_t timeout = LLCP_DEFAULT_TIMEOUT);
@@ -34,23 +37,23 @@
     int8_t disconnect(uint16_t timeout = LLCP_DEFAULT_TIMEOUT);
 
 	/**
-    * @brief    write a packet, the packet should be less than (255 - 2) bytes
-    * @param    header  packet header
-    * @param    hlen    length of header
-    * @param    body    packet body
-    * @param    blen    length of body
-    * @return   true    success
-    *           false   failed
-    */
+     * @brief    write a packet, the packet should be less than (255 - 2) bytes
+     * @param    header  packet header
+     * @param    hlen    length of header
+     * @param    body    packet body
+     * @param    blen    length of body
+     * @return   true    success
+     *           false   failed
+     */
     bool write(const uint8_t *header, uint8_t hlen, const uint8_t *body = 0, uint8_t blen = 0);
 
     /**
-    * @brief    read a  packet, the packet will be less than (255 - 2) bytes
-    * @param    buf     the buffer to contain the packet
-    * @param    len     lenght of the buffer
-    * @return   >=0     length of the packet 
-    *           <0      failed
-    */
+     * @brief    read a  packet, the packet will be less than (255 - 2) bytes
+     * @param    buf     the buffer to contain the packet
+     * @param    len     lenght of the buffer
+     * @return   >=0     length of the packet 
+     *           <0      failed
+     */
     int16_t read(uint8_t *buf, uint8_t len);
 
     uint8_t *getHeaderBuffer(uint8_t *len) {
--- a/mac_link.h	Thu Nov 21 04:41:47 2013 +0000
+++ b/mac_link.h	Tue Mar 25 16:00:44 2014 +0000
@@ -5,6 +5,9 @@
 
 #include "PN532.h"
 
+/**
+ * The MACLink class
+ */
 class MACLink {
 public:
     MACLink(PN532Interface &interface) : pn532(interface) {
@@ -12,32 +15,32 @@
     };
     
     /**
-    * @brief    Activate PN532 as a target
-    * @param    timeout max time to wait, 0 means no timeout
-    * @return   > 0     success
-    *           = 0     timeout
-    *           < 0     failed
-    */
+     * @brief    Activate PN532 as a target
+     * @param    timeout max time to wait, 0 means no timeout
+     * @return   > 0     success
+     *           = 0     timeout
+     *           < 0     failed
+     */
     int8_t activateAsTarget(uint16_t timeout = 0);
 
     /**
-    * @brief    write a PDU packet, the packet should be less than (255 - 2) bytes
-    * @param    header  packet header
-    * @param    hlen    length of header
-    * @param 	body	packet body
-    * @param 	blen	length of body
-    * @return   true    success
-    *           false   failed
-    */
+     * @brief    write a PDU packet, the packet should be less than (255 - 2) bytes
+     * @param    header  packet header
+     * @param    hlen    length of header
+     * @param    body    packet body
+     * @param    blen    length of body
+     * @return   true    success
+     *           false   failed
+     */
     bool write(const uint8_t *header, uint8_t hlen, const uint8_t *body = 0, uint8_t blen = 0);
 
     /**
-    * @brief    read a PDU packet, the packet will be less than (255 - 2) bytes
-    * @param    buf     the buffer to contain the PDU packet
-    * @param    len     lenght of the buffer
-    * @return   >=0     length of the PDU packet 
-    *           <0      failed
-    */
+     * @brief    read a PDU packet, the packet will be less than (255 - 2) bytes
+     * @param    buf     the buffer to contain the PDU packet
+     * @param    len     lenght of the buffer
+     * @return   >=0     length of the PDU packet 
+     *           <0      failed
+     */
     int16_t read(uint8_t *buf, uint8_t len);
 
     uint8_t *getHeaderBuffer(uint8_t *len) {
--- a/snep.h	Thu Nov 21 04:41:47 2013 +0000
+++ b/snep.h	Tue Mar 25 16:00:44 2014 +0000
@@ -13,6 +13,9 @@
 #define SNEP_RESPONSE_SUCCESS	0x81
 #define SNEP_RESPONSE_REJECT	0xFF
 
+/**
+ * The SNEP class
+ */
 class SNEP {
 public:
 	SNEP(PN532Interface &interface) : llcp(interface) {
@@ -20,24 +23,24 @@
 	};
 
 	/**
-    * @brief    write a SNEP packet, the packet should be less than (255 - 2 - 3) bytes
-    * @param    buf     the buffer to contain the packet
-    * @param    len     lenght of the buffer
-    * @param    timeout max time to wait, 0 means no timeout
-    * @return   >0      success
-    *			=0      timeout
-    *           <0      failed
-    */
+     * @brief    write a SNEP packet, the packet should be less than (255 - 2 - 3) bytes
+     * @param    buf     the buffer to contain the packet
+     * @param    len     lenght of the buffer
+     * @param    timeout max time to wait, 0 means no timeout
+     * @return   >0      success
+     *			=0      timeout
+     *           <0      failed
+     */
     int8_t write(const uint8_t *buf, uint8_t len, uint16_t timeout = 0);
 
     /**
-    * @brief    read a SNEP packet, the packet will be less than (255 - 2 - 3) bytes
-    * @param    buf     the buffer to contain the packet
-    * @param    len     lenght of the buffer
-    * @param    timeout max time to wait, 0 means no timeout
-    * @return   >=0     length of the packet 
-    *           <0      failed
-    */
+     * @brief    read a SNEP packet, the packet will be less than (255 - 2 - 3) bytes
+     * @param    buf     the buffer to contain the packet
+     * @param    len     lenght of the buffer
+     * @param    timeout max time to wait, 0 means no timeout
+     * @return   >=0     length of the packet 
+     *           <0      failed
+     */
     int16_t read(uint8_t *buf, uint8_t len, uint16_t timeout = 0);
 
 private: