Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of PN532 by
Revision 9:70abe4844114, committed 2016-02-10
- Comitter:
- stanvn
- Date:
- Wed Feb 10 10:25:02 2016 +0000
- Parent:
- 8:30bba738e292
- Child:
- 10:2fcf2448d199
- Commit message:
- An RTQA/B can be send using the function sendRequestCommand
Changed in this revision
| PN532.cpp | Show annotated file Show diff for this revision Revisions of this file |
| PN532.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/PN532.cpp Wed Feb 10 08:41:44 2016 +0000
+++ b/PN532.cpp Wed Feb 10 10:25:02 2016 +0000
@@ -409,6 +409,42 @@
return 1;
}
+uint8_t* PN532::sendRequestCommand(uint8_t cardbaudrate, uint16_t timeout){
+ // for the request commands see: http://www.nxp.com/documents/user_manual/141520.pdf
+ // the InListPassiveTarget command is explaned at page 115
+ pn532_packetbuffer[0] = PN532_COMMAND_INLISTPASSIVETARGET;
+ pn532_packetbuffer[1] = 1; // max 1 cards at once (we can set this to 2 later)
+ pn532_packetbuffer[2] = cardbaudrate;
+ if(cardbaudrate == PN532_MIFARE_ISO14443B){
+ //printf("tag-type = type b");
+ pn532_packetbuffer[3] = 0;
+ pn532_packetbuffer[4] = 0x01;
+ }
+
+ if (HAL(writeCommand)(pn532_packetbuffer, 5)) {
+ return 0x0; // command failed
+ }
+
+ // read data packet
+ if (HAL(readResponse)(pn532_packetbuffer, sizeof(pn532_packetbuffer), timeout) < 0) {
+ return 0x0;
+ }
+ if (pn532_packetbuffer[0] != 1)
+ return 0;
+ // check some basic stuff
+ /* ISO14443A card response should be in the following format:
+
+ byte Description
+ ------------- ------------------------------------------
+ b0 Tags Found
+ b1 Tag Number (only one used in this example)
+ b2..3 SENS_RES
+ b4 SEL_RES
+ b5 NFCID Length
+ b6..NFCIDLen NFCID
+ */
+ return pn532_packetbuffer;
+}
/***** Mifare Classic Functions ******/
/**************************************************************************/
@@ -438,6 +474,7 @@
return ((uiBlock + 1) % 4 == 0);
else
return ((uiBlock + 1) % 16 == 0);
+
}
/**************************************************************************/
--- a/PN532.h Wed Feb 10 08:41:44 2016 +0000
+++ b/PN532.h Wed Feb 10 10:25:02 2016 +0000
@@ -51,6 +51,7 @@
#define PN532_MIFARE_ISO14443A (0x00)
+#define PN532_MIFARE_ISO14443B (0x03)
// Mifare Commands
#define MIFARE_CMD_AUTH_A (0x60)
@@ -146,6 +147,9 @@
bool readPassiveTarget(uint8_t cardbaudrate, uint8_t *uid, uint8_t *uidLength, uint8_t *sak, uint16_t timeout = 1000) ;
bool inDataExchange(uint8_t *send, uint8_t sendLength, uint8_t *response, uint8_t *responseLength);
+ // ISO14443 requestes
+ uint8_t* sendRequestCommand(uint8_t cardbaudrate, uint16_t timeout);
+
// Mifare Classic functions
bool mifareclassic_IsFirstBlock (uint32_t uiBlock);
bool mifareclassic_IsTrailerBlock (uint32_t uiBlock);
