Example application for the X-Nucleo-NFC01A1 Dynamic NFC Tag board.
Dependencies: NDefLib X_NUCLEO_NFC01A1 mbed
Fork of HelloWorld_NFC01A1 by
X-NUCLEO-NFC01A1 Dynamic NFC Tag Expansion Board Firmware Package
Introduction
This firmware package includes Components Device Drivers, Board Support Package and example applications for STMicroelectronics X-NUCLEO-NFC01A1 Dynamic NFC Tag Expansion Board based on M24SR.
Example Application
This is just a simple "hello world" style program for the X-NUCLEO-NFC01A1 Dynamic NFC Tag Expansion Board. The program writes a URI link to the M24SR dynamic tag using the synchronous programming model. The URI can then be retrieved from an NFC enabled smartphone/tablet.
A more complex example providing asynchronous access to the tag is also available.
Diff: main.cpp
- Revision:
- 14:1b99908360c5
- Parent:
- 11:925a5a491a5c
- Child:
- 17:22e6c00f3a4c
- Child:
- 18:982e7640cfb6
diff -r d408e5eaf98e -r 1b99908360c5 main.cpp --- a/main.cpp Mon Feb 01 15:43:24 2016 +0000 +++ b/main.cpp Tue Feb 02 16:04:36 2016 +0000 @@ -48,7 +48,10 @@ //use default board pinout I2C i2cChannel(X_NUCLEO_NFC01A1::DEFAULT_SDA_PIN,X_NUCLEO_NFC01A1::DEFAULT_SDL_PIN); - X_NUCLEO_NFC01A1 *nfcNucleo = X_NUCLEO_NFC01A1::Instance(i2cChannel,NULL); + X_NUCLEO_NFC01A1 *nfcNucleo = X_NUCLEO_NFC01A1::Instance(i2cChannel,NULL, + X_NUCLEO_NFC01A1::DEFAULT_GPO_PIN,X_NUCLEO_NFC01A1::DEFAULT_RF_DISABLE_PIN, + X_NUCLEO_NFC01A1::DEFAULT_LED1_PIN,X_NUCLEO_NFC01A1::DEFAULT_LED2_PIN, + X_NUCLEO_NFC01A1::DEFAULT_LED3_PIN); //retrieve the NdefLib interface NDefLib::NDefNfcTag& tag =nfcNucleo->getM24SR().getNDefTag(); @@ -56,7 +59,7 @@ //open the i2c session with the nfc chip if(tag.openSession()){ - printf("Session open\n\r"); + printf("Session opened\n\r"); nfcNucleo->getLed1()=1; //create the NDef message and record @@ -66,7 +69,7 @@ //write the tag if(tag.write(msg)){ - printf("Tag writed \n\r"); + printf("Tag written\n\r"); nfcNucleo->getLed2()=1; }else{ printf("Error writing \n\r"); @@ -77,9 +80,9 @@ printf("Session closed\n\r"); nfcNucleo->getLed3()=1; }else{ - printf("Error Closing the session\n\r"); + printf("Error closing the session\n\r"); }//if-else }else - printf("Error open Session\n\r"); + printf("Error opening the session\n\r"); } \ No newline at end of file