adafruit / adafruit_nfcshield_i2c Goto Github PK
View Code? Open in Web Editor NEWI2C Driver for Adafruit's PN532-based NFC Shield
License: Other
I2C Driver for Adafruit's PN532-based NFC Shield
License: Other
*** DEPRECATED! *** This library is now deprecated and will not be maintained. The NFC shield and I2C communication logic has been merged into the Adafruit-PN532 library with no loss of functionality. Please see this page for details on installing and using the Adafruit-PN532 library in place of this Adafruit_NFCShield_I2C library: https://learn.adafruit.com/adafruit-pn532-rfid-nfc/arduino-library *** DEPRECATED! *** This is a library for the Adafruit PN532 NFC/RFID breakout boards This library works with the Adafruit NFC breakout and shield ----> https://www.adafruit.com/products/364 ----> https://www.adafruit.com/products/789 Check out the links above for our tutorials and wiring diagrams These chips use SPI or I2C to communicate Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit! Written by Limor Fried/Ladyada & Kevin Townsend for Adafruit Industries. BSD license, check license.txt for more information All text above must be included in any redistribution To download: click the ZIP button above, rename the uncompressed folder Adafruit_NFCShield_I2C. Check that the Adafruit_NFCShield_I2C folder contains Adafruit_NFCShield_I2C.cpp and Adafruit_NFCShield_I2C.h Place the Adafruit_NFCShield_I2C library folder your <arduinosketchfolder>/libraries/ folder. You may need to create the libraries subfolder if its your first library. Restart the IDE.
For some reason (it's 1:15 am so i should stop looking at code), mifareclassic_formatndef has issues writing NDEF messages to sector 1 on the writable card I got with my NDFShield. I believe it has something to do with the block 0 authentication and formatting because when I edit out the below block of code, it works fine.
From: "//Try to format the card for NDEF data"
To "Serial.println("Card has been formatted for NDEF data using MAD1");" it works fine.
I'm not sure if it is specific to this card due to the way block 0 was setup on the card or not.
Side note, so I don't have to open another 'issue,' on readMifare, the uint8_t data array wasn't working as two lines but did as one (shown below);
uint8_t data[16] = { 'a', 'd', 'a', 'f', 'r', 'u', 'i', 't', '.', 'c', 'o', 'm', 0, 0, 0, 0};
Thak you for the code and libraries! I've been playing around with the PN532 all day and am loving it!
Matt
Merge adafruit/Adafruit-PN532#3 didn't happen in this library
In the file "Adafruit_NFCShield_I2C/Adafruit_NFCShield_I2C.cpp" in the function wirereaddata()
, there is a delay(1)
(at the moment in line 985) in the for-loop when reading data.
That delay may be removed.
The data is put into a buffer by the Wire.requestFrom()
. After the I2C bus transaction has finished, the Wire.read()
reads data from that buffer. There is no need to have a delay to get data from a buffer.
I have a problem with formatting the card using NDEF records using the example sketch.
It worked only once (setting the URL of adafruit). When I try to reformat the card with other NDEF informaton (e.g. comment out the mail record), the sketch will print all success messages, but fail to actually write the card.
The card is correctly formatted. I can write the card using some Android tag apps, such as NXP Tag Writer, however I cannot reformat the card using the sketch. It is just that the old NDEF record remains.
Here is the output of the standard sketch:
Looking for PN532...
Found chip PN532
Firmware ver. 1.6
PLEASE NOTE: Formatting your card for NDEF records will change the
authentication keys and you will no longer be able to read the
card as a normal Mifare card without resetting all keys. Try to keep
seperate cards for NDEF and non-NDEF purposes.
Place your Mifare Classic card on the reader to format with NDEF
and press any key to continue ...
Found an ISO14443A card
UID Length: 4 bytes
UID Value: 0xFA 0x6F 0x44 0xE6
Seems to be a Mifare Classic card (4 byte UID)
Card has been formatted for NDEF data using MAD1
Writing URI to sector 1 as an NDEF Message
NDEF URI Record written to sector 1
Done!
Hey guys,
how about sharing tag with the Adafruit PN532 NFC/RFID Controller Shield ?
In the description, it's writtten :
This chipset is very powerful, and can pretty much do it all, such as read and write to tags and cards, communicate with phones (say for payment processing), and 'act' like a NFC tag.
Is there a way with your library to share a NFC tag ?
Hello !
I'm working on a project where I need to send data from an Android device to an Arduino through NFC.
Since we can't do that directly, my solutions was to just physically attach a MiFare Card to the shield and use it as an intermediary between Android and Arduino. Android writes to the card... Arduino reads from the card... user thinks it's magic... everyone is happy.
It works pretty well, but I have to power down the PN532 in order to write to the card while it's sitting on top of the shield coil.
So I created a disable() function that puts the PN532 in PowerDown mode, and an enable() function that wakes it up when I want to try reading a card.
If this is of value to the lib I would love to make a PR with my additions.
I think there is a mistake in the library regarding the key settings. It is said in the AuthenticateBlock function:
pn532_packetbuffer[2] = (keyNumber) ? MIFARE_CMD_AUTH_A : MIFARE_CMD_AUTH_B;
with the comment:
@param keyNumber
Which key type to use during authentication (0 = MIFARE_CMD_AUTH_A, 1 = MIFARE_CMD_AUTH_B)
I think it should be the other way around! That made me a lot of trouble until i found out! Still not too sure though xD.. I'm new too C++/Arduino.
Also I am new to Github. I have extended this library with an Increment, Decrement and Transfer function. Where can I post it, so that maybe it can be integrated to the library?
as ive read so far, there is no timeout (to return false) for the read passive target function, this is good for default feature, but a timeout is also needed for other things such as allowing a loop to continue to allow printing to lcd regardless of card input.
suggested behaviour:
if timeout specified in the perameters (brackets) :
nfc.ReadPassiveTarget(mandetoryStuff,int timeout in ms).
since there is no feature request on github, id like to file it here.
wonderful product but i need some more done to the code.. i can contribute if need be.
The example files are very memory inefficient, commitments to SRAM all over the place, from AdaFruit's own page....
https://learn.adafruit.com/memories-of-an-arduino/optimizing-sram
I was using the example code in a project and getting some inexplicable crashes... cleaning up the memory allocation fixed it
I need this version for older ino, but this one doesnt work like the seeedstudio version without irq
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.