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
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 .
Diff: Samples/sample_lockWriteTag.cpp
- Revision:
- 12:c4a778f52d8a
- Parent:
- 11:283df715f241
--- a/Samples/sample_lockWriteTag.cpp Mon Jan 11 16:10:12 2016 +0000
+++ b/Samples/sample_lockWriteTag.cpp Thu Jan 14 09:17:03 2016 +0000
@@ -41,15 +41,15 @@
static volatile bool buttonPress=false; /// true when the user press the message
/**
- * call back called when the user press the button
+ * Call back called when the user press the button.
*/
static void setButtonPress(){
buttonPress=true;
}//if buttonPress
/**
- * return the led that tell if the tag is read only
- * @param nfcNucleo board where the lead lives
+ * Return the led that tell if the tag is read only.
+ * @param nfcNucleo Board where the lead lives.
* @return let to switch on if the tag is read only
*/
static inline DigitalOut& getReadOnlyLed(X_NUCLEO_NFC01A1 *nfcNucleo){
@@ -57,8 +57,8 @@
}
/**
- * return the led that tell if the tag is write only
- * @param nfcNucleo board where the lead lives
+ * Return the led that tell if the tag is write only.
+ * @param nfcNucleo Board where the lead lives.
* @return let to switch on if the tag is write only
*/
static inline DigitalOut& getWriteableLed(X_NUCLEO_NFC01A1 *nfcNucleo){
@@ -66,8 +66,8 @@
}
/**
- * set the tag as read only and switch the led on
- * @param nfcNucleo board where the lead lives
+ * Set the tag as read only and switch the led on.
+ * @param nfcNucleo Board where the lead lives.
* @return true if the change has effect
*/
bool enableReadOnly( X_NUCLEO_NFC01A1 *nfcNucleo){
@@ -81,8 +81,8 @@
}
/**
- * set the tag as read/write and switch the led on
- * @param nfcNucleo board where the lead lives
+ * Set the tag as read/write and switch the led on.
+ * @param nfcNucleo Board where the lead lives.
* @return true if the change has effect
*/
bool disableReadOnly( X_NUCLEO_NFC01A1 *nfcNucleo){
@@ -96,7 +96,7 @@
}
/**
- * When the user press the button enable/disable the tag write protetion
+ * When the user press the button enable/disable the tag write protetion.
*/
void sample_lockTagContent() {
Serial console(SERIAL_TX, SERIAL_RX);
@@ -105,7 +105,7 @@
I2C i2cChannel(X_NUCLEO_NFC01A1::DEFAULT_SDA_PIN,X_NUCLEO_NFC01A1::DEFAULT_SDL_PIN);
X_NUCLEO_NFC01A1 *nfcNucleo = X_NUCLEO_NFC01A1::Instance(i2cChannel);
- //get the wrapper for use the NdefLib
+ //retrieve the NdefLib interface
NDefLib::NDefNfcTag& tag = nfcNucleo->getM24SR().getNDefTag();
//when the user press the button set buttonPress to true
@@ -136,10 +136,10 @@
if(changeStatusResult)
tagIsLock=!tagIsLock;
else
- console.printf("Error change the tag status");
+ console.printf("Error change the tag status\r\n");
tag.closeSession();
}else{
- console.printf("Error opening the session, tag is in use");
+ console.printf("Error opening the session, tag is in use\r\n");
}
buttonPress=false;
}//if
