This application provides a set of demos with X-NUCLEO-NFC01A1 expansion board.

Dependencies:   NDefLib X_NUCLEO_NFC01A1 mbed

Fork of X-MBED-NFC1 by Giovanni Visentini

This application provides a set of demos with X-NUCLEO-NFC01A1 expansion board.

The available demos are:

  • SAMPLE_WRITE_URL: write a tag with the ST home page URL
  • SAMPLE_COUNT_CLICK: create a custom tag to count and report the user button clicks.
  • SAMPLE_WRITE_AND_CHANGE_ALL: write a tag with all the supported records and update the tag contents when the user button is pressed.
  • SAMPLE_LOCK_TAG_CONTENT: use the M24SR component API to set the NFC tag as read-only.

To enable the different demos comment/uncomment the SAMPLE_* macros provided in main.cpp .

Committer:
giovannivisentini
Date:
Fri Nov 27 15:10:25 2015 +0000
Revision:
1:6d202b62ed68
Parent:
0:674813bd5ec9
Child:
2:0648c1561eb2
add the enable/disable read/write function

Who changed what in which revision?

UserRevisionLine numberNew contents of line
giovannivisentini 0:674813bd5ec9 1 /*
giovannivisentini 0:674813bd5ec9 2 * X_NUCLEO_NFC01A1.cpp
giovannivisentini 0:674813bd5ec9 3 *
giovannivisentini 0:674813bd5ec9 4 * Created on: Nov 5, 2015
giovannivisentini 0:674813bd5ec9 5 * Author: giovanni visentini
giovannivisentini 0:674813bd5ec9 6 */
giovannivisentini 0:674813bd5ec9 7
giovannivisentini 0:674813bd5ec9 8 #include <X_NUCLEO_NFC01A1.h>
giovannivisentini 0:674813bd5ec9 9
giovannivisentini 1:6d202b62ed68 10 X_NUCLEO_NFC01A1 *X_NUCLEO_NFC01A1::mInstance = NULL;
giovannivisentini 0:674813bd5ec9 11
giovannivisentini 0:674813bd5ec9 12 X_NUCLEO_NFC01A1* X_NUCLEO_NFC01A1::Instance(I2C &devI2C,
giovannivisentini 1:6d202b62ed68 13 const PinName &gpoName, const PinName &RFDisableName,
giovannivisentini 1:6d202b62ed68 14 const PinName &led1Name, const PinName &led2Name,
giovannivisentini 1:6d202b62ed68 15 const PinName &led3Name) {
giovannivisentini 1:6d202b62ed68 16 if (mInstance == NULL) {
giovannivisentini 1:6d202b62ed68 17 mInstance = new X_NUCLEO_NFC01A1(devI2C, gpoName, RFDisableName,
giovannivisentini 1:6d202b62ed68 18 led1Name, led2Name, led3Name);
giovannivisentini 1:6d202b62ed68 19 if (mInstance != NULL) {
giovannivisentini 1:6d202b62ed68 20 const int status = mInstance->mM24SR.Init(NULL);
giovannivisentini 1:6d202b62ed68 21 if (status != NFC_SUCCESS) {
giovannivisentini 1:6d202b62ed68 22 delete mInstance;
giovannivisentini 1:6d202b62ed68 23 error(
giovannivisentini 1:6d202b62ed68 24 "Failed to init X_NUCLEO_NFC01A1 expansion board!\r\nError:0x%X\r\n",
giovannivisentini 1:6d202b62ed68 25 status);
giovannivisentini 1:6d202b62ed68 26 } //if init
giovannivisentini 1:6d202b62ed68 27 } //if instance !=NULL
giovannivisentini 1:6d202b62ed68 28 } //if instance
giovannivisentini 1:6d202b62ed68 29 return mInstance;
giovannivisentini 1:6d202b62ed68 30 }