This is a driver needed by NFCEEPROOM constructor for the ST ST25DV NFC chip.

Dependents:   mbed-os-example-nfc-EEPROM

Files at this revision

API Documentation at this revision

Comitter:
apalmieri
Date:
Tue Jan 28 15:54:19 2020 +0000
Commit message:
Initial commit

Changed in this revision

ST25DV/README.md Show annotated file Show diff for this revision Revisions of this file
ST25DV/st25dv.cpp Show annotated file Show diff for this revision Revisions of this file
ST25DV/st25dv.h Show annotated file Show diff for this revision Revisions of this file
X_NUCLEO_NFC04A1/README.md Show annotated file Show diff for this revision Revisions of this file
X_NUCLEO_NFC04A1/x_nucleo_nfc04a1.cpp Show annotated file Show diff for this revision Revisions of this file
X_NUCLEO_NFC04A1/x_nucleo_nfc04a1.h Show annotated file Show diff for this revision Revisions of this file
mbed_lib.json Show annotated file Show diff for this revision Revisions of this file
st25dv_driver.cpp Show annotated file Show diff for this revision Revisions of this file
st25dv_driver.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ST25DV/README.md	Tue Jan 28 15:54:19 2020 +0000
@@ -0,0 +1,4 @@
+# ST25DV
+ST25DV is a library for STMicroelectronics X-NUCLEO-NFC04A1
+# Overview
+ This library implements the functions to drive the ST25DV NFC dynamic tag.It provides a standard structure to expose the NFC tag standard API. It also provides an extended API through its extended driver structure. In order to be usable on any MCU, this driver calls several IOBus functions. The IOBus functions are implemented outside this driver, and are in charge of accessing the MCU peripherals used for the communication with the tag. 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ST25DV/st25dv.cpp	Tue Jan 28 15:54:19 2020 +0000
@@ -0,0 +1,2403 @@
+/**
+  ******************************************************************************
+  * @file    st25dv.c 
+  * @author  MMY Application Team
+  * @version $Revision: 3308 $
+  * @date    $Date: 2017-01-13 11:19:33 +0100 (Fri, 13 Jan 2017) $
+  * @brief   This file provides set of driver functions to manage communication 
+  *          between BSP and ST25DV chip.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2>
+  *
+  * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License");
+  * You may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at:
+  *
+  *        http://www.st.com/myliberty  
+  *
+  * Unless required by applicable law or agreed to in writing, software 
+  * distributed under the License is distributed on an "AS IS" BASIS, 
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
+  * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+  * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  *
+  ******************************************************************************
+  */ 
+
+/* Includes ------------------------------------------------------------------*/
+#include "st25dv.h"
+
+#include "st25dv_driver.h"
+
+
+
+
+/** @addtogroup BSP
+  * @{
+  */
+
+/** @defgroup ST25DV ST25DV driver
+  * @brief    This module implements the functions to drive the ST25DV NFC dynamic tag.
+  * @details  As recommended by the STM32 Cube methodology, this driver provides a standard structure to expose the NFC tag standard API.\n
+  *           It also provides an extended API through its extended driver structure.\n
+  *           To be usable on any MCU, this driver calls several IOBus functions.
+  *           The IOBus functions are implemented outside this driver, and are in charge of accessing the MCU peripherals used for the communication with the tag.
+  * @{
+  */
+
+/* External variables --------------------------------------------------------*/
+/* Private typedef -----------------------------------------------------------*/
+/* Private defines -----------------------------------------------------------*/
+/** @brief This component driver only supports 1 instance of the component */
+#define ST25DV_MAX_INSTANCE         1
+
+  
+/* Private macros ------------------------------------------------------------*/
+/* Private function prototypes -----------------------------------------------*/
+NFCTAG_StatusTypeDef ST25DV_i2c_Init( I2C * mi2cChannel, DigitalOut* mLPD );
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadID( uint8_t * const pICRef, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadICRev( uint8_t * const pICRev, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_IsDeviceReady( const uint32_t Trials, I2C * mi2cChannel);
+NFCTAG_StatusTypeDef ST25DV_i2c_GetGPOStatus( uint16_t * const pGPOStatus, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ConfigureGPO( const uint16_t ITConf, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadITPulse( ST25DV_PULSE_DURATION * const pITtime, I2C * mi2cChannel);
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteITPulse( const ST25DV_PULSE_DURATION ITtime, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadData( uint8_t * const pData, const uint16_t TarAddr, const uint16_t NbByte, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteData( const uint8_t * const pData, const uint16_t TarAddr, const uint16_t NbByte, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadDataCurrentAddr( uint8_t * const pData, const uint16_t NbByte, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadRegister( uint8_t * const pData, const uint16_t TarAddr, const uint16_t NbByte , I2C * mi2cChannel);
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteRegister( const uint8_t * const pData, const uint16_t TarAddr, const uint16_t NbByte, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadUID( ST25DV_UID * const pUid, I2C * mi2cChannel);
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadDSFID( uint8_t * const pDsfid, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadDsfidRFProtection( ST25DV_LOCK_STATUS * const pLockDsfid, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadAFI( uint8_t * const pAfi, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadAfiRFProtection( ST25DV_LOCK_STATUS * const pLockAfi, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadI2CProtectZone( ST25DV_I2C_PROT_ZONE * const pProtZone, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteI2CProtectZonex( const ST25DV_PROTECTION_ZONE Zone, const ST25DV_PROTECTION_CONF ReadWriteProtection, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadLockCCFile( ST25DV_LOCK_CCFILE * const pLockCCFile, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteLockCCFile( const ST25DV_CCFILE_BLOCK NbBlockCCFile, const ST25DV_LOCK_STATUS LockCCFile, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadLockCFG( ST25DV_LOCK_STATUS * const pLockCfg, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteLockCFG( const ST25DV_LOCK_STATUS LockCfg, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_PresentI2CPassword( const ST25DV_PASSWD PassWord, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteI2CPassword( const ST25DV_PASSWD PassWord, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadRFZxSS( const ST25DV_PROTECTION_ZONE Zone, ST25DV_RF_PROT_ZONE * const pRfprotZone, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteRFZxSS( const ST25DV_PROTECTION_ZONE Zone, const ST25DV_RF_PROT_ZONE RfProtZone , I2C * mi2cChannel);
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadEndZonex( const ST25DV_END_ZONE EndZone, uint8_t * const pEndZ, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteEndZonex( const ST25DV_END_ZONE EndZone, const uint8_t EndZ, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_InitEndZone( I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_CreateUserZone( uint16_t Zone1Length, uint16_t Zone2Length, uint16_t Zone3Length, uint16_t Zone4Length, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadMemSize( ST25DV_MEM_SIZE * const pSizeInfo, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadEHMode( ST25DV_EH_MODE_STATUS * const pEH_mode, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteEHMode( const ST25DV_EH_MODE_STATUS EH_mode, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadRFMngt( ST25DV_RF_MNGT * const pRF_Mngt, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteRFMngt( const uint8_t Rfmngt, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_GetRFDisable( ST25DV_EN_STATUS * const pRFDisable, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_SetRFDisable( I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ResetRFDisable( I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_GetRFSleep( ST25DV_EN_STATUS * const pRFSleep, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_SetRFSleep( I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ResetRFSleep( I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadMBMode( ST25DV_EN_STATUS * const pMB_mode, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteMBMode( const ST25DV_EN_STATUS MB_mode, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadMBWDG( uint8_t * const pWdgDela, I2C * mi2cChannely );
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteMBWDG( const uint8_t WdgDelay, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadMailboxData( uint8_t * const pData, const uint16_t TarAddr, const uint16_t NbByte, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteMailboxData( const uint8_t * const pData, const uint16_t NbByte, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadMailboxRegister( uint8_t * const pData, const uint16_t TarAddr, const uint16_t NbByte, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteMailboxRegister( const uint8_t * const pData, const uint16_t TarAddr, const uint16_t NbByte, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadI2CSecuritySession_Dyn( ST25DV_I2CSSO_STATUS * const pSession, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadITSTStatus_Dyn( uint8_t * const pITStatus, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadGPO_Dyn( uint8_t *GPOConfig, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_GetGPO_en_Dyn( ST25DV_EN_STATUS * const pGPO_en, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_SetGPO_en_Dyn( I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ResetGPO_en_Dyn( I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadEHCtrl_Dyn( ST25DV_EH_CTRL * const pEH_CTRL, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_GetEHENMode_Dyn( ST25DV_EN_STATUS * const pEH_Val, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_SetEHENMode_Dyn( I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ResetEHENMode_Dyn( I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_GetEHON_Dyn( ST25DV_EN_STATUS * const pEHON, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_GetRFField_Dyn( ST25DV_FIELD_STATUS * const pRF_Field, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_GetVCC_Dyn( ST25DV_VCC_STATUS * const pVCC, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadRFMngt_Dyn( ST25DV_RF_MNGT * const pRF_Mngt, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteRFMngt_Dyn( const uint8_t RF_Mngt, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_GetRFDisable_Dyn( ST25DV_EN_STATUS * const pRFDisable, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_SetRFDisable_Dyn( I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ResetRFDisable_Dyn( I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_GetRFSleep_Dyn( ST25DV_EN_STATUS * const pRFSleep, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_SetRFSleep_Dyn( I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ResetRFSleep_Dyn( I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadMBCtrl_Dyn( ST25DV_MB_CTRL_DYN_STATUS * const pCtrlStatus, I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_GetMBEN_Dyn( ST25DV_EN_STATUS * const pMBEN, I2C * mi2cChannel);
+NFCTAG_StatusTypeDef ST25DV_i2c_SetMBEN_Dyn( I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ResetMBEN_Dyn( I2C * mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadMBLength_Dyn( uint8_t * const pMBLength, I2C * mi2cChannel );
+
+/* Global variables ---------------------------------------------------------*/
+/**
+  * @brief    Standard NFC tag driver API for the ST25DV.
+  * @details  Provides a generic way to access the ST25DV implementation of the NFC tag standard driver functions. 
+  */
+NFCTAG_DrvTypeDef St25Dv_i2c_Drv =
+{
+  ST25DV_i2c_Init,
+  ST25DV_i2c_ReadID,
+  ST25DV_i2c_IsDeviceReady,
+  ST25DV_i2c_GetGPOStatus,
+  ST25DV_i2c_ConfigureGPO,
+  ST25DV_i2c_ReadData,
+  ST25DV_i2c_WriteData,
+  ST25DV_i2c_ReadRegister,
+  ST25DV_i2c_WriteRegister,
+  NULL
+};
+
+/**
+  * @brief    Extended NFC tag driver API for the ST25DV.
+  * @details  Provides a generic way to access the ST25DV extended driver functions. 
+  */
+NFCTAG_ExtDrvTypeDef St25Dv_i2c_ExtDrv =
+{
+  ST25DV_i2c_ReadICRev,
+  ST25DV_i2c_WriteITPulse,
+  ST25DV_i2c_ReadITPulse,
+  ST25DV_i2c_ReadDataCurrentAddr,
+  ST25DV_i2c_ReadUID,
+  ST25DV_i2c_ReadDSFID,
+  ST25DV_i2c_ReadDsfidRFProtection,
+  ST25DV_i2c_ReadAFI,
+  ST25DV_i2c_ReadAfiRFProtection,
+  ST25DV_i2c_ReadI2CProtectZone,
+  ST25DV_i2c_WriteI2CProtectZonex,
+  ST25DV_i2c_ReadLockCCFile,
+  ST25DV_i2c_WriteLockCCFile,
+  ST25DV_i2c_ReadLockCFG,
+  ST25DV_i2c_WriteLockCFG,
+  ST25DV_i2c_PresentI2CPassword,
+  ST25DV_i2c_WriteI2CPassword,
+  ST25DV_i2c_ReadRFZxSS,
+  ST25DV_i2c_WriteRFZxSS,
+  ST25DV_i2c_ReadEndZonex,
+  ST25DV_i2c_WriteEndZonex,
+  ST25DV_i2c_InitEndZone,
+  ST25DV_i2c_CreateUserZone,
+  ST25DV_i2c_ReadMemSize,
+  ST25DV_i2c_ReadEHMode,
+  ST25DV_i2c_WriteEHMode,
+  ST25DV_i2c_ReadRFMngt,
+  ST25DV_i2c_WriteRFMngt,
+  ST25DV_i2c_GetRFDisable,
+  ST25DV_i2c_SetRFDisable,
+  ST25DV_i2c_ResetRFDisable,
+  ST25DV_i2c_GetRFSleep,
+  ST25DV_i2c_SetRFSleep,
+  ST25DV_i2c_ResetRFSleep,
+  ST25DV_i2c_ReadMBMode,
+  ST25DV_i2c_WriteMBMode,
+  ST25DV_i2c_ReadMBWDG,
+  ST25DV_i2c_WriteMBWDG,
+  ST25DV_i2c_ReadMailboxData,
+  ST25DV_i2c_WriteMailboxData,
+  ST25DV_i2c_ReadMailboxRegister,
+  ST25DV_i2c_WriteMailboxRegister,
+  ST25DV_i2c_ReadI2CSecuritySession_Dyn,
+  ST25DV_i2c_ReadITSTStatus_Dyn,
+  ST25DV_i2c_ReadGPO_Dyn,
+  ST25DV_i2c_GetGPO_en_Dyn,
+  ST25DV_i2c_SetGPO_en_Dyn,
+  ST25DV_i2c_ResetGPO_en_Dyn,
+  ST25DV_i2c_ReadEHCtrl_Dyn,
+  ST25DV_i2c_GetEHENMode_Dyn,
+  ST25DV_i2c_SetEHENMode_Dyn,
+  ST25DV_i2c_ResetEHENMode_Dyn,
+  ST25DV_i2c_GetEHON_Dyn,
+  ST25DV_i2c_GetRFField_Dyn,
+  ST25DV_i2c_GetVCC_Dyn,
+  ST25DV_i2c_ReadRFMngt_Dyn,
+  ST25DV_i2c_WriteRFMngt_Dyn,
+  ST25DV_i2c_GetRFDisable_Dyn,
+  ST25DV_i2c_SetRFDisable_Dyn,
+  ST25DV_i2c_ResetRFDisable_Dyn,
+  ST25DV_i2c_GetRFSleep_Dyn,
+  ST25DV_i2c_SetRFSleep_Dyn,
+  ST25DV_i2c_ResetRFSleep_Dyn,
+  ST25DV_i2c_ReadMBCtrl_Dyn,
+  ST25DV_i2c_GetMBEN_Dyn,
+  ST25DV_i2c_SetMBEN_Dyn,
+  ST25DV_i2c_ResetMBEN_Dyn,
+  ST25DV_i2c_ReadMBLength_Dyn
+};
+
+
+/** @brief ST25DV instances by address. */
+uint8_t aSt25Dv[ST25DV_MAX_INSTANCE] = {0};
+
+
+/* Public functions ---------------------------------------------------------*/
+/**
+  * @brief  ST25DV nfctag Initialization.
+  * @param mi2cChannel : I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_Init( I2C* mi2cChannel, DigitalOut * mLPD )
+{
+  /* Configure the low level interface */
+  return ST25DV_IO_Init( mi2cChannel, mLPD );
+}
+
+/**
+  * @brief  Reads the ST25DV ID.
+  * @param  pICRef Pointeron a uint8_t used to return the ST25DV ID.
+  * @param mi2cChannel : I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadID( uint8_t * const pICRef, I2C * mi2cChannel )
+{
+  /* Read ICRef on device */
+  return ST25DV_i2c_ReadRegister( pICRef, ST25DV_ICREF_REG, 1, mi2cChannel );
+}
+
+/**
+  * @brief  Reads the ST25DV IC Revision.
+  * @param  pICRev Pointer on the uint8_t used to return the ST25DV IC Revision number.
+  * @param mi2cChannel : I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadICRev( uint8_t * const pICRev, I2C * mi2cChannel )
+{
+  /* Read ICRev on device */
+  return ST25DV_i2c_ReadRegister( pICRev, ST25DV_ICREV_REG, 1, mi2cChannel );
+}
+
+/**
+  * @brief    Checks the ST25DV availability.
+  * @details  The ST25DV I2C is NACKed when a RF communication is on-going.
+  *           This function determines if the ST25DV is ready to answer an I2C request. 
+  * @param    Trials Max number of tentative.
+  * @param mi2cChannel : I2C channel
+  * @retval   NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_IsDeviceReady( const uint32_t Trials, I2C * mi2cChannel)
+{
+  /* Test communication with device */
+  return ST25DV_IO_IsDeviceReady( ST25DV_ADDR_DATA_I2C, Trials, mi2cChannel);
+}
+
+/**
+  * @brief  Reads the ST25DV GPO configuration.
+  * @param  pGPOStatus  Pointer on a uint16_t used to return the current GPO consiguration, as:
+  *                     - RFUSERSTATE = 0x01
+  *                     - RFBUSY = 0x02
+  *                     - RFINTERRUPT = 0x04
+  *                     - FIELDFALLING = 0x08
+  *                     - FIELDRISING = 0x10
+  *                     - RFPUTMSG = 0x20
+  *                     - RFGETMSG = 0x40
+  *                     - RFWRITE = 0x80
+  * @param mi2cChannel : I2C channel
+  * @retval   NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_GetGPOStatus( uint16_t * const pGPOStatus, I2C * mi2cChannel )
+{
+  uint8_t reg_value;
+  NFCTAG_StatusTypeDef status;
+  
+  /* Read value of GPO register */
+  status = ST25DV_i2c_ReadRegister( &reg_value, ST25DV_GPO_REG, 1, mi2cChannel );
+  if( status != NFCTAG_OK )
+    return status;
+
+  /* Extract GPO configuration */
+  *pGPOStatus = (uint16_t)reg_value;
+  
+  return NFCTAG_OK;
+}
+
+/**
+  * @brief    Configures the ST25DV GPO.
+  * @details  Needs the I2C Password presentation to be effective.
+  * @param    ITConf Provides the GPO configuration to apply:
+  *           - RFUSERSTATE = 0x01
+  *           - RFBUSY = 0x02
+  *           - RFINTERRUPT = 0x04
+  *           - FIELDFALLING = 0x08
+  *           - FIELDRISING = 0x10
+  *           - RFPUTMSG = 0x20
+  *           - RFGETMSG = 0x40
+  *           - RFWRITE = 0x80
+  *
+  * @param mi2cChannel : I2C channel
+  *
+  * @retval   NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ConfigureGPO( const uint16_t ITConf, I2C * mi2cChannel )
+{
+  /* Write GPO configuration to register */
+  return ST25DV_i2c_WriteRegister( (uint8_t *)&ITConf, ST25DV_GPO_REG, 1, mi2cChannel );
+}
+
+
+/**
+  * @brief  Reads the ST25DV ITtime duration for the GPO pulses.
+  * @param  pITtime Pointer used to return the coefficient for the GPO Pulse duration (Pulse duration = 302,06 us - ITtime * 512 / fc).
+  * @param  mi2cChannel  I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadITPulse( ST25DV_PULSE_DURATION * const pITtime, I2C * mi2cChannel )
+{
+  uint8_t reg_value;
+  NFCTAG_StatusTypeDef status;
+  
+  /* Read ITtime register value */
+  status = ST25DV_i2c_ReadRegister( &reg_value, ST25DV_ITTIME_REG, 1,  mi2cChannel );
+  if( status != NFCTAG_OK )
+  {
+    return status;
+  }
+  
+  /* Extract delay coefficient value */
+  *pITtime = (ST25DV_PULSE_DURATION)reg_value;
+  
+  return NFCTAG_OK;
+}
+
+/**
+  * @brief    Configures the ST25DV ITtime duration for the GPO pulse.
+  * @details  Needs the I2C Password presentation to be effective.
+  * @param    ITtime Coefficient for the Pulse duration to be written (Pulse duration = 302,06 us - ITtime * 512 / fc)
+  * @param    mi2cChannel  I2C channel
+  * @retval   NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteITPulse( const ST25DV_PULSE_DURATION ITtime, I2C * mi2cChannel )
+{
+  uint8_t reg_value;
+  
+  /* prepare data to write */
+  reg_value = (uint8_t)ITtime;
+  
+  /* Write value for ITtime register */
+  return ST25DV_i2c_WriteRegister( &reg_value, ST25DV_ITTIME_REG, 1, mi2cChannel );
+}
+
+/**
+  * @brief  Reads N bytes of Data, starting from the specified I2C address.
+  * @param  pData   Pointer used to return the read data.
+  * @param  TarAddr I2C data memory address to read.
+  * @param  NbByte  Number of bytes to be read.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadData( uint8_t * const pData, const uint16_t TarAddr, const uint16_t NbByte, I2C * mi2cChannel)
+{
+  /* Read Data in user memory */
+  return ST25DV_IO_MemRead( pData, ST25DV_ADDR_DATA_I2C, TarAddr, NbByte, mi2cChannel );
+}
+
+/**
+  * @brief  Writes N bytes of Data starting from the specified I2C Address.
+  * @param  pData   Pointer on the data to be written.
+  * @param  TarAddr I2C data memory address to be written.
+  * @param  NbByte  Number of bytes to be written.
+  * @param mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteData( const uint8_t * const pData, const uint16_t TarAddr, const uint16_t NbByte, I2C* mi2cChannel )
+{ 
+  NFCTAG_StatusTypeDef ret;
+  NFCTAG_StatusTypeDef pollstatus;
+  uint16_t split_data_nb;
+  const uint8_t *pdata_index = (const uint8_t *)pData;
+
+  uint16_t bytes_to_write = NbByte;
+  uint16_t mem_addr = TarAddr;
+  
+  /* ST25DV can write a maximum of 256 bytes in EEPROM per i2c communication */
+  do
+  {
+    /* Split write if data to write is superior of max write bytes for ST25DV */
+    if( bytes_to_write > ST25DV_MAX_WRITE_BYTE )
+    {
+      /* DataSize higher than max page write, copy data by page */
+      split_data_nb = (uint16_t)ST25DV_MAX_WRITE_BYTE;
+    }
+    else
+    {
+      /* DataSize lower or equal to max page write, copy only last bytes */
+      split_data_nb = bytes_to_write;
+    }
+    /* Write split_data_nb bytes in memory */
+    ret = ST25DV_IO_MemWrite( pdata_index, ST25DV_ADDR_DATA_I2C, mem_addr, split_data_nb, mi2cChannel);
+
+    Timer t;
+    /* POLLING, NEW CODE */
+    if( ret == 0 )
+    {
+      /* Poll until EEPROM is available */
+
+      int ms = 0;
+      /* Wait until ST25DV is ready or timeout occurs */
+      do
+      {
+        t.start();
+        pollstatus = ST25DV_IO_IsDeviceReady( ST25DV_ADDR_DATA_I2C , 1, mi2cChannel);
+        ms = t.read_ms();
+        t.stop();
+      } while( ( ms  < ST25DV_I2C_TIMEOUT) && (pollstatus != NFCTAG_OK) );
+
+
+      if( pollstatus != NFCTAG_OK )
+      {
+        return NFCTAG_TIMEOUT;
+      }
+    }
+
+    /* update index, dest address, size for next write */
+    pdata_index += split_data_nb;
+    mem_addr += split_data_nb;
+    bytes_to_write -= split_data_nb;
+  }
+  while( ( bytes_to_write > 0 ) && ( ret == NFCTAG_OK ) );
+  
+  return ret;
+}
+
+/**
+  * @brief  Reads N bytes of Data, starting at current address.
+  * @param  pData   Pointer used to return the read data.
+  * @param  NbByte  Number of bytes to be read.
+  * @param mi2cChannel : I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadDataCurrentAddr( uint8_t * const pData, const uint16_t NbByte, I2C* mi2cChannel )
+{
+  /* Read Data in user memory */
+  return ST25DV_IO_Read( pData, ST25DV_ADDR_DATA_I2C, NbByte, mi2cChannel );
+}
+
+/**
+  * @brief  Reads N bytes from Registers, starting at the specified I2C address.
+  * @param  pData   Pointer used to return the read data.
+  * @param  TarAddr I2C memory address to be read.
+  * @param  NbByte  Number of bytes to be read.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadRegister( uint8_t * const pData, const uint16_t TarAddr, const uint16_t NbByte, I2C * mi2cChannel )
+{  
+  /* Read Data in system memory */
+  return ST25DV_IO_MemRead( pData, ST25DV_ADDR_SYST_I2C, TarAddr, NbByte, mi2cChannel );
+}
+
+/**
+  * @brief    Writes N bytes to the specified register.
+  * @details  Needs the I2C Password presentation to be effective.
+  * @param    pData   Pointer on the data to be written.
+  * @param    TarAddr I2C register address to written.
+  * @param    NbByte  Number of bytes to be written.
+  * @param    mi2cChannel I2C channel
+  * @return   NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteRegister( const uint8_t * const pData, const uint16_t TarAddr, const uint16_t NbByte, I2C * mi2cChannel )
+{ 
+  NFCTAG_StatusTypeDef ret;
+  NFCTAG_StatusTypeDef pollstatus;
+  uint8_t split_data_nb;
+  uint16_t bytes_to_write = NbByte;
+  uint16_t mem_addr = TarAddr;
+  const uint8_t *pdata_index = (const uint8_t *)pData;
+  
+  /* ST25DV can write a maximum of 256 bytes in EEPROM per i2c communication */
+  do
+  {
+    /* Split write if data to write is superior of max write bytes for ST25DV */
+    if( bytes_to_write > ST25DV_MAX_WRITE_BYTE )
+    {
+      /* DataSize higher than max page write, copy data by page */
+      split_data_nb = (uint8_t)ST25DV_MAX_WRITE_BYTE;
+    }
+    else
+    {
+      /* DataSize lower or equal to max page write, copy only last bytes */
+      split_data_nb = bytes_to_write;
+    }
+    /* Write split_data_nb bytes in register */
+    ret = ST25DV_IO_MemWrite( pdata_index, ST25DV_ADDR_SYST_I2C, mem_addr, split_data_nb, mi2cChannel);
+
+    Timer t;
+    /* POLLING, NEW CODE */
+    if( ret == 0 )
+    {
+        int ms = 0;
+         /* Wait until ST25DV is ready or timeout occurs */
+         do
+         {
+           t.start();
+           pollstatus = ST25DV_IO_IsDeviceReady( ST25DV_ADDR_DATA_I2C , 1, mi2cChannel);
+           ms = t.read_ms();
+           t.stop();
+         } while( ( ms  < ST25DV_I2C_TIMEOUT) && (pollstatus != NFCTAG_OK) );
+
+      if( pollstatus != NFCTAG_OK )
+      {
+        return NFCTAG_TIMEOUT;
+      }
+    }
+
+
+    /* update index, dest address, size for next write */
+    pdata_index += split_data_nb;
+    mem_addr += split_data_nb;
+    bytes_to_write -= split_data_nb;
+  }
+  while( ( bytes_to_write > 0 ) && ( ret == NFCTAG_OK ) );
+  
+
+
+  return ret;
+}
+
+/**
+  * @brief  Reads the ST25DV UID.
+  * @param  pUid Pointer used to return the ST25DV UID value.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadUID( ST25DV_UID * const pUid, I2C * mi2cChannel )
+{
+  uint8_t reg_value[8];
+  uint8_t i;
+  NFCTAG_StatusTypeDef status;
+  
+  /* Read value of UID registers */
+  status = ST25DV_i2c_ReadRegister( reg_value, ST25DV_UID_REG, 8,  mi2cChannel );
+  if( status != NFCTAG_OK )
+  {
+    return status;
+  }
+  
+  /* Store information in 2 WORD */
+  pUid->MsbUid = 0;
+  
+  for( i = 0; i < 4; i++ )
+  {
+    pUid->MsbUid = (pUid->MsbUid << 8) | reg_value[7 - i];
+  }
+  
+  pUid->LsbUid = 0;
+  
+  for( i = 0; i < 4; i++ )
+  {
+    pUid->LsbUid = (pUid->LsbUid << 8) | reg_value[3 - i];
+  }
+  
+  return NFCTAG_OK;
+}
+
+/**
+  * @brief  Reads the ST25DV DSFID.
+  * @param  pDsfid Pointer used to return the ST25DV DSFID value.
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadDSFID( uint8_t * const pDsfid, I2C * mi2cChannel )
+{
+  /* Read DSFID register */
+  return ST25DV_i2c_ReadRegister( pDsfid, ST25DV_DSFID_REG, 1, mi2cChannel );
+}
+
+/**
+  * @brief  Reads the ST25DV DSFID RF Lock state.
+  * @param  pLockDsfid Pointer on a ST25DV_LOCK_STATUS used to return the DSFID lock state.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadDsfidRFProtection( ST25DV_LOCK_STATUS * const pLockDsfid, I2C * mi2cChannel)
+{
+  uint8_t reg_value;
+  NFCTAG_StatusTypeDef status;
+  
+  /* Read register */
+  status = ST25DV_i2c_ReadRegister( &reg_value, ST25DV_LOCKDSFID_REG, 1 , mi2cChannel);
+  if( status != NFCTAG_OK )
+  {
+    return status;
+  }
+  
+  /* Extract Lock Status */
+  if( reg_value == 0 )
+  {
+    *pLockDsfid = ST25DV_UNLOCKED;
+  }
+  else
+  {
+    *pLockDsfid = ST25DV_LOCKED;
+  }
+  return NFCTAG_OK;
+}
+
+/**
+  * @brief  Reads the ST25DV AFI.
+  * @param  pAfi Pointer used to return the ST25DV AFI value.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadAFI( uint8_t * const pAfi, I2C * mi2cChannel )
+{
+  /* Read AFI register */
+  return ST25DV_i2c_ReadRegister( pAfi, ST25DV_AFI_REG, 1 , mi2cChannel);
+}
+
+/**
+  * @brief  Reads the AFI RF Lock state.
+  * @param  pLockAfi Pointer on a ST25DV_LOCK_STATUS used to return the ASFID lock state.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadAfiRFProtection( ST25DV_LOCK_STATUS * const pLockAfi, I2C * mi2cChannel )
+{
+  uint8_t reg_value;
+  NFCTAG_StatusTypeDef status;
+  
+  /* Read register */
+  status = ST25DV_i2c_ReadRegister( &reg_value, ST25DV_LOCKAFI_REG, 1,  mi2cChannel );
+  if( status != NFCTAG_OK )
+  {
+    return status;
+  }
+  
+  /* Extract Lock Status */
+  if( reg_value == 0 )
+  {
+    *pLockAfi = ST25DV_UNLOCKED;
+  }
+  else
+  {
+    *pLockAfi = ST25DV_LOCKED;
+  }
+  return NFCTAG_OK;
+}
+
+/**
+  * @brief  Reads the I2C Protected Area state.
+  * @param  pProtZone Pointer on a ST25DV_I2C_PROT_ZONE structure used to return the Protected Area state.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadI2CProtectZone( ST25DV_I2C_PROT_ZONE * const pProtZone, I2C * mi2cChannel )
+{
+  uint8_t reg_value;
+  NFCTAG_StatusTypeDef status;
+  
+  /* Read value of I2c Protected Zone register */
+  status = ST25DV_i2c_ReadRegister( &reg_value, ST25DV_I2CZSS_REG, 1,  mi2cChannel );
+  if( status != NFCTAG_OK )
+  {
+    return status;
+  }
+  
+  /* Dispatch information to corresponding struct member */
+  pProtZone->ProtectZone1 = (ST25DV_PROTECTION_CONF)( (reg_value & ST25DV_I2CZSS_PZ1_MASK) >> ST25DV_I2CZSS_PZ1_SHIFT );
+  pProtZone->ProtectZone2 = (ST25DV_PROTECTION_CONF)( (reg_value & ST25DV_I2CZSS_PZ2_MASK) >> ST25DV_I2CZSS_PZ2_SHIFT );
+  pProtZone->ProtectZone3 = (ST25DV_PROTECTION_CONF)( (reg_value & ST25DV_I2CZSS_PZ3_MASK) >> ST25DV_I2CZSS_PZ3_SHIFT );
+  pProtZone->ProtectZone4 = (ST25DV_PROTECTION_CONF)( (reg_value & ST25DV_I2CZSS_PZ4_MASK) >> ST25DV_I2CZSS_PZ4_SHIFT );
+  
+  return NFCTAG_OK;
+}
+
+/**
+  * @brief    Sets the I2C write-protected state to an EEPROM Area.
+  * @details  Needs the I2C Password presentation to be effective.
+  * @param    Zone                ST25DV_PROTECTION_ZONE value coresponding to the area to protect.
+  * @param    ReadWriteProtection ST25DV_PROTECTION_CONF value corresponding to the protection to be set.
+  * @param  mi2cChannel I2C channel
+  * @return   NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteI2CProtectZonex( const ST25DV_PROTECTION_ZONE Zone, const ST25DV_PROTECTION_CONF ReadWriteProtection, I2C * mi2cChannel )
+{
+  NFCTAG_StatusTypeDef status;
+  uint8_t reg_value = 0;
+  
+  /* Read actual i2c Zone Security Status */
+  status = ST25DV_i2c_ReadRegister( &reg_value, ST25DV_I2CZSS_REG, 1, mi2cChannel);
+  if( status != NFCTAG_OK )
+    return status;
+  
+  /* Compute and update new i2c Zone Security Status */
+  switch( Zone )
+  {
+    case ST25DV_PROT_ZONE1:
+      reg_value &= ST25DV_I2CZSS_PZ1_FIELD;
+      /* Read protection is not allowed for Zone 1 */
+      reg_value |= (ReadWriteProtection & 0x01) << ST25DV_I2CZSS_PZ1_SHIFT;
+      break;
+    case ST25DV_PROT_ZONE2:
+      reg_value &= ST25DV_I2CZSS_PZ2_FIELD;
+      reg_value |= ReadWriteProtection << ST25DV_I2CZSS_PZ2_SHIFT;
+      break;
+    case ST25DV_PROT_ZONE3:
+      reg_value &= ST25DV_I2CZSS_PZ3_FIELD;
+      reg_value |= ReadWriteProtection << ST25DV_I2CZSS_PZ3_SHIFT;
+      break;
+    case ST25DV_PROT_ZONE4:
+      reg_value &= ST25DV_I2CZSS_PZ4_FIELD;
+      reg_value |= ReadWriteProtection << ST25DV_I2CZSS_PZ4_SHIFT;
+      break;
+    
+    default:
+      return NFCTAG_ERROR;
+  }
+  
+  /* Write I2CZSS register */
+  return ST25DV_i2c_WriteRegister( &reg_value, ST25DV_I2CZSS_REG, 1, mi2cChannel );
+}
+
+/**
+  * @brief  Reads the CCile protection state.
+  * @param  pLockCCFile Pointer on a ST25DV_LOCK_CCFILE value corresponding to the lock state of the CCFile.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadLockCCFile( ST25DV_LOCK_CCFILE * const pLockCCFile, I2C * mi2cChannel )
+{
+  uint8_t reg_value;
+  NFCTAG_StatusTypeDef status;
+  
+  /* Get actual LOCKCCFILE register value */
+  status = ST25DV_i2c_ReadRegister( &reg_value, ST25DV_LOCKCCFILE_REG, 1, mi2cChannel );
+  if( status != NFCTAG_OK )
+  {
+    return status;
+  }
+  
+  /* Extract CCFile block information */
+  if( (reg_value & ST25DV_LOCKCCFILE_BLCK0_MASK)  == ST25DV_LOCKCCFILE_BLCK0_MASK )
+  {
+    pLockCCFile->LckBck0 = ST25DV_LOCKED;
+  }
+  else
+  {
+    pLockCCFile->LckBck0 = ST25DV_UNLOCKED;
+  }
+  
+  if( (reg_value & ST25DV_LOCKCCFILE_BLCK1_MASK)  == ST25DV_LOCKCCFILE_BLCK1_MASK )
+  {
+    pLockCCFile->LckBck1 = ST25DV_LOCKED;
+  }
+  else
+  {
+    pLockCCFile->LckBck1 = ST25DV_UNLOCKED;
+  }
+  
+  return status;
+}
+
+/**
+  * @brief  Locks the CCile to prevent any RF write access.
+  * @details  Needs the I2C Password presentation to be effective.
+  * @param  NbBlockCCFile ST25DV_CCFILE_BLOCK value corresponding to the number of blocks to be locked.
+  * @param  LockCCFile    ST25DV_LOCK_CCFILE value corresponding to the lock state to apply on the CCFile.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteLockCCFile( const ST25DV_CCFILE_BLOCK NbBlockCCFile, const ST25DV_LOCK_STATUS LockCCFile, I2C * mi2cChannel )
+{
+  uint8_t reg_value;
+  
+  /* Configure value to write on register */
+  if( NbBlockCCFile == ST25DV_CCFILE_1BLCK )
+  {
+    if( LockCCFile == ST25DV_LOCKED )
+    {
+      reg_value = ST25DV_LOCKCCFILE_BLCK0_MASK;
+    }
+    else
+    {
+      reg_value = 0x00;
+    }
+  }
+  else
+  {
+    if( LockCCFile == ST25DV_LOCKED )
+    {
+      reg_value = ST25DV_LOCKCCFILE_BLCK0_MASK | ST25DV_LOCKCCFILE_BLCK1_MASK;
+    }
+    else
+    {
+      reg_value = 0x00;
+    }
+  }
+  
+  /* Write LOCKCCFILE register */
+  return ST25DV_i2c_WriteRegister( &reg_value, ST25DV_LOCKCCFILE_REG, 1, mi2cChannel );
+}
+
+/**
+  * @brief  Reads the Cfg registers protection.
+  * @param  pLockCfg Pointer on a ST25DV_LOCK_STATUS value corresponding to the Cfg registers lock state.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadLockCFG( ST25DV_LOCK_STATUS * const pLockCfg, I2C * mi2cChannel )
+{
+  uint8_t reg_value;
+  NFCTAG_StatusTypeDef status;
+  
+  /* Get actual LOCKCCFILE register value */
+  status = ST25DV_i2c_ReadRegister( &reg_value, ST25DV_LOCKCFG_REG, 1, mi2cChannel );
+  if( status != NFCTAG_OK )
+  {
+    return status;
+  }
+
+  /* Extract LOCKCFG block information */
+  if( (reg_value & ST25DV_LOCKCFG_B0_MASK) == ST25DV_LOCKCFG_B0_MASK )
+  {
+    *pLockCfg = ST25DV_LOCKED;
+  }
+  else
+  {
+    *pLockCfg = ST25DV_UNLOCKED;
+  }
+  return NFCTAG_OK;  
+}
+
+/**
+  * @brief  Lock/Unlock the Cfg registers, to prevent any RF write access.
+  * @details  Needs the I2C Password presentation to be effective.
+  * @param  LockCfg ST25DV_LOCK_STATUS value corresponding to the lock state to be written.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteLockCFG( const ST25DV_LOCK_STATUS LockCfg, I2C * mi2cChannel )
+{
+  uint8_t reg_value;
+  
+  /* Configure value to write on register */
+  reg_value = (uint8_t)LockCfg;
+  
+  /* Write LOCKCFG register */
+  return ST25DV_i2c_WriteRegister( &reg_value, ST25DV_LOCKCFG_REG, 1,  mi2cChannel );
+}
+
+/**
+  * @brief  Presents I2C password, to authorize the I2C writes to protected areas.
+  * @param  PassWord Password value on 32bits
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_PresentI2CPassword( const ST25DV_PASSWD PassWord, I2C * mi2cChannel )
+{
+  uint8_t ai2c_message[17] = {0};
+  uint8_t i;
+  
+  /* Build I2C Message with Password + Validation code 0x09 + Password */
+  ai2c_message[8] = 0x09;
+  for( i = 0; i < 4; i++ )
+  {
+    ai2c_message[i] = ( PassWord.MsbPasswd >> ( (3 - i) * 8) ) & 0xFF;
+    ai2c_message[i + 4] = ( PassWord.LsbPasswd >> ( (3 - i) * 8) ) & 0xFF;
+    ai2c_message[i + 9] = ai2c_message[i];
+    ai2c_message[i + 13] = ai2c_message[i + 4];
+  };
+  
+  /* Present password to ST25DV */
+  return ST25DV_i2c_WriteRegister( ai2c_message, ST25DV_I2CPASSWD_REG, 17, mi2cChannel );
+}
+
+/**
+  * @brief  Writes a new I2C password.
+  * @details  Needs the I2C Password presentation to be effective.
+  * @param  PassWord New I2C PassWord value on 32bits.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteI2CPassword( const ST25DV_PASSWD PassWord, I2C * mi2cChannel )
+{
+  uint8_t ai2c_message[17] = {0};
+  uint8_t i;
+  
+  /* Build I2C Message with Password + Validation code 0x07 + Password */
+  ai2c_message[8] = 0x07;
+
+  for( i = 0; i < 4; i++ )
+  {
+    ai2c_message[i] = ( PassWord.MsbPasswd >> ( (3 - i) * 8) ) & 0xFF;
+    ai2c_message[i + 4] = ( PassWord.LsbPasswd >> ( (3 - i) * 8) ) & 0xFF;
+    ai2c_message[i + 9] = ai2c_message[i];
+    ai2c_message[i + 13] = ai2c_message[i + 4];
+  };
+  
+  /* Write new password in I2CPASSWD register */
+  return ST25DV_i2c_WriteRegister( ai2c_message, ST25DV_I2CPASSWD_REG, 17, mi2cChannel );
+}
+
+/**
+  * @brief  Reads the RF Zone Security Status (defining the allowed RF accesses).
+  * @param  Zone        ST25DV_PROTECTION_ZONE value coresponding to the protected area.
+  * @param  pRfprotZone Pointer on a ST25DV_RF_PROT_ZONE value corresponding to the area protection state.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadRFZxSS( const ST25DV_PROTECTION_ZONE Zone, ST25DV_RF_PROT_ZONE * const pRfprotZone, I2C * mi2cChannel )
+{
+  uint8_t reg_value;
+  NFCTAG_StatusTypeDef status;
+  uint16_t sector_security_addr;
+  
+  /* Select Sector Security register address */
+  switch( Zone )
+  {
+    case ST25DV_PROT_ZONE1:
+      sector_security_addr = ST25DV_RFZ1SS_REG;
+      break;
+    case ST25DV_PROT_ZONE2:
+      sector_security_addr = ST25DV_RFZ2SS_REG;
+      break;
+    case ST25DV_PROT_ZONE3:
+      sector_security_addr = ST25DV_RFZ3SS_REG;
+      break;
+    case ST25DV_PROT_ZONE4:
+      sector_security_addr = ST25DV_RFZ4SS_REG;
+      break;
+    
+    default:
+      return NFCTAG_ERROR;
+  }
+  
+  /* Read actual value of Sector Security Status register */
+  status = ST25DV_i2c_ReadRegister( &reg_value, sector_security_addr, 1, mi2cChannel );
+  if( status != NFCTAG_OK )
+  {
+    return status;
+  }
+  
+  /* Extract Sector Security Status configuration */
+  pRfprotZone->PasswdCtrl = (ST25DV_PASSWD_PROT_STATUS)((reg_value & ST25DV_RFZSS_PWDCTRL_MASK) >> ST25DV_RFZSS_PWDCTRL_SHIFT);
+  pRfprotZone->RWprotection = (ST25DV_PROTECTION_CONF)((reg_value & ST25DV_RFZSS_RWPROT_MASK) >> ST25DV_RFZSS_RWPROT_SHIFT);
+  
+  return NFCTAG_OK;
+}
+
+/**
+  * @brief  Writes the RF Zone Security Status (defining the allowed RF accesses)
+  * @details  Needs the I2C Password presentation to be effective.
+  * @param  Zone        ST25DV_PROTECTION_ZONE value corresponding to the area on which to set the RF protection.
+  * @param  RfProtZone  Pointer on a ST25DV_RF_PROT_ZONE value defininf the protection to be set on the area.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteRFZxSS( const ST25DV_PROTECTION_ZONE Zone, const ST25DV_RF_PROT_ZONE RfProtZone, I2C * mi2cChannel )
+{
+  uint8_t reg_value;
+  uint16_t sector_security_addr;
+  
+  /* Select Sector Security register address */
+  switch( Zone )
+  {
+    case ST25DV_PROT_ZONE1:
+      sector_security_addr = ST25DV_RFZ1SS_REG;
+      break;
+    case ST25DV_PROT_ZONE2:
+      sector_security_addr = ST25DV_RFZ2SS_REG;
+      break;
+    case ST25DV_PROT_ZONE3:
+      sector_security_addr = ST25DV_RFZ3SS_REG;
+      break;
+    case ST25DV_PROT_ZONE4:
+      sector_security_addr = ST25DV_RFZ4SS_REG;
+      break;
+    
+    default:
+      return NFCTAG_ERROR;
+  }
+  
+  /* Update Sector Security Status */
+  reg_value = (RfProtZone.RWprotection << ST25DV_RFZSS_RWPROT_SHIFT) & ST25DV_RFZSS_RWPROT_MASK;
+  reg_value |= ((RfProtZone.PasswdCtrl << ST25DV_RFZSS_PWDCTRL_SHIFT) & ST25DV_RFZSS_PWDCTRL_MASK);
+  
+  /* Write Sector Security register */
+  return ST25DV_i2c_WriteRegister( &reg_value, sector_security_addr, 1,  mi2cChannel );
+}
+
+/**
+  * @brief  Reads the value of the an area end address.
+  * @param  EndZone ST25DV_END_ZONE value corresponding to an area end address.
+  * @param  pEndZ   Pointer used to return the end address of the area.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadEndZonex( const ST25DV_END_ZONE EndZone, uint8_t * const pEndZ, I2C * mi2cChannel )
+{
+  uint16_t mem_addr;
+  
+  /* End zone register address to read */
+  switch( EndZone )
+  {
+    case ST25DV_ZONE_END1:
+      mem_addr = ST25DV_END1_REG;
+      break;
+    case ST25DV_ZONE_END2:
+      mem_addr = ST25DV_END2_REG;
+      break;
+    case ST25DV_ZONE_END3:
+      mem_addr = ST25DV_END3_REG;
+      break;
+    
+    default:
+      return NFCTAG_ERROR;
+  }
+  
+  /* Read the corresponding End zone */ 
+  return ST25DV_i2c_ReadRegister( pEndZ, mem_addr, 1,  mi2cChannel );
+}
+
+/**
+  * @brief    Sets the end address of an area.
+  * @details  Needs the I2C Password presentation to be effective.
+  * @note     The ST25DV answers a NACK when setting the EndZone2 & EndZone3 to same value than repectively EndZone1 & EndZone2.\n
+  *           These NACKs are ok.
+  * @param  EndZone ST25DV_END_ZONE value corresponding to an area.
+  * @param  EndZ   End zone value to be written.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteEndZonex( const ST25DV_END_ZONE EndZone, const uint8_t EndZ , I2C * mi2cChannel)
+{
+  uint16_t mem_addr;
+  NFCTAG_StatusTypeDef ret;
+  
+  /* End zone register address to write */
+  switch( EndZone )
+  {
+    case ST25DV_ZONE_END1:
+      mem_addr = ST25DV_END1_REG;
+      break;
+    case ST25DV_ZONE_END2:
+      mem_addr = ST25DV_END2_REG;
+      break;
+    case ST25DV_ZONE_END3:
+      mem_addr = ST25DV_END3_REG;
+      break;
+    
+    default:
+      return NFCTAG_ERROR;
+  }
+
+  /* Write the corresponding End zone value in register */
+  ret = ST25DV_i2c_WriteRegister( &EndZ, mem_addr, 1,mi2cChannel );
+  
+  return ret;
+}
+
+/**
+  * @brief  Initializes the end address of the ST25DV areas with their default values (end of memory).
+  * @details  Needs the I2C Password presentation to be effective..
+  *           The ST25DV answers a NACK when setting the EndZone2 & EndZone3 to same value than repectively EndZone1 & EndZone2.
+  *           These NACKs are ok.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_InitEndZone( I2C * mi2cChannel )
+{
+  uint8_t endval = 0xFF;
+  uint32_t maxmemlength;
+  ST25DV_MEM_SIZE memsize;
+  NFCTAG_StatusTypeDef ret;
+  
+  memsize.Mem_Size = 0;
+  memsize.BlockSize = 0;
+
+  /* Get EEPROM mem size */
+  ST25DV_i2c_ReadMemSize( &memsize, mi2cChannel );
+  maxmemlength = (memsize.Mem_Size + 1) * (memsize.BlockSize + 1);
+  
+  /* Compute Max value for endzone register */
+  endval = (maxmemlength / 32) - 1;
+  
+  /* Write EndZone value to ST25DV registers */
+  ret = ST25DV_i2c_WriteEndZonex( ST25DV_ZONE_END3, endval, mi2cChannel );
+  if( (ret != NFCTAG_OK) && (ret != NFCTAG_NACK) )
+  {
+    return ret;
+  }
+
+  ret = ST25DV_i2c_WriteEndZonex( ST25DV_ZONE_END2, endval, mi2cChannel );
+  if( (ret != NFCTAG_OK) && (ret != NFCTAG_NACK) )
+  {
+    return ret;
+  }
+
+  ret = ST25DV_i2c_WriteEndZonex( ST25DV_ZONE_END1, endval, mi2cChannel );
+  if( (ret != NFCTAG_OK) && (ret != NFCTAG_NACK) )
+  {
+    return ret;
+  }
+  
+  return ret;
+}
+
+/**
+  * @brief  Creates user areas with defined lengths.
+  * @details  Needs the I2C Password presentation to be effective.
+  * @param  Zone1Length Length of area1 in bytes (32 to 8192, 0x20 to 0x2000)
+  * @param  Zone2Length Length of area2 in bytes (0 to 8128, 0x00 to 0x1FC0)
+  * @param  Zone3Length Length of area3 in bytes (0 to 8064, 0x00 to 0x1F80)
+  * @param  Zone4Length Length of area4 in bytes (0 to 8000, 0x00 to 0x1F40)
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_CreateUserZone( uint16_t Zone1Length, uint16_t Zone2Length, uint16_t Zone3Length, uint16_t Zone4Length, I2C * mi2cChannel )
+{
+  uint8_t EndVal;
+  ST25DV_MEM_SIZE memsize;
+  uint16_t maxmemlength = 0;
+  NFCTAG_StatusTypeDef ret;
+  
+  memsize.Mem_Size = 0;
+  memsize.BlockSize = 0;
+
+  ST25DV_i2c_ReadMemSize( &memsize, mi2cChannel );
+  
+  maxmemlength = (memsize.Mem_Size + 1) * (memsize.BlockSize + 1);
+  
+  /* Checks that values of different zones are in bounds */
+  if( ( Zone1Length < 32 ) || ( Zone1Length > maxmemlength ) || ( Zone2Length > (maxmemlength - 32) ) 
+      || ( Zone3Length > (maxmemlength - 64) ) || ( Zone4Length > (maxmemlength - 96) ) )
+  {
+    return NFCTAG_ERROR;
+  }
+
+  /* Checks that the total is less than the authorised maximum */
+  if( ( Zone1Length + Zone2Length + Zone3Length + Zone4Length ) > maxmemlength )
+  {
+    return NFCTAG_ERROR;
+  }
+  
+  /* if The value for each Length is not a multiple of 64 correct it. */
+  if( (Zone1Length % 32) != 0 )
+  {
+    Zone1Length = Zone1Length - ( Zone1Length % 32 );
+  }
+  
+  if( (Zone2Length % 32) != 0 )
+  {
+    Zone2Length = Zone2Length - ( Zone2Length % 32 );
+  }
+  
+  if( (Zone3Length % 32) != 0 )
+  {
+    Zone3Length = Zone3Length - ( Zone3Length % 32 );
+  }
+  
+  /* First right 0xFF in each Endx value */
+  ret = ST25DV_i2c_InitEndZone( mi2cChannel );
+  if( (ret != NFCTAG_OK) && (ret != NFCTAG_NACK) )
+  {
+    return ret;
+  }
+  
+  /* Then Write corresponding value for each zone */
+  EndVal = (uint8_t)( (Zone1Length / 32 ) - 1 );
+  ret = ST25DV_i2c_WriteEndZonex( ST25DV_ZONE_END1, EndVal, mi2cChannel );
+  if( (ret != NFCTAG_OK) && (ret != NFCTAG_NACK) )
+  {
+    return ret;
+  }
+  
+  EndVal = (uint8_t)( ((Zone1Length + Zone2Length) / 32 ) - 1 );
+  ret = ST25DV_i2c_WriteEndZonex( ST25DV_ZONE_END2, EndVal, mi2cChannel );
+  if( (ret != NFCTAG_OK) && (ret != NFCTAG_NACK) )
+  {
+    return ret;
+  }
+  
+  EndVal = (uint8_t)( ((Zone1Length + Zone2Length + Zone3Length) / 32 ) - 1 );
+  ret = ST25DV_i2c_WriteEndZonex( ST25DV_ZONE_END3, EndVal, mi2cChannel );
+  if( (ret != NFCTAG_OK) && (ret != NFCTAG_NACK) )
+  {
+    return ret;
+  }
+  
+  return NFCTAG_OK;
+}
+
+/**
+  * @brief  Reads the ST25DV Memory Size.
+  * @param  pSizeInfo Pointer on a ST25DV_MEM_SIZE structure used to return the Memory size information.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadMemSize( ST25DV_MEM_SIZE * const pSizeInfo, I2C * mi2cChannel )
+{
+  uint8_t reg_value[3];
+  NFCTAG_StatusTypeDef status;
+  
+  /* Read actual value of MEM_SIZE register,cheeeeeeeeeeeeeck*/
+  status = ST25DV_i2c_ReadRegister( reg_value, ST25DV_MEM_SIZE_REG, 1, mi2cChannel );
+  status = ST25DV_i2c_ReadRegister( reg_value + 1, ST25DV_MEM_SIZE_REG + 1, 1, mi2cChannel );
+  status = ST25DV_i2c_ReadRegister( reg_value + 2, ST25DV_MEM_SIZE_REG + 2, 1, mi2cChannel );
+
+
+  if( status != NFCTAG_OK )
+    return status;
+  
+  /* Extract Memory information */
+  pSizeInfo->BlockSize = reg_value[2];
+  pSizeInfo->Mem_Size = reg_value[1];
+  pSizeInfo->Mem_Size = (pSizeInfo->Mem_Size << 8) | reg_value[0];
+  return NFCTAG_OK;
+}
+
+/**
+  * @brief  Reads the Energy harvesting mode.
+  * @param  pEH_mode Pointer on a ST25DV_EH_MODE_STATUS value corresponding to the Energy Harvesting state.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadEHMode( ST25DV_EH_MODE_STATUS * const pEH_mode, I2C * mi2cChannel )
+{
+  uint8_t reg_value;
+  NFCTAG_StatusTypeDef status;
+  
+  /* Read actual value of EH_MODE register */
+  status = ST25DV_i2c_ReadRegister( &reg_value, ST25DV_EH_MODE_REG, 1, mi2cChannel );
+  if( status != NFCTAG_OK )
+    return status;
+  
+  /* Extract EH_mode configuration */
+  if( (reg_value & ST25DV_EH_MODE_MASK) == ST25DV_EH_MODE_MASK )
+  {
+    *pEH_mode = ST25DV_EH_ON_DEMAND;
+  }
+  else
+  {
+    *pEH_mode = ST25DV_EH_ACTIVE_AFTER_BOOT;
+  }
+  
+  return NFCTAG_OK;
+}
+
+/**
+  * @brief  Sets the Energy harvesting mode.
+  * @details  Needs the I2C Password presentation to be effective.
+  * @param  EH_mode ST25DV_EH_MODE_STATUS value for the Energy harvesting mode to be set.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteEHMode( const ST25DV_EH_MODE_STATUS EH_mode, I2C * mi2cChannel )
+{
+  uint8_t reg_value;
+  
+  /* Update EH_mode */
+  reg_value = (uint8_t)EH_mode;
+  
+  /* Write EH_MODE register */
+  return ST25DV_i2c_WriteRegister( &reg_value, ST25DV_EH_MODE_REG, 1, mi2cChannel );
+}
+
+/**
+  * @brief  Reads the RF Management configuration.
+  * @param  pRF_Mngt Pointer on a ST25DV_RF_MNGT structure used to return the RF Management configuration.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadRFMngt( ST25DV_RF_MNGT * const pRF_Mngt, I2C * mi2cChannel )
+{
+  NFCTAG_StatusTypeDef status;
+  uint8_t reg_value = 0;
+  
+  /* Read actual value of RF_MNGT register */
+  status = ST25DV_i2c_ReadRegister( &reg_value, ST25DV_RF_MNGT_REG, 1,  mi2cChannel );
+
+  if( status == NFCTAG_OK )
+  {
+    /* Extract RF Disable information */
+    if( (reg_value & ST25DV_RF_MNGT_RFDIS_MASK) == ST25DV_RF_MNGT_RFDIS_MASK )
+    {
+      pRF_Mngt->RfDisable = ST25DV_ENABLE;
+    }
+    else
+    {
+      pRF_Mngt->RfDisable = ST25DV_DISABLE;
+    }
+    
+    /* Extract RF Sleep information */
+    if( (reg_value & ST25DV_RF_MNGT_RFSLEEP_MASK) == ST25DV_RF_MNGT_RFSLEEP_MASK )
+    {
+      pRF_Mngt->RfSleep = ST25DV_ENABLE;
+    }
+    else
+    {
+      pRF_Mngt->RfSleep = ST25DV_DISABLE;
+    }
+  }
+  
+  return status;
+}
+
+/**
+  * @brief  Sets the RF Management configuration.
+  * @details  Needs the I2C Password presentation to be effective.
+  * @param  Rfmngt Value of the RF Management configuration to be written.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteRFMngt( const uint8_t Rfmngt, I2C * mi2cChannel )
+{
+  /* Write RF_MNGT register */
+  return ST25DV_i2c_WriteRegister( &Rfmngt, ST25DV_RF_MNGT_REG, 1, mi2cChannel );
+}
+
+/**
+  * @brief  Reads the RFDisable register information.
+  * @param  pRFDisable Pointer on a ST25DV_EN_STATUS value corresponding to the RF Disable status.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_GetRFDisable( ST25DV_EN_STATUS * const pRFDisable, I2C * mi2cChannel )
+{
+  NFCTAG_StatusTypeDef status;
+  uint8_t reg_value = 0;
+  
+  /* Read actual value of RF_MNGT register */
+  status = ST25DV_i2c_ReadMailboxRegister( &reg_value, ST25DV_RF_MNGT_REG, 1, mi2cChannel );
+  
+  /* Extract RFDisable information */
+  if( status == NFCTAG_OK )
+  {
+    if( (reg_value & ST25DV_RF_MNGT_RFDIS_MASK) == ST25DV_RF_MNGT_RFDIS_MASK )
+    {
+      *pRFDisable = ST25DV_ENABLE;
+    }
+    else
+    {
+      *pRFDisable = ST25DV_DISABLE;
+    }
+    return NFCTAG_OK;
+  }
+  
+  return status;
+}
+
+/**
+  * @brief  Sets the RF Disable configuration.
+  * @details  Needs the I2C Password presentation to be effective.7
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_SetRFDisable( I2C * mi2cChannel )
+{
+  NFCTAG_StatusTypeDef status;
+  uint8_t reg_value = 0;
+  
+  /* Read actual value of RF_RMNGT register */
+  status = ST25DV_i2c_ReadRegister( &reg_value, ST25DV_RF_MNGT_REG, 1, mi2cChannel );
+  if( status != NFCTAG_OK )
+  {
+    return status;
+  }
+  
+  /* Update RF Disable field configuration */
+  reg_value |= ST25DV_RF_MNGT_RFDIS_MASK;
+  
+  /* Write RF_MNGT register */
+  return ST25DV_i2c_WriteRegister( &reg_value, ST25DV_RF_MNGT_REG, 1, mi2cChannel );
+}
+
+/**
+  * @brief  Resets the RF Disable configuration
+  * @details  Needs the I2C Password presentation to be effective.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ResetRFDisable( I2C * mi2cChannel )
+{
+  NFCTAG_StatusTypeDef status;
+  uint8_t reg_value = 0;
+  
+  /* Read actual value of RF_RMNGT register */
+  status = ST25DV_i2c_ReadRegister( &reg_value, ST25DV_RF_MNGT_REG, 1, mi2cChannel );
+  if( status != NFCTAG_OK )
+  {
+    return status;
+  }
+  
+  /* Update RF Disable field configuration */
+  reg_value &= ST25DV_RF_MNGT_RFDIS_FIELD;
+  
+  /* Write RF_MNGT register */
+  return ST25DV_i2c_WriteRegister( &reg_value, ST25DV_RF_MNGT_REG, 1,  mi2cChannel );
+}
+
+/**
+  * @brief  Reads the RFSleep register information.
+  * @param  pRFSleep Pointer on a ST25DV_EN_STATUS value corresponding to the RF Sleep status.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_GetRFSleep( ST25DV_EN_STATUS * const pRFSleep, I2C * mi2cChannel )
+{
+  NFCTAG_StatusTypeDef status;
+  uint8_t reg_value = 0;
+  
+  /* Read actual value of RF_MNGT register */
+  status = ST25DV_i2c_ReadMailboxRegister( &reg_value, ST25DV_RF_MNGT_REG, 1, mi2cChannel );
+  
+  /* Extract RFSleep information */
+  if( status == NFCTAG_OK )
+  {
+    if( (reg_value & ST25DV_RF_MNGT_RFDIS_MASK) == ST25DV_RF_MNGT_RFDIS_MASK )
+    {
+      *pRFSleep = ST25DV_ENABLE;
+    }
+    else
+    {
+      *pRFSleep = ST25DV_DISABLE;
+    }
+    return NFCTAG_OK;
+  }
+  
+  return status;
+}
+
+/**
+  * @brief  Sets the RF Sleep configuration.
+  * @details  Needs the I2C Password presentation to be effective.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_SetRFSleep( I2C * mi2cChannel )
+{
+  NFCTAG_StatusTypeDef status;
+  uint8_t reg_value = 0;
+  
+  /* Read actual value of RF_RMNGT register */
+  status = ST25DV_i2c_ReadRegister( &reg_value, ST25DV_RF_MNGT_REG, 1, mi2cChannel );
+  if( status != NFCTAG_OK )
+  {
+    return status;
+  }
+  
+  /* Update RF Sleep field configuration */
+  reg_value |= ST25DV_RF_MNGT_RFSLEEP_MASK;
+  
+  /* Write RF_MNGT register */
+  return ST25DV_i2c_WriteRegister( &reg_value, ST25DV_RF_MNGT_REG, 1,mi2cChannel );
+}
+
+/**
+  * @brief  Resets the RF Sleep configuration.
+  * @details  Needs the I2C Password presentation to be effective.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ResetRFSleep( I2C * mi2cChannel )
+{
+  NFCTAG_StatusTypeDef status;
+  uint8_t reg_value = 0;
+  
+  /* Read actual value of RF_RMNGT register */
+  status = ST25DV_i2c_ReadRegister( &reg_value, ST25DV_RF_MNGT_REG, 1, mi2cChannel );
+  if( status != NFCTAG_OK )
+  {
+    return status;
+  }
+  
+  /* Update RF Sleep field configuration */
+  reg_value &= ST25DV_RF_MNGT_RFSLEEP_FIELD;
+  
+  /* Write RF_MNGT register */
+  return ST25DV_i2c_WriteRegister( &reg_value, ST25DV_RF_MNGT_REG, 1, mi2cChannel );
+}
+
+/**
+  * @brief  Reads the Mailbox mode.
+  * @param  pMB_mode Pointer on a ST25DV_EH_MODE_STATUS value used to return the Mailbox mode.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadMBMode( ST25DV_EN_STATUS * const pMB_mode, I2C * mi2cChannel )
+{
+  uint8_t reg_value;
+  NFCTAG_StatusTypeDef status;
+  
+  /* Read actual value of MB_MODE register */
+  status = ST25DV_i2c_ReadRegister( &reg_value, ST25DV_MB_MODE_REG, 1,  mi2cChannel );
+  if( status != NFCTAG_OK )
+  {
+    return status;
+  }
+  
+  /* Extract Mailbox mode status */
+  if( (reg_value & ST25DV_MB_MODE_RW_MASK) == ST25DV_MB_MODE_RW_MASK )
+  {
+    *pMB_mode = ST25DV_ENABLE;
+  }
+  else
+  {
+    *pMB_mode = ST25DV_DISABLE;
+  }
+  
+  return NFCTAG_OK;
+}
+
+/**
+  * @brief  Sets the Mailbox mode.
+  * @details  Needs the I2C Password presentation to be effective.
+  * @param  MB_mode ST25DV_EN_STATUS value corresponding to the Mailbox mode to be set.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteMBMode( const ST25DV_EN_STATUS MB_mode, I2C * mi2cChannel )
+{
+  uint8_t reg_value;
+  
+  /* Update Mailbox mode status */
+  reg_value = (uint8_t)MB_mode;
+  
+  /* Write MB_MODE register */
+  return ST25DV_i2c_WriteRegister( &reg_value, ST25DV_MB_MODE_REG, 1, mi2cChannel );
+}
+
+/**
+  * @brief  Reads the Mailbox watchdog duration coefficient.
+  * @param  pWdgDelay Pointer on a uint8_t used to return the watchdog duration coefficient.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadMBWDG( uint8_t * const pWdgDelay, I2C * mi2cChannel )
+{
+  uint8_t reg_value;
+  NFCTAG_StatusTypeDef status;
+  
+  /* Read actual value of MB_WDG register */
+  status = ST25DV_i2c_ReadRegister( &reg_value, ST25DV_MB_WDG_REG, 1 , mi2cChannel);
+  if( status != NFCTAG_OK )
+  {
+    return status;
+  }
+  
+  /* Extract watchdog coefficient delay configuration */
+  *pWdgDelay = (reg_value & ST25DV_MB_WDG_DELAY_MASK) >> ST25DV_MB_WDG_DELAY_SHIFT;
+  
+  return NFCTAG_OK;
+}
+
+/**
+  * @brief  Writes the Mailbox watchdog coefficient delay
+  * @details  Needs the I2C Password presentation to be effective.
+  * @param  WdgDelay Watchdog duration coefficient to be written (Watch dog duration = MB_WDG*30 ms +/- 6%).
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteMBWDG( const uint8_t WdgDelay, I2C * mi2cChannel )
+{
+  uint8_t reg_value;
+  
+  /* Set Watchdog coefficient delay */
+  reg_value = WdgDelay & ST25DV_MB_WDG_DELAY_MASK;
+  
+  /* Write MB_MODE register */
+  return ST25DV_i2c_WriteRegister( &reg_value, ST25DV_MB_WDG_REG, 1, mi2cChannel );
+}
+
+/**
+  * @brief  Reads N bytes of data from the Mailbox, starting at the specified byte offset.
+  * @param  pData   Pointer on the buffer used to return the read data.
+  * @param  Offset  Offset in the Mailbox memory, byte number to start the read.
+  * @param  NbByte  Number of bytes to be read.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadMailboxData( uint8_t * const pData, const uint16_t Offset, const uint16_t NbByte, I2C * mi2cChannel )
+{
+  if( Offset > ST25DV_MAX_MAILBOX_LENGTH )
+  {
+    return NFCTAG_ERROR;
+  }
+  
+  /* Read Data in user memory */
+  return ST25DV_IO_MemRead( pData, ST25DV_ADDR_DATA_I2C, ST25DV_MAILBOX_RAM_REG + Offset, NbByte,  mi2cChannel );
+}
+
+/**
+  * @brief  Writes N bytes of data in the Mailbox, starting from first Mailbox Address.
+  * @param  pData   Pointer to the buffer containing the data to be written.
+  * @param  NbByte  Number of bytes to be written.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteMailboxData( const uint8_t * const pData, const uint16_t NbByte, I2C * mi2cChannel )
+{ 
+  NFCTAG_StatusTypeDef status;
+  
+  /* ST25DV can write a maximum of 256 bytes in Mailbox */
+  if( NbByte < ST25DV_MAX_MAILBOX_LENGTH )
+  {
+    /* Write NbByte data in memory */
+    status = ST25DV_IO_MemWrite( pData, ST25DV_ADDR_DATA_I2C, ST25DV_MAILBOX_RAM_REG, NbByte,  mi2cChannel);
+  }
+  else
+  {
+    status = NFCTAG_ERROR;
+  }
+  
+  return status;
+}
+
+/**
+  * @brief  Reads N bytes from the mailbox registers, starting at the specified I2C address.
+  * @param  pData   Pointer on the buffer used to return the data.
+  * @param  TarAddr I2C memory address to be read.
+  * @param  NbByte  Number of bytes to be read.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadMailboxRegister( uint8_t * const pData, const uint16_t TarAddr, const uint16_t NbByte, I2C * mi2cChannel )
+{ 
+  if( (TarAddr < ST25DV_GPO_DYN_REG) || (TarAddr > ST25DV_MBLEN_DYN_REG) )
+  {
+    return NFCTAG_ERROR;
+  }
+  
+  return ST25DV_IO_MemRead( pData, ST25DV_ADDR_DATA_I2C, TarAddr, NbByte,  mi2cChannel );
+}
+
+/**
+  * @brief  Writes N bytes to the specified mailbox register.
+  * @param  pData   Pointer on the data to be written.
+  * @param  TarAddr I2C register address to be written.
+  * @param  NbByte  Number of bytes to be written.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteMailboxRegister( const uint8_t * const pData, const uint16_t TarAddr, const uint16_t NbByte, I2C * mi2cChannel )
+{ 
+  NFCTAG_StatusTypeDef status;
+  
+  if( (TarAddr < ST25DV_GPO_DYN_REG) || (TarAddr > ST25DV_MBLEN_DYN_REG) )
+  {
+    return NFCTAG_ERROR;
+  }
+  
+  /* ST25DV can write a maximum of 256 bytes in Mailbox */
+  if( NbByte < ST25DV_MAX_MAILBOX_LENGTH )
+  {
+    /* Write NbByte data in memory */
+    status = ST25DV_IO_MemWrite( pData, ST25DV_ADDR_DATA_I2C, TarAddr, NbByte, mi2cChannel);
+  }
+  else
+  {
+    status = NFCTAG_ERROR;
+  }
+  
+  return status;
+}
+
+/**
+  * @brief  Reads the status of the security session open register.
+  * @param  pSession Pointer on a ST25DV_I2CSSO_STATUS value used to return the session status.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadI2CSecuritySession_Dyn( ST25DV_I2CSSO_STATUS * const pSession, I2C * mi2cChannel )
+{
+  uint8_t reg_value;
+  NFCTAG_StatusTypeDef status;
+
+  /* Read actual value of I2C_SSO_DYN register */
+  status = ST25DV_i2c_ReadMailboxRegister( &reg_value, ST25DV_I2C_SSO_DYN_REG, 1, mi2cChannel );
+  if( status != NFCTAG_OK )
+  {
+    return status;
+  }
+  
+  /* Extract Open session information */
+  if( (reg_value & ST25DV_I2C_SSO_DYN_I2CSSO_MASK) == ST25DV_I2C_SSO_DYN_I2CSSO_MASK )
+  {
+    *pSession = ST25DV_SESSION_OPEN;
+  }
+  else
+  {
+    *pSession = ST25DV_SESSION_CLOSED;
+  }
+  
+  return NFCTAG_OK;
+}
+
+/**
+  * @brief  Reads the IT status register from the ST25DV.
+  * @param  pITStatus Pointer on uint8_t, used to return the IT status, such as:
+  *                       - RFUSERSTATE = 0x01
+  *                       - RFBUSY = 0x02
+  *                       - RFINTERRUPT = 0x04
+  *                       - FIELDFALLING = 0x08
+  *                       - FIELDRISING = 0x10
+  *                       - RFPUTMSG = 0x20
+  *                       - RFGETMSG = 0x40
+  *                       - RFWRITE = 0x80
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadITSTStatus_Dyn( uint8_t * const pITStatus, I2C * mi2cChannel )
+{
+  /* Read value of ITStatus register */
+  return ST25DV_i2c_ReadMailboxRegister( pITStatus, ST25DV_ITSTS_DYN_REG, 1,  mi2cChannel );
+}
+
+/**
+  * @brief  Read value of dynamic GPO register configuration.
+  * @param  pGPO ST25DV_GPO pointer of the dynamic GPO configuration to store.
+  * @param  mi2cChannel I2C channel
+  * @retval NFCTAG enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadGPO_Dyn( uint8_t *GPOConfig, I2C * mi2cChannel )
+{
+  /* Read actual value of ST25DV_GPO_DYN_REG register */
+  return ST25DV_i2c_ReadMailboxRegister( GPOConfig, ST25DV_GPO_DYN_REG, 1,  mi2cChannel );
+}
+
+
+/**
+  * @brief  Get dynamique GPO enable status
+  * @param  pGPO_en ST25DV_EN_STATUS pointer of the GPO enable status to store
+  * @param  mi2cChannel I2C channel
+  * @retval NFCTAG enum status
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_GetGPO_en_Dyn( ST25DV_EN_STATUS * const pGPO_en, I2C * mi2cChannel )
+{
+  uint8_t reg_value;
+  NFCTAG_StatusTypeDef status;
+  /* Read actual value of GPO_DYN register */
+  status = ST25DV_i2c_ReadMailboxRegister( &reg_value, ST25DV_GPO_DYN_REG, 1,  mi2cChannel );
+  if( status != NFCTAG_OK )
+  {
+    return status;
+  }
+  
+  /* Extract GPO enable status information */
+  if( (reg_value & ST25DV_GPO_DYN_ENABLE_MASK) == ST25DV_GPO_DYN_ENABLE_MASK )
+  {
+    *pGPO_en = ST25DV_ENABLE;
+  }
+  else
+  {
+    *pGPO_en = ST25DV_DISABLE;
+  }
+  
+  return NFCTAG_OK;
+}
+
+/**
+  * @brief  Set dynamique GPO enable configuration.
+  * @param  None No parameters.
+  * @param  mi2cChannel I2C channel
+  * @retval NFCTAG enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_SetGPO_en_Dyn( I2C * mi2cChannel )
+{
+  uint8_t reg_value;
+  NFCTAG_StatusTypeDef status;
+  
+  /* Read actual value of GPO_DYN register */
+  status = ST25DV_i2c_ReadMailboxRegister( &reg_value, ST25DV_GPO_DYN_REG, 1, mi2cChannel );
+  if( status != NFCTAG_OK )
+  {
+    return status;
+  }
+  
+  /* Update GPO enable configuration */
+  reg_value |= ST25DV_GPO_DYN_ENABLE_MASK;
+  
+  /* Write GPO_DYN Register */
+  return ST25DV_i2c_WriteMailboxRegister( &reg_value, ST25DV_GPO_DYN_REG, 1,  mi2cChannel );
+}
+
+/**
+  * @brief  Reset dynamique GPO enable configuration.
+  * @param  None No parameters.
+  * @param  mi2cChannel I2C channel
+  * @retval NFCTAG enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ResetGPO_en_Dyn( I2C * mi2cChannel )
+{
+  uint8_t reg_value;
+  NFCTAG_StatusTypeDef status;
+  
+  /* Read actual value of GPO_DYN register */
+  status = ST25DV_i2c_ReadMailboxRegister( &reg_value, ST25DV_GPO_DYN_REG, 1, mi2cChannel );
+  if( status != NFCTAG_OK )
+  {
+    return status;
+  }
+  
+  /* Update GPO enable configuration */
+  reg_value &= ST25DV_GPO_DYN_ENABLE_FIELD;
+  
+  /* Write GPO_DYN Register */
+  return ST25DV_i2c_WriteMailboxRegister( &reg_value, ST25DV_GPO_DYN_REG, 1, mi2cChannel );
+}
+
+/**
+  * @brief  Read value of dynamic EH Ctrl register configuration
+  * @param  pEH_CTRL : ST25DV_EH_CTRL pointer of the dynamic EH Ctrl configuration to store
+  * @param  mi2cChannel I2C channel
+  * @retval NFCTAG enum status
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadEHCtrl_Dyn( ST25DV_EH_CTRL * const pEH_CTRL, I2C * mi2cChannel )
+{
+  NFCTAG_StatusTypeDef status;
+  uint8_t reg_value = 0;
+  
+  /* Read actual value of ST25DV_EH_CTRL_DYN_REG register */
+  status = ST25DV_i2c_ReadMailboxRegister( &reg_value, ST25DV_EH_CTRL_DYN_REG, 1,  mi2cChannel );
+  
+  if( status == NFCTAG_OK )
+  {
+    /* Extract EH EN Mode configuration */
+    if( (reg_value & ST25DV_EH_CTRL_DYN_EH_EN_MASK) == ST25DV_EH_CTRL_DYN_EH_EN_MASK )
+    {
+      pEH_CTRL->EH_EN_Mode = ST25DV_ENABLE;
+    }
+    else
+    {
+      pEH_CTRL->EH_EN_Mode = ST25DV_DISABLE;
+    }
+    
+    /* Extract EH_ON configuration */
+    if( (reg_value & ST25DV_EH_CTRL_DYN_EH_ON_MASK) == ST25DV_EH_CTRL_DYN_EH_ON_MASK )
+    {
+      pEH_CTRL->EH_on = ST25DV_ENABLE;
+    }
+    else
+    {
+      pEH_CTRL->EH_on = ST25DV_DISABLE;
+    }
+    
+    /* Extract FIELD_ON configuration */
+    if( (reg_value & ST25DV_EH_CTRL_DYN_FIELD_ON_MASK) == ST25DV_EH_CTRL_DYN_FIELD_ON_MASK )
+    {
+      pEH_CTRL->Field_on = ST25DV_ENABLE;
+    }
+    else
+    {
+      pEH_CTRL->Field_on = ST25DV_DISABLE;
+    }
+    
+    /* Extract VCC_ON configuration */
+    if( (reg_value & ST25DV_EH_CTRL_DYN_VCC_ON_MASK) == ST25DV_EH_CTRL_DYN_VCC_ON_MASK )
+    {
+      pEH_CTRL->VCC_on = ST25DV_ENABLE;
+    }
+    else
+    {
+      pEH_CTRL->VCC_on = ST25DV_DISABLE;
+    }
+    
+    return NFCTAG_OK;
+  }
+  
+  return status;
+}
+
+/**
+  * @brief  Reads the Energy Harvesting dynamic status.
+  * @param  pEH_Val Pointer on a ST25DV_EN_STATUS value used to return the Energy Harvesting dynamic status.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_GetEHENMode_Dyn( ST25DV_EN_STATUS * const pEH_Val, I2C * mi2cChannel )
+{
+  uint8_t reg_value;
+  NFCTAG_StatusTypeDef status;
+  
+  /* Read actual value of EH_CTRL_DYN register */
+  status = ST25DV_i2c_ReadMailboxRegister( &reg_value, ST25DV_EH_CTRL_DYN_REG, 1,  mi2cChannel );
+  if( status != NFCTAG_OK )
+  {
+    return status;
+  }
+  
+  /* Extract Energy Harvesting status information */
+  if( (reg_value & ST25DV_EH_CTRL_DYN_EH_EN_MASK) == ST25DV_EH_CTRL_DYN_EH_EN_MASK )
+  {
+    *pEH_Val = ST25DV_ENABLE;
+  }
+  else
+  {
+    *pEH_Val = ST25DV_DISABLE;
+  }
+  
+  return NFCTAG_OK;
+}
+
+/**
+  * @brief  Dynamically sets the Energy Harvesting mode.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_SetEHENMode_Dyn(  I2C * mi2cChannel )
+{
+  uint8_t reg_value;
+  NFCTAG_StatusTypeDef status;
+  
+  /* Read actual value of EH_CTRL_DYN register */
+  status = ST25DV_i2c_ReadMailboxRegister( &reg_value, ST25DV_EH_CTRL_DYN_REG, 1, mi2cChannel );
+  if( status != NFCTAG_OK )
+  {
+    return status;
+  }
+  
+  /* Update Energy Harvesting configuration */
+  reg_value |= ST25DV_EH_CTRL_DYN_EH_EN_MASK;
+  
+  /* Write EH_CTRL_DYN Register */
+  return ST25DV_i2c_WriteMailboxRegister( &reg_value, ST25DV_EH_CTRL_DYN_REG, 1, mi2cChannel );
+}
+
+/**
+  * @brief  Dynamically unsets the Energy Harvesting mode.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ResetEHENMode_Dyn( I2C * mi2cChannel )
+{
+  uint8_t reg_value;
+  NFCTAG_StatusTypeDef status;
+  
+  /* Read actual value of EH_CTRL_DYN register */
+  status = ST25DV_i2c_ReadMailboxRegister( &reg_value, ST25DV_EH_CTRL_DYN_REG, 1, mi2cChannel );
+  if( status != NFCTAG_OK )
+  {
+    return status;
+  }
+  
+  /* Update Energy Harvesting configuration */
+  reg_value &= ST25DV_EH_CTRL_DYN_EH_EN_FIELD;
+  
+  /* Write EH_CTRL_DYN Register */
+  return ST25DV_i2c_WriteMailboxRegister( &reg_value, ST25DV_EH_CTRL_DYN_REG, 1, mi2cChannel );
+}
+
+/**
+  * @brief  Reads the EH_ON status from the EH_CTRL_DYN register.
+  * @param  pEHON Pointer on a ST25DV_EN_STATUS value used to return the EHON status.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_GetEHON_Dyn( ST25DV_EN_STATUS * const pEHON, I2C * mi2cChannel )
+{
+  NFCTAG_StatusTypeDef status;
+  uint8_t reg_value = 0;
+  
+  /* Read actual value of EH_CTRL_DYN register */
+  status = ST25DV_i2c_ReadMailboxRegister( &reg_value, ST25DV_EH_CTRL_DYN_REG, 1, mi2cChannel );
+  
+  /* Extract RF Field information */
+  if( status == NFCTAG_OK )
+  {
+    if( (reg_value & ST25DV_EH_CTRL_DYN_EH_ON_MASK) == ST25DV_EH_CTRL_DYN_EH_ON_MASK )
+    {
+      *pEHON = ST25DV_ENABLE;
+    }
+    else
+    {
+      *pEHON = ST25DV_DISABLE;
+    }
+    return NFCTAG_OK;
+  }
+  
+  return status;
+}
+
+/**
+  * @brief  Checks if RF Field is present in front of the ST25DV.
+  * @param  pRF_Field Pointer on a ST25DV_FIELD_STATUS value used to return the field presence.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_GetRFField_Dyn( ST25DV_FIELD_STATUS * const pRF_Field, I2C * mi2cChannel )
+{
+  NFCTAG_StatusTypeDef status;
+  uint8_t reg_value = 0;
+  
+  /* Read actual value of EH_CTRL_DYN register */
+  status = ST25DV_i2c_ReadMailboxRegister( &reg_value, ST25DV_EH_CTRL_DYN_REG, 1, mi2cChannel );
+  
+  /* Extract RF Field information */
+  if( status == NFCTAG_OK )
+  {
+    if( (reg_value & ST25DV_EH_CTRL_DYN_FIELD_ON_MASK) == ST25DV_EH_CTRL_DYN_FIELD_ON_MASK )
+    {
+      *pRF_Field = ST25DV_FIELD_ON;
+    }
+    else
+    {
+      *pRF_Field = ST25DV_FIELD_OFF;
+    }
+    return NFCTAG_OK;
+  }
+  
+  return status;
+}
+
+/**
+  * @brief  Check if VCC is supplying the ST25DV.
+  * @param  pVCC ST25DV_VCC_STATUS pointer of the VCC status to store
+  * @param  mi2cChannel I2C channel
+  * @retval NFCTAG enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_GetVCC_Dyn( ST25DV_VCC_STATUS * const pVCC, I2C * mi2cChannel )
+{
+  NFCTAG_StatusTypeDef status;
+  uint8_t reg_value = 0;
+  
+  /* Read actual value of EH_CTRL_DYN register */
+  status = ST25DV_i2c_ReadMailboxRegister( &reg_value, ST25DV_EH_CTRL_DYN_REG, 1, mi2cChannel );
+  
+  /* Extract VCC information */
+  if( status == NFCTAG_OK )
+  {
+    if( (reg_value & ST25DV_EH_CTRL_DYN_VCC_ON_MASK) == ST25DV_EH_CTRL_DYN_VCC_ON_MASK )
+    {
+      *pVCC = ST25DV_VCC_ON;
+    }
+    else
+    {
+      *pVCC = ST25DV_VCC_OFF;
+    }
+    return NFCTAG_OK;
+  }
+  
+  return status;
+}
+
+/**
+  * @brief  Read value of dynamic RF Management configuration
+  * @param  pRF_Mngt : ST25DV_RF_MNGT pointer of the dynamic RF Management configuration to store
+  * @param  mi2cChannel I2C channel
+  * @retval NFCTAG enum status
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadRFMngt_Dyn( ST25DV_RF_MNGT * const pRF_Mngt, I2C * mi2cChannel )
+{
+  NFCTAG_StatusTypeDef status;
+  uint8_t reg_value = 0;
+  
+  /* Read actual value of RF_MNGT_DYN register */
+  status = ST25DV_i2c_ReadMailboxRegister( &reg_value, ST25DV_RF_MNGT_DYN_REG, 1, mi2cChannel );
+  
+  if( status == NFCTAG_OK )
+  {
+    /* Extract RF Disable configuration */
+    if( (reg_value & ST25DV_RF_MNGT_DYN_RFDIS_MASK) == ST25DV_RF_MNGT_DYN_RFDIS_MASK )
+    {
+      pRF_Mngt->RfDisable = ST25DV_ENABLE;
+    }
+    else
+    {
+      pRF_Mngt->RfDisable = ST25DV_DISABLE;
+    }
+    
+    /* Extract RF Sleep configuration */
+    if( (reg_value & ST25DV_RF_MNGT_DYN_RFSLEEP_MASK) == ST25DV_RF_MNGT_DYN_RFSLEEP_MASK )
+    {
+      pRF_Mngt->RfSleep = ST25DV_ENABLE;
+    }
+    else
+    {
+      pRF_Mngt->RfSleep = ST25DV_DISABLE;
+    }
+    
+    return NFCTAG_OK;
+  }
+  
+  return status;
+}
+
+/**
+  * @brief  Writes a value to the RF Management dynamic register.
+  * @param  RF_Mngt Value to be written to the RF Management dynamic register.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_WriteRFMngt_Dyn( const uint8_t RF_Mngt, I2C * mi2cChannel )
+{
+  /* Write value to RF_MNGT_DYN register */
+  return ST25DV_i2c_WriteMailboxRegister( &RF_Mngt, ST25DV_RF_MNGT_DYN_REG, 1,  mi2cChannel );
+}
+
+/**
+  * @brief  Reads the RFDisable dynamic register information.
+  * @param  pRFDisable Pointer on a ST25DV_EN_STATUS value used to return the RF Disable state.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_GetRFDisable_Dyn( ST25DV_EN_STATUS * const pRFDisable, I2C * mi2cChannel )
+{
+  NFCTAG_StatusTypeDef status;
+  uint8_t reg_value = 0;
+  
+  /* Read actual value of RF_MNGT_DYN register */
+  status = ST25DV_i2c_ReadMailboxRegister( &reg_value, ST25DV_RF_MNGT_DYN_REG, 1, mi2cChannel );
+  
+  /* Extract RFDisable information */
+  if( status == NFCTAG_OK )
+  {
+    if( (reg_value & ST25DV_RF_MNGT_DYN_RFDIS_MASK) == ST25DV_RF_MNGT_DYN_RFDIS_MASK )
+    {
+      *pRFDisable = ST25DV_ENABLE;
+    }
+    else
+    {
+      *pRFDisable = ST25DV_DISABLE;
+    }
+    return NFCTAG_OK;
+  }
+  
+  return status;
+}
+
+/**
+  * @brief  Sets the RF Disable dynamic configuration.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_SetRFDisable_Dyn( I2C * mi2cChannel )
+{
+  NFCTAG_StatusTypeDef status;
+  uint8_t reg_value = 0;
+  
+  /* Read actual value of RF_MNGT_DYN register */
+  status = ST25DV_i2c_ReadMailboxRegister( &reg_value, ST25DV_RF_MNGT_DYN_REG, 1, mi2cChannel );
+  if( status != NFCTAG_OK )
+  {
+    return status;
+  }
+  
+  /* Update dynamic RF Disable field */
+  reg_value |= ST25DV_RF_MNGT_DYN_RFDIS_MASK;
+  
+  /* Write RF_MNGT_DYN register */
+  return ST25DV_i2c_WriteMailboxRegister( &reg_value, ST25DV_RF_MNGT_DYN_REG, 1,  mi2cChannel );
+}
+
+/**
+  * @brief  Unsets the RF Disable dynamic configuration.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ResetRFDisable_Dyn( I2C * mi2cChannel )
+{
+  NFCTAG_StatusTypeDef status;
+  uint8_t reg_value = 0;
+  
+  /* Read actual value of RF_MNGT_DYN register */
+  status = ST25DV_i2c_ReadMailboxRegister( &reg_value, ST25DV_RF_MNGT_DYN_REG, 1, mi2cChannel );
+  if( status != NFCTAG_OK )
+  {
+    return status;
+  }
+  
+  /* Update dynamic RF Disable field configuration */
+  reg_value &= ST25DV_RF_MNGT_DYN_RFDIS_FIELD;
+  
+  /* Write RF_MNGT_DYN register */
+  return ST25DV_i2c_WriteMailboxRegister( &reg_value, ST25DV_RF_MNGT_DYN_REG, 1, mi2cChannel );
+}
+
+/**
+  * @brief  Reads the RFSleep dynamic register information.
+  * @param  pRFSleep Pointer on a ST25DV_EN_STATUS values used to return the RF Sleep state.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_GetRFSleep_Dyn( ST25DV_EN_STATUS * const pRFSleep, I2C * mi2cChannel )
+{
+  NFCTAG_StatusTypeDef status;
+  uint8_t reg_value = 0;
+  
+  /* Read actual value of RF_MNGT_DYN register */
+  status = ST25DV_i2c_ReadMailboxRegister( &reg_value, ST25DV_RF_MNGT_DYN_REG, 1,  mi2cChannel );
+  
+  /* Extract RFSleep information */
+  if( status == NFCTAG_OK )
+  {
+    if( (reg_value & ST25DV_RF_MNGT_DYN_RFDIS_MASK) == ST25DV_RF_MNGT_DYN_RFDIS_MASK )
+    {
+      *pRFSleep = ST25DV_ENABLE;
+    }
+    else
+    {
+      *pRFSleep = ST25DV_DISABLE;
+    }
+    return NFCTAG_OK;
+  }
+  
+  return status;
+}
+
+/**
+  * @brief  Sets the RF Sleep dynamic configuration.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_SetRFSleep_Dyn( I2C * mi2cChannel )
+{
+  NFCTAG_StatusTypeDef status;
+  uint8_t reg_value = 0;
+  
+  /* Read actual value of RF_MNGT_DYN register */
+  status = ST25DV_i2c_ReadMailboxRegister( &reg_value, ST25DV_RF_MNGT_DYN_REG, 1, mi2cChannel );
+  if( status != NFCTAG_OK )
+  {
+    return status;
+  }
+  
+  /* Update dynamic RF Disable field configuration */
+  reg_value |= ST25DV_RF_MNGT_DYN_RFSLEEP_MASK;
+  
+  /* Write RF_MNGT_DYN register */
+  return ST25DV_i2c_WriteMailboxRegister( &reg_value, ST25DV_RF_MNGT_DYN_REG, 1, mi2cChannel );
+}
+
+/**
+  * @brief  Unsets the RF Sleep dynamic configuration.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ResetRFSleep_Dyn( I2C * mi2cChannel )
+{
+  NFCTAG_StatusTypeDef status;
+  uint8_t reg_value = 0;
+  
+  /* Read actual value of RF_MNGT_DYN register */
+  status = ST25DV_i2c_ReadMailboxRegister( &reg_value, ST25DV_RF_MNGT_DYN_REG, 1, mi2cChannel );
+  if( status != NFCTAG_OK )
+  {
+    return status;
+  }
+  
+  /* Update dynamic RF Disable field configuration */
+  reg_value &= ST25DV_RF_MNGT_DYN_RFSLEEP_FIELD;
+  
+  /* Write RF_MNGT_DYN register */
+  return ST25DV_i2c_WriteMailboxRegister( &reg_value, ST25DV_RF_MNGT_DYN_REG, 1, mi2cChannel );
+}
+
+/**
+  * @brief  Reads the Mailbox ctrl dynamic register.
+  * @param  pCtrlStatus Pointer on a ST25DV_MB_CTRL_DYN_STATUS structure used to return the dynamic Mailbox ctrl information.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadMBCtrl_Dyn( ST25DV_MB_CTRL_DYN_STATUS * const pCtrlStatus, I2C * mi2cChannel )
+{
+  uint8_t reg_value;
+  NFCTAG_StatusTypeDef status;
+  
+  /* Read MB_CTRL_DYN register */
+  status = ST25DV_i2c_ReadMailboxRegister( &reg_value, ST25DV_MB_CTRL_DYN_REG, 1, mi2cChannel );
+  if( status != NFCTAG_OK )
+  {
+    return status;
+  }
+  
+  /* Extract Mailbox ctrl information */
+  pCtrlStatus->MbEnable = (reg_value & ST25DV_MB_CTRL_DYN_MBEN_MASK) >> ST25DV_MB_CTRL_DYN_MBEN_SHIFT;
+  pCtrlStatus->HostPutMsg = (reg_value & ST25DV_MB_CTRL_DYN_HOSTPUTMSG_MASK) >> ST25DV_MB_CTRL_DYN_HOSTPUTMSG_SHIFT;
+  pCtrlStatus->RfPutMsg = (reg_value & ST25DV_MB_CTRL_DYN_RFPUTMSG_MASK) >> ST25DV_MB_CTRL_DYN_RFPUTMSG_SHIFT;
+  pCtrlStatus->HostMissMsg = (reg_value & ST25DV_MB_CTRL_DYN_HOSTMISSMSG_MASK) >> ST25DV_MB_CTRL_DYN_HOSTMISSMSG_SHIFT;
+  pCtrlStatus->RFMissMsg = (reg_value & ST25DV_MB_CTRL_DYN_RFMISSMSG_MASK) >> ST25DV_MB_CTRL_DYN_RFMISSMSG_SHIFT;
+  pCtrlStatus->CurrentMsg = (ST25DV_CURRENT_MSG)((reg_value & ST25DV_MB_CTRL_DYN_CURRENTMSG_MASK) >> ST25DV_MB_CTRL_DYN_CURRENTMSG_SHIFT);
+  
+  return NFCTAG_OK;
+}
+
+/**
+  * @brief  Reads the Mailbox Enable dynamic configuration.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_GetMBEN_Dyn( ST25DV_EN_STATUS * const pMBEN, I2C * mi2cChannel )
+{
+  uint8_t reg_value;
+  NFCTAG_StatusTypeDef status;
+  
+  /* Read MB_CTRL_DYN register */
+  status = ST25DV_i2c_ReadMailboxRegister( &reg_value, ST25DV_MB_CTRL_DYN_REG, 1, mi2cChannel );
+  if( status != NFCTAG_OK )
+  {
+    return status;
+  }
+  
+  if( (reg_value & ST25DV_MB_MODE_RW_MASK ) == ST25DV_MB_MODE_RW_MASK )
+  {
+    *pMBEN = ST25DV_ENABLE;
+  }
+  else
+  {
+    *pMBEN = ST25DV_DISABLE;
+  }
+  
+  return NFCTAG_OK;
+}
+
+/**
+  * @brief  Sets the Mailbox Enable dynamic configuration.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_SetMBEN_Dyn( I2C * mi2cChannel )
+{
+  uint8_t reg_value;
+  
+  /* Set dynamic Mailbox enable */
+  reg_value = ST25DV_MB_CTRL_DYN_MBEN_MASK;
+  
+  /* Write MB_CTRL_DYN register */
+  return ST25DV_i2c_WriteMailboxRegister( &reg_value, ST25DV_MB_CTRL_DYN_REG, 1, mi2cChannel );
+}
+
+/**
+  * @brief  Unsets the Mailbox Enable dynamic configuration.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ResetMBEN_Dyn( I2C * mi2cChannel )
+{
+  uint8_t reg_value;
+
+  
+  /* Set dynamic Mailbox disable */
+  reg_value = 0;
+  
+  /* Write MB_CTRL_DYN register */
+  ST25DV_i2c_ReadMailboxRegister( &reg_value, ST25DV_MB_CTRL_DYN_REG, 1, mi2cChannel );
+  return ST25DV_i2c_WriteMailboxRegister( &reg_value, ST25DV_MB_CTRL_DYN_REG, 1, mi2cChannel );
+
+}
+
+/**
+  * @brief  Reads the Mailbox message length dynamic register.
+  * @param  pMBLength Pointer on a uint8_t used to return the Mailbox message length.
+  * @param  mi2cChannel I2C channel
+  * @return NFCTAG_StatusTypeDef enum status.
+  */
+NFCTAG_StatusTypeDef ST25DV_i2c_ReadMBLength_Dyn( uint8_t * const pMBLength, I2C * mi2cChannel )
+{
+  /* Read actual value of MBLEN_DYN register */
+  return ST25DV_i2c_ReadMailboxRegister( pMBLength, ST25DV_MBLEN_DYN_REG, 1, mi2cChannel );
+}
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
+/******************* (C) COPYRIGHT 2016 STMicroelectronics *****END OF FILE****/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ST25DV/st25dv.h	Tue Jan 28 15:54:19 2020 +0000
@@ -0,0 +1,716 @@
+/**
+  ******************************************************************************
+  * @file    st25dv.h
+  * @author  MMY Application Team
+  * @version $Revision: 3308 $
+  * @date    $Date: 2017-01-13 11:19:33 +0100 (Fri, 13 Jan 2017) $
+  * @brief   This file provides set of driver functions to manage communication 
+  * @brief   between MCU and ST25DV chip 
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2>
+  *
+  * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License");
+  * You may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at:
+  *
+  *        http://www.st.com/myliberty  
+  *
+  * Unless required by applicable law or agreed to in writing, software 
+  * distributed under the License is distributed on an "AS IS" BASIS, 
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
+  * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+  * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  *
+  ******************************************************************************
+  */ 
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __ST25DV_H
+#define __ST25DV_H
+
+
+/* Includes ------------------------------------------------------------------*/
+#include <stdint.h>
+#include <stddef.h>
+#include "mbed.h"
+
+
+
+/** @addtogroup BSP
+  * @{
+  */ 
+ 
+
+/** @addtogroup ST25DV
+  * @{
+  */
+
+/* Exported types ------------------------------------------------------------*/
+/**
+ * @brief  NFCTAG status enumerator definition.
+ */
+typedef enum
+{
+  NFCTAG_OK      = 0,
+  NFCTAG_ERROR   = 1,
+  NFCTAG_BUSY    = 2,
+  NFCTAG_TIMEOUT = 3,
+  NFCTAG_NACK    = 4
+} NFCTAG_StatusTypeDef;
+
+/**
+ * @brief  ST25DV Enable Disable enumerator definition.
+ */
+typedef enum
+{
+  ST25DV_DISABLE = 0,
+  ST25DV_ENABLE
+} ST25DV_EN_STATUS;
+
+/**
+ * @brief  ST25DV Energy Harvesting mode enumerator definition.
+ */
+typedef enum
+{
+  ST25DV_EH_ACTIVE_AFTER_BOOT = 0,
+  ST25DV_EH_ON_DEMAND
+} ST25DV_EH_MODE_STATUS;
+
+/**
+ * @brief  ST25DV FIELD status enumerator definition.
+ */
+typedef enum
+{
+  ST25DV_FIELD_OFF = 0,
+  ST25DV_FIELD_ON
+} ST25DV_FIELD_STATUS;
+
+/**
+ * @brief  ST25DV VCC status enumerator definition
+ */
+typedef enum
+{
+  ST25DV_VCC_OFF = 0,
+  ST25DV_VCC_ON
+} ST25DV_VCC_STATUS;
+
+/**
+ * @brief  ST25DV protection status enumerator definition
+ */
+typedef enum
+{
+  ST25DV_NO_PROT = 0,
+  ST25DV_WRITE_PROT,
+  ST25DV_READ_PROT,
+  ST25DV_READWRITE_PROT
+} ST25DV_PROTECTION_CONF;
+
+/**
+ * @brief  ST25DV area protection enumerator definition.
+ */
+typedef enum
+{
+  ST25DV_PROT_ZONE1 = 0,
+  ST25DV_PROT_ZONE2,
+  ST25DV_PROT_ZONE3,
+  ST25DV_PROT_ZONE4
+} ST25DV_PROTECTION_ZONE;
+
+/**
+ * @brief  ST25DV password protection status enumerator definition.
+ */
+typedef enum
+{
+  ST25DV_NOT_PROTECTED = 0,
+  ST25DV_PROT_PASSWD1,
+  ST25DV_PROT_PASSWD2,
+  ST25DV_PROT_PASSWD3
+} ST25DV_PASSWD_PROT_STATUS;
+
+/**
+ * @brief  ST25DV lock status enumerator definition.
+ */
+typedef enum
+{
+  ST25DV_UNLOCKED = 0,
+  ST25DV_LOCKED
+} ST25DV_LOCK_STATUS;
+
+/**
+ * @brief  ST25DV Number of Blocks for the CCFile enumerator definition.
+ */
+typedef enum
+{
+  ST25DV_CCFILE_1BLCK = 0,
+  ST25DV_CCFILE_2BLCK
+} ST25DV_CCFILE_BLOCK;
+
+/**
+ * @brief  ST25DV session status enumerator definition.
+ */
+typedef enum
+{
+  ST25DV_SESSION_CLOSED = 0,
+  ST25DV_SESSION_OPEN
+} ST25DV_I2CSSO_STATUS;
+
+/**
+ * @brief  ST25DV area end address enumerator definition.
+ */
+typedef enum
+{
+  ST25DV_ZONE_END1 = 0,
+  ST25DV_ZONE_END2,
+  ST25DV_ZONE_END3
+} ST25DV_END_ZONE;
+
+/**
+ * @brief  ST25DV IT pulse duration enumerator definition.
+ */
+typedef enum
+{
+  ST25DV_302_US = 0,
+  ST25DV_264_US,
+  ST25DV_226_US,
+  ST25DV_188_US,
+  ST25DV_151_US,
+  ST25DV_113_US,
+  ST25DV_75_US,
+  ST25DV_37_US  
+} ST25DV_PULSE_DURATION;
+
+/**
+ * @brief  ST25DV Mailbox Current Message enumerator definition
+ */
+typedef enum
+{
+  ST25DV_NO_MSG = 0,
+  ST25DV_HOST_MSG,
+  ST25DV_RF_MSG  
+} ST25DV_CURRENT_MSG;
+
+/**
+ * @brief  ST25DV EH Ctrl structure definition
+ */
+typedef struct
+{
+  ST25DV_EN_STATUS EH_EN_Mode;
+  ST25DV_EN_STATUS EH_on;
+  ST25DV_EN_STATUS Field_on;
+  ST25DV_EN_STATUS VCC_on;
+} ST25DV_EH_CTRL;
+
+/**
+ * @brief  ST25DV GPO structure definition
+ */
+typedef struct
+{
+  ST25DV_EN_STATUS GPO_RFUser_en;
+  ST25DV_EN_STATUS GPO_RFActivity_en;
+  ST25DV_EN_STATUS GPO_RFInterrupt_en;
+  ST25DV_EN_STATUS GPO_FieldChange_en;
+  ST25DV_EN_STATUS GPO_RFPutMsg_en;
+  ST25DV_EN_STATUS GPO_RFGetMsg_en;
+  ST25DV_EN_STATUS GPO_RFWrite_en;
+  ST25DV_EN_STATUS GPO_Enable;
+} ST25DV_GPO;
+
+/**
+ * @brief  ST25DV RF Management structure definition.
+ */
+typedef struct
+{
+  ST25DV_EN_STATUS RfDisable;
+  ST25DV_EN_STATUS RfSleep;
+} ST25DV_RF_MNGT;
+
+/**
+ * @brief  ST25DV RF Area protection structure definition.
+ */
+typedef struct
+{
+  ST25DV_PASSWD_PROT_STATUS PasswdCtrl;
+  ST25DV_PROTECTION_CONF RWprotection;
+} ST25DV_RF_PROT_ZONE;
+
+/**
+ * @brief  ST25DV I2C Area protection structure definition.
+ */
+typedef struct
+{
+  ST25DV_PROTECTION_CONF ProtectZone1;
+  ST25DV_PROTECTION_CONF ProtectZone2;
+  ST25DV_PROTECTION_CONF ProtectZone3;
+  ST25DV_PROTECTION_CONF ProtectZone4;
+} ST25DV_I2C_PROT_ZONE;
+
+/**
+ * @brief  ST25DV MB_CTRL_DYN register structure definition.
+ */
+typedef struct
+{
+  uint8_t MbEnable;
+  uint8_t HostPutMsg;
+  uint8_t RfPutMsg;
+  uint8_t HostMissMsg;
+  uint8_t RFMissMsg;
+  ST25DV_CURRENT_MSG CurrentMsg;
+} ST25DV_MB_CTRL_DYN_STATUS;
+
+/**
+ * @brief  ST25DV Lock CCFile structure definition.
+ */
+typedef struct
+{
+  ST25DV_LOCK_STATUS LckBck0;
+  ST25DV_LOCK_STATUS LckBck1;
+} ST25DV_LOCK_CCFILE;
+
+/**
+ * @brief  ST25DV Memory size structure definition.
+ */
+typedef struct
+{
+  uint8_t BlockSize;
+  uint16_t Mem_Size;
+} ST25DV_MEM_SIZE;
+
+/**
+ * @brief  ST25DV UID information structure definition.
+ */
+typedef struct
+{
+  uint32_t MsbUid;
+  uint32_t LsbUid;
+} ST25DV_UID;
+
+/**
+ * @brief  ST25DV Password structure definition.
+ */
+typedef struct
+{
+  uint32_t MsbPasswd;
+  uint32_t LsbPasswd;
+} ST25DV_PASSWD;
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+/**
+ * @brief  NFCTAG standard driver API structure definition.
+ */
+typedef struct
+{
+  NFCTAG_StatusTypeDef       (*Init)( I2C * , DigitalOut*   );
+  NFCTAG_StatusTypeDef       (*ReadID)( uint8_t * const , I2C *  );
+  NFCTAG_StatusTypeDef       (*IsReady)( const uint32_t , I2C *);
+  NFCTAG_StatusTypeDef       (*GetITStatus)( uint16_t * const , I2C *  );
+  NFCTAG_StatusTypeDef       (*ConfigIT)( const uint16_t, I2C * );
+  NFCTAG_StatusTypeDef       (*ReadData)( uint8_t * const, const uint16_t, const uint16_t, I2C* );
+  NFCTAG_StatusTypeDef       (*WriteData)( const uint8_t * const, const uint16_t, const uint16_t, I2C* );
+  NFCTAG_StatusTypeDef       (*ReadRegister)( uint8_t * const, const uint16_t, const uint16_t, I2C*  );
+  NFCTAG_StatusTypeDef       (*WriteRegister)( const uint8_t * const, const uint16_t, const uint16_t, I2C*  );
+  void                       *pData;
+} NFCTAG_DrvTypeDef;
+
+/**
+ * @brief  NFCTAG extended driver API structure definition.
+ */
+typedef struct
+{
+  NFCTAG_StatusTypeDef (*ReadICRev)( uint8_t * const, I2C * );
+  NFCTAG_StatusTypeDef (*WriteITPulse)( const ST25DV_PULSE_DURATION, I2C * );
+  NFCTAG_StatusTypeDef (*ReadITPulse)( ST25DV_PULSE_DURATION * const, I2C * );
+  NFCTAG_StatusTypeDef (*ReadDataCurrentAddr)( uint8_t * const, const uint16_t, I2C * );
+  NFCTAG_StatusTypeDef (*ReadUID)( ST25DV_UID * const, I2C * );
+  NFCTAG_StatusTypeDef (*ReadDSFID)( uint8_t * const, I2C * );
+  NFCTAG_StatusTypeDef (*ReadDsfidRFProtection)( ST25DV_LOCK_STATUS * const, I2C * );
+  NFCTAG_StatusTypeDef (*ReadAFI)( uint8_t * const, I2C * );
+  NFCTAG_StatusTypeDef (*ReadAfiRFProtection)( ST25DV_LOCK_STATUS * const, I2C * );
+  NFCTAG_StatusTypeDef (*ReadI2CProtectZone)( ST25DV_I2C_PROT_ZONE * const, I2C * );
+  NFCTAG_StatusTypeDef (*WriteI2CProtectZonex)( const ST25DV_PROTECTION_ZONE, const ST25DV_PROTECTION_CONF, I2C * );
+  NFCTAG_StatusTypeDef (*ReadLockCCFile)( ST25DV_LOCK_CCFILE * const, I2C * );
+  NFCTAG_StatusTypeDef (*WriteLockCCFile)( const ST25DV_CCFILE_BLOCK, const ST25DV_LOCK_STATUS, I2C * );
+  NFCTAG_StatusTypeDef (*ReadLockCFG)( ST25DV_LOCK_STATUS * const, I2C * );
+  NFCTAG_StatusTypeDef (*WriteLockCFG)( const ST25DV_LOCK_STATUS, I2C * );
+  NFCTAG_StatusTypeDef (*PresentI2CPassword)( const ST25DV_PASSWD, I2C * );
+  NFCTAG_StatusTypeDef (*WriteI2CPassword)( const ST25DV_PASSWD, I2C * );
+  NFCTAG_StatusTypeDef (*ReadRFZxSS)( const ST25DV_PROTECTION_ZONE, ST25DV_RF_PROT_ZONE * const, I2C * );
+  NFCTAG_StatusTypeDef (*WriteRFZxSS)( const ST25DV_PROTECTION_ZONE, const ST25DV_RF_PROT_ZONE, I2C * );
+  NFCTAG_StatusTypeDef (*ReadEndZonex)( const ST25DV_END_ZONE, uint8_t * const, I2C * );
+  NFCTAG_StatusTypeDef (*WriteEndZonex)( const ST25DV_END_ZONE, const uint8_t, I2C * );
+  NFCTAG_StatusTypeDef (*InitEndZone)( I2C * );
+  NFCTAG_StatusTypeDef (*CreateUserZone)( uint16_t, uint16_t, uint16_t, uint16_t, I2C * );
+  NFCTAG_StatusTypeDef (*ReadMemSize)( ST25DV_MEM_SIZE * const, I2C * );
+  NFCTAG_StatusTypeDef (*ReadEHMode)( ST25DV_EH_MODE_STATUS * const, I2C * );
+  NFCTAG_StatusTypeDef (*WriteEHMode)( const ST25DV_EH_MODE_STATUS, I2C * );
+  NFCTAG_StatusTypeDef (*ReadRFMngt)( ST25DV_RF_MNGT * const, I2C * );
+  NFCTAG_StatusTypeDef (*WriteRFMngt)( const uint8_t, I2C * );
+  NFCTAG_StatusTypeDef (*GetRFDisable)( ST25DV_EN_STATUS * const, I2C * );
+  NFCTAG_StatusTypeDef (*SetRFDisable)( I2C * );
+  NFCTAG_StatusTypeDef (*ResetRFDisable)( I2C * );
+  NFCTAG_StatusTypeDef (*GetRFSleep)( ST25DV_EN_STATUS * const, I2C * );
+  NFCTAG_StatusTypeDef (*SetRFSleep)( I2C *  );
+  NFCTAG_StatusTypeDef (*ResetRFSleep)( I2C * );
+  NFCTAG_StatusTypeDef (*ReadMBMode)( ST25DV_EN_STATUS * const, I2C * );
+  NFCTAG_StatusTypeDef (*WriteMBMode)( const ST25DV_EN_STATUS, I2C * );
+  NFCTAG_StatusTypeDef (*ReadMBWDG)( uint8_t * const, I2C * );
+  NFCTAG_StatusTypeDef (*WriteMBWDG)( const uint8_t, I2C * );
+  NFCTAG_StatusTypeDef (*ReadMailboxData)( uint8_t * const, const uint16_t, const uint16_t, I2C * );
+  NFCTAG_StatusTypeDef (*WriteMailboxData)( const uint8_t * const, const uint16_t, I2C * );
+  NFCTAG_StatusTypeDef (*ReadMailboxRegister)( uint8_t * const, const uint16_t, const uint16_t, I2C * );
+  NFCTAG_StatusTypeDef (*WriteMailboxRegister)( const uint8_t * const, const uint16_t, const uint16_t, I2C * );
+  NFCTAG_StatusTypeDef (*ReadI2CSecuritySession_Dyn)( ST25DV_I2CSSO_STATUS * const, I2C * );
+  NFCTAG_StatusTypeDef (*ReadITSTStatus_Dyn)( uint8_t * const, I2C * );
+  NFCTAG_StatusTypeDef (*ReadGPO_Dyn)( uint8_t *, I2C * );
+  NFCTAG_StatusTypeDef (*GetGPO_en_Dyn)( ST25DV_EN_STATUS * const, I2C * );
+  NFCTAG_StatusTypeDef (*SetGPO_en_Dyn)( I2C * );
+  NFCTAG_StatusTypeDef (*ResetGPO_en_Dyn)( I2C * );
+  NFCTAG_StatusTypeDef (*ReadEHCtrl_Dyn)( ST25DV_EH_CTRL * const, I2C * );
+  NFCTAG_StatusTypeDef (*GetEHENMode_Dyn)( ST25DV_EN_STATUS * const, I2C * );
+  NFCTAG_StatusTypeDef (*SetEHENMode_Dyn)( I2C *);
+  NFCTAG_StatusTypeDef (*ResetEHENMode_Dyn)( I2C * );
+  NFCTAG_StatusTypeDef (*GetEHON_Dyn)( ST25DV_EN_STATUS * const, I2C * );
+  NFCTAG_StatusTypeDef (*GetRFField_Dyn)( ST25DV_FIELD_STATUS * const, I2C * );
+  NFCTAG_StatusTypeDef (*GetVCC_Dyn)( ST25DV_VCC_STATUS * const, I2C * );
+  NFCTAG_StatusTypeDef (*ReadRFMngt_Dyn)( ST25DV_RF_MNGT * const, I2C * );
+  NFCTAG_StatusTypeDef (*WriteRFMngt_Dyn)( const uint8_t, I2C * );
+  NFCTAG_StatusTypeDef (*GetRFDisable_Dyn)( ST25DV_EN_STATUS * const, I2C * );
+  NFCTAG_StatusTypeDef (*SetRFDisable_Dyn)( I2C * );
+  NFCTAG_StatusTypeDef (*ResetRFDisable_Dyn)(  I2C * );
+  NFCTAG_StatusTypeDef (*GetRFSleep_Dyn)( ST25DV_EN_STATUS * const , I2C *);
+  NFCTAG_StatusTypeDef (*SetRFSleep_Dyn)(  I2C * );
+  NFCTAG_StatusTypeDef (*ResetRFSleep_Dyn)(   I2C * );
+  NFCTAG_StatusTypeDef (*ReadMBctrl_Dyn)( ST25DV_MB_CTRL_DYN_STATUS * const, I2C * );
+  NFCTAG_StatusTypeDef (*GetMBEN_Dyn)( ST25DV_EN_STATUS * const, I2C * );
+  NFCTAG_StatusTypeDef (*SetMBEN_Dyn)( I2C * );
+  NFCTAG_StatusTypeDef (*ResetMBEN_Dyn)( I2C * );
+  NFCTAG_StatusTypeDef (*ReadMBLength_Dyn)( uint8_t * const, I2C * );
+} NFCTAG_ExtDrvTypeDef;
+#endif
+
+/* Exported constants --------------------------------------------------------*/
+/** @brief ST25DV 4Kbits */
+#define I_AM_ST25DV04                        0x24
+/** @brief ST25DV 64Kbits */
+#define I_AM_ST25DV64                        0x26
+
+/*#ifndef NULL
+#define NULL      (void *) 0
+#endif
+*/
+/** @brief I2C address to be used for ST25DV Data accesses. */
+#define ST25DV_ADDR_DATA_I2C                 0xA6
+/** @brief I2C address to be used for ST25DV System accesses. */
+#define ST25DV_ADDR_SYST_I2C                 0xAE
+
+/** @brief I2C Time out (ms), min value : (Max write bytes) / (Internal page write) * tw   (256/4)*5. */
+#define ST25DV_I2C_TIMEOUT                   320 
+
+/** @brief Size of the ST25DV write buffer. */
+#define ST25DV_MAX_WRITE_BYTE                256
+/** @brief Size of the ST25DVMailbox memory. */
+#define ST25DV_MAX_MAILBOX_LENGTH            256
+
+/* Registers i2c address */
+/** @brief ST25DV GPO register address. */
+#define ST25DV_GPO_REG                       0x0000
+/** @brief ST25DV IT duration register address. */
+#define ST25DV_ITTIME_REG                    0x0001
+/** @brief ST25DV Energy Harvesting register address. */
+#define ST25DV_EH_MODE_REG                   0x0002
+/** @brief ST25DV RF management register address. */
+#define ST25DV_RF_MNGT_REG                   0x0003
+/** @brief ST25DV Area 1 security register address. */
+#define ST25DV_RFZ1SS_REG                    0x0004
+/** @brief ST25DV Area 1 end address register address. */
+#define ST25DV_END1_REG                      0x0005
+/** @brief ST25DV Area 2 security register address. */
+#define ST25DV_RFZ2SS_REG                    0x0006
+/** @brief ST25DV Area 2 end address register address. */
+#define ST25DV_END2_REG                      0x0007
+/** @brief ST25DV Area 3 security register address. */
+#define ST25DV_RFZ3SS_REG                    0x0008
+/** @brief ST25DV Area 3 end address register address. */
+#define ST25DV_END3_REG                      0x0009
+/** @brief ST25DV Area 4 security register address. */
+#define ST25DV_RFZ4SS_REG                    0x000A
+/** @brief ST25DV I2C security register address. */
+#define ST25DV_I2CZSS_REG                    0x000B
+/** @brief ST25DV Capability Container lock register address. */
+#define ST25DV_LOCKCCFILE_REG                0x000C
+/** @brief ST25DV Mailbox mode register address. */
+#define ST25DV_MB_MODE_REG                   0x000D
+/** @brief ST25DV Mailbox Watchdog register address. */
+#define ST25DV_MB_WDG_REG                    0x000E
+/** @brief ST25DV Configuration lock register address. */
+#define ST25DV_LOCKCFG_REG                   0x000F
+/** @brief ST25DV DSFID lock register address. */
+#define ST25DV_LOCKDSFID_REG                 0x0010
+/** @brief ST25DV AFI lock register address. */
+#define ST25DV_LOCKAFI_REG                   0x0011
+/** @brief ST25DV DSFID register address. */
+#define ST25DV_DSFID_REG                     0x0012
+/** @brief ST25DV AFI register address. */
+#define ST25DV_AFI_REG                       0x0013
+/** @brief ST25DV Memory size register address. */
+#define ST25DV_MEM_SIZE_REG                  0x0014
+/** @brief ST25DV ICref register address. */
+#define ST25DV_ICREF_REG                     0x0017
+/** @brief ST25DV UID register address. */
+#define ST25DV_UID_REG                       0x0018
+/** @brief ST25DV IC revision register address. */
+#define ST25DV_ICREV_REG                     0x0020
+/** @brief ST25DV I2C password register address. */
+#define ST25DV_I2CPASSWD_REG                 0x0900
+
+/* Dynamic Registers i2c address */
+/** @brief ST25DV GPO dynamic register address. */
+#define ST25DV_GPO_DYN_REG                   0x2000
+/** @brief ST25DV Energy Harvesting control dynamic register address. */
+#define ST25DV_EH_CTRL_DYN_REG               0x2002
+/** @brief ST25DV RF management dynamic register address. */
+#define ST25DV_RF_MNGT_DYN_REG               0x2003
+/** @brief ST25DV I2C secure session opened dynamic register address. */
+#define ST25DV_I2C_SSO_DYN_REG               0x2004
+/** @brief ST25DV Interrupt status dynamic register address. */
+#define ST25DV_ITSTS_DYN_REG                 0x2005
+/** @brief ST25DV Mailbox control dynamic register address. */
+#define ST25DV_MB_CTRL_DYN_REG               0x2006
+/** @brief ST25DV Mailbox message length dynamic register address. */
+#define ST25DV_MBLEN_DYN_REG                 0x2007
+/** @brief ST25DV Mailbox buffer address. */
+#define ST25DV_MAILBOX_RAM_REG               0x2008
+
+/* Registers fields definitions */
+/* MB_MODE */
+#define ST25DV_MB_MODE_RW_SHIFT              (0)
+#define ST25DV_MB_MODE_RW_FIELD              0xFE
+#define ST25DV_MB_MODE_RW_MASK               0x01
+
+/* MB_LEN_Dyn */
+#define ST25DV_MBLEN_DYN_MBLEN_SHIFT         (0)
+#define ST25DV_MBLEN_DYN_MBLEN_FIELD         0x00
+#define ST25DV_MBLEN_DYN_MBLEN_MASK          0xFF
+
+/* MB_CTRL_Dyn */
+#define ST25DV_MB_CTRL_DYN_MBEN_SHIFT        (0)
+#define ST25DV_MB_CTRL_DYN_MBEN_FIELD        0xFE
+#define ST25DV_MB_CTRL_DYN_MBEN_MASK         0x01
+#define ST25DV_MB_CTRL_DYN_HOSTPUTMSG_SHIFT  (1)
+#define ST25DV_MB_CTRL_DYN_HOSTPUTMSG_FIELD  0xFD
+#define ST25DV_MB_CTRL_DYN_HOSTPUTMSG_MASK   0x02
+#define ST25DV_MB_CTRL_DYN_RFPUTMSG_SHIFT    (2)
+#define ST25DV_MB_CTRL_DYN_RFPUTMSG_FIELD    0xFB
+#define ST25DV_MB_CTRL_DYN_RFPUTMSG_MASK     0x04
+#define ST25DV_MB_CTRL_DYN_STRESERVED_SHIFT  (3)
+#define ST25DV_MB_CTRL_DYN_STRESERVED_FIELD  0xF7
+#define ST25DV_MB_CTRL_DYN_STRESERVED_MASK   0x08
+#define ST25DV_MB_CTRL_DYN_HOSTMISSMSG_SHIFT (4)
+#define ST25DV_MB_CTRL_DYN_HOSTMISSMSG_FIELD 0xEF
+#define ST25DV_MB_CTRL_DYN_HOSTMISSMSG_MASK  0x10
+#define ST25DV_MB_CTRL_DYN_RFMISSMSG_SHIFT   (5)
+#define ST25DV_MB_CTRL_DYN_RFMISSMSG_FIELD   0xDF
+#define ST25DV_MB_CTRL_DYN_RFMISSMSG_MASK    0x20
+#define ST25DV_MB_CTRL_DYN_CURRENTMSG_SHIFT  (6)
+#define ST25DV_MB_CTRL_DYN_CURRENTMSG_FIELD  0x3F
+#define ST25DV_MB_CTRL_DYN_CURRENTMSG_MASK   0xC0
+
+/* MB_WDG */
+#define ST25DV_MB_WDG_DELAY_SHIFT            (0)
+#define ST25DV_MB_WDG_DELAY_FIELD            0xF8
+#define ST25DV_MB_WDG_DELAY_MASK             0x07
+
+/* GPO */
+#define ST25DV_GPO_RFUSERSTATE_SHIFT         (0)
+#define ST25DV_GPO_RFUSERSTATE_FIELD         0xFE
+#define ST25DV_GPO_RFUSERSTATE_MASK          0x01
+#define ST25DV_GPO_RFACTIVITY_SHIFT          (1)
+#define ST25DV_GPO_RFACTIVITY_FIELD          0xFD
+#define ST25DV_GPO_RFACTIVITY_MASK           0x02
+#define ST25DV_GPO_RFINTERRUPT_SHIFT         (2)
+#define ST25DV_GPO_RFINTERRUPT_FIELD         0xFB
+#define ST25DV_GPO_RFINTERRUPT_MASK          0x04
+#define ST25DV_GPO_FIELDCHANGE_SHIFT         (3)
+#define ST25DV_GPO_FIELDCHANGE_FIELD         0xF7
+#define ST25DV_GPO_FIELDCHANGE_MASK          0x08
+#define ST25DV_GPO_RFPUTMSG_SHIFT            (4)
+#define ST25DV_GPO_RFPUTMSG_FIELD            0xEF
+#define ST25DV_GPO_RFPUTMSG_MASK             0x10
+#define ST25DV_GPO_RFGETMSG_SHIFT            (5)
+#define ST25DV_GPO_RFGETMSG_FIELD            0xDF
+#define ST25DV_GPO_RFGETMSG_MASK             0x20
+#define ST25DV_GPO_RFWRITE_SHIFT             (6)
+#define ST25DV_GPO_RFWRITE_FIELD             0xBF
+#define ST25DV_GPO_RFWRITE_MASK              0x40
+#define ST25DV_GPO_ENABLE_SHIFT              (7)
+#define ST25DV_GPO_ENABLE_FIELD              0x7F
+#define ST25DV_GPO_ENABLE_MASK               0x80
+#define ST25DV_GPO_ALL_MASK                  0xFF
+
+/* GPO_Dyn */
+#define ST25DV_GPO_DYN_RFUSERSTATE_SHIFT     (0)
+#define ST25DV_GPO_DYN_RFUSERSTATE_FIELD     0xFE
+#define ST25DV_GPO_DYN_RFUSERSTATE_MASK      0x01
+#define ST25DV_GPO_DYN_RFACTIVITY_SHIFT      (1)
+#define ST25DV_GPO_DYN_RFACTIVITY_FIELD      0xFD
+#define ST25DV_GPO_DYN_RFACTIVITY_MASK       0x02
+#define ST25DV_GPO_DYN_RFINTERRUPT_SHIFT     (2)
+#define ST25DV_GPO_DYN_RFINTERRUPT_FIELD     0xFB
+#define ST25DV_GPO_DYN_RFINTERRUPT_MASK      0x04
+#define ST25DV_GPO_DYN_FIELDCHANGE_SHIFT     (3)
+#define ST25DV_GPO_DYN_FIELDCHANGE_FIELD     0xF7
+#define ST25DV_GPO_DYN_FIELDCHANGE_MASK      0x08
+#define ST25DV_GPO_DYN_RFPUTMSG_SHIFT        (4)
+#define ST25DV_GPO_DYN_RFPUTMSG_FIELD        0xEF
+#define ST25DV_GPO_DYN_RFPUTMSG_MASK         0x10
+#define ST25DV_GPO_DYN_RFGETMSG_SHIFT        (5)
+#define ST25DV_GPO_DYN_RFGETMSG_FIELD        0xDF
+#define ST25DV_GPO_DYN_RFGETMSG_MASK         0x20
+#define ST25DV_GPO_DYN_RFWRITE_SHIFT         (6)
+#define ST25DV_GPO_DYN_RFWRITE_FIELD         0xBF
+#define ST25DV_GPO_DYN_RFWRITE_MASK          0x40
+#define ST25DV_GPO_DYN_ENABLE_SHIFT          (7)
+#define ST25DV_GPO_DYN_ENABLE_FIELD          0x7F
+#define ST25DV_GPO_DYN_ENABLE_MASK           0x80
+#define ST25DV_GPO_DYN_ALL_MASK              0xFF
+
+/* ITTIME */
+#define ST25DV_ITTIME_DELAY_SHIFT            (0)
+#define ST25DV_ITTIME_DELAY_FIELD            0xFC
+#define ST25DV_ITTIME_DELAY_MASK             0x03
+
+/* ITSTS_Dyn */
+#define ST25DV_ITSTS_RFUSERSTATE_SHIFT       (0)
+#define ST25DV_ITSTS_RFUSERSTATE_FIELD       0xFE
+#define ST25DV_ITSTS_RFUSERSTATE_MASK        0x01
+#define ST25DV_ITSTS_RFACTIVITY_SHIFT        (1)
+#define ST25DV_ITSTS_RFACTIVITY_FIELD        0xFD
+#define ST25DV_ITSTS_RFACTIVITY_MASK         0x02
+#define ST25DV_ITSTS_RFINTERRUPT_SHIFT       (2)
+#define ST25DV_ITSTS_RFINTERRUPT_FIELD       0xFB
+#define ST25DV_ITSTS_RFINTERRUPT_MASK        0x04
+#define ST25DV_ITSTS_FIELDFALLING_SHIFT      (3)
+#define ST25DV_ITSTS_FIELDFALLING_FIELD      0xF7
+#define ST25DV_ITSTS_FIELDFALLING_MASK       0x08
+#define ST25DV_ITSTS_FIELDRISING_SHIFT       (4)
+#define ST25DV_ITSTS_FIELDRISING_FIELD       0xEF
+#define ST25DV_ITSTS_FIELDRISING_MASK        0x10
+#define ST25DV_ITSTS_RFPUTMSG_SHIFT          (5)
+#define ST25DV_ITSTS_RFPUTMSG_FIELD          0xDF
+#define ST25DV_ITSTS_RFPUTMSG_MASK           0x20
+#define ST25DV_ITSTS_RFGETMSG_SHIFT          (6)
+#define ST25DV_ITSTS_RFGETMSG_FIELD          0xBF
+#define ST25DV_ITSTS_RFGETMSG_MASK           0x40
+#define ST25DV_ITSTS_RFWRITE_SHIFT           (7)
+#define ST25DV_ITSTS_RFWRITE_FIELD           0x7F
+#define ST25DV_ITSTS_RFWRITE_MASK            0x80
+
+/* EH_MODE */
+#define ST25DV_EH_MODE_SHIFT                 (0)
+#define ST25DV_EH_MODE_FIELD                 0xFE
+#define ST25DV_EH_MODE_MASK                  0x01
+
+/* EH_CTRL_Dyn */
+#define ST25DV_EH_CTRL_DYN_EH_EN_SHIFT       (0)
+#define ST25DV_EH_CTRL_DYN_EH_EN_FIELD       0xFE
+#define ST25DV_EH_CTRL_DYN_EH_EN_MASK        0x01
+#define ST25DV_EH_CTRL_DYN_EH_ON_SHIFT       (1)
+#define ST25DV_EH_CTRL_DYN_EH_ON_FIELD       0xFD
+#define ST25DV_EH_CTRL_DYN_EH_ON_MASK        0x02
+#define ST25DV_EH_CTRL_DYN_FIELD_ON_SHIFT    (2)
+#define ST25DV_EH_CTRL_DYN_FIELD_ON_FIELD    0xFB
+#define ST25DV_EH_CTRL_DYN_FIELD_ON_MASK     0x04
+#define ST25DV_EH_CTRL_DYN_VCC_ON_SHIFT      (3)
+#define ST25DV_EH_CTRL_DYN_VCC_ON_FIELD      0xF7
+#define ST25DV_EH_CTRL_DYN_VCC_ON_MASK       0x08
+
+/* RF_MNGT */
+#define ST25DV_RF_MNGT_RFDIS_SHIFT           (0)
+#define ST25DV_RF_MNGT_RFDIS_FIELD           0xFE
+#define ST25DV_RF_MNGT_RFDIS_MASK            0x01
+#define ST25DV_RF_MNGT_RFSLEEP_SHIFT         (1)
+#define ST25DV_RF_MNGT_RFSLEEP_FIELD         0xFD
+#define ST25DV_RF_MNGT_RFSLEEP_MASK          0x02
+
+/* RF_MNGT_Dyn */
+#define ST25DV_RF_MNGT_DYN_RFDIS_SHIFT       (0)
+#define ST25DV_RF_MNGT_DYN_RFDIS_FIELD       0xFE
+#define ST25DV_RF_MNGT_DYN_RFDIS_MASK        0x01
+#define ST25DV_RF_MNGT_DYN_RFSLEEP_SHIFT     (1)
+#define ST25DV_RF_MNGT_DYN_RFSLEEP_FIELD     0xFD
+#define ST25DV_RF_MNGT_DYN_RFSLEEP_MASK      0x02
+
+/* RFZSS */
+#define ST25DV_RFZSS_PWDCTRL_SHIFT           (0)
+#define ST25DV_RFZSS_PWDCTRL_FIELD           0xFC
+#define ST25DV_RFZSS_PWDCTRL_MASK            0x03
+#define ST25DV_RFZSS_RWPROT_SHIFT            (2)
+#define ST25DV_RFZSS_RWPROT_FIELD            0xF3
+#define ST25DV_RFZSS_RWPROT_MASK             0x0C
+
+/* I2CZSS */
+#define ST25DV_I2CZSS_PZ1_SHIFT              (0)
+#define ST25DV_I2CZSS_PZ1_FIELD              0xFC
+#define ST25DV_I2CZSS_PZ1_MASK               0x03
+#define ST25DV_I2CZSS_PZ2_SHIFT              (2)
+#define ST25DV_I2CZSS_PZ2_FIELD              0xF3
+#define ST25DV_I2CZSS_PZ2_MASK               0x0C
+#define ST25DV_I2CZSS_PZ3_SHIFT              (4)
+#define ST25DV_I2CZSS_PZ3_FIELD              0xCF
+#define ST25DV_I2CZSS_PZ3_MASK               0x30
+#define ST25DV_I2CZSS_PZ4_SHIFT              (6)
+#define ST25DV_I2CZSS_PZ4_FIELD              0x3F
+#define ST25DV_I2CZSS_PZ4_MASK               0xC0
+
+/* LOCKCCFILE */
+#define ST25DV_LOCKCCFILE_BLCK0_SHIFT        (0)
+#define ST25DV_LOCKCCFILE_BLCK0_FIELD        0xFE
+#define ST25DV_LOCKCCFILE_BLCK0_MASK         0x01
+#define ST25DV_LOCKCCFILE_BLCK1_SHIFT        (1)
+#define ST25DV_LOCKCCFILE_BLCK1_FIELD        0xFD
+#define ST25DV_LOCKCCFILE_BLCK1_MASK         0x02
+
+/* LOCKCFG */
+#define ST25DV_LOCKCFG_B0_SHIFT              (0)
+#define ST25DV_LOCKCFG_B0_FIELD              0xFE
+#define ST25DV_LOCKCFG_B0_MASK               0x01
+
+/* I2C_SSO_Dyn */
+#define ST25DV_I2C_SSO_DYN_I2CSSO_SHIFT      (0)
+#define ST25DV_I2C_SSO_DYN_I2CSSO_FIELD      0xFE
+#define ST25DV_I2C_SSO_DYN_I2CSSO_MASK       0x01
+
+
+  
+/* External variables --------------------------------------------------------*/
+/* NFCTAG driver structure */
+extern NFCTAG_DrvTypeDef St25Dv_i2c_Drv;
+extern NFCTAG_ExtDrvTypeDef St25Dv_i2c_ExtDrv;
+
+/* Exported macro ------------------------------------------------------------*/
+/* Imported functions ------------------------------------------------------- */
+extern NFCTAG_StatusTypeDef ST25DV_IO_Init( I2C* mi2cChannel, DigitalOut *mLPD );
+extern NFCTAG_StatusTypeDef ST25DV_IO_MemWrite( const uint8_t * const pData, const uint8_t DevAddr, const uint16_t TarAddr, const uint16_t Size, I2C* mi2cChannel );
+extern NFCTAG_StatusTypeDef ST25DV_IO_Write( const uint8_t * const pData, const uint8_t DevAddr, const uint16_t Size, I2C* mi2cChannel );
+extern NFCTAG_StatusTypeDef ST25DV_IO_MemRead( uint8_t * const pData, const uint8_t DevAddr, const uint16_t TarAddr, const uint16_t Size, I2C* mi2cChannel );
+extern NFCTAG_StatusTypeDef ST25DV_IO_Read( uint8_t * const pData, const uint8_t DevAddr, const uint16_t Size, I2C* mi2cChannel );
+extern uint8_t ST25DV_IO_IsNacked( void );
+extern NFCTAG_StatusTypeDef ST25DV_IO_IsDeviceReady( const uint8_t DevAddr, const uint32_t Trials, I2C* mi2cChannel);
+
+/* Exported functions ------------------------------------------------------- */
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */ 
+  
+
+#endif /* __ST25DV_H */
+
+/******************* (C) COPYRIGHT 2016 STMicroelectronics *****END OF FILE****/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/X_NUCLEO_NFC04A1/README.md	Tue Jan 28 15:54:19 2020 +0000
@@ -0,0 +1,4 @@
+# BSP
+BSP is a library for STMicroelectronics X-NUCLEO-NFC04A1.
+# Overview
+This library contains all the functions to read and write the memory of the chip, to initialize some settings of the device or the I2C Channel. 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/X_NUCLEO_NFC04A1/x_nucleo_nfc04a1.cpp	Tue Jan 28 15:54:19 2020 +0000
@@ -0,0 +1,342 @@
+/**
+  ******************************************************************************
+  * @file    x_nucleo_nfc04a1.c
+  * @author  MMY Application Team
+  * @version $Revision: 3351 $
+  * @date    $Date: 2017-01-25 17:28:08 +0100 (Wed, 25 Jan 2017) $
+  * @brief   This file provides nfc04a1 specific functions
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT 2017 STMicroelectronics</center></h2>
+  *
+  * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License");
+  * You may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at:
+  *
+  *        http://www.st.com/myliberty  
+  *
+  * Unless required by applicable law or agreed to in writing, software 
+  * distributed under the License is distributed on an "AS IS" BASIS, 
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
+  * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+  * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  *
+  ******************************************************************************
+  */ 
+
+/* Includes ------------------------------------------------------------------*/
+#include "st25dv.h"
+#include "time.h"
+
+/** @defgroup X_NUCLEO_NFC04A1
+ * @{
+ */
+/* Private typedef -----------------------------------------------------------*/
+/* Private defines -----------------------------------------------------------*/
+/* Private macros ------------------------------------------------------------*/
+/* Private variables ---------------------------------------------------------*/ 
+/* Global variables ----------------------------------------------------------*/
+/** @defgroup X_NUCLEO_NFC04A1_Global_Variables
+ * @{
+ */
+//uint8_t NFC04A1_Led[3] = {  1 , 2 , 3 };
+
+/**
+ * @}
+ */
+
+/* Private function prototypes -----------------------------------------------*/
+
+NFCTAG_StatusTypeDef ST25DV_IO_Init( I2C* mi2cChannel, DigitalOut *mLPD );
+NFCTAG_StatusTypeDef ST25DV_IO_MemWrite( const uint8_t * const pData, const uint8_t DevAddr, const uint16_t TarAddr, const uint16_t Size, I2C* mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_IO_MemRead( uint8_t * const pData, const uint8_t DevAddr, const uint16_t TarAddr, const uint16_t Size, I2C* mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_IO_Read( uint8_t * const pData, const uint8_t DevAddr, const uint16_t Size, I2C* mi2cChannel );
+NFCTAG_StatusTypeDef ST25DV_IO_IsDeviceReady( const uint8_t DevAddr, const uint32_t Trials, I2C* mi2cChannel);
+NFCTAG_StatusTypeDef NFCTAG_ConvertStatus(uint8_t ret);
+
+
+/* Functions Definition ------------------------------------------------------*/
+/** @defgroup X_NUCLEO_NFC04A1_Public_Functions
+ * @{
+ */
+
+
+
+/**
+  * @brief  Toggles the selected LED
+  * @param  led : Specifies the Led to be toggled
+  * @retval None
+  */
+void NFC04A1_LED_Toggle( DigitalOut* led)
+{
+	*led = !(*led);
+}
+
+
+
+/**
+  * @brief  This function get the GPIO value through GPIO
+  * @param  None
+  * @retval HAL GPIO pin status
+  */
+DigitalOut NFC04A1_GPO_ReadPin( DigitalOut *mMISO )
+{
+  return *mMISO;
+}
+
+/**
+  * @brief  This function initialize the GPIO to manage the NFCTAG LPD pin
+  * @param  None
+  * @retval None
+  */
+
+void NFC04A1_LPD_Init( DigitalOut *mLPD )
+{
+	*mLPD = 0;
+}
+
+/**
+  * @brief  This function get the GPIO value through GPIO
+  * @param  None
+  * @retval HAL GPIO pin status
+  */
+uint8_t NFC04A1_LPD_ReadPin( DigitalOut *mLPD )
+{
+  return mLPD -> read();
+}
+
+/**
+  * @brief  This function get the GPIO value through GPIO
+  * @param  None
+  * @retval HAL GPIO pin status
+  */
+void NFC04A1_LPD_WritePin( uint8_t LpdPinState, DigitalOut *mLPD )
+{
+  mLPD -> write( LpdPinState );
+}
+
+/**
+  * @brief  This function select the i2cChannel1 speed to communicate with NFCTAG
+  * @param  i2cChannelspeedchoice Number from 0 to 5 to select i2cChannel speed
+  * @param mi2cChannel : I2C channel
+  * @retval HAL GPIO pin status
+  */
+void NFC04A1_Selecti2cSpeed( uint8_t i2cspeedchoice, I2C* mi2cChannel)
+{
+  
+  switch( i2cspeedchoice )
+  {
+    case 0:
+      
+      mi2cChannel -> frequency(10000);
+      break;
+    
+    case 1:
+      
+      mi2cChannel -> frequency(100000);
+      break;
+    
+    case 2:
+      
+    mi2cChannel -> frequency(200000);
+      break;
+    
+    case 3:
+      
+    mi2cChannel -> frequency(400000);
+      break;
+    
+    case 4:
+
+    mi2cChannel -> frequency(800000);
+      break;
+    
+    case 5:
+      
+    mi2cChannel -> frequency(1000000);
+      break;
+    
+    default:
+      
+    mi2cChannel -> frequency(1000000);
+      break;
+  }    
+
+}
+
+/**
+ * @}
+ */
+
+/** @defgroup X_NUCLEO_NFC04A1_Private_Functions
+ * @{
+ */
+/******************************** LINK EEPROM COMPONENT *****************************/
+
+/**
+  * @brief  Initializes peripherals used by the i2cChannel NFCTAG driver
+  * @param mi2cChannel : I2C channel
+  * @param mLPD
+  * @retval NFCTAG enum status
+  */
+NFCTAG_StatusTypeDef ST25DV_IO_Init( I2C* mi2cChannel, DigitalOut *mLPD )
+{
+
+  
+  NFC04A1_LPD_Init( mLPD );
+
+  NFC04A1_Selecti2cSpeed(3, mi2cChannel);
+
+  return NFCTAG_OK;
+}
+
+/**
+  * @brief  Write data, at specific address, through i2c to the ST25DV
+  * @param  pData: pointer to the data to write
+  * @param  DevAddr : Target device address
+  * @param  TarAddr : i2c data memory address to write
+  * @param  Size : Size in bytes of the value to be written
+  * @param mi2cChannel : I2C channel
+  * @retval NFCTAG enum status
+  */
+NFCTAG_StatusTypeDef ST25DV_IO_MemWrite( const uint8_t * const pData, const uint8_t DevAddr, const uint16_t TarAddr, const uint16_t Size, I2C* mi2cChannel )
+{
+
+  uint8_t ret = 4;
+  
+  uint8_t Addr = DevAddr;
+
+
+  uint8_t buffer[2];
+  buffer[0] = (uint8_t) (TarAddr>>8);
+  buffer[1] = (uint8_t) (TarAddr&0xFF);
+
+
+   char * pDataChar = (char*) pData;
+
+
+  ret = mi2cChannel -> write(Addr, (const char*)buffer, 2 , true);
+
+  // Address is not OK
+  	if(ret != 0)
+		return NFCTAG_ConvertStatus(ret);
+
+	ret = mi2cChannel -> write(Addr, pDataChar, Size, false);
+
+  return NFCTAG_ConvertStatus(ret);
+}
+
+
+/*
+  * @brief  Reads data at a specific address from the NFCTAG.
+  * @param  pData: pointer to store read data
+  * @param  DevAddr : Target device address
+  * @param  TarAddr : i2c data memory address to read
+  * @param  Size : Size in bytes of the value to be read
+  * @param mi2cChannel : I2C channel
+  * @retval NFCTAG enum status
+  */
+
+NFCTAG_StatusTypeDef ST25DV_IO_MemRead( uint8_t * const pData, const uint8_t DevAddr, const uint16_t TarAddr, const uint16_t Size, I2C* mi2cChannel )
+{
+
+	uint8_t ret = 4;
+	uint8_t Addr = DevAddr;
+
+    uint8_t buffer[2];
+    buffer[0] = (uint8_t) (TarAddr>>8);
+    buffer[1] = (uint8_t) (TarAddr&0xFF);
+
+    ret = mi2cChannel -> write(Addr, (const char*)buffer , 2 , false);
+
+    // Address is not OK
+  	if(ret != 0)
+  		return NFCTAG_ConvertStatus(ret);
+
+	char * pDataChar = (char*) pData;
+
+	ret = mi2cChannel -> read(DevAddr, pDataChar, Size, false );
+
+	return NFCTAG_ConvertStatus(ret);
+}
+
+NFCTAG_StatusTypeDef NFCTAG_ConvertStatus(uint8_t ret) {
+	if (ret == 0) {
+		return NFCTAG_OK;
+	} else if ((ret == 2) || (ret == 3)) {
+		return NFCTAG_NACK;
+	} else {
+		return NFCTAG_ERROR;
+	}
+}
+
+
+/**
+  * @brief  Reads data at current address from the NFCTAG.
+  * @param  pData: pointer to store read data
+  * @param  DevAddr : Target device address
+  * @param  Size : Size in bytes of the value to be read
+  * @retval NFCTAG enum status
+  */
+NFCTAG_StatusTypeDef ST25DV_IO_Read( uint8_t * const pData, const uint8_t DevAddr, const uint16_t Size, I2C* mi2cChannel )
+{
+	//this has to change( send  addr then read)
+	int i = 0;
+	uint8_t ret = 4;
+
+	char * pDataChar = (char*) pData;
+	uint8_t ReadAddr = DevAddr | 1u;
+	ret = mi2cChannel -> read(ReadAddr, pDataChar, 1, false );
+
+
+// Tell slave we need to read 1byte from the current register
+	while(mi2cChannel -> read( 0 ) != 0) {
+		pData[i++] = mi2cChannel -> read( 0 );
+
+	}
+
+
+  return NFCTAG_ConvertStatus( ret);
+}
+
+
+/**
+* @brief  Checks if target device is ready for communication
+* @note   This function is used with Memory devices
+* @param  DevAddr : Target device address
+* @param  mi2cChannel : I2C channel
+* @retval NFCTAG enum status
+*/
+NFCTAG_StatusTypeDef ST25DV_IO_IsDeviceReady( const uint8_t DevAddr, const uint32_t Trials, I2C* mi2cChannel)
+{ 
+  int ret = 4;
+  uint32_t count = 0;
+
+  uint8_t Addr = DevAddr;
+
+
+  while ((count++ < Trials && ret) ) {
+	  ret = mi2cChannel -> write(Addr, NULL, 0 , false);
+  }
+  return NFCTAG_ConvertStatus(ret);
+}
+
+
+
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/******************* (C) COPYRIGHT 2017 STMicroelectronics *****END OF FILE****/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/X_NUCLEO_NFC04A1/x_nucleo_nfc04a1.h	Tue Jan 28 15:54:19 2020 +0000
@@ -0,0 +1,127 @@
+/**
+  ******************************************************************************
+  * @file    x_nucleo_nfc04a1.h
+  * @author  MMY Application Team
+  * @version $Revision: 3351 $
+  * @date    $Date: 2017-01-25 17:28:08 +0100 (Wed, 25 Jan 2017) $
+  * @brief   This file contains definitions for the x_nucleo_nfc04a1.c
+  *          board specific functions.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT 2017 STMicroelectronics</center></h2>
+  *
+  * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License");
+  * You may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at:
+  *
+  *        http://www.st.com/myliberty  
+  *
+  * Unless required by applicable law or agreed to in writing, software 
+  * distributed under the License is distributed on an "AS IS" BASIS, 
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
+  * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+  * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  *
+  ******************************************************************************
+  */ 
+
+#include "st25dv_driver.h"
+#include "mbed.h"
+//#include "PinNames.h"
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __X_NUCLEO_NFC04A1_H
+#define __X_NUCLEO_NFC04A1_H
+
+
+
+/* Includes ------------------------------------------------------------------*/
+//#include "ST25DV/st25dv.h"
+
+/** @addtogroup BSP
+  * @{
+  */
+
+/** @addtogroup X_NUCLEO_NFC04A1
+  * @{
+  */
+
+/* Exported types ------------------------------------------------------------*/
+/** @defgroup X_NUCLEO_NFC04A1_Exported_Types
+  * @{
+  */
+/**
+ * @brief  NFC04A1 Led enumerator definition
+ */
+typedef enum 
+{
+  GREEN_LED = 0,
+  BLUE_LED ,
+  YELLOW_LED
+}NFC04A1_Led_E;
+
+/**
+ * @brief  NFC04A1 Ack Nack enumerator definition
+ */
+typedef enum 
+{
+  I2CANSW_ACK = 0,
+  I2CANSW_NACK
+}NFC04A1_I2CANSW_E;
+
+
+
+/**
+ * @brief  NFC04A1 Led structure definition
+ */
+ 
+typedef struct
+{
+  uint16_t          NFC04A1_LED_PIN;
+}NFC04A1_Led_TypeDef;
+
+/**
+  * @}
+  */
+/* Exported constants --------------------------------------------------------*/
+/** @defgroup X_NUCLEO_NFC04A1_Exported_Constants
+  * @{
+  */
+#define ST25DV_I2C_SPEED                  NFC04A1_ST25DV_I2C_SPEED_1M
+#define NFC04A1_I2C_TIMEOUT               ST25DV_I2C_TIMEOUT
+/**
+  * @}
+  */
+
+/* External variables --------------------------------------------------------*/
+/* Exported macro ------------------------------------------------------------*/
+/* Exported functions ------------------------------------------------------- */
+/** @defgroup ST25DV_NUCLEO_Exported_Functions
+  * @{
+  */
+void NFC04A1_LED_Toggle( DigitalOut* led);
+DigitalOut NFC04A1_GPO_ReadPin( DigitalOut *mMISO );
+void NFC04A1_LPD_Init( DigitalOut *mLPD );
+uint8_t NFC04A1_LPD_ReadPin( void );
+void NFC04A1_LPD_WritePin( uint8_t LpdPinState, DigitalOut *mLPD );
+void NFC04A1_SelectI2cSpeed( uint8_t i2cspeedchoice, I2C* mi2cChannel);
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */ 
+
+
+
+#endif /* __X_NUCLEO_NFC04A1_H */
+
+/******************* (C) COPYRIGHT 2017 STMicroelectronics *****END OF FILE****/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed_lib.json	Tue Jan 28 15:54:19 2020 +0000
@@ -0,0 +1,15 @@
+{
+    "name": "MBED_NFC_ST25DV",
+    "config": {
+        "X_NUCLEO_NFC04A1": {
+            "macro_name": "MBED_CONF_X_NUCLEO_NFC04A1",
+            "value": true,
+            "help": "Device is using an X-NUCLEO-NFC04A1 shield attached through an arduino header"
+        },
+        "nfceeprom": {
+            "macro_name": "MBED_CONF_NFCEEPROM",
+            "value": false,
+            "help": "Device supports NFC EEPROM"
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/st25dv_driver.cpp	Tue Jan 28 15:54:19 2020 +0000
@@ -0,0 +1,659 @@
+/**
+ ******************************************************************************
+ * @file    m24sr_driver.cpp
+ * @author  ST Central Labs
+ * @brief   This file provides a set of functions to interface with the M24SR
+ *          device.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT(c) 2018 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.
+ *
+ ******************************************************************************
+ */
+
+#include <st25dv_driver.h>
+#include "Callback.h"
+
+namespace mbed {
+namespace nfc {
+namespace vendor {
+namespace ST {
+
+ST25dvDriver::ST25dvDriver(PinName i2c_data_pin,
+                            PinName i2c_clock_pin,
+                            PinName led1_pin,
+                            PinName led2_pin,
+                            PinName led3_pin,
+                            PinName lpd_pin,
+                            PinName gpo_pin)
+    : _i2c_channel(i2c_data_pin, i2c_clock_pin),
+      _led1_pin(led1_pin),
+      _led2_pin(led2_pin),
+      _led3_pin(led3_pin),
+      _lpd_pin(lpd_pin),
+      _gpo_pin(gpo_pin),
+      _ndef_size(MAX_NDEF_SIZE),
+      _is_device_inited(false),
+      _is_session_started(false) {
+    /* driver requires valid pin names */
+    MBED_ASSERT(i2c_data_pin != NC);
+    MBED_ASSERT(i2c_clock_pin != NC);
+    MBED_ASSERT(led1_pin != NC);
+    MBED_ASSERT(led2_pin != NC);
+    MBED_ASSERT(led3_pin != NC);
+    MBED_ASSERT(lpd_pin != NC);
+    MBED_ASSERT(gpo_pin != NC);
+}
+
+int ST25dvDriver::begin(void) {
+    int ret = 0;
+    
+    // Light some leds
+    ledOn(_led1_pin);
+    wait_us( 300000 );
+    ledOn(_led2_pin);
+
+    /* NFCTAG Init */
+    ret = NFCTAG_Init();
+    if(ret != NFCTAG_OK)
+        return ret;
+
+    /* Reset MBEN Dynamic */
+    NFCTAG_GetExtended_Drv()->ResetMBEN_Dyn( &_i2c_channel );
+
+    if( NfcType5_NDEFDetection() != NDEF_OK ) {
+        printf("NDEF not detected\r\n");
+
+        CCFileStruct.MagicNumber = NFCT5_MAGICNUMBER_E1_CCFILE;
+        CCFileStruct.Version = NFCT5_VERSION_V1_0;
+        CCFileStruct.MemorySize = ( ST25DV_MAX_SIZE / 8 ) & 0xFF;
+        CCFileStruct.TT5Tag = 0x05;
+
+        /* Init of the Type Tag 5 component */
+        ret = NfcType5_TT5Init();
+        if (ret != NDEF_OK)
+            return ret;
+        
+    } else {
+        printf("NDEF detected\r\n");
+    }
+
+    ledOff( _led1_pin );
+    wait_us( 300000 );
+    ledOff( _led2_pin );
+    wait_us( 300000 );
+    ledOff( _led3_pin );
+    wait_us( 300000 );
+    return NFCTAG_OK;
+}
+
+int ST25dvDriver::read_data(uint32_t address, uint8_t* bytes, size_t count) {
+    
+    (void) address;
+    (void) count;
+    int ret = NfcType5_ReadNDEF((uint8_t*)bytes);
+
+    if (ret != NDEF_OK) {   
+        return ret;
+    }
+    return NFCTAG_OK;
+}
+
+int ST25dvDriver::write_data(uint32_t address, const uint8_t* bytes, size_t count) {
+
+    (void) address;
+    int ret = NfcType5_WriteNDEF(count, (uint8_t*)bytes);
+
+    if (ret != NDEF_OK) {   
+        return ret;
+    }
+    return NFCTAG_OK;
+}
+
+int ST25dvDriver::get_size(void) {
+    int ret = NfcType5_GetLength(&_ndef_size);
+
+    if (ret != NDEF_OK) {   
+        return ret;
+    }
+    return NFCTAG_OK;
+}
+
+int ST25dvDriver::set_size(size_t count) {
+    int ret = NfcType5_SetLength(count);
+
+    if (ret != NDEF_OK) {   
+        return ret;
+    }
+    return NFCTAG_OK;
+}
+
+NFCTAG_StatusTypeDef ST25dvDriver::NFCTAG_Init(void) {
+
+  uint8_t nfctag_id;
+  
+  if( !_is_device_inited )
+  {
+    /* ST25DV Init */
+    if( St25Dv_i2c_Drv.Init(&_i2c_channel, &_lpd_pin) != NFCTAG_OK )
+    {
+      return NFCTAG_ERROR;
+    }
+
+
+    St25Dv_i2c_Drv.ReadID(&nfctag_id, &_i2c_channel);
+    
+    /* Check if it is the wanted chip */
+    if( (nfctag_id == I_AM_ST25DV04) || (nfctag_id == I_AM_ST25DV64) )
+    {
+      _is_device_inited = true;
+      Nfctag_Drv = &St25Dv_i2c_Drv;
+      Nfctag_Drv->pData = &St25Dv_i2c_ExtDrv;
+    }
+    else
+    {
+      Nfctag_Drv = NULL;
+      _is_device_inited = false;
+      return NFCTAG_ERROR;
+    }
+  }
+  
+  return NFCTAG_OK;
+}
+
+
+NFCTAG_StatusTypeDef ST25dvDriver::NFCTAG_ReadData(uint8_t * const pData, const uint16_t TarAddr, const uint16_t Size) {
+    
+  if ( Nfctag_Drv->ReadData == NULL )
+  {
+    return NFCTAG_ERROR;
+  }
+  
+  return Nfctag_Drv->ReadData( pData, TarAddr, Size, &_i2c_channel );
+}
+
+
+NFCTAG_StatusTypeDef ST25dvDriver::NFCTAG_WriteData(const uint8_t * const pData, const uint16_t TarAddr, const uint16_t Size) {
+    
+  if ( Nfctag_Drv->WriteData == NULL )
+  {
+    return NFCTAG_ERROR;
+  }
+  
+  return Nfctag_Drv->WriteData( pData, TarAddr, Size, &_i2c_channel );
+}
+
+uint32_t ST25dvDriver::NFCTAG_GetByteSize(void)
+{
+  ST25DV_MEM_SIZE mem_size;
+  ((NFCTAG_ExtDrvTypeDef *)Nfctag_Drv->pData)->ReadMemSize( &mem_size, &_i2c_channel );
+  return (mem_size.BlockSize+1) * (mem_size.Mem_Size+1);
+}
+
+/**
+  * @brief  Give extended features for component
+  * @param  None
+  * @retval address of the Extended Component Structure
+  */
+NFCTAG_ExtDrvTypeDef* ST25dvDriver::NFCTAG_GetExtended_Drv(void)
+{
+  return (NFCTAG_ExtDrvTypeDef *)Nfctag_Drv->pData;
+}
+
+/**
+  * @brief  This function light on selected Led
+  * @param  led : Led to be lit on
+  * @retval None
+  */
+void ST25dvDriver::ledOn(DigitalOut led) {
+    printf("ledOn\r\n");
+    led.write(1);
+}
+
+/**
+  * @brief  This function light off selected Led
+  * @param  led : Led to be lit off
+  * @retval None
+  */
+
+void ST25dvDriver::ledOff(DigitalOut led) {
+    led.write(0);
+}
+
+/**
+  * @brief    This function detects a NDEF message in a Type 5 Tag.
+  * @details  It first detects the Capability Container and then look for the NDEF TLV.
+  *           The `CCfileStruct` global variable is updated accordingly with what is detected.
+  * @retval NDEF_OK                 NDEF message Tag Type 5 detected.
+  * @retval NDEF_ERROR_NOT_FORMATED Device is not a NFC Tag Type 5 Tag.
+  */
+uint16_t ST25dvDriver::NfcType5_NDEFDetection(void)
+{
+ uint8_t acc_buffer[8];
+  TT5_TLV_t tlv_detect;
+  uint16_t status;
+  uint32_t memory_size;
+  
+  CCFileStruct.State = TT5_NO_NDEF;
+
+  /* Read CCFile */
+  status = NfcType5_ReadCCFile( acc_buffer );
+
+  if( status != NDEF_OK )
+  {
+    return status;
+  }
+  
+  /* Check Byte 0 is equal to magic number */
+  if( ( acc_buffer[0] != NFCT5_MAGICNUMBER_E1_CCFILE ) && ( acc_buffer[0] != NFCT5_MAGICNUMBER_E2_CCFILE ) )
+  {
+   return NDEF_ERROR_NOT_FORMATTED;
+  }
+  /* Check Version number */
+  else if( ( (acc_buffer[1]&0xFC) != 0x40 ) )
+  {
+    return NDEF_ERROR_NOT_FORMATTED;
+  }
+  
+  /* Check if CCFile is on 4 Bytes or 8 Bytes */
+  if( acc_buffer[2] == 0x00 )
+  {
+    /* Update CCFIle structure */
+    CCFileStruct.MemorySize = 0x0;
+    CCFileStruct.ExtMemorySize = (uint16_t)acc_buffer[6];
+    CCFileStruct.ExtMemorySize = ( CCFileStruct.ExtMemorySize << 8 ) |  acc_buffer[7];
+    memory_size = CCFileStruct.ExtMemorySize;
+    CCFileStruct.NDEF_offset = 8;
+  }
+  else
+  {
+    /* Update CCFIle structure */
+    CCFileStruct.MemorySize = acc_buffer[2];
+    CCFileStruct.ExtMemorySize = 0x0;
+    memory_size = CCFileStruct.MemorySize;
+    CCFileStruct.NDEF_offset = 4;
+  }
+  
+  /* Update CCFIle structure */
+  CCFileStruct.MagicNumber = (TT5_MagicNumber_t)acc_buffer[0];
+  CCFileStruct.Version = acc_buffer[1];
+  CCFileStruct.TT5Tag = acc_buffer[3];
+  
+  /* Search for position of NDEF TLV in memory and tag status */
+  while( ( NFCTAG_ReadData( (uint8_t *)&tlv_detect, CCFileStruct.NDEF_offset, sizeof(TT5_TLV_t) ) == NFCTAG_OK ) && ( CCFileStruct.NDEF_offset < memory_size ) )
+  {
+    /* Detect first NDEF Message in memory */
+    if( tlv_detect.Type == NFCT5_NDEF_MSG_TLV )
+    {
+      if( tlv_detect.Length == 0x00 )
+      {
+        CCFileStruct.State = TT5_INITIALIZED;
+      }
+      else
+      {
+        if( CCFileStruct.Version & 0x3 )
+        {
+          CCFileStruct.State = TT5_READ;
+        }
+        else
+        {
+          CCFileStruct.State = TT5_READ_WRITE;
+        }
+      }
+      return NDEF_OK;
+    }
+    /* If Proprietary NDEF jump to end of proprietary message */
+    else if( tlv_detect.Type == NFCT5_PROPRIETARY_TLV )
+    {
+      if( tlv_detect.Length == NFCT5_3_BYTES_L_TLV )
+      {
+        CCFileStruct.NDEF_offset = CCFileStruct.NDEF_offset + tlv_detect.Length16;
+        continue;
+      }
+      else
+      {
+        CCFileStruct.NDEF_offset = CCFileStruct.NDEF_offset + tlv_detect.Length;
+        continue;
+      }
+    }
+    /* if Terminator no NDEF detected */
+    else if( tlv_detect.Type == NFCT5_TERMINATOR_TLV )
+    {
+     return NDEF_ERROR_NOT_FORMATTED;
+    }
+      
+    CCFileStruct.NDEF_offset++;
+  }
+  
+  return NDEF_ERROR_NOT_FORMATTED;
+}
+
+/**
+  * @brief  This function initializes the Capability Container and an empty NDEF message in a NFC Tag.
+  * @details The Capability Container content is defined by the global variable `CCFileStruct`.
+  * @retval NDEF_ERROR The Tag has not been initialized.
+  * @retval NDEF_OK    The Tag has been successfully initialized.
+  */
+uint16_t ST25dvDriver::NfcType5_TT5Init(void)
+{
+  NFCTAG_StatusTypeDef ret_value = NFCTAG_OK;
+  uint16_t status;
+  uint8_t accbuffer[8];
+  uint8_t cdata;
+
+  /* Prepare buffer to update CCFile */
+  accbuffer[0] = CCFileStruct.MagicNumber;
+  accbuffer[1] = CCFileStruct.Version;
+  accbuffer[2] = CCFileStruct.MemorySize;
+  accbuffer[3] = CCFileStruct.TT5Tag;
+  CCFileStruct.NDEF_offset = 0x04;
+  
+  /* If extended memory prepare the length bytes */
+  if( CCFileStruct.MemorySize == NFCT5_EXTENDED_CCFILE )
+  {
+    accbuffer[6] = (uint8_t)(CCFileStruct.ExtMemorySize >> 8);
+    accbuffer[7] = (uint8_t)(CCFileStruct.ExtMemorySize & 0xFF);
+    CCFileStruct.NDEF_offset = 0x08;
+  }
+  
+  /* Update CCFile */
+  status = NfcType5_WriteCCFile( accbuffer );
+
+
+  if( status != NDEF_OK )
+  {
+    return status;
+  }
+
+  /* Update NDEF TLV for INITIALIZED state */
+  /* Update T */
+  cdata = NFCT5_NDEF_MSG_TLV;
+  ret_value = NFCTAG_WriteData( &cdata, CCFileStruct.NDEF_offset, 1 );
+  if( ret_value != NFCTAG_OK )
+  {
+    return NDEF_ERROR;
+  }
+
+  /* Update L */
+  cdata = 0x00;
+  ret_value = NFCTAG_WriteData( &cdata, (CCFileStruct.NDEF_offset + 1), 1 );
+  if( ret_value != NFCTAG_OK )
+  {
+    return NDEF_ERROR;
+  }
+  
+  return NDEF_OK;
+}
+
+/**
+  * @brief  This functions writes the Capability Container in the NFC Tag.
+  * @param  pCCBuffer Pointer on the buffer containnig the Capability Container.
+  * @retval NDEF_ERROR Error when writing the Tag.
+  * @retval NDEF_OK    The CC has been successfully written.
+  */
+uint16_t ST25dvDriver::NfcType5_WriteCCFile( const uint8_t * const pCCBuffer )
+{
+  NFCTAG_StatusTypeDef ret_value;
+  
+  /* Write first block of CCFile */
+  ret_value = NFCTAG_WriteData( pCCBuffer, 0x00, 0x4 );
+ 
+  /* If extended memory writes the next 4 bytes */
+  if( (pCCBuffer[2] == 0x00) && (ret_value == NFCTAG_OK) )
+  {
+    ret_value = NFCTAG_WriteData( pCCBuffer + 4, 0x04, 4 );
+  }
+
+  if( ret_value != NFCTAG_OK )
+  {
+    return NDEF_ERROR;
+  }
+  
+    return NDEF_OK;
+}
+
+/**
+  * @brief  This functions reads the Capability Container from the NFC Tag.
+  * @param  pCCBuffer Pointer on the buffer used to store the CC.
+  * @retval NDEF_ERROR Error when reading the Tag.
+  * @retval NDEF_OK    The CC has been successfully read.
+  */
+uint16_t ST25dvDriver::NfcType5_ReadCCFile( uint8_t * const pCCBuffer )
+{
+  NFCTAG_StatusTypeDef ret_value;
+  
+  /* Read 4 bytes of CC File */
+  ret_value = NFCTAG_ReadData( pCCBuffer, 0x00, 4 );
+
+  /* If extended memory reads the next 4 bytes */
+  if( (pCCBuffer[2] == 0x00) && (ret_value == NFCTAG_OK) )
+  {
+    ret_value = NFCTAG_ReadData( pCCBuffer + 4, 0x04, 4 );
+  }
+  
+  if( ret_value != NFCTAG_OK )
+  {
+    return NDEF_ERROR;
+  }
+  
+    return NDEF_OK;
+}
+
+/**
+  * @brief  This function reads the data stored in the NDEF message.
+  * @param  pData Pointer on the buffer used to store the read data.
+  * @retval NDEF_ERROR_MEMORY_INTERNAL  The buffer is too small for the NDEF message.
+  * @retval NDEF_ERROR_NOT_FORMATED     No Capability Container detected.
+  * @retval NDEF_ERROR                  Error when reading the NDEF message.
+  * @retval NDEF_OK                     NDEF message successfully read.
+  */
+uint16_t ST25dvDriver::NfcType5_ReadNDEF( uint8_t* pData )
+{
+  uint16_t status = NDEF_ERROR;
+  TT5_TLV_t tlv;
+  uint8_t tlv_size = 0;
+  uint16_t DataLength;
+
+  /* Detect NDEF message in memory */
+  status = NfcType5_NDEFDetection();
+  if( status != NDEF_OK )
+  {
+    return status;
+  }
+  
+  /* Read TL of Type 5 */
+  status = NFCTAG_ReadData( (uint8_t*)&tlv, CCFileStruct.NDEF_offset, sizeof(TT5_TLV_t) );
+  if( status != NDEF_OK )
+  {
+    return status;
+  }
+  
+  /* Check if L is on 3 or 1 byte and update length in buffer */
+  if( tlv.Length == NFCT5_3_BYTES_L_TLV )
+  {
+    tlv_size = 4;
+    DataLength = ((tlv.Length16 >> 8)&0xff) | ((tlv.Length16&0xff)<<8);
+  }
+  else
+  {
+    tlv_size = 2;
+    DataLength = tlv.Length;
+  }
+      /* If too many data to write return error */
+  if( DataLength > NDEF_MAX_SIZE )
+  {
+    return NDEF_ERROR_MEMORY_INTERNAL;
+  }
+  
+  /* Check CC file is in the correct mode to proceed */
+  if( CCFileStruct.State ==  TT5_INITIALIZED )
+  {
+    return NDEF_ERROR;
+  }
+
+  if( DataLength > 0 )
+  {
+    /* Read NDEF */
+    if( NFCTAG_ReadData( (pData), CCFileStruct.NDEF_offset + tlv_size, DataLength ) != NFCTAG_OK )
+    {
+      return NDEF_ERROR;
+    }
+  }
+  
+  return NDEF_OK;
+}
+
+/**
+  * @brief  This function writes a NDEF message in the NFC Tag.
+  * @param  Length Number of bytes to write.
+  * @param  pData  Pointer on the buffer to copy.
+  * @retval NDEF_ERROR_MEMORY_INTERNAL Memory size is too small for the data.
+  * @retval NDEF_ERROR_NOT_FORMATED    No Capability Container detected.
+  * @retval NDEF_ERROR                 Error when writing the Tag.
+  * @retval NDEF_OK                    The data has been successfully written.
+  */
+uint16_t ST25dvDriver::NfcType5_WriteNDEF( uint16_t Length, uint8_t *pData )
+{
+  uint8_t tlv_size;
+  uint32_t offset;
+  uint8_t NfcT5_Terminator = NFCT5_TERMINATOR_TLV;
+  
+  if(Length >= 0xFF)
+  {
+    tlv_size = 4;
+  } else {
+    tlv_size = 2;
+  }
+
+  offset = CCFileStruct.NDEF_offset + tlv_size;
+
+  /* Continue write TLV data  to EEPROM */
+  if(NFCTAG_WriteData( pData , offset, Length ) != NFCTAG_OK )
+      return NDEF_ERROR;
+
+  offset +=Length;
+  
+  /* Write Terminator TLV */
+  if(NFCTAG_WriteData( &NfcT5_Terminator, offset, sizeof(NfcT5_Terminator) ) != NFCTAG_OK)
+    return NDEF_ERROR;
+  
+  return NDEF_OK;
+}
+
+uint16_t ST25dvDriver::NfcType5_SetLength(uint16_t Length)
+{
+  TT5_TLV_t tlv;
+  uint8_t tlv_size;
+  uint32_t offset;
+  uint8_t NfcT5_Terminator = NFCT5_TERMINATOR_TLV;
+  
+  uint32_t max_length = NFCTAG_GetByteSize()        /* Memory size */
+                        - ((Length >= 0xFF) ? 4 : 2)    /* - TLV length */
+                        - sizeof(NfcT5_Terminator)      /* - Terminator TLV */
+                        - CCFileStruct.NDEF_offset;     /* - CCfile length */
+
+  /* If too many data to write return error */
+  if( Length > max_length )
+  {
+    return NDEF_ERROR_MEMORY_TAG;
+  }
+
+  /* Detect NDEF message in memory */
+  if( NfcType5_NDEFDetection() != NDEF_OK )
+  {
+    return NDEF_ERROR;
+  }
+  
+  /* Prepare TLV */
+  tlv.Type = NFCT5_NDEF_MSG_TLV;
+  if(Length >= 0xFF)
+  {
+    tlv.Length = NFCT5_3_BYTES_L_TLV;
+    tlv.Length16 = ((Length&0xff)<<8) | ((Length>>8)&0xff) ;
+    tlv_size = 4;
+    
+  } else {
+    tlv.Length = Length;
+    tlv_size = 2;
+  }
+
+  offset = CCFileStruct.NDEF_offset;
+  /* Start write TLV to EEPROM */
+  if(NFCTAG_WriteData( (uint8_t*)&tlv, offset, tlv_size )!= NFCTAG_OK)
+    return NDEF_ERROR;
+
+  return NDEF_OK;
+}
+
+/**
+  * @brief  This function reads and return the size of the NDEF message in the NFC tag.
+  * @param  Length Pointer on the NDEF size to be returned.
+  * @retval NDEF_ERROR_NOT_FORMATED Device is not a NFC Tag Type 5 Tag.
+  * @retval NDEF_ERROR              The NDEF message size has not been read.
+  * @retval NDEF_OK                 The NDEF message size has been retrieved.
+  */
+uint16_t ST25dvDriver::NfcType5_GetLength(uint16_t* Length)
+{
+  
+  uint16_t status = NDEF_ERROR;
+  TT5_TLV_t tlv;
+  
+  /* Detect NDEF message in memory */
+  status = NfcType5_NDEFDetection();
+  if( status != NDEF_OK )
+  {
+    return status;
+  }
+  
+  /* Read TL of Type 5 */
+  status = NFCTAG_ReadData( (uint8_t*)&tlv, CCFileStruct.NDEF_offset, sizeof(TT5_TLV_t) );
+  if( status != NFCTAG_OK )
+  {
+    return NDEF_ERROR;
+  }
+  
+  if(tlv.Length != NFCT5_3_BYTES_L_TLV)
+  {
+    *Length = tlv.Length;
+  } else {
+    *Length = ((tlv.Length16 >> 8)&0xff) | ((tlv.Length16 & 0xff) << 8);
+  }
+  
+  return NDEF_OK;  
+}
+
+} //ST
+} //vendor
+} //nfc
+} //mbed
+
+mbed::nfc::NFCEEPROMDriver* greentea_nfc_EEPROM_driver_get_instance()
+{
+    static mbed::nfc::vendor::ST::ST25dvDriver instance;
+    return &instance;
+}
+
+/******************* (C) COPYRIGHT 2020 STMicroelectronics *****END OF FILE****/
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/st25dv_driver.h	Tue Jan 28 15:54:19 2020 +0000
@@ -0,0 +1,351 @@
+/**
+ ******************************************************************************
+ * @file    st25dv_driver.h
+ * @author  ST Central Labs
+ * @brief   This file provides a set of functions to interface with the ST25DV
+ *          device.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT(c) 2020 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.
+ *
+ ******************************************************************************
+ */
+
+#ifndef ST25DV_H
+#define ST25DV_H
+
+#include <stdint.h>
+#include <mbed.h>
+#include "I2C.h"
+#include "NFCEEPROMDriver.h"
+#include "EventQueue.h"
+#include "st25dv.h"
+
+#if defined MBED_CONF_X_NUCLEO_NFC04A1
+
+#define ST25DV_I2C_SDA_PIN     D14
+#define ST25DV_I2C_SCL_PIN     D15
+#define ST25DV_LPD_PIN         D7
+#define ST25DV_GPO_PIN         D12
+#define ST25DV_LED1_PIN        D5
+#define ST25DV_LED2_PIN        D4
+#define ST25DV_LED3_PIN        D2
+
+#else
+
+#define ST25DV_I2C_SDA_PIN     NC
+#define ST25DV_I2C_SCL_PIN     NC
+#define ST25DV_LPD_PIN         NC
+#define ST25DV_GPO_PIN         NC
+#define ST25DV_LED1_PIN        NC
+#define ST25DV_LED2_PIN        NC
+#define ST25DV_LED3_PIN        NC
+
+#endif
+
+namespace mbed {
+namespace nfc {
+namespace vendor {
+namespace ST {
+
+#ifndef MIN
+#define MIN(x, y) (((x) < (y)) ? (x) : (y))
+#endif
+
+#define NFCTAG_4K_SIZE            ((uint32_t) 0x200)
+#define NFCTAG_16K_SIZE           ((uint32_t) 0x800)
+#define NFCTAG_64K_SIZE           ((uint32_t) 0x2000)
+
+#define MAX_NDEF_MEM                 0x200
+#define ST25DV_MAX_SIZE              NFCTAG_4K_SIZE
+#define ST25DV_NDEF_MAX_SIZE         MIN(ST25DV_MAX_SIZE,MAX_NDEF_MEM)
+#define NFC_DEVICE_MAX_NDEFMEMORY    ST25DV_NDEF_MAX_SIZE
+
+/* Error codes for Higher level */
+#define NDEF_OK                     0
+#define NDEF_ERROR                  1
+#define NDEF_ERROR_MEMORY_TAG       2
+#define NDEF_ERROR_MEMORY_INTERNAL  3
+#define NDEF_ERROR_LOCKED           4
+#define NDEF_ERROR_NOT_FORMATTED    5
+
+#define NDEF_MAX_SIZE               NFC_DEVICE_MAX_NDEFMEMORY
+#define NDEF_RECORD_MAX_SIZE        NFC_DEVICE_MAX_NDEFMEMORY
+
+/** @brief Memory size value indicating that this is a 8-bytes Capability Container */
+#define NFCT5_EXTENDED_CCFILE             0x00
+/** @brief Capability container version 1.0 */
+#define NFCT5_VERSION_V1_0                0x40
+/** @brief Read access condition mask for the Capability Container byte1 */
+#define NFCT5_READ_ACCESS                 0x0C
+/** @brief Write access condition mask for the Capability Container byte1 */
+#define NFCT5_WRITE_ACCESS                0x03
+
+/** @brief Type5 Tag NDEF message TLV-Type. */
+#define NFCT5_NDEF_MSG_TLV                ((uint8_t) 0x03)
+/** @brief Type5 Tag Proprietary message TLV-Type. */
+#define NFCT5_PROPRIETARY_TLV             ((uint8_t) 0xFD)
+/** @brief Type5 Tag Terminator TLV-Type. */
+#define NFCT5_TERMINATOR_TLV              ((uint8_t) 0xFE)
+/** @brief TLV-Length indicating a 4-bytes TLV (Length coded on 2 bytes). */
+#define NFCT5_3_BYTES_L_TLV               ((uint8_t) 0xFF)
+
+#define MAX_NDEF_SIZE         NFC_DEVICE_MAX_NDEFMEMORY
+
+typedef enum
+{
+  TT5_NO_NDEF = 0,  /**< No data detected in the tag. */
+  TT5_INITIALIZED,  /**< Capability container detected. */
+  TT5_READ_WRITE,   /**< Read-Write data detected. */
+  TT5_READ          /**< Read-Only data message detected. */
+} TT5_State;
+
+/** @brief Type5 Tag Capability Container Magic numbers as defined by the NFC Forum. */
+typedef enum {
+  NFCT5_MAGICNUMBER_E1_CCFILE = 0xE1, /**<  Complete data area can be read by 1-byte block adrdess commands. */
+  NFCT5_MAGICNUMBER_E2_CCFILE = 0xE2  /**<  Last part of the data area can be only read by 2-bytes block address commands.\n
+                                            The first 256 blocks can be read by 1-byte block address commands. */
+} TT5_MagicNumber_t;
+
+/**
+  * @brief  Type5 Tag Capability Container structure.
+  */
+typedef struct
+{
+  TT5_MagicNumber_t MagicNumber;  /**< CCfile[0]: Magic Number should be E1h or E2h (for extended API) */
+  uint8_t Version;                /**< CCfile[1]: Capability container version (b7-b4) and access conditions (b3-b0) */
+  uint8_t MemorySize;             /**< CCfile[2]: Memory size, expressed in 8 bytes blocks, set to 0 if tag size is greater than 16kbits. */
+  uint8_t TT5Tag;                 /**< CCfile[3]: Additionnal information on the Type5 Tag:\n
+                                                  b0: supports `read multiple block` commands\n
+                                                  b1: RFU\n
+                                                  b2: RFU\n
+                                                  b3: supports `lock block` commands\n
+                                                  b4: requires the `special frame` format
+                                    */
+  uint8_t rsved1;                 /**< RFU */
+  uint8_t rsved2;                 /**< RFU */
+  uint16_t ExtMemorySize;         /**< CCfile[6],CCfile[7]: Memory size, expressed in 8 bytes blocks, when tag size is greater than 16kbits. */
+  TT5_State State;                /**< Indicates if a NDEF message is present. */
+  uint32_t NDEF_offset;           /**< Indicates the address of a NDEF message in the tag. */
+}sCCFileInfo;
+
+/** @brief Type5 Tag Type-Length-Value structure as defined by the NFC Forum */
+typedef struct
+{
+  uint8_t   Type;     /**< NFC Forum message Type */
+  uint8_t   Length;   /**< Message length if lesser than 255 bytes */
+  uint16_t  Length16; /**< Message length if greater than or equal to 255 bytes */
+} TT5_TLV_t;
+
+class ST25dvDriver : public NFCEEPROMDriver {
+
+public:
+    /** Create the driver, default pin names will be used appropriate for the board.
+     *  @param i2c_data_pin I2C data pin name.
+     *  @param i2c_clock_pin I2C clock pin name.
+     *  @param gpo_pin I2C GPO pin name.
+     *  @param rf_disable_pin pin name for breaking the RF connection.
+     */
+    ST25dvDriver(PinName i2c_data_pin = ST25DV_I2C_SDA_PIN,
+                PinName i2c_clock_pin = ST25DV_I2C_SCL_PIN,
+                PinName led1_pin = ST25DV_LED1_PIN,
+                PinName led2_pin = ST25DV_LED2_PIN,
+                PinName led3_pin = ST25DV_LED3_PIN,
+                PinName lpd_pin = ST25DV_LPD_PIN,
+                PinName gpo_pin = ST25DV_GPO_PIN);
+
+    virtual ~ST25dvDriver() { }
+
+    /** @see NFCEEPROMDriver::reset
+     */
+    virtual void reset() {
+        printf("reset\r\n");
+        begin();
+    }
+
+    /** @see NFCEEPROMDriver::get_max_size
+     */
+    virtual size_t read_max_size() {
+        return MAX_NDEF_SIZE;
+    }
+
+    /** @see NFCEEPROMDriver::start_session
+     */
+    virtual void start_session(bool force = true) {
+        printf("start_session\r\n");
+        if(_is_device_inited) {
+            _is_session_started = true;
+            delegate()->on_session_started(true);
+        } else {
+            delegate()->on_session_started(false);
+        }
+    }
+
+    /** @see NFCEEPROMDriver::end_session
+     */
+    virtual void end_session() {
+        printf("end_session\r\n");
+        if(_is_session_started) {
+            _is_session_started = false;
+            delegate()->on_session_ended(true);
+        } else {
+            delegate()->on_session_ended(false);
+        }
+    }
+
+    /** @see NFCEEPROMDriver::read_bytes
+     */
+    virtual void read_bytes(uint32_t address, uint8_t* bytes, size_t count) {
+        int ret;
+        printf("read_bytes\r\n");
+
+        if (address > _ndef_size) {
+            delegate()->on_bytes_read(0);
+            return;
+        }
+
+        ret = read_data(address, bytes, count);
+        printf("read_bytes read_data ret =%d count=%d bytes=%s\r\n", ret, count, bytes);
+        if(ret != 0) {
+            delegate()->on_bytes_read(0);
+        } else {
+            delegate()->on_bytes_read(count);
+        }
+    }
+
+    /** @see NFCEEPROMDriver::write_bytes
+     */
+    virtual void write_bytes(uint32_t address, const uint8_t* bytes, size_t count) {
+        int ret;
+        printf("write_bytes\r\n");
+        if (address > _ndef_size) {
+            delegate()->on_bytes_written(0);
+            printf("write_bytes error (address > _ndef_size)\r\n");
+            return;
+        }
+
+        ret = write_data(address, bytes, count);
+        printf("write_bytes write_data ret =%d count=%d bytes=%s\r\n", ret, count, bytes);
+        if(ret != 0) {
+            delegate()->on_bytes_written(0);
+        } else {
+            delegate()->on_bytes_written(count);
+        }
+    }
+
+    /** @see NFCEEPROMDriver::write_size
+     */
+    virtual void write_size(size_t count) {
+        int ret;
+        printf("write_size (count=%d)\r\n", count);
+        if (!_is_session_started) {
+            delegate()->on_size_written(false);
+            return;
+        }
+        _ndef_size = count;
+
+        ret = set_size(count);
+        if(ret != 0) {
+            delegate()->on_size_written(false);
+        } else {
+            delegate()->on_size_written(true);
+        }
+    }
+
+    /** @see NFCEEPROMDriver::read_size
+     */
+    virtual void read_size() {
+        int ret;
+        printf("read_size\r\n");
+        if (!_is_session_started) {
+            delegate()->on_size_read(false, 0);
+            return;
+        }
+
+        ret = get_size();
+        if(ret != 0) {
+            delegate()->on_size_read(false, 0);
+        } else {
+            delegate()->on_size_read(true, _ndef_size);
+        }
+        printf("read_size _ndef_size=%d\r\n", _ndef_size);
+    }
+
+    /** @see NFCEEPROMDriver::erase_bytes
+     */
+    virtual void erase_bytes(uint32_t address, size_t size) {
+        printf("erase_bytes\r\n");
+        write_data(address, NULL, size);
+    }
+
+private:
+    int begin();
+    int read_data(uint32_t address, uint8_t* bytes, size_t count);
+    int write_data(uint32_t address, const uint8_t* bytes, size_t count);
+    int get_size(void);
+    int set_size(size_t count);
+
+    NFCTAG_StatusTypeDef NFCTAG_Init(void);
+    NFCTAG_StatusTypeDef NFCTAG_ReadData(uint8_t * const pData, const uint16_t TarAddr, const uint16_t Size);
+    NFCTAG_StatusTypeDef NFCTAG_WriteData(const uint8_t * const pData, const uint16_t TarAddr, const uint16_t Size);
+    uint32_t NFCTAG_GetByteSize(void);
+    NFCTAG_ExtDrvTypeDef *NFCTAG_GetExtended_Drv(void);
+    uint16_t NfcType5_NDEFDetection(void);
+    uint16_t NfcType5_TT5Init(void);
+    uint16_t NfcType5_WriteCCFile( const uint8_t * const pCCBuffer );
+    uint16_t NfcType5_ReadCCFile( uint8_t * const pCCBuffer );
+    uint16_t NfcType5_ReadNDEF(uint8_t* pData);
+    uint16_t NfcType5_WriteNDEF(uint16_t Length, uint8_t* pData);
+    uint16_t NfcType5_GetLength(uint16_t* Length);
+    uint16_t NfcType5_SetLength(uint16_t Length);
+
+    void ledOn(DigitalOut led);
+    void ledOff(DigitalOut led);
+
+    I2C _i2c_channel;
+    NFCTAG_DrvTypeDef *Nfctag_Drv;
+    sCCFileInfo CCFileStruct;
+
+    DigitalOut _led1_pin;
+    DigitalOut _led2_pin;
+    DigitalOut _led3_pin;
+    DigitalOut _lpd_pin;
+    DigitalIn _gpo_pin;
+
+    uint16_t _ndef_size;
+
+    bool _is_device_inited;
+    bool _is_session_started;
+};
+
+} //ST
+} //vendor
+} //nfc
+} //mbed
+
+#endif // ST25DV_H
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/