ST / X_NUCLEO_NFC01A1

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:
6:96389fb79676
Parent:
1:15d4a123ef6b
Child:
7:19fc04b8fec6
--- a/m24sr/m24sr_class.h	Tue Dec 22 08:30:06 2015 +0000
+++ b/m24sr/m24sr_class.h	Tue Dec 22 15:34:24 2015 +0000
@@ -1,7 +1,8 @@
 /**
  ******************************************************************************
  * @file    m24sr_class.h
- * @date    05/11/2015
+ * @author  ST Central Labs
+ * @date    05 Nov 2015
  * @brief   This file provides a set of functions to interface with the M24SR
  *          device.
  ******************************************************************************
@@ -52,6 +53,7 @@
 
 #include "m24sr.h"
 #include "Interfaces/Nfc_class.h"
+#include "NDefNfcTagM24SR.h"
 
 /* Classes -------------------------------------------------------------------*/
 
@@ -73,7 +75,7 @@
 			const PinName& RFDISPinName) :
 			Nfc(), address(address), dev_i2c(i2c), GPOPin(GPOPinName), RFDisablePin(
 					RFDISPinName), answerReadyInterrupt(GPOPinName), interruptIsFired(
-					false) {
+					false),NDefTagUtil(*this) {
 
 		memset(uM24SRbuffer, 0, 0xFF * sizeof(int8_t));
 		syncMode = M24SR_WAITINGTIME_POLLING;
@@ -210,6 +212,63 @@
 		return (NFC_StatusTypeDef) M24SR_SendInterrupt();
 	}
 
+	/////////////////// hight level/utility function /////////////////////
+
+	NDefLib::NDefNfcTag& getNDefTag(){
+		return NDefTagUtil;
+	}
+
+
+	NFC_StatusTypeDef enableReadPassword(const uint8_t* pCurrentWritePassword,
+			const uint8_t* pNewPassword);
+
+	NFC_StatusTypeDef disableReadPassword(const uint8_t* pCurrentWritePassword=M24SR::DEFAULT_PASSWORD);
+
+	NFC_StatusTypeDef enableWritePassword(const uint8_t* pCurrentWritePassword,
+			uint8_t* pNewPassword);
+
+	NFC_StatusTypeDef disableWritePassword(const uint8_t* pCurrentWritePassword=M24SR::DEFAULT_PASSWORD);
+
+	/**
+	 * @brief  This function deactivate the need of read and write password for next access
+	 * @param	pSuperUserPassword : I2C super user password to overwrite read and write password
+	 * @retval SUCCESS : M24SR access is now free (no password needed)
+	 * @retval ERROR : operation does not complete
+	 */
+	NFC_StatusTypeDef disableAllPassword(const uint8_t* pSuperUserPassword=M24SR::DEFAULT_PASSWORD);
+
+	/**
+	 * @brief  This function enable read only mode
+	 * @param	pCurrentWritePassword : Write password is needed to have right to enable read only mode
+	 * @retval SUCCESS : M24SR access is now forbidden in write mode
+	 * @retval ERROR : operation does not complete
+	 */
+	NFC_StatusTypeDef enableReadOnly(const uint8_t* pCurrentWritePassword=M24SR::DEFAULT_PASSWORD);
+
+	/**
+	 * @brief  This fonction disable read only mode
+	 * @param	pCurrentWritePassword : Write password is needed to have right to disable read only mode
+	 * @retval SUCCESS : M24SR write access is now allowed
+	 * @retval ERROR : operation does not complete
+	 */
+	NFC_StatusTypeDef disableReadOnly();
+
+	/**
+	 * @brief  This fonction enable write only mode
+	 * @param	pCurrentWritePassword : Write password is needed to have right to enable write only mode
+	 * @retval SUCCESS : M24SR access is now forbidden in read mode
+	 * @retval ERROR : operation does not complete
+	 */
+	NFC_StatusTypeDef enableWriteOnly(const uint8_t* pCurrentWritePassword=M24SR::DEFAULT_PASSWORD);
+
+	/**
+	 * @brief  This fonction disable write only mode
+	 * @param	pCurrentWritePassword : Write password is needed to have right to disable write only mode
+	 * @retval SUCCESS : M24SR read access is now allowed
+	 * @retval ERROR : operation does not complete
+	 */
+	NFC_StatusTypeDef disableWriteOnly();
+
 protected:
 
 	/*** Protected Component Related Methods ***/
@@ -326,6 +385,8 @@
 	 * state variable change when the interrupt is fired
 	 */
 	volatile bool interruptIsFired;
+	
+	NDefNfcTagM24SR NDefTagUtil;
 };
 
 #endif // __M24SR_CLASS_H