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
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 9:9f2e2e68d695, committed 2016-01-14
- Comitter:
- giovannivisentini
- Date:
- Thu Jan 14 07:54:59 2016 +0000
- Parent:
- 8:5e637c71cbb3
- Child:
- 10:482175f7ae66
- Commit message:
- update documentation 3
Changed in this revision
--- a/Common/component.h Mon Jan 11 13:06:23 2016 +0000
+++ b/Common/component.h Thu Jan 14 07:54:59 2016 +0000
@@ -1,91 +1,91 @@
-/**
- ******************************************************************************
- * @file component.h
- * @author AST
- * @version V1.0.0
- * @date 1 April 2015
- * @brief Generic header file containing a generic component's definitions
- * and I/O functions.
- ******************************************************************************
- * @attention
- *
- * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of STMicroelectronics nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */
-
-
-/* Prevent recursive inclusion -----------------------------------------------*/
-
-#ifndef __COMPONENT_H__
-#define __COMPONENT_H__
-
-
-/* Types ---------------------------------------------------------------------*/
-
-/**
- * @brief Component's Context structure definition.
- */
-typedef struct
-{
- /* Identity. */
- uint8_t who_am_i;
-
- /* ACTION ----------------------------------------------------------------*/
- /* There should be only a unique identifier for each component, which */
- /* should be the "who_am_i" parameter, hence this parameter is optional. */
- /* -----------------------------------------------------------------------*/
- /* Type. */
- uint8_t type;
-
- /* Configuration. */
- uint8_t address;
-
- /* Pointer to the Data. */
- void *pData;
-
- /* Pointer to the Virtual Table. */
- void *pVTable;
-
- /* ACTION ----------------------------------------------------------------*/
- /* There should be only a unique virtual table for each component, which */
- /* should be the "pVTable" parameter, hence this parameter is optional. */
- /* -----------------------------------------------------------------------*/
- /* Pointer to the Extended Virtual Table. */
- void *pExtVTable;
-} DrvContextTypeDef;
-
-/**
- * @brief Component's Status enumerator definition.
- */
-typedef enum
-{
- COMPONENT_OK = 0,
- COMPONENT_ERROR,
- COMPONENT_TIMEOUT,
- COMPONENT_NOT_IMPLEMENTED
-} DrvStatusTypeDef;
-
+/**
+ ******************************************************************************
+ * @file component.h
+ * @author AST
+ * @version V1.0.0
+ * @date 1 April 2015
+ * @brief Header file containing generic component definitions
+ * and I/O functions.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+
+/* Prevent recursive inclusion -----------------------------------------------*/
+
+#ifndef __COMPONENT_H__
+#define __COMPONENT_H__
+
+
+/* Types ---------------------------------------------------------------------*/
+
+/**
+ * @brief Component's Context structure definition.
+ */
+typedef struct
+{
+ /* Identity. */
+ uint8_t who_am_i;
+
+ /* ACTION ----------------------------------------------------------------*/
+ /* There should be only a unique identifier for each component, which */
+ /* should be the "who_am_i" parameter, hence this parameter is optional. */
+ /* -----------------------------------------------------------------------*/
+ /* Type. */
+ uint8_t type;
+
+ /* Configuration. */
+ uint8_t address;
+
+ /* Pointer to the Data. */
+ void *pData;
+
+ /* Pointer to the Virtual Table. */
+ void *pVTable;
+
+ /* ACTION ----------------------------------------------------------------*/
+ /* There should be only a unique virtual table for each component, which */
+ /* should be the "pVTable" parameter, hence this parameter is optional. */
+ /* -----------------------------------------------------------------------*/
+ /* Pointer to the Extended Virtual Table. */
+ void *pExtVTable;
+} DrvContextTypeDef;
+
+/**
+ * @brief Component's Status enumerator definition.
+ */
+typedef enum
+{
+ COMPONENT_OK = 0,
+ COMPONENT_ERROR,
+ COMPONENT_TIMEOUT,
+ COMPONENT_NOT_IMPLEMENTED
+} DrvStatusTypeDef;
+
#endif
--- a/Interfaces/Nfc_class.h Mon Jan 11 13:06:23 2016 +0000
+++ b/Interfaces/Nfc_class.h Thu Jan 14 07:54:59 2016 +0000
@@ -2,7 +2,7 @@
******************************************************************************
* @file Nfc_class.h
* @author ST Central Labs
- * @version V0.0.1
+ * @version V1.0.0
* @date 13-April-2015
* @brief This file contains the abstract class describing the interface of a
* nfc component.
@@ -52,165 +52,167 @@
/* Classes ------------------------------------------------------------------*/
-/** An abstract class for Nfc components.
+/**
+ * An abstract class for Nfc components.
*/
class Nfc : public Component
{
public:
/**
- * possible password to set
+ * Possible password to set.
*/
typedef enum{
- ReadPwd=READ_PWD, //!< password to use before read the tag
- WritePwd=WRITE_PWD,//!< password to use before write the tag
- I2CPwd=I2C_PWD, //!< root password, used only thought nfc
+ ReadPwd=READ_PWD, //!< Password to use before read the tag
+ WritePwd=WRITE_PWD,//!< Password to use before write the tag
+ I2CPwd=I2C_PWD, //!< Root password, used only thought nfc
}PasswordType_t;
/**
- * open a i2c connection with the tag if an RF connection isn't already open
+ * Open a I2C connection with the tag if an RF connection isn't already open.
* @return operation status
*/
virtual NFC_StatusTypeDef GetSession(void) = 0;
+
/**
- * force to open an i2c connection , abort the RF connection
+ * Force to open an I2C connection , abort the RF connection.
* @return NFC_SUCCESS if the session is acquired
*/
virtual NFC_StatusTypeDef KillSession(void) = 0;
/**
- * close an i2c connection
+ * Close an I2C connection.
* @return NFC_SUCCESS if the session is release
*/
virtual NFC_StatusTypeDef Deselect(void) = 0;
/**
- * Select the application file
+ * Select the application file.
* @return NFC_SUCCESS if the application is selected
*/
virtual NFC_StatusTypeDef SelectApplication(void) = 0;
/**
- * select the CC file
- * @return NFC_SUCCESS if the cc file is selected
+ * Select the CC file.
+ * @return NFC_SUCCESS if the CC file is selected.
*/
virtual NFC_StatusTypeDef SelectCCfile(void) = 0;
/**
- * select the ndef file
- * @param NDEFfileId file id to open
+ * Select the ndef file.
+ * @param NDEFfileId File id to open.
* @return NFC_SUCCESS if the file is selected
*/
virtual NFC_StatusTypeDef SelectNDEFfile(uint16_t NDEFfileId) = 0;
/**
- * select the system file
+ * Select the system file.
* @return NFC_SUCCESS if the system file is selected
*/
virtual NFC_StatusTypeDef SelectSystemfile(void) = 0;
/**
- * read data from the tag
- * @param Offset offset where start to read
- * @param NbByteToRead number of byte to read
- * @param[out] pBufferRead buffer where store the read data
- * @return NFC_SUCCESS if no error happen
+ * Read data from the tag.
+ * @param Offset Read offset.
+ * @param NbByteToRead Number of bytes to read.
+ * @param[out] pBufferRead Buffer to store the read data into.
+ * @return NFC_SUCCESS if no errors
*/
virtual NFC_StatusTypeDef ReadBinary(uint16_t Offset, uint8_t NbByteToRead, uint8_t *pBufferRead) = 0;
/**
- * write data to the tag
- * @param Offset offset where start to write
- * @param NbByteToWrite number of byte to write
- * @param pDataToWrite buffer to write
- * @return NFC_SUCCESS if no error happen
+ * Write data to the tag.
+ * @param Offset Write offset.
+ * @param NbByteToWrite Number of bytes to write.
+ * @param pDataToWrite Buffer to write.
+ * @return NFC_SUCCESS if no errors
*/
virtual NFC_StatusTypeDef UpdateBinary(uint16_t Offset, uint8_t NbByteToWrite, uint8_t *pDataToWrite) = 0;
/**
- * check that the password is correct
- * @param uPwdId password type
- * @param NbPwdByte password size ( must be 0x10)
- * @param pPwd password buffer
- * @return NFC_SUCCESS if no error happen, and you have the permission to write/read
+ * Check that the password is correct.
+ * @param uPwdId Password type.
+ * @param NbPwdByte Password size ( must be 0x10).
+ * @param pPwd Password buffer.
+ * @return NFC_SUCCESS if no errors and write/read permission granted
*/
virtual NFC_StatusTypeDef Verify(PasswordType_t uPwdId, uint8_t NbPwdByte,const uint8_t *pPwd) = 0;
/**
- * 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
+ * Replace the read or write password.
+ * @param uPwdId Password to change.
+ * @param pPwd New password.
+ * @return NFC_SUCCESS if no errors
*/
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
+ * Activate NDEF file password protection.
+ * When this command is successful, read or write access to the NDEF file is protected by a 128-bit password.
+ * @param uReadOrWrite Read or write password.
+ * @return NFC_SUCCESS if no errors
*/
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
+ * Deactivate NDEF file password protection.
+ * When this command is successful, read or write access to the NDEF file is granted.
+ * with no security enforcement.
+ * @param uReadOrWrite Read or write password.
+ * @return NFC_SUCCESS if no errors
*/
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
- * that are available
- * @param Offset offset where start to read
- * @param NbByteToRead number of byte to read
- * @param[out] pBufferRead buffer where store the read data
- * @return NFC_SUCCESS if no error happen
+ * Same as {@link NFC#ReadBinary}, however permitting to read more bytes than available.
+ * @param Offset read offset.
+ * @param NbByteToRead Number of bytes to read.
+ * @param[out] pBufferRead Buffer to store the read data into.
+ * @return NFC_SUCCESS if no errors
*/
virtual NFC_StatusTypeDef STReadBinary(uint16_t Offset, uint8_t NbByteToRead, uint8_t *pBufferRead) = 0;
/**
- * set the tag as read/write only and write it in the eeprom
- * @param uReadOrWrite ReadPwd if you need a write only, WritePwd if you need a read only
- * @return NFC_SUCCESS if no error happen
+ * Set the tag as read/write only, stored in the eeprom.
+ * @param uReadOrWrite ReadPwd if write only, WritePwd if read only.
+ * @return NFC_SUCCESS if no errors
*/
virtual NFC_StatusTypeDef EnablePermanentState(PasswordType_t uReadOrWrite) = 0;
+
/**
- * unset the tag as read/write only and write it in the eeprom
- * @param uReadOrWrite ReadPwd if you need a write only, WritePwd if you need a read only
- * @return NFC_SUCCESS if no error happen
- * @par you must be in i2csuper user state for call this function
+ * Unset the tag as read/write only, stored in the eeprom.
+ * @param uReadOrWrite ReadPwd if write only, WritePwd if read only.
+ * @return NFC_SUCCESS if no errors
+ * @par Caller must have I2Csuper user permissions to call this function.
*/
virtual NFC_StatusTypeDef DisablePermanentState(PasswordType_t uReadOrWrite) = 0;
/**
- * set the gpo output pin
- * @param uSetOrReset new pin status
- * @return NFC_SUCCESS if no error happen
+ * Set the gpo output pin.
+ * @param uSetOrReset New pin status.
+ * @return NFC_SUCCESS if no errors
*/
virtual NFC_StatusTypeDef StateControl(uint8_t uSetOrReset) = 0;
/**
- * @brief This function configure GPO purpose for I2C session
- * @param GPO_I2Cconfig: GPO configuration to set
- * @return NFC_SUCCESS if no error happen
+ * @brief This function configures GPO for I2C session.
+ * @param GPO_I2Cconfig GPO configuration to set.
+ * @return NFC_SUCCESS if no errors
*/
virtual NFC_StatusTypeDef ManageI2CGPO(uint8_t GPO_I2Cconfig) = 0;
/**
- * @brief This function configure GPO purpose for RF session
- * @param GPO_RFconfig: GPO configuration to set
- * @return NFC_SUCCESS if no error happen
+ * @brief This function configures GPO for RF session.
+ * @param GPO_RFconfig GPO configuration to set.
+ * @return NFC_SUCCESS if no errors
*/
virtual NFC_StatusTypeDef ManageRFGPO(uint8_t GPO_RFconfig) = 0;
/**
- * @brief This function enable or disable RF communication
- * @param OnOffChoice: GPO configuration to set
- * @return NFC_SUCCESS if no error happen
+ * @brief This function enables or disables the RF communication.
+ * @param OnOffChoice GPO configuration to set.
+ * @return NFC_SUCCESS if no errors
*/
virtual NFC_StatusTypeDef RFConfig(uint8_t OnOffChoice) = 0;
--- a/X_NUCLEO_NFC01A1.cpp Mon Jan 11 13:06:23 2016 +0000 +++ b/X_NUCLEO_NFC01A1.cpp Thu Jan 14 07:54:59 2016 +0000 @@ -3,7 +3,7 @@ * @file X_NUCLEO_NFC01A1.h * @author ST Central Labs * @date 05 Nov 2015 - * @brief singleton class that controls all the electronics inside the + * @brief Singleton class that controls all the electronics inside the * X_NUCLEO_NFC01A1 expansion board ****************************************************************************** *
--- a/X_NUCLEO_NFC01A1.h Mon Jan 11 13:06:23 2016 +0000
+++ b/X_NUCLEO_NFC01A1.h Thu Jan 14 07:54:59 2016 +0000
@@ -2,12 +2,14 @@
******************************************************************************
* @file X_NUCLEO_NFC01A1.h
* @author ST Central Labs
+ * @version V1.0.0
* @date 05 Nov 2015
- * @brief singleton class that controls all the electronics inside the
- * X_NUCLEO_NFC01A1 expansion board
+ * @brief Singleton class that controls all the electronics inside the
+ * X_NUCLEO_NFC01A1 expansion board.
******************************************************************************
+ * @attention
*
- * COPYRIGHT(c) 2015 STMicroelectronics
+ * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -43,28 +45,28 @@
#include "m24sr/m24sr_class.h"
/**
- * singleton class that controls all the electronics inside the X_NUCLEO_NFC01A1 expansion board
+ * Singleton class that controls all the electronics inside the X_NUCLEO_NFC01A1 expansion board.
*/
class X_NUCLEO_NFC01A1 {
private:
/**
- * ponter to the singleton instance, NULL if we did't build one
+ * Ponter to the singleton instance, NULL if not allocated.
*/
static X_NUCLEO_NFC01A1 *mInstance;
/**
- * i2c address of the m24sr chip
+ * I2C address of the M24SR chip.
*/
static const uint8_t M24SR_ADDR;
/**
* constructor
- * @param devI2C i2c channel used for communicate with the board
- * @param gpoName pin of the gpio pin of the M24SR chip
- * @param RFDisableName pin for disable the rf antenna
- * @param led1Name pin for control the led1 status
- * @param led2Name pin for control the led1 status
- * @param led3Name pin for control the led1 status
+ * @param devI2C I2C channel used to communicate with the board.
+ * @param gpoName Name of the gpio pin of the M24SR chip.
+ * @param RFDisableName Pin that controls the rf antenna status.
+ * @param led1Name Pin to control the led1 status.
+ * @param led2Name Pin to control the led1 status.
+ * @param led3Name Pin to control the led1 status.
*/
X_NUCLEO_NFC01A1(I2C &devI2C, const PinName &gpoName,
const PinName &RFDisableName, const PinName &led1Name,
@@ -73,22 +75,22 @@
mNfcLed1(led1Name),mNfcLed2(led2Name),mNfcLed3(led3Name){}
public:
- static const PinName DEFAULT_SDA_PIN; //!< default pin used for the M24SR SDA signal
- static const PinName DEFAULT_SDL_PIN; //!< default pin used for the M24SR SDL signal
- static const PinName DEFAULT_GPO_PIN; //!< default pin used for the M24SR GPO signal
- static const PinName DEFAULT_RF_DISABLE_PIN; //!< default pin used for M24SR RF_DISABLE signal
- static const PinName DEFAULT_LED1_PIN; //!< default pin for controll the led 1
- static const PinName DEFAULT_LED2_PIN; //!< default pin for controll the led 2
- static const PinName DEFAULT_LED3_PIN; //!< default pin for controll the led 3
+ static const PinName DEFAULT_SDA_PIN; //!< Default pin used for the M24SR SDA signal.
+ static const PinName DEFAULT_SDL_PIN; //!< Default pin used for the M24SR SDL signal.
+ static const PinName DEFAULT_GPO_PIN; //!< Default pin used for the M24SR GPO signal.
+ static const PinName DEFAULT_RF_DISABLE_PIN; //!< Default pin used for M24SR RF_DISABLE signal.
+ static const PinName DEFAULT_LED1_PIN; //!< Default pin to controll the led 1.
+ static const PinName DEFAULT_LED2_PIN; //!< Default pin to controll the led 2.
+ static const PinName DEFAULT_LED3_PIN; //!< Default pin to controll the led 3.
/**
- * create or return an instance of X_NUCLEO_NFC01A1
- * @param devI2C i2c channel used for communicate with the board
- * @param gpoName pin of the gpio pin of the M24SR chip
- * @param RFDisableName pin for disable the rf antenna
- * @param led1Name pin for control the led1 status
- * @param led2Name pin for control the led1 status
- * @param led3Name pin for control the led1 status
+ * Create or return an instance of X_NUCLEO_NFC01A1.
+ * @param devI2C I2C channel used to communicate with the board.
+ * @param gpoName Name of the gpio pin of the M24SR chip.
+ * @param RFDisableName Pin that controls the rf antenna status.
+ * @param led1Name Pin to control the led1 status.
+ * @param led2Name Pin to control the led1 status.
+ * @param led3Name Pin to control the led1 status.
*/
static X_NUCLEO_NFC01A1* Instance(I2C &devI2C,
const PinName &gpoName = DEFAULT_GPO_PIN,
@@ -98,28 +100,28 @@
const PinName &led3Name = DEFAULT_LED3_PIN);
/**
- * @return board led1
+ * @return board led1.
*/
DigitalOut& getLed1() {
return mNfcLed1;
}
/**
- * @return board led2
+ * @return board led2.
*/
DigitalOut& getLed2() {
return mNfcLed2;
}
/**
- * @return board led3
+ * @return board led3.
*/
DigitalOut& getLed3() {
return mNfcLed3;
}
/**
- * @return NFC Chip
+ * @return NFC Chip.
*/
M24SR& getM24SR() {
return mM24SR;
--- a/m24sr/NDefNfcTagM24SR.cpp Mon Jan 11 13:06:23 2016 +0000 +++ b/m24sr/NDefNfcTagM24SR.cpp Thu Jan 14 07:54:59 2016 +0000 @@ -2,11 +2,13 @@ ****************************************************************************** * @file NdefNfcTagSTM24SR.cpp * @author ST Central Labs + * @version V1.0.0 * @date 05 Nov 2015 * @brief wrapper class for use the NDefLib library for write/read ndef message ****************************************************************************** + * @attention * - * COPYRIGHT(c) 2015 STMicroelectronics + * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: @@ -37,7 +39,7 @@ #include "m24sr_class.h" /* wait 1sec, driver is configured to let 200ms for command to complete */ /* which is enough for all commands except GetSession if RF session is already opened */ -/* Smartphone generaly release the session within the second, but customer can modify this value */ +/* Smartphone generally releases the session within the second, anyway the user can modify this value */ #define OPENSESSION_NTRIALS 5 #define CC_FILE_LENGTH_BYTE 15
--- a/m24sr/NDefNfcTagM24SR.h Mon Jan 11 13:06:23 2016 +0000
+++ b/m24sr/NDefNfcTagM24SR.h Thu Jan 14 07:54:59 2016 +0000
@@ -2,11 +2,13 @@
******************************************************************************
* @file Type4NfcTagM24SR.h
* @author ST Central Labs
+ * @version V1.0.0
* @date 05 Nov 2015
- * @brief wrapper class for use the NDefLib library for write/read ndef message
+ * @brief M24SR specific NDefLib derived class
******************************************************************************
+ * @attention
*
- * COPYRIGHT(c) 2015 STMicroelectronics
+ * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -42,13 +44,13 @@
class M24SR;
/**
- * implement the abstract method for use the NDefLib */
+ * Implement all NDefLib abstract methods. */
class NDefNfcTagM24SR: public NDefLib::NDefNfcTag {
public:
/**
- * create the object
- * @param device device where write the Ndef tags
+ * Create the object.
+ * @param Device device to write the Ndef tags into.
*/
NDefNfcTagM24SR(M24SR &device) :
mDevice(device), mMaxReadBytes(0xFF), mMaxWriteBytes(
@@ -56,22 +58,22 @@
}
/**
- * 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
+ * Open the communication session with the nfc tag.
+ * @par This method should be called at the end of an overriding implementation, just before returning.
+ * @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
+ * Close the communication with the nfc tag.
+ * @par This method should be called at the end of an overriding implementation, just before returning.
* @return true if success
*/
virtual bool closeSession();
/**
- * close the open session
+ * Close the open session.
*/
virtual ~NDefNfcTagM24SR() {
if(isSessionOpen())
@@ -83,19 +85,19 @@
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
+ * Write a sequence of bytes to the NDEF file.
+ * @param buffer Buffer to write.
+ * @param length Number of bytes to write.
+ * @param offset Write offset in bytes.
* @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
+ * Read a sequence of bytes from the NDEF file.
+ * @param byteOffset Read offsetin bytes.
+ * @param byteLength Number of bytes to read.
+ * @param[out] buffer Buffer to store the read data into.
* @return true if success
*/
virtual bool readByte(const uint16_t byteOffset, const uint16_t byteLength,
@@ -106,12 +108,12 @@
M24SR &mDevice;
/**
- * max length for a read operation
+ * Max length for a read operation
*/
uint16_t mMaxReadBytes;
/**
- * max length for a write operation
+ * Max length for a write operation
*/
uint16_t mMaxWriteBytes;
};
--- a/m24sr/m24sr_class.cpp Mon Jan 11 13:06:23 2016 +0000
+++ b/m24sr/m24sr_class.cpp Thu Jan 14 07:54:59 2016 +0000
@@ -2,6 +2,7 @@
******************************************************************************
* @file m24sr_class.cpp
* @author ST Central Labs
+ * @version V1.0.0
* @date 05 Nov 2015
* @brief This file provides a set of functions to interface with the M24SR
* device.
@@ -42,7 +43,7 @@
#include "m24sr.h"
/**
- * default password, it is used also for reach the super user mode throught the i2c channel
+ * default password, also used to enable super user mode throught the I2C channel
*/
const uint8_t M24SR::DEFAULT_PASSWORD[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
@@ -59,7 +60,7 @@
#ifndef errchk
-/** value return by the NFC chip when a command is successfully done */
+/** value returned by the NFC chip when a command is successfully completed */
#define NFC_COMMAND_SUCCESS 0x9000
/** call the fCall funtion and check that the return status is NFC_SUCCESS,
@@ -89,7 +90,7 @@
/**
* @brief This function returns the CRC 16
* @param Data : pointer on the data used to compute the CRC16
- * @param Length : number of byte of the data
+ * @param Length : number of bytes of the data
* @retval CRC16
*/
static uint16_t M24SR_ComputeCrc(uint8_t *Data, uint8_t Length) {
@@ -106,7 +107,7 @@
/**
* @brief This function computes the CRC16 residue as defined by CRC ISO/IEC 13239
- * @param DataIn : input to data
+ * @param DataIn : input data
* @param Length : Number of bits of DataIn
* @retval Status (SW1&SW2) : CRC16 residue is correct
* @retval M24SR_ERROR_CRC : CRC16 residue is false
@@ -138,10 +139,10 @@
/**
* @brief This functions creates an I block command according to the structures CommandStructure and data->command.
- * @param Command : structue which contains the field of the different parameter
- * @param CommandStructure : structure that contain the structure of the command (if the different field are presnet or not
- * @param NbByte : number of byte of the command
- * @param pCommand : pointer of the command created
+ * @param Command : structure which contains the field of the different parameters
+ * @param CommandStructure : structure of the command
+ * @param NbByte : number of bytes of the command
+ * @param pCommand : pointer to the command created
*/
static void M24SR_BuildIBlockCommand(uint16_t CommandStructure, C_APDU *Command,
uint8_t uDIDbyte, uint16_t *NbByte, uint8_t *pCommand) {
@@ -203,51 +204,10 @@
}
-#if 0
-/**
- * @brief This function return M24SR_STATUS_SUCCESS if the pBuffer is an I-block
- * @param pBuffer : pointer of the data
- * @retval M24SR_STATUS_SUCCESS : the data is a I-Block
- * @retval M24SR_ERROR_DEFAULT : the data is not a I-Block
- */
-static int8_t IsIBlock (uint8_t *pBuffer)
-{
-
- if ((pBuffer[M24SR_OFFSET_PCB] & M24SR_MASK_BLOCK) == M24SR_MASK_IBLOCK)
- {
- return M24SR_STATUS_SUCCESS;
- }
- else
- {
- return M24SR_ERROR_DEFAULT;
- }
-
-}
/**
- * @brief This function return M24SR_STATUS_SUCCESS if the pBuffer is an R-block
- * @param pBuffer : pointer of the data
- * @retval M24SR_STATUS_SUCCESS : the data is a R-Block
- * @retval M24SR_ERROR_DEFAULT : the data is not a R-Block
- */
-static int8_t IsRBlock (uint8_t *pBuffer)
-{
-
- if ((pBuffer[M24SR_OFFSET_PCB] & M24SR_MASK_BLOCK) == M24SR_MASK_RBLOCK)
- {
- return M24SR_STATUS_SUCCESS;
- }
- else
- {
- return M24SR_ERROR_DEFAULT;
- }
-
-}
-#endif
-
-/**
- * @brief This function return M24SR_STATUS_SUCCESS if the pBuffer is an s-block
- * @param pBuffer : pointer of the data
+ * @brief This function returns M24SR_STATUS_SUCCESS if the pBuffer is an s-block
+ * @param pBuffer : pointer to the data
* @retval NFC_SUCCESS : the data is a S-Block
* @retval NFC_ERROR : the data is not a S-Block
*/
@@ -264,7 +224,7 @@
/**
* @brief This function sends the FWT extension command (S-Block format)
* @param FWTbyte : FWT value
- * @return NFC_SUCCESS if no error happen
+ * @return NFC_SUCCESS if no errors
*/
NFC_StatusTypeDef M24SR::M24SR_FWTExtension(uint8_t FWTbyte) {
uint8_t pBuffer[M24SR_STATUSRESPONSE_NBBYTE];
@@ -299,7 +259,7 @@
/**
* @brief This function sends the KillSession command to the M24SR device
* @param None
- * @return NFC_SUCCESS if no error happen
+ * @return NFC_SUCCESS if no errors
*/
NFC_StatusTypeDef M24SR::M24SR_KillSession(void) {
uint8_t commandBuffer[] = M24SR_KILLSESSION_COMMAND;
@@ -316,7 +276,7 @@
/**
* @brief This function sends the Deselect command (S-Block format)
- * @return NFC_SUCCESS if no error happen
+ * @return NFC_SUCCESS if no errors
*/
NFC_StatusTypeDef M24SR::M24SR_Deselect(void) {
uint8_t pBuffer[] = M24SR_DESELECTREQUEST_COMMAND;
@@ -333,7 +293,7 @@
/**
* @brief This function sends the SelectApplication command
- * @return NFC_SUCCESS if no error happen
+ * @return NFC_SUCCESS if no errors
*/
NFC_StatusTypeDef M24SR::M24SR_SelectApplication(void) {
@@ -403,8 +363,8 @@
/**
* @brief This function sends the GetSession command to the M24SR device
- * @retval NFC_SUCCESS : the function is successful.
- * @retval Status (SW1&SW2) : if operation does not complete.
+ * @retval NFC_SUCCESS the function is successful.
+ * @retval Status (SW1&SW2) if operation does not complete.
*/
NFC_StatusTypeDef M24SR::M24SR_GetSession(void) {
uint8_t commandBuffer[] = M24SR_OPENSESSION_COMMAND;
@@ -422,9 +382,9 @@
/**
* @brief This function sends the SelectCCFile command
- * @retval NFC_SUCCESS : the function is successful.
- * @retval M24SR_ERROR_I2CTIMEOUT : The I2C timeout occurred.
- * @retval Status (SW1&SW2) : if operation does not complete for another reason.
+ * @retval NFC_SUCCESS the function is successful.
+ * @retval M24SR_ERROR_I2CTIMEOUT I2C timeout occurred.
+ * @retval Status (SW1&SW2) if operation does not complete for another reason.
*/
NFC_StatusTypeDef M24SR::M24SR_SelectCCfile(void) {
C_APDU command;
@@ -465,8 +425,8 @@
/**
* @brief This function sends the SelectSystemFile command
- * @retval Status (SW1&SW2) : Status of the operation to complete.
- * @retval M24SR_ERROR_I2CTIMEOUT : The I2C timeout occurred.
+ * @retval Status (SW1&SW2) Status of the operation to complete.
+ * @retval M24SR_ERROR_I2CTIMEOUT I2C timeout occurred.
*/
NFC_StatusTypeDef M24SR::M24SR_SelectSystemfile(void) {
C_APDU command;
@@ -507,8 +467,8 @@
/**
* @brief This function sends the SelectNDEFfile command
- * @retval Status (SW1&SW2) : Status of the operation to complete.
- * @retval M24SR_ERROR_I2CTIMEOUT : The I2C timeout occurred.
+ * @retval Status (SW1&SW2) Status of the operation to complete.
+ * @retval M24SR_ERROR_I2CTIMEOUT I2C timeout occurred.
*/
NFC_StatusTypeDef M24SR::M24SR_SelectNDEFfile(uint16_t NDEFfileId) {
C_APDU command;
@@ -548,11 +508,11 @@
/**
* @brief This function sends a read binary command
- * @param Offset : first byte to read
- * @param NbByteToRead : number of byte to read
- * @param pBufferRead : pointer of the buffer read from the M24SR device
- * @retval Status (SW1&SW2) : Status of the operation to complete.
- * @retval M24SR_ERROR_I2CTIMEOUT : The I2C timeout occurred.
+ * @param Offset first byte to read
+ * @param NbByteToRead number of bytes to read
+ * @param pBufferRead pointer to the buffer read from the M24SR device
+ * @retval Status (SW1&SW2) Status of the operation to complete.
+ * @retval M24SR_ERROR_I2CTIMEOUT I2C timeout occurred.
*/
NFC_StatusTypeDef M24SR::M24SR_ReadBinary(uint16_t Offset, uint8_t NbByteToRead,
uint8_t *pBufferRead) {
@@ -590,11 +550,11 @@
/**
* @brief This function sends a ST read binary command (no error if access is not inside NDEF file)
- * @param Offset : first byte to read
- * @param NbByteToRead : number of byte to read
- * @param pBufferRead : pointer of the buffer read from the M24SR device
- * @retval Status (SW1&SW2) : Status of the operation to complete.
- * @retval M24SR_ERROR_I2CTIMEOUT : The I2C timeout occurred.
+ * @param Offset first byte to read
+ * @param NbByteToRead number of bytes to read
+ * @param pBufferRead pointer to the buffer read from the M24SR device
+ * @retval Status (SW1&SW2) Status of the operation to complete.
+ * @retval M24SR_ERROR_I2CTIMEOUT I2C timeout occurred.
*/
NFC_StatusTypeDef M24SR::M24SR_STReadBinary(uint16_t Offset,
uint8_t NbByteToRead, uint8_t *pBufferRead) {
@@ -632,11 +592,11 @@
/**
* @brief This function sends a Update binary command
- * @param Offset : first byte to read
- * @param NbByteToWrite : number of byte to write
- * @param pBufferRead : pointer of the buffer read from the M24SR device
- * @retval Status (SW1&SW2) : Status of the operation to complete.
- * @retval M24SR_ERROR_I2CTIMEOUT : The I2C timeout occurred.
+ * @param Offset first byte to read
+ * @param NbByteToWrite number of bytes to write
+ * @param pBufferRead pointer to the buffer read from the M24SR device
+ * @retval Status (SW1&SW2) Status of the operation to complete.
+ * @retval M24SR_ERROR_I2CTIMEOUT I2C timeout occurred.
*/
NFC_StatusTypeDef M24SR::M24SR_UpdateBinary(uint16_t Offset,
uint8_t NbByteToWrite, uint8_t *pDataToWrite) {
@@ -690,11 +650,11 @@
/**
* @brief This function sends the Verify command
- * @param uPwdId : PasswordId ( 0x0001 : Read NDEF pwd or 0x0002 : Write NDEF pwd or 0x0003 : I2C pwd)
- * @param NbPwdByte : Number of byte ( 0x00 or 0x10)
- * @param pPwd : pointer on the passwaord
- * @retval Status (SW1&SW2) : Status of the operation to complete.
- * @retval M24SR_ERROR_I2CTIMEOUT : The I2C timeout occurred.
+ * @param uPwdId PasswordId ( 0x0001 : Read NDEF pwd or 0x0002 : Write NDEF pwd or 0x0003 : I2C pwd)
+ * @param NbPwdByte Number of bytes ( 0x00 or 0x10)
+ * @param pPwd pointer to the password
+ * @retval Status (SW1&SW2) Status of the operation to complete.
+ * @retval M24SR_ERROR_I2CTIMEOUT I2C timeout occurred.
*/
NFC_StatusTypeDef M24SR::M24SR_Verify(uint16_t uPwdId, uint8_t NbPwdByte,
const uint8_t *pPwd) {
@@ -718,7 +678,7 @@
/* copy the Password Id */
command.Header.P1 = GETMSB(uPwdId);
command.Header.P2 = GETLSB(uPwdId);
- /* copy the number of byte of the data field */
+ /* copy the number of bytes of the data field */
command.Body.LC = NbPwdByte;
if (NbPwdByte == 0x10) {
@@ -752,10 +712,10 @@
/**
* @brief This function sends the ChangeReferenceData command
- * @param uPwdId : PasswordId ( 0x0001 : Read NDEF pwd or 0x0002 : Write NDEF pwd or 0x0003 : I2C pwd)
- * @param pPwd : pointer on the passwaord
- * @retval Status (SW1&SW2) : Status of the operation to complete.
- * @retval M24SR_ERROR_I2CTIMEOUT : The I2C timeout occurred.
+ * @param uPwdId PasswordId ( 0x0001 : Read NDEF pwd or 0x0002 : Write NDEF pwd or 0x0003 : I2C pwd)
+ * @param pPwd pointer to the passwaord
+ * @retval Status (SW1&SW2) Satus of the operation to complete.
+ * @retval M24SR_ERROR_I2CTIMEOUT I2C timeout occurred.
*/
NFC_StatusTypeDef M24SR::M24SR_ChangeReferenceData(uint16_t uPwdId,
uint8_t *pPwd) {
@@ -800,9 +760,9 @@
/**
* @brief This function sends the EnableVerificationRequirement command
- * @param uReadOrWrite : enable the read or write protection ( 0x0001 : Read or 0x0002 : Write )
- * @retval Status (SW1&SW2) : Status of the operation to complete.
- * @retval M24SR_ERROR_I2CTIMEOUT : The I2C timeout occurred.
+ * @param uReadOrWrite enable the read or write protection ( 0x0001 : Read or 0x0002 : Write )
+ * @retval Status (SW1&SW2) Status of the operation to complete.
+ * @retval M24SR_ERROR_I2CTIMEOUT I2C timeout occurred.
*/
NFC_StatusTypeDef M24SR::M24SR_EnableVerificationRequirement(
uint16_t uReadOrWrite) {
@@ -843,9 +803,9 @@
/**
* @brief This function sends the DisableVerificationRequirement command
- * @param uReadOrWrite : enable the read or write protection ( 0x0001 : Read or 0x0002 : Write )
- * @retval Status (SW1&SW2) : Status of the operation to complete.
- * @retval M24SR_ERROR_I2CTIMEOUT : The I2C timeout occurred.
+ * @param uReadOrWrite enable the read or write protection ( 0x0001 : Read or 0x0002 : Write )
+ * @retval Status (SW1&SW2) Status of the operation to complete.
+ * @retval M24SR_ERROR_I2CTIMEOUT I2C timeout occurred.
*/
NFC_StatusTypeDef M24SR::M24SR_DisableVerificationRequirement(
uint16_t uReadOrWrite) {
@@ -888,9 +848,9 @@
/**
* @brief This function sends the EnablePermananentState command
- * @param uReadOrWrite : enable the read or write protection ( 0x0001 : Read or 0x0002 : Write )
- * @retval Status (SW1&SW2) : Status of the operation to complete.
- * @retval M24SR_ERROR_I2CTIMEOUT : The I2C timeout occurred.
+ * @param uReadOrWrite enable the read or write protection ( 0x0001 : Read or 0x0002 : Write )
+ * @retval Status (SW1&SW2) Status of the operation to complete.
+ * @retval M24SR_ERROR_I2CTIMEOUT I2C timeout occurred.
*/
NFC_StatusTypeDef M24SR::M24SR_EnablePermanentState(uint16_t uReadOrWrite) {
C_APDU command;
@@ -930,9 +890,9 @@
/**
* @brief This function sends the DisablePermanentState command
- * @param uReadOrWrite : enable the read or write protection ( 0x0001 : Read or 0x0002 : Write )
- * @retval Status (SW1&SW2) : Status of the operation to complete.
- * @retval M24SR_ERROR_I2CTIMEOUT : The I2C timeout occurred.
+ * @param uReadOrWrite enable the read or write protection ( 0x0001 : Read or 0x0002 : Write )
+ * @retval Status (SW1&SW2) Status of the operation to complete.
+ * @retval M24SR_ERROR_I2CTIMEOUT I2C timeout occurred.
*/
NFC_StatusTypeDef M24SR::M24SR_DisablePermanentState(uint16_t uReadOrWrite) {
C_APDU command;
@@ -972,10 +932,10 @@
}
/**
- * @brief This function generates a interrupt on GPO pin
+ * @brief This function generates an interrupt on GPO pin
* @param None
- * @retval Status (SW1&SW2) : Status of the operation to complete.
- * @retval M24SR_ERROR_I2CTIMEOUT : The I2C timeout occurred.
+ * @retval Status (SW1&SW2) Status of the operation to complete.
+ * @retval M24SR_ERROR_I2CTIMEOUT I2C timeout occurred.
*/
NFC_StatusTypeDef M24SR::M24SR_SendInterrupt(void) {
C_APDU command;
@@ -1015,10 +975,10 @@
}
/**
- * @brief This function force GPO pin to low state or high Z
- * @param uSetOrReset : select if GPO must be low (reset) or HiZ
- * @retval Status (SW1&SW2) : Status of the operation to complete.
- * @retval M24SR_ERROR_I2CTIMEOUT : The I2C timeout occurred.
+ * @brief This function forces GPO pin to low state or high Z
+ * @param uSetOrReset select if GPO must be low (reset) or HiZ
+ * @retval Status (SW1&SW2) Status of the operation to complete.
+ * @retval M24SR_ERROR_I2CTIMEOUT I2C timeout occurred.
*/
NFC_StatusTypeDef M24SR::M24SR_StateControl(uint8_t uSetOrReset) {
C_APDU command;
--- a/m24sr/m24sr_class.h Mon Jan 11 13:06:23 2016 +0000
+++ b/m24sr/m24sr_class.h Thu Jan 14 07:54:59 2016 +0000
@@ -2,6 +2,7 @@
******************************************************************************
* @file m24sr_class.h
* @author ST Central Labs
+ * @version V1.0.0
* @date 05 Nov 2015
* @brief This file provides a set of functions to interface with the M24SR
* device.
@@ -57,14 +58,15 @@
/* Classes -------------------------------------------------------------------*/
-/** Class representing a M24SR component.
+/**
+ * Class representing a M24SR component.
*/
class M24SR: public Nfc {
public:
/**
- * default password uesed for change the write/read permission
+ * Default password used to change the write/read permission
*/
static const uint8_t DEFAULT_PASSWORD[16];
@@ -73,13 +75,13 @@
/**
* @brief Constructor.
* @param address I2C address of the component.
- * @param i2c I2C device to be used for communication.
- * @param GPOPinName pin used as GPIO
- * @param RFDISPinName pin used for disable the RF function
+ * @param I2C I2C device to be used for communication.
+ * @param GPOPinName Pin used as GPIO.
+ * @param RFDISPinName Pin used to disable the RF function.
*/
- M24SR(const uint8_t address, I2C &i2c, const PinName& GPOPinName,
+ M24SR(const uint8_t address, I2C &I2C, const PinName& GPOPinName,
const PinName& RFDISPinName) :
- Nfc(), address(address), dev_i2c(i2c), GPOPin(GPOPinName), RFDisablePin(
+ Nfc(), address(address), dev_I2C(I2C), GPOPin(GPOPinName), RFDisablePin(
RFDISPinName), answerReadyInterrupt(GPOPinName), interruptIsFired(
false),NDefTagUtil(*this) {
@@ -104,9 +106,9 @@
/*** Public Component Related Methods ***/
/**
- * @brief This function initialize the M24SR device
- * @param ptr configure paramiters, not used
- * @return NFC_SUCCESS if no error happen
+ * @brief This function initializes the M24SR device.
+ * @param ptr Configure parameters, not used.
+ * @return NFC_SUCCESS if no errors
*/
virtual int Init(void *ptr) {
return (NFC_StatusTypeDef) M24SR_Init((NFC_InitTypeDef*)ptr);
@@ -186,9 +188,7 @@
}
////////////////////// ST proprietary //////////////////////////////////
- /**
- * as
- */
+
virtual NFC_StatusTypeDef STReadBinary(uint16_t Offset,
uint8_t NbByteToRead, uint8_t *pBufferRead) {
return (NFC_StatusTypeDef) M24SR_STReadBinary((uint16_t) Offset,
@@ -226,8 +226,8 @@
/**
* Generates a negative pulse on the GPO pin.
- * It starts at the end of the command and ends at the end of the RF response
- * @return NFC_SUCCESS if no error happen
+ * Pulse starts immediately after the command is issued and ends at the end of the RF response.
+ * @return NFC_SUCCESS if no errors
*/
virtual NFC_StatusTypeDef SendInterrupt(void) {
return (NFC_StatusTypeDef) M24SR_SendInterrupt();
@@ -236,8 +236,8 @@
/////////////////// hight level/utility function /////////////////////
/**
- * get an implementation of NDefNfcTag for use the library NDefLib
- * @retrun object of type NdefNfcTag for use this M24SR component
+ * Get an implementation of NDefNfcTag to use the library NDefLib.
+ * @return an object of type NdefNfcTag
*/
NDefLib::NDefNfcTag& getNDefTag(){
return NDefTagUtil;
@@ -245,72 +245,78 @@
/**
- * enable the request of a password before read the tag
- * @param pCurrentWritePassword current password ( use M24SR::DEFAULT_PASSWORD if it is the first time)
- * @param pNewPassword password to request before read the tag
- * @return return NFC_SUCCESS if no error happen
- * @par the password must have a length of 16 char
+ * Enable the request of a password before reading the tag.
+ * @param pCurrentWritePassword Current password (the first time use M24SR::DEFAULT_PASSWORD ).
+ * @param pNewPassword Password to request before reading the tag.
+ * @return return NFC_SUCCESS if no errors
+ * @par The password must have a length of 16 chars.
*/
NFC_StatusTypeDef enableReadPassword(const uint8_t* pCurrentWritePassword,
const uint8_t* pNewPassword);
/**
- * disable the request of a password before read the tag
- * @param pCurrentWritePassword current password ( use M24SR::DEFAULT_PASSWORD if it is the first time)
- * @return return NFC_SUCCESS if no error happen
- * @par the password must have a length of 16 char
+ * Disable the request of a password before reading the tag.
+ * @param pCurrentWritePassword Current password (the first time use M24SR::DEFAULT_PASSWORD).
+ * @return return NFC_SUCCESS if no errors
+ * @par The password must have a length of 16 chars.
*/
NFC_StatusTypeDef disableReadPassword(const uint8_t* pCurrentWritePassword=M24SR::DEFAULT_PASSWORD);
/**
- * enable the request of a password before write the tag
- * @param pCurrentWritePassword current password ( use M24SR::DEFAULT_PASSWORD if it is the first time)
- * @param pNewPassword password to request before read the tag
- * @return return NFC_SUCCESS if no error happen
- * @par the password must have a length of 16 char
+ * Enable the request of a password before writing to the tag.
+ * @param pCurrentWritePassword Current password (the first time use M24SR::DEFAULT_PASSWORD).
+ * @param pNewPassword Password to request before reading the tag.
+ * @return return NFC_SUCCESS if no errors
+ * @par The password must have a length of 16 chars.
*/
NFC_StatusTypeDef enableWritePassword(const uint8_t* pCurrentWritePassword,
uint8_t* pNewPassword);
+ /**
+ * Disable the request of a password before writing the tag.
+ * @param pCurrentWritePassword Current password (the first time use M24SR::DEFAULT_PASSWORD).
+ * @return return NFC_SUCCESS if no errors
+ * @par The password must have a length of 16 chars.
+ */
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
- * @return return NFC_SUCCESS if no error happen
- * @par the password must have a length of 16 char
+ * @brief This function disables both read and write passwords.
+ * @param pSuperUserPassword I2C super user password.
+ * @return return NFC_SUCCESS if no errors
+ * @par The password must have a length of 16 chars.
*/
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
- * @return return NFC_SUCCESS if no error happen
- * @par the password must have a length of 16 char
+ * @brief This function enables read only mode.
+ * @param pCurrentWritePassword Write password is needed to enable read only mode.
+ * @return return NFC_SUCCESS if no errors
+ * @par The password must have a length of 16 chars.
*/
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
- * @return return NFC_SUCCESS if no error happen
- * @par the password must have a length of 16 char
+ * @brief This function disables read only mode.
+ * @param pCurrentWritePassword Write password is needed to disable read only mode.
+ * @return return NFC_SUCCESS if no errors
+ * @par The password must have a length of 16 chars.
*/
NFC_StatusTypeDef disableReadOnly();
/**
- * @brief This fonction enable write only mode
- * @param pCurrentWritePassword Write password is needed to have right to enable write only mode
- * @return return NFC_SUCCESS if no error happen
- * @par the password must have a length of 16 char
+ * @brief This function enables write only mode.
+ * @param pCurrentWritePassword Write password is needed to enable write only mode.
+ * @return return NFC_SUCCESS if no errors
+ * @par The password must have a length of 16 chars.
*/
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
- * @return return NFC_SUCCESS if no error happen
- * @par the password must have a length of 16 char
+ * @brief This function disables write only mode.
+ * @param pCurrentWritePassword Write password is needed to disable write only mode.
+ * @return return NFC_SUCCESS if no errors
+ * @par The password must have a length of 16 chars.
*/
NFC_StatusTypeDef disableWriteOnly();
@@ -350,36 +356,36 @@
NFC_StatusTypeDef M24SR_FWTExtension(uint8_t FWTbyte);
/**
- * wait until the answer is not ready
+ * Wait until the answer is ready.
*/
NFC_StatusTypeDef M24SR_IO_IsAnswerReady(void);
/**
- * send a command to the component
- * @param NbByte lenght of the command
- * @param pBuffer buffer containing the command
- * @return NFC_SUCCESS if no error happen
+ * Send a command to the component.
+ * @param NbByte Lenght of the command.
+ * @param pBuffer Buffer containing the command.
+ * @return NFC_SUCCESS if no errors
*/
NFC_StatusTypeDef M24SR_IO_SendI2Ccommand(uint8_t NbByte, uint8_t *pBuffer);
/**
- * read a command renspose
- * @param NbByte number of byte to read
- * @param pBuffer buffer where store the rensponse
- * @return NFC_SUCCESS if no error happen
+ * Read a command response.
+ * @param NbByte Number of bytes to read.
+ * @param pBuffer Buffer to store the response into.
+ * @return NFC_SUCCESS if no errors
*/
NFC_StatusTypeDef M24SR_IO_ReceiveI2Cresponse(uint8_t NbByte,
uint8_t *pBuffer);
/**
- * do and active polling on the i2c bus until the answer is not ready
- * @return NFC_SUCCESS if no error happen
+ * Do an active polling on the I2C bus until the answer is ready.
+ * @return NFC_SUCCESS if no errors
*/
NFC_StatusTypeDef M24SR_IO_PollI2C(void);
/**
- * read the gpo pin
- * @param[out] pPinState variable where store the pin state
+ * Read the gpo pin.
+ * @param[out] pPinState Variable to store the pin state into.
*/
void M24SR_IO_GPO_ReadPin(GPIO_PinState *pPinState) {
if (GPOPin == 0)
@@ -389,8 +395,8 @@
}
/**
- * write the gpo pin
- * @param pPinState state to write
+ * Write the gpo pin.
+ * @param pPinState Pin state to write.
*/
void M24SR_IO_RFDIS_WritePin(GPIO_PinState PinState) {
if (PinState == GPIO_PIN_RESET)
@@ -400,15 +406,15 @@
}
/**
- * set how wait the command answer
- * @param mode how to wait the i2c rensponse
+ * Set the command synchronous answer mode.
+ * @param mode How to wait the I2C rensponse.
*/
void M24SR_IO_SetI2CSynchroMode(M24SR_WAITINGTIME_MGMT mode) {
syncMode = mode;
}
/**
- * callback trigger when the chip finish to do a command
+ * Callback triggers when a command is completed.
*/
void M24SR_AnswerReadyInterruptCallback() {
interruptIsFired = true;
@@ -420,37 +426,37 @@
/* Identity */
uint8_t who_am_i;
- /* Type. */
+ /* Type */
uint8_t type;
/* I2C address */
uint8_t address;
/* IO Device. */
- I2C &dev_i2c;
+ I2C &dev_I2C;
/* GPIO */
DigitalIn GPOPin;
/**
- * pin used for disable the rf chip functionality
+ * Pin used to disable the rf chip functionality.
*/
DigitalOut RFDisablePin;
/**
- * pin used as interrupt
+ * Pin used as interrupt.
*/
InterruptIn answerReadyInterrupt;
/**
- * method used for wait the chip response
+ * Method used to wait the chip response.
*/
M24SR_WAITINGTIME_MGMT syncMode;
/**
- * buffer used for build the command to send to the chip
+ * Buffer used to build the command to send to the chip.
*/
- uint8_t uM24SRbuffer[0xFF];
+ uint8_t uM24SRbuffer[0xFF];//max command length is 255
/**
* ???
@@ -458,12 +464,12 @@
uint8_t uDIDbyte;
/**
- * state variable change when the interrupt is fired
+ * State variable changes when the interrupt is fired.
*/
volatile bool interruptIsFired;
/**
- * Object implementing the interface for use the NDefLib
+ * Object implementing the interface to use the NDefLib.
*/
NDefNfcTagM24SR NDefTagUtil;
};

X-NUCLEO-NFC01A1 Dynamic NFC Tag