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:
7:19fc04b8fec6
Parent:
6:96389fb79676
Child:
9:9f2e2e68d695
--- a/m24sr/m24sr_class.cpp	Tue Dec 22 15:34:24 2015 +0000
+++ b/m24sr/m24sr_class.cpp	Mon Jan 11 12:37:28 2016 +0000
@@ -62,7 +62,7 @@
 /** value return by the NFC chip when a command is successfully done */
 #define NFC_COMMAND_SUCCESS 0x9000
 
-/** call the fCall funtion and check that the return status is NFC_COMMAND_SUCCESS,
+/** call the fCall funtion and check that the return status is NFC_SUCCESS,
  *  otherwise return the error status*/
 #define errchk(fCall) {\
 	const NFC_StatusTypeDef status = (fCall); \
@@ -248,8 +248,8 @@
 /**  
  * @brief  	This function return M24SR_STATUS_SUCCESS if the pBuffer is an s-block
  * @param  	pBuffer		:	pointer of the data
- * @retval 	M24SR_STATUS_SUCCESS  :  the data is a S-Block
- * @retval 	M24SR_ERROR_DEFAULT  	:  the data is not a S-Block
+ * @retval 	NFC_SUCCESS  :  the data is a S-Block
+ * @retval 	NFC_ERROR  	:  the data is not a S-Block
  */
 static NFC_StatusTypeDef IsSBlock(uint8_t *pBuffer) {
 
@@ -264,8 +264,7 @@
 /**
  * @brief  This function sends the FWT extension command (S-Block format)
  * @param	FWTbyte : FWT value
- * @retval Status (SW1&SW2) : Status of the operation to complete.
- * @retval M24SR_ERROR_I2CTIMEOUT : The I2C timeout occurred.
+ * @return NFC_SUCCESS if no error happen
  */
 NFC_StatusTypeDef M24SR::M24SR_FWTExtension(uint8_t FWTbyte) {
 	uint8_t pBuffer[M24SR_STATUSRESPONSE_NBBYTE];
@@ -300,8 +299,7 @@
 /**
  * @brief  This function sends the KillSession command to the M24SR device
  * @param  None
- * @retval NFC_SUCCESS : the function is successful.
- * @retval M24SR_ERROR_I2CTIMEOUT : The I2C timeout occurred.
+ * @return NFC_SUCCESS if no error happen
  */
 NFC_StatusTypeDef M24SR::M24SR_KillSession(void) {
 	uint8_t commandBuffer[] = M24SR_KILLSESSION_COMMAND;
@@ -318,8 +316,7 @@
 
 /**
  * @brief  This function sends the Deselect command (S-Block format)
- * @retval NFC_SUCCESS : the function is successful.
- * @retval M24SR_ERROR_I2CTIMEOUT : The I2C timeout occurred.
+ * @return NFC_SUCCESS if no error happen
  */
 NFC_StatusTypeDef M24SR::M24SR_Deselect(void) {
 	uint8_t pBuffer[] = M24SR_DESELECTREQUEST_COMMAND;
@@ -336,8 +333,7 @@
 
 /**
  * @brief  This function sends the SelectApplication command
- * @retval NFC_SUCCESS : the function is successful.
- * @retval M24SR_ERROR_I2CTIMEOUT : The I2C timeout occurred.
+ * @return NFC_SUCCESS if no error happen
  */
 NFC_StatusTypeDef M24SR::M24SR_SelectApplication(void) {
 
@@ -449,7 +445,7 @@
 	/* copy the number of byte of the data field */
 	command.Body.LC = sizeof(pDataOut);
 	command.Body.pData = pDataOut;
-	/* build the I²C command */
+	/* build the I2C command */
 	M24SR_BuildIBlockCommand(M24SR_CMDSTRUCT_SELECTCCFILE, &command, uDIDbyte,
 			&NbByte, pBuffer);
 
@@ -1068,11 +1064,7 @@
 		return status;
 }
 
-/**
- * @brief  This function configure GPO purpose for I2C session
- * @param	GPO_I2Cconfig: GPO configuration to set
- * @retval Status (SW1&SW2) : Status of the operation to complete.
- */
+
 NFC_StatusTypeDef M24SR::M24SR_ManageI2CGPO(M24SR_GPO_MGMT GPO_I2Cconfig) {
 	uint8_t GPO_config = 0;
 
@@ -1103,12 +1095,6 @@
 	return NFC_SUCCESS;
 }
 
-/**
- * @brief  This function configure GPO purpose for RF session
- *
- * @param	GPO_RFconfig: GPO configuration to set
- * @retval Status (SW1&SW2) : Status of the operation to complete.
- */
 NFC_StatusTypeDef M24SR::M24SR_ManageRFGPO(M24SR_GPO_MGMT GPO_RFconfig) {
 	uint8_t GPO_config;
 
@@ -1130,11 +1116,6 @@
 	return NFC_SUCCESS;
 }
 
-/**
- * @brief  This function enable or disable RF communication
- * @param	OnOffChoice: GPO configuration to set
- * @retval Status (SW1&SW2) : Status of the operation to complete.
- */
 NFC_StatusTypeDef M24SR::M24SR_RFConfig(uint8_t OnOffChoice) {
 	/* Disable RF */
 	if (OnOffChoice != 0) {
@@ -1163,7 +1144,8 @@
 }
 
 #define M24SR_POLL_DELAY 10
-#define M24SR_I2C_POLLING       200 /* In case M24SR will reply ACK failed allow to perform retry before returning error (HAL option not used) */
+/* In case M24SR will reply ACK failed allow to perform retry before returning error (HAL option not used) */
+#define M24SR_I2C_POLLING       200 
 
 NFC_StatusTypeDef M24SR::M24SR_IO_PollI2C(void) {