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/SampleAsync_writeAndChangeAll.cpp
- Revision:
- 14:3b604972b89f
- Parent:
- 13:685d95525ec8
- Child:
- 15:94c98d2aa235
--- a/Samples/SampleAsync_writeAndChangeAll.cpp Mon Feb 01 15:33:26 2016 +0000
+++ b/Samples/SampleAsync_writeAndChangeAll.cpp Wed Aug 31 13:06:13 2016 +0000
@@ -126,7 +126,7 @@
switch(r->getType()){
case Record::TYPE_TEXT: {
RecordText *temp = (RecordText*)r;
- temp->setText("CIAOCiao");
+ temp->setText("Hello");
break; }
case Record::TYPE_AAR:{
RecordAAR *temp = (RecordAAR*)r;
@@ -172,7 +172,7 @@
* Class that print read a message and print it on console,
* and enable the user button when it finish
*/
-class ReadMessageCallback : public NDefLib::NDefNfcTag::Callback{
+class ReadMessageCallback : public NDefLib::NDefNfcTag::Callbacks{
NDefLib::Message *mMsg; /// Message where read
bool *mDisableButton; /// enable the user button
@@ -235,7 +235,7 @@
/**
* Read the message, change some data and write it back
*/
-class ChangeMessageCallback : public NDefLib::NDefNfcTag::Callback{
+class ChangeMessageCallback : public NDefLib::NDefNfcTag::Callbacks{
ReadMessageCallback* mReadMessage;
NDefLib::Message *mMsg;
@@ -263,7 +263,7 @@
public:
/**
- * @param readCallback Callback needed for print the tag content after the change
+ * @param readCallback Callback needed to print the tag content after the change
*/
ChangeMessageCallback(ReadMessageCallback* readCallback):
mReadMessage(readCallback),mMsg(NULL){}
@@ -323,7 +323,7 @@
/**
* Create and write a message in a nfc tag
*/
-class WriteMessageCallback : public NDefLib::NDefNfcTag::Callback{
+class WriteMessageCallback : public NDefLib::NDefNfcTag::Callbacks{
ReadMessageCallback* mReadMessage;
@@ -363,7 +363,7 @@
NDefLib::RecordMail rMail("mail@st.com","ciao","da nfc tag");
msg.addRecord(&rMail);
- NDefLib::RecordMimeType rText1("text/plain",(const uint8_t*)"ciao",4);
+ NDefLib::RecordMimeType rText1("text/plain",(const uint8_t*)"Ciao",4);
msg.addRecord(&rText1);
NDefLib::RecordText rText3(NDefLib::RecordText::UTF8,"it","ciao");
@@ -407,7 +407,7 @@
}
/**
- * Set the callback for print the tag content and open a new session
+ * Set the callback to print the tag content and open a new session
*/
virtual void onSessionClose(NDefLib::NDefNfcTag *tag,bool success){
if(success){
@@ -421,7 +421,7 @@
};
-static bool buttonPress=false; /// true when the user press the message
+static volatile bool buttonPress=false; /// true when the user press the message
/**
* Call back called when the user press the button
@@ -430,7 +430,7 @@
buttonPress=true;
}//if buttonPress
-static bool nfcEvent=false; /// true if there is an nfc interrupt
+static volatile bool nfcEvent=false; /// true if there is an nfc interrupt
/**
* Call back called when the user press the button
