Firmware library for the X-NUCLEO-NFC01A1 Dynamic NFC Tag board.

Dependencies:   M24SR

Dependents:   NFC M2M_2016_STM32 MyongjiElec_capstone1 IDW01M1_Cloud_IBM ... more

Fork of X_NUCLEO_NFC01A1 by ST Expansion SW Team

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.

Firmware Library

Class X_NUCLEO_NFC01A1 is intended to represent the Dynamic NFC Tag Expansion Board with the same name.
It provides an API to access to the M24SR component and to the three onboard LEDs.
It is intentionally implemented as a singleton because only one X_NUCLEO_NFC01A1 at a time might be deployed in a HW component stack.
The library also provides an implementation of the NDEF library API for M24SR, providing an simple way to read/write NDEF formatted messages from/to the M24SR dynamic NFC tag.

Example applications

1. Hello World
2. Asynchronous Hello World

Revision:
33:e6b7e74be1d5
Parent:
29:7a2dfd06cb29
--- a/m24sr/NDefNfcTagM24SR.h	Thu May 18 15:20:43 2017 +0000
+++ b/m24sr/NDefNfcTagM24SR.h	Wed Jul 12 14:15:02 2017 +0000
@@ -76,18 +76,19 @@
 	/**
 	* Close the open session.
 	*/
-	virtual ~NDefNfcTagM24SR(){
-		if(is_session_open())
+	virtual ~NDefNfcTagM24SR() {
+		if (is_session_open()) {
 			close_session();
+		}
 	}//~NDefNfcTagM24SR
 
 	protected:
 
 		virtual bool writeByte(const uint8_t *buffer, uint16_t length,uint16_t offset,
-				byteOperationCallback_t callback,CallbackStatus_t *callbackStatus);
+			byteOperationCallback_t callback,CallbackStatus_t *callbackStatus);
 
 		virtual bool readByte(const uint16_t byteOffset, const uint16_t byteLength,
-				uint8_t *buffer, byteOperationCallback_t callback,CallbackStatus_t *callbackStatus);
+			uint8_t *buffer, byteOperationCallback_t callback,CallbackStatus_t *callbackStatus);
 
 	private:
 
@@ -153,10 +154,10 @@
 
 				virtual void on_deselect(M24SR *nfc,M24SR::StatusTypeDef status){
 					(void)nfc;
-					if(status==M24SR::M24SR_SUCCESS){
-						mSender.mIsSessionOpen=false;
+					if (status==M24SR::M24SR_SUCCESS) {
+						mSender.mIsSessionOpen = false;
 						mSender.mCallBack->on_session_close(&mSender,true);
-					}else{
+					} else {
 						mSender.mCallBack->on_session_close(&mSender,false);
 					}//if-else
 				}
@@ -182,12 +183,12 @@
 				 * @param sender tag where write the buffer
 				 */
 				WriteByteCallback(NDefNfcTagM24SR &sender):
-									mByteToWrite(NULL),
-									mNByteToWrite(0),
-									mByteWrote(0),
-									mCallback(NULL),
-									mCallbackParam(NULL),
-									mSender(sender){}
+								  mByteToWrite(NULL),
+								  mNByteToWrite(0),
+								  mByteWrote(0),
+								  mCallback(NULL),
+								  mCallbackParam(NULL),
+								  mSender(sender){}
 
 				/**
 				 * Set the buffer to write and the function to call when finish
@@ -197,7 +198,7 @@
 				 * @param param Parameter to pass to the callback function.
 				 */
 				void set_task(const uint8_t *buffer,uint16_t nByte,
-						byteOperationCallback_t callback,CallbackStatus_t *param){
+					byteOperationCallback_t callback,CallbackStatus_t *param) {
 					mByteToWrite=buffer;
 					mNByteToWrite=nByte;
 					mByteWrote=0;
@@ -206,7 +207,7 @@
 				}
 
 				virtual void on_updated_binary(M24SR *nfc,M24SR::StatusTypeDef status,
-						uint16_t startOffset,uint8_t *writeByte,uint16_t nWriteByte);
+					uint16_t startOffset,uint8_t *writeByte,uint16_t nWriteByte);
 
 
 			private:
@@ -241,12 +242,12 @@
 				 * @param Sender tag where read the buffer
 				 */
 				ReadByteCallback(NDefNfcTagM24SR &sender):
-										mBuffer(NULL),
-										mNByteToRead(0),
-										mByteRead(0),
-										mCallback(NULL),
-										mCallbackParam(NULL),
-										mSender(sender){}
+								 mBuffer(NULL),
+								 mNByteToRead(0),
+								 mByteRead(0),
+								 mCallback(NULL),
+								 mCallbackParam(NULL),
+								 mSender(sender){}
 
 				/**
 				 * Set the buffer where read the data and the function to call when finish
@@ -256,7 +257,7 @@
 				 * @param param Parameter to pass to the callback function
 				 */
 				void set_task(uint8_t *buffer,uint16_t nByte,
-						byteOperationCallback_t callback,CallbackStatus_t *param){
+					byteOperationCallback_t callback,CallbackStatus_t *param){
 					mBuffer=buffer;
 					mNByteToRead=nByte;
 					mByteRead=0;
@@ -265,7 +266,7 @@
 				}
 
 				virtual void on_read_byte(M24SR *nfc,M24SR::StatusTypeDef status,
-						uint16_t offset,uint8_t *readByte, uint16_t nReadByte);
+					uint16_t offset,uint8_t *readByte, uint16_t nReadByte);
 
 
 			private: