Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: M24SR
Dependents: NFC M2M_2016_STM32 MyongjiElec_capstone1 IDW01M1_Cloud_IBM ... more
Fork of X_NUCLEO_NFC01A1 by
X-NUCLEO-NFC01A1 Dynamic NFC Tag Expansion Board Firmware Package
Introduction
This firmware package includes Components Device Drivers, Board Support Package and example applications for STMicroelectronics X-NUCLEO-NFC01A1 Dynamic NFC Tag Expansion Board based on M24SR.
Firmware Library
Class X_NUCLEO_NFC01A1 is intended to represent the Dynamic NFC Tag Expansion Board with the same name.
It provides an API to access to the M24SR component and to the three onboard LEDs.
It is intentionally implemented as a singleton because only one X_NUCLEO_NFC01A1 at a time might be deployed in a HW component stack.
The library also provides an implementation of the NDEF library API for M24SR, providing an simple way to read/write NDEF formatted messages from/to the M24SR dynamic NFC tag.
Example applications
1. Hello World
2. Asynchronous Hello World
Diff: m24sr/m24sr_class.h
- Revision:
- 11:a798ebea69fa
- Parent:
- 7:19fc04b8fec6
--- a/m24sr/m24sr_class.h Mon Jan 11 13:06:23 2016 +0000
+++ b/m24sr/m24sr_class.h Tue Jan 12 14:24:42 2016 +0000
@@ -163,26 +163,26 @@
virtual NFC_StatusTypeDef Verify(PasswordType_t pwdId, uint8_t NbPwdByte,
const uint8_t *pPwd) {
- return (NFC_StatusTypeDef) M24SR_Verify((uint16_t) pwdId,
+ return (NFC_StatusTypeDef) M24SR_Verify(passTypeToIntFlag(pwdId),
(uint8_t) NbPwdByte, pPwd);
}
virtual NFC_StatusTypeDef ChangeReferenceData(PasswordType_t pwdId,
const uint8_t *pPwd) {
- return (NFC_StatusTypeDef) M24SR_ChangeReferenceData((uint16_t) pwdId,
+ return (NFC_StatusTypeDef) M24SR_ChangeReferenceData(passTypeToIntFlag(pwdId),
(uint8_t *) pPwd);
}
virtual NFC_StatusTypeDef EnableVerificationRequirement(
PasswordType_t uReadOrWrite) {
return (NFC_StatusTypeDef) M24SR_EnableVerificationRequirement(
- (uint16_t) uReadOrWrite);
+ passTypeToIntFlag(uReadOrWrite));
}
virtual NFC_StatusTypeDef DisableVerificationRequirement(
PasswordType_t uReadOrWrite) {
return (NFC_StatusTypeDef) M24SR_DisableVerificationRequirement(
- (uint16_t) uReadOrWrite);
+ passTypeToIntFlag(uReadOrWrite));
}
////////////////////// ST proprietary //////////////////////////////////
@@ -197,12 +197,12 @@
virtual NFC_StatusTypeDef EnablePermanentState(PasswordType_t uReadOrWrite) {
return (NFC_StatusTypeDef) M24SR_EnablePermanentState(
- (uint16_t) uReadOrWrite);
+ passTypeToIntFlag(uReadOrWrite));
}
virtual NFC_StatusTypeDef DisablePermanentState(PasswordType_t uReadOrWrite) {
return (NFC_StatusTypeDef) M24SR_DisablePermanentState(
- (uint16_t) uReadOrWrite);
+ passTypeToIntFlag(uReadOrWrite));
}
///////////////////// chip configuration /////////////////////////////////
@@ -272,6 +272,12 @@
NFC_StatusTypeDef enableWritePassword(const uint8_t* pCurrentWritePassword,
uint8_t* pNewPassword);
+ /**
+ * disable the request of a password before write the tag
+ * @param pCurrentWritePassword current password ( use M24SR::DEFAULT_PASSWORD if it is the first time)
+ * @return return NFC_SUCCESS if no error happen
+ * @par the password must have a length of 16 char
+ */
NFC_StatusTypeDef disableWritePassword(const uint8_t* pCurrentWritePassword=M24SR::DEFAULT_PASSWORD);
/**
@@ -466,6 +472,26 @@
* Object implementing the interface for use the NDefLib
*/
NDefNfcTagM24SR NDefTagUtil;
+
+private:
+
+ /**
+ * Convert a enum file into a M24SR constant
+ * @param pass type of password
+ * @return equvalent constant used in the m24sr device
+ */
+ uint16_t passTypeToIntFlag(const PasswordType_t &pass){
+ switch(pass){
+ case ReadPwd:
+ return READ_PWD;
+ case WritePwd:
+ return WRITE_PWD;
+ case I2CPwd:
+ default:
+ return I2C_PWD;
+ }//switch
+ }//passTypeToIntFlag
+
};
#endif // __M24SR_CLASS_H

X-NUCLEO-NFC01A1 Dynamic NFC Tag