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

Files at this revision

API Documentation at this revision

Comitter:
giovannivisentini
Date:
Mon Jan 11 13:06:23 2016 +0000
Parent:
7:19fc04b8fec6
Child:
9:9f2e2e68d695
Child:
11:a798ebea69fa
Commit message:
update comments 2

Changed in this revision

Interfaces/Component_class.h Show annotated file Show diff for this revision Revisions of this file
Interfaces/Nfc_class.h Show annotated file Show diff for this revision Revisions of this file
m24sr/NDefNfcTagM24SR.h Show annotated file Show diff for this revision Revisions of this file
--- a/Interfaces/Component_class.h	Mon Jan 11 12:37:28 2016 +0000
+++ b/Interfaces/Component_class.h	Mon Jan 11 13:06:23 2016 +0000
@@ -55,21 +55,19 @@
 class Component
 {
 public:
-	/**
-	 * @brief       Initialization of the component.
-	 * @param[out]  ptr Pointer to device specific initalization structure.
-	 * @return      0 in case of success, an error code otherwise.
-	 */
-	virtual int Init(void *ptr) = 0;
+    /**
+     * @brief  Initializing the component.
+     * @param  init pointer to device specific initalization structure.
+     * @retval "0" in case of success, an error code otherwise.
+     */
+    virtual int Init(void *init) = 0;
 
-	/**
-	 * @brief       Get ID of the component.
-	 * @param[out]  id Pointer to where to store the ID to.
-	 * @return      0 in case of success, an error code otherwise.
-	 */
-	virtual int ReadID(uint8_t *id) = 0;
-
-	virtual ~Component(){};
+    /**
+     * @brief  Getting the ID of the component.
+     * @param[out]  id pointer to an allocated variable to store the ID into.
+     * @retval "0" in case of success, an error code otherwise.
+     */
+    virtual int ReadID(uint8_t *id) = 0;
 };
 
 #endif /* __COMPONENT_CLASS_H */
--- a/Interfaces/Nfc_class.h	Mon Jan 11 12:37:28 2016 +0000
+++ b/Interfaces/Nfc_class.h	Mon Jan 11 13:06:23 2016 +0000
@@ -138,17 +138,32 @@
 	virtual NFC_StatusTypeDef Verify(PasswordType_t uPwdId, uint8_t NbPwdByte,const uint8_t *pPwd) = 0;
 
 	/**
-	 * change the pa
-	 * @param uPwdId
-	 * @param pPwd
-	 * @return
+	 * replaces the read or write password related to the NDEF files previously selected.
+	 * @param uPwdId password to change
+	 * @param pPwd new password
+	 * @return NFC_SUCCESS if no error happen
 	 */
 	virtual NFC_StatusTypeDef ChangeReferenceData(PasswordType_t uPwdId,const uint8_t *pPwd) = 0;
+	
+	/**
+	 *	activates the protection by password of the NDEF file.
+	 *  When this command is successful, the read or write access to the NDEF file is protected by a 128-bit password.
+	 *  @param uReadOrWrite password to requeire
+	 *  @return NFC_SUCCESS if no error happen
+	 */
 	virtual NFC_StatusTypeDef EnableVerificationRequirement(PasswordType_t uReadOrWrite) = 0;
+	
+	/**
+     * deactivates the protection by password of the NDEF file.
+     * When this command is successful, the read or write access to the NDEF file is granted
+     * without security requirements.
+	 * @param uReadOrWrite password to requeire
+	 * @return NFC_SUCCESS if no error happen
+	 */     
 	virtual NFC_StatusTypeDef DisableVerificationRequirement(PasswordType_t uReadOrWrite) = 0;
 	
 	/**
-	 * as {@link Nfc#ReadBinary} but it doesn't give error if you read more byte than the ones 
+	 * as {@link NFC#ReadBinary} but it doesn't give error if you read more byte than the ones 
 	 * that are available
 	 * @param Offset offset where start to read
 	 * @param NbByteToRead number of byte to read
--- a/m24sr/NDefNfcTagM24SR.h	Mon Jan 11 12:37:28 2016 +0000
+++ b/m24sr/NDefNfcTagM24SR.h	Mon Jan 11 13:06:23 2016 +0000
@@ -42,14 +42,12 @@
 class M24SR;
 
 /**
- * implement the abstract method for use the NDefLib,
- * all method must be called after opening a session
- */
+ * implement the abstract method for use the NDefLib */
 class NDefNfcTagM24SR: public NDefLib::NDefNfcTag {
 
 public:
 	/**
-	 *
+	 * create the object
 	 * @param device device where write the Ndef tags
 	 */
 	NDefNfcTagM24SR(M24SR &device) :
@@ -57,7 +55,19 @@
 					0xFF) {
 	}
 
+	/**
+	 * open the communication with the nfc tag
+	 * \par when override this method call this implementation as last action for set the session opened
+	 * @param force force to open a communication
+	 * @return true if success
+	 */
 	virtual bool openSession(bool force = false);
+	
+	/**
+	 * close the communication with the nfc tag
+	 * \par when override this method call this implementation as last action for set the session closed
+	 * @return true if success
+	 */
 	virtual bool closeSession();
 
 	/**
@@ -71,7 +81,23 @@
 	
 
 protected:
+	
+	/**
+	 * write a sequence of byte in the NDEF file
+	 * @param buffer buffer to write
+	 * @param length number of byte to write
+	 * @param offset offset where start to write
+	 * @return true if success
+	 */
 	virtual bool writeByte(const uint8_t *buffer, const uint16_t length, uint16_t offset);
+	
+	/**
+	 * read a sequence of byte from the NDEF file
+	 * @param byteOffset offset were start read
+	 * @param byteLength number of byte to read
+	 * @param[out] buffer buffer where store the data read
+	 * @return true if success
+	 */
 	virtual bool readByte(const uint16_t byteOffset, const uint16_t byteLength,
 			uint8_t *buffer);