X_NUCLEO_NFC02A1 library for M24LR
Dependencies: ST_INTERFACES
Dependents: HelloWorld_NFC02A1_mbedOS HelloWorld_NFC02A1laatste HelloWorld_NFC02A1
Fork of X_NUCLEO_NFC02A1 by
X-NUCLEO-NFC02A1 Dynamic NFC Tag Expansion Board Firmware Package
Introduction
This firmware package includes Components Device Drivers, Board Support Package and example applications for STMicroelectronics X-NUCLEO-NFC02A1 Dynamic NFC Tag Expansion Board based on M24LR.
Firmware Library
Class X_NUCLEO_NFC02A1 is intended to represent the Dynamic NFC Tag Expansion Board with the same name.
It provides an API to access to the M24LR component and to the three onboard LEDs.
It is intentionally implemented as a singleton because only one X_NUCLEO_NFC02A1 at a time might be deployed in a HW component stack.
The library also provides an implementation of the NDEF library API for M24LR, providing an simple way to read/write NDEF formatted messages from/to the M24LR dynamic NFC tag.
Example application
Hello World is a simple application to program and read an URI from the NFC tag.
Diff: m24lr/M24LR.cpp
- Revision:
- 7:b876cdcf095a
- Parent:
- 6:8c1eca41b3a9
- Child:
- 8:7c4cf671960b
--- a/m24lr/M24LR.cpp Fri May 19 07:51:32 2017 +0000
+++ b/m24lr/M24LR.cpp Tue Jul 11 15:23:56 2017 +0000
@@ -140,7 +140,7 @@
char buffer;
while (status != 0) {
/* for device is ready address in M24Lr is M24LR_ADDR_DATA_I2C */
- status = dev_I2C.read(i2c_address_data, &buffer, 1, false);
+ status = dev_I2C->read(i2c_address_data, &buffer, 1, false);
}
if ( status == 0 )
return NFCTAG_OK;
@@ -242,7 +242,7 @@
}
/* Rosarium : To check M24LR_ADDR_DATA_I2C is this case */
/* return M24lr_IO_MemRead( pData, M24LR_ADDR_DATA_I2C, TarAddr, NbByte ); */
- status = dev_I2C.i2c_read(pData, i2c_address_data, TarAddr, NbByte);
+ status = dev_I2C->i2c_read(pData, i2c_address_data, TarAddr, NbByte);
if ( status == 0 )
return NFCTAG_OK;
else
@@ -290,7 +290,7 @@
/* Write align_mem_offset bytes in memory */
/* Rosarium to Check as the address here is 0xA6 rather than 0xAE */
/* Rosarium dev_I2C.i2c_write(pdata_index, M24LR_ADDR_DATA_I2C, mem_addr, align_mem_offset); */
- status = dev_I2C.i2c_write(pdata_index, i2c_address_data, mem_addr, align_mem_offset);
+ status = dev_I2C->i2c_write(pdata_index, i2c_address_data, mem_addr, align_mem_offset);
/* update index, dest address, size for next write */
pdata_index += align_mem_offset;
@@ -324,7 +324,7 @@
return NFCTAG_TIMEOUT;
}
/* Read actual value of register */
- status = dev_I2C.i2c_read(pData, i2c_address_syst, TarAddr, NbByte);
+ status = dev_I2C->i2c_read(pData, i2c_address_syst, TarAddr, NbByte);
if ( status == 0 )
return NFCTAG_OK;
@@ -370,7 +370,7 @@
}
/* Write align_mem_offset bytes in register */
// status = M24lr_IO_MemWrite( pdata_index, M24LR_ADDR_SYST_I2C, mem_addr, align_mem_offset );
- status = dev_I2C.i2c_write(pdata_index, i2c_address_syst, mem_addr, align_mem_offset);
+ status = dev_I2C->i2c_write(pdata_index, i2c_address_syst, mem_addr, align_mem_offset);
/* update index, dest address, size for next write */
pdata_index += align_mem_offset;
mem_addr += align_mem_offset;
@@ -701,7 +701,7 @@
int status;
/* Read actual value of CFG register */
- status = dev_I2C.i2c_read( ®_value, i2c_address_syst, (uint16_t)M24LR_CFG_REG, 1 );
+ status = dev_I2C->i2c_read( ®_value, i2c_address_syst, (uint16_t)M24LR_CFG_REG, 1 );
if( status != 0 )
{
return NFCTAG_TIMEOUT;

X-NUCLEO-NFC02A1 Dynamic NFC tag