Complete mbed library/workspace for HelloWorld_NFC02A1

Dependencies:   NDefLib X_NUCLEO_NFC02A1 mbed

Fork of HelloWorld_NFC02A1 by ST Expansion SW Team

X-NUCLEO-NFC02A1 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-NFC02A1 Dynamic NFC Tag Expansion Board based on M24LR.

Example Application

This is just a simple "hello world" style program for the X-NUCLEO-NFC02A1 Dynamic NFC Tag Expansion Board. The program writes a URI link to the M24LR dynamic tag using the synchronous programming model. It then reads back the URI from the tag to display it on terminal. The URI can also be retrieved from an NFC enabled smartphone/tablet.

Revision:
2:6f1b1f7f8d12
Parent:
1:11ae12d41082
--- a/X_NUCLEO_NFC02A1/m24lr/NDefNfcTagM24LR.h	Tue Aug 30 09:18:50 2016 +0000
+++ b/X_NUCLEO_NFC02A1/m24lr/NDefNfcTagM24LR.h	Wed Sep 28 11:26:49 2016 +0000
@@ -42,23 +42,9 @@
 #include <stdint.h>
 
 #include "NDefNfcTag.h"
-#include "Nfc_class.h"
-
-//#include "m24lr.h"
+#include "Nfc.h"
 
-#define NFCT5_MAGICNUMBER_E1_CCFILE       0xE1
-#define NFCT5_MAGICNUMBER_E2_CCFILE       0xE2
-#define NFCT5_EXTENDED_CCFILE             0xFF
-#define NFCT5_VERSION_V1_0                0x40
-#define NFCT5_READ_ACCESS                 0x0C
-#define NFCT5_WRITE_ACCESS                0x03
-
-#define NFCT5_NDEF_MSG_TLV                0x03
-#define NFCT5_PROPRIETARY_TLV             0xFD
-#define NFCT5_TERMINATOR_TLV              0xFE
-#define NFCT5_3_BYTES_L_TLV               0xFF
-    
-#define NFC_OK                   0
+#define NFC_OK                      0
 #define NDEF_OK                     0
 #define NDEF_ERROR                  1
 #define NDEF_ERROR_MEMORY_TAG       2
@@ -66,52 +52,6 @@
 #define NDEF_ERROR_LOCKED           4
 #define NDEF_ERROR_NOT_FORMATED     5
 
-#define NDEF_MAX_SIZE               NFC_DEVICE_MAX_NDEFMEMORY
-
-#define NDEF_SIZE_OFFSET            0
-#define FIRST_RECORD_OFFSET         2
-
-#ifndef MIN
-#define MIN(x, y) (((x) < (y)) ? (x) : (y))
-#endif
-
-#define NFCTAG_4M_SIZE            0x200
-#define NFCTAG_16M_SIZE           0x800
-#define NFCTAG_64M_SIZE           0x2000
-
-    
-#define MAX_NDEF_MEM                 0x200
-#define M24LR_MAX_SIZE               NFCTAG_4M_SIZE
-#define M24LR_NDEF_MAX_SIZE          MIN(M24LR_MAX_SIZE,MAX_NDEF_MEM)
-#define NFC_DEVICE_MAX_NDEFMEMORY    M24LR_NDEF_MAX_SIZE
-    
-
-
-typedef enum
-{
-  TT5_NO_NDEF = 0,
-  TT5_INITIALIZED,
-  TT5_READ_WRITE,
-  TT5_READ
-} TT5_State;
-
-/**
-  * @brief  CCfile structure
-  */
-typedef struct
-{
-  uint8_t MagicNumber;  /* Magic Number should be E1h or E2h */
-  uint8_t Version;
-  uint8_t MemorySize;
-  uint8_t TT5Tag;
-  uint8_t rsved1;
-  uint8_t rsved2;
-  uint16_t ExtMemorySize;
-  TT5_State State;
-  uint32_t NDEF_offset;
-}sCCFileInfo;
-
-
 /**
  * Helper class to use the NDefLib
  */
@@ -137,12 +77,7 @@
     virtual bool isSessionOpen(){
         return mIsSessionOpen;
     }
-        uint16_t ReadData( uint16_t Offset , uint16_t DataSize , uint8_t* pData );
-        uint16_t WriteData( uint16_t Offset , uint32_t DataSize , uint8_t *pData );
-        uint16_t NfcType5_WriteCCFile( const uint8_t * const pCCBuffer );
-        uint16_t NfcType5_ReadCCFile( uint8_t * const pCCBuffer );
-        uint16_t NfcType5_TT5Init( void );
-        uint16_t NfcType5_NDEFDetection( void );
+        
     /**
     * Close the open session.
     */
@@ -161,10 +96,18 @@
                 bool NDefWriteByte(const uint8_t *buffer, uint16_t length,uint16_t offset);
 
 
-                bool NDefReadByte(const uint16_t byteOffset, const uint16_t length, uint8_t *buffer);
+        
 
     private:
+        bool NDefReadByte(const uint16_t byteOffset, const uint16_t length,
+             uint8_t *buffer);
 
+        uint16_t ReadData( uint16_t Offset , uint16_t DataSize , uint8_t* pData );
+        uint16_t WriteData( uint16_t Offset , uint32_t DataSize , uint8_t *pData );
+        uint16_t NfcType5_WriteCCFile( const uint8_t * const pCCBuffer );
+        uint16_t NfcType5_ReadCCFile( uint8_t * const pCCBuffer );
+        uint16_t NfcType5_TT5Init( void );
+        uint16_t NfcType5_NDEFDetection( void );
         Nfc &mDevice;
 
         /**
@@ -181,9 +124,35 @@
         * Max length for a write operation
         */
         uint16_t mMaxWriteBytes;
+        typedef enum
+        {
+          TT5_NO_NDEF = 0,
+          TT5_INITIALIZED,
+          TT5_READ_WRITE,
+          TT5_READ
+        } TT5_State;
+        
+        /**
+          * @brief  CCfile structure
+          */
+        typedef struct
+        {
+          uint8_t MagicNumber;  /* Magic Number should be E1h or E2h */
+          uint8_t Version;
+          uint8_t MemorySize;
+          uint8_t TT5Tag;
+          uint8_t rsved1;
+          uint8_t rsved2;
+          uint16_t ExtMemorySize;
+          TT5_State State;
+          uint32_t NDEF_offset;
+        }sCCFileInfo;
                 
                 sCCFileInfo CCFileStruct;
 
     };
 
 #endif /* X_NUCLEO_NFC02A1_M24LR_NDEFNFCTAGM24LR_H_ */
+
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/