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:
24:9f98eafa2d39
Parent:
23:d07138541feb
Child:
25:caa16fd0e50b
--- a/Interfaces/Nfc_class.h	Mon Feb 01 15:32:40 2016 +0000
+++ b/Interfaces/Nfc_class.h	Tue Feb 02 16:04:24 2016 +0000
@@ -53,16 +53,16 @@
 /* Classes  ------------------------------------------------------------------*/
 
 /**
- * An abstract class for Nfc components.
- * This component has two operation mode, sync or async.
- * In the sync mode each function will return only when the command is complete.
- * In the async mode the function will only send the command and the answer will be notify
- * thought a callback.
- * The default behavior is sync mode.
- * For enable the async mode you have to call the ManageI2CGPO(I2C_ANSWER_READY) function.
- * When the component notify an interrupt you have to call the  {@link ManageInterrupt} function.
- * Note that when you call ManageI2CGPO with other parameters the component will return in sync mode.
- */
+* An abstract class for Nfc components. 
+* This component has two operation modes, sync or async.
+* In sync mode each function call returns only after the command has completed.
+* In async mode each function call returns immediately and the answer will be notified
+* through a callback.
+* The default behavior is sync mode.
+* To enable the async mode ManageI2CGPO(I2C_ANSWER_READY) function must be called.
+* When the component notifies an interrupt user must call  {@link ManageEvent} function.
+* Note that passing a parameter other than I2C_ANSWER_READY to ManageI2CGPO initialize the component in sync mode.
+*/
 class Nfc : public Component
 {
 public:
@@ -71,9 +71,9 @@
 	 * Possible password to set.
 	 */
 	typedef enum{
-		ReadPwd,   //!< Password to use before read the tag
-		WritePwd,  //!< Password to use before write the tag
-		I2CPwd,    //!< Root password, used only thought nfc
+		ReadPwd,   //!< Password to use before reading the tag
+		WritePwd,  //!< Password to use before writing the tag
+		I2CPwd,    //!< Root password, used only through nfc
 	}PasswordType_t;
 
 	/**
@@ -83,13 +83,13 @@
 	typedef void(*gpoEventCallback)(void);
 
 	/**
-	 * Object that contains all the callback fired by this class, each command has its own callback.
+	 * Object that contains all the callbacks fired by this class, each command has its own callback.
 	 * The callback default implementation is an empty function.
 	 */
-	class Callback{
+	class Callbacks{
 	public:
 
-		/** call when GetSession or KillSession finish */
+		/** called when GetSession or KillSession finish */
 		virtual void onSessionOpen(Nfc *nfc,NFC_StatusTypeDef status){
 			(void)nfc; (void)status;
 		}
@@ -124,7 +124,7 @@
 			(void)nfc; (void)status; (void)writeByte; (void)nWriteByte; (void)offset;
 		}
 
-		virtual void onVerifyed(Nfc *nfc,NFC_StatusTypeDef status,PasswordType_t uPwdId,
+		virtual void onVerified(Nfc *nfc,NFC_StatusTypeDef status,PasswordType_t uPwdId,
 				const uint8_t *pwd){
 			(void)nfc; (void)status;(void)uPwdId;(void)pwd;
 		}
@@ -198,7 +198,7 @@
 			(void)nfc; (void)status;
 		}
 
-		virtual ~Callback(){};
+		virtual ~Callbacks(){};
 	};
 
 	Nfc():mCallback(&defaultCallback),
@@ -364,7 +364,7 @@
 	 * Change the function to call when a command ends.
 	 * @param commandCallback Object containing the callback, if NULL it will use empty callback
 	 */
-	void SetCallback(Callback *commandCallback){
+	void SetCallback(Callbacks *commandCallback){
 		if(commandCallback!=NULL)
 			mCallback = commandCallback;
 		else
@@ -378,7 +378,7 @@
 	virtual NFC_StatusTypeDef ManageEvent()=0;
 
 
-	///////////////////////HIGHT LEVEL /UTILITY FUNCTION ////////////////////////////////////
+	///////////////////////HIGH LEVEL / UTILITY FUNCTIONS ////////////////////////////////////
 
 	/**
 	 * Enable the request of a password before reading the tag.
@@ -509,21 +509,21 @@
 	virtual ~Nfc(){};
 
 protected:
-		/** object containing the callback to use*/
-		Callback *mCallback;
+		/** object containing the callbacks to use*/
+		Callbacks *mCallback;
 
 		/**
-		 * Object with private callback used for hide height level commands
-		 * that require more than one low level command.
-		 * This object has an height priority comparing the user callback
+		 * Object with private callbacks used to hide high level commands each
+		 * calling multiple low level commands. This callbacks object has 
+		 * higher priority comparing to the user callbacks.
 		 */
-		Nfc::Callback *mComponentCallback;
+		Nfc::Callbacks *mComponentCallback;
 
 		/**
 		 * get the callback object to use
 		 * @return callback object to use
 		 */
-		Nfc::Callback * getCallback(){
+		Nfc::Callbacks * getCallback(){
 			if(mComponentCallback!=NULL)
 				return mComponentCallback;
 			return mCallback;
@@ -531,12 +531,12 @@
 
 private:
 	/** object containing empty callback to use in the default case*/
-	Callback defaultCallback;
+	Callbacks defaultCallback;
 
 
 	/**
-	 * This class permit to enable/disable the password request to read/write into the tag
-	 * This class is equivalent to call the method:
+	 * This class permits to enable/disable the password request to read/write into the tag
+	 * This class is equivalent to calling the methods:
 	 * To enable the request:
 	 * <ul>
 	 *   <li> Verify </li>
@@ -549,12 +549,12 @@
 	 *   <li> DisableVerificationRequirement </li>
 	 * </ul>
 	 */
-	class ChangePasswordRequestStatusCallback : public Nfc::Callback{
+	class ChangePasswordRequestStatusCallback : public Nfc::Callbacks{
 
 		public:
 
 			/**
-			 * Build the chain of callback.
+			 * Build the chain of callbacks.
 			 * @param parent object where send the command
 			 */
 			ChangePasswordRequestStatusCallback():
@@ -571,7 +571,7 @@
 				mEnable=newPwd!=NULL;
 			}//setTask
 
-			virtual void onVerifyed(Nfc *nfc, NFC_StatusTypeDef status,PasswordType_t ,
+			virtual void onVerified(Nfc *nfc, NFC_StatusTypeDef status,PasswordType_t ,
 					const uint8_t *){
 				if(status!=NFC_SUCCESS)
 					return onFinishCommand(nfc,status);
@@ -604,7 +604,7 @@
 		private:
 
 			/**
-			 * Remove the private callback and call the user callback.
+			 * Remove the private callbacks and call the user callback.
 			 * @param nfc Object where the command is run.
 			 * @param status Command status.
 			 */
@@ -638,8 +638,8 @@
 		friend class ChangePasswordRequestStatusCallback;
 
 		/**
-		 * This class permit to disable all the password request to read/write into the tag
-		 * This class is equivalent to call the methods:
+		 * This class permits to disable all the password requests to read/write into the tag
+		 * This class is equivalent to calling the methods:
 		 * <ul>
 		 *   <li> Verify(i2c) </li>
 		 *   <li> DisablePermanentState(Read) </li>
@@ -650,7 +650,7 @@
 		 *   <li> ChangeReferenceData(write) </li>
 		 * </ul>
 		 */
-		class RemoveAllPasswordCallback : public Nfc::Callback{
+		class RemoveAllPasswordCallback : public Nfc::Callbacks{
 
 			/**
 			 * Store the default password used for open a super user session
@@ -661,12 +661,12 @@
 			public:
 
 				/**
-				 * Build the chain of callback.
-				 * @param parent object where send the command
+				 * Build the chain of callbacks.
+				 * @param parent object where to send the command
 				 */
 				RemoveAllPasswordCallback():mI2CPwd(NULL){}
 
-				virtual void onVerifyed(Nfc *nfc,NFC_StatusTypeDef status,
+				virtual void onVerified(Nfc *nfc,NFC_StatusTypeDef status,
 						PasswordType_t,const uint8_t* data){
 					if(status!=NFC_SUCCESS)
 						return onFinishCommand(nfc,status);
@@ -721,14 +721,14 @@
 
 
 		/**
-		 * Object containing the callback chain needed remove the password request
+		 * Object containing the callback chain needed to remove the password request
 		 */
 		RemoveAllPasswordCallback mRemoveAllPasswordCallback;
 		friend class RemoveAllPasswordCallback;
 
 		/**
-		 * This class permit set the tag as read/write only
-		 * This class is equivalent to call the methods:
+		 * This class permits to set the tag as read/write only
+		 * This class is equivalent to calling the methods:
 		 * <ul>
 		 *   <li> Verify(i2c) </li>
 		 *   <li> EnablePermanentState(Read/write) </li>
@@ -740,7 +740,7 @@
 		 *   <li> DisableVerificationRequirement(Read/write) </li>
 		 * </ul>
 		 */
-		class ChangeAccessStateCallback : public Nfc::Callback{
+		class ChangeAccessStateCallback : public Nfc::Callbacks{
 
 			public:
 
@@ -750,22 +750,22 @@
 				}AccessType_t;
 
 				/**
-				 * Build the chain of callback.
-				 * @param parent object where send the command
+				 * Build the chain of callbacks.
+				 * @param parent object where to send the command
 				 */
 				ChangeAccessStateCallback():mType(WRITE),mEnable(false){}
 
 				/**
-				 * Set the access to enable/disable.
-				 * @param type Type to enable or disable.
-				 * @param enable true for enable the state, false for disable it.
+				 * Set the access to enable/disable an access type.
+				 * @param type Access type.
+				 * @param enable True to enable the state, False to disable it.
 				 */
 				void changeAccessState(AccessType_t type,bool enable){
 					mType=type;
 					mEnable=enable;
 				}
 
-				virtual void onVerifyed(Nfc *nfc,NFC_StatusTypeDef status,
+				virtual void onVerified(Nfc *nfc,NFC_StatusTypeDef status,
 						PasswordType_t,const uint8_t*){
 					if(status!=NFC_SUCCESS)
 						return onFinishCommand(nfc,status);