This application provides a set of demos with X-NUCLEO-NFC01A1 expansion board.
Dependencies: NDefLib X_NUCLEO_NFC01A1 mbed
Fork of X-MBED-NFC1 by
This application provides a set of demos with X-NUCLEO-NFC01A1 expansion board.
The available demos are:
- SAMPLE_WRITE_URL: write a tag with the ST home page URL
- SAMPLE_COUNT_CLICK: create a custom tag to count and report the user button clicks.
- SAMPLE_WRITE_AND_CHANGE_ALL: write a tag with all the supported records and update the tag contents when the user button is pressed.
- SAMPLE_LOCK_TAG_CONTENT: use the M24SR component API to set the NFC tag as read-only.
To enable the different demos comment/uncomment the SAMPLE_* macros provided in main.cpp .
X_NUCLEO_NFC01A1.cpp@2:0648c1561eb2, 2015-12-01 (annotated)
- Committer:
- giovannivisentini
- Date:
- Tue Dec 01 08:30:54 2015 +0000
- Revision:
- 2:0648c1561eb2
- Parent:
- 1:6d202b62ed68
- Child:
- 3:f7f818ee694e
change the tag content when the user press the button
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| giovannivisentini | 0:674813bd5ec9 | 1 | /* |
| giovannivisentini | 0:674813bd5ec9 | 2 | * X_NUCLEO_NFC01A1.cpp |
| giovannivisentini | 0:674813bd5ec9 | 3 | * |
| giovannivisentini | 0:674813bd5ec9 | 4 | * Created on: Nov 5, 2015 |
| giovannivisentini | 0:674813bd5ec9 | 5 | * Author: giovanni visentini |
| giovannivisentini | 0:674813bd5ec9 | 6 | */ |
| giovannivisentini | 0:674813bd5ec9 | 7 | |
| giovannivisentini | 0:674813bd5ec9 | 8 | #include <X_NUCLEO_NFC01A1.h> |
| giovannivisentini | 0:674813bd5ec9 | 9 | |
| giovannivisentini | 2:0648c1561eb2 | 10 | const uint8_t X_NUCLEO_NFC01A1::M24SR_ADDR=0xAC; |
| giovannivisentini | 2:0648c1561eb2 | 11 | |
| giovannivisentini | 1:6d202b62ed68 | 12 | X_NUCLEO_NFC01A1 *X_NUCLEO_NFC01A1::mInstance = NULL; |
| giovannivisentini | 0:674813bd5ec9 | 13 | |
| giovannivisentini | 0:674813bd5ec9 | 14 | X_NUCLEO_NFC01A1* X_NUCLEO_NFC01A1::Instance(I2C &devI2C, |
| giovannivisentini | 1:6d202b62ed68 | 15 | const PinName &gpoName, const PinName &RFDisableName, |
| giovannivisentini | 1:6d202b62ed68 | 16 | const PinName &led1Name, const PinName &led2Name, |
| giovannivisentini | 1:6d202b62ed68 | 17 | const PinName &led3Name) { |
| giovannivisentini | 2:0648c1561eb2 | 18 | if (mInstance == NULL) { // the first time |
| giovannivisentini | 1:6d202b62ed68 | 19 | mInstance = new X_NUCLEO_NFC01A1(devI2C, gpoName, RFDisableName, |
| giovannivisentini | 1:6d202b62ed68 | 20 | led1Name, led2Name, led3Name); |
| giovannivisentini | 2:0648c1561eb2 | 21 | if (mInstance != NULL) { //allocation ok |
| giovannivisentini | 1:6d202b62ed68 | 22 | const int status = mInstance->mM24SR.Init(NULL); |
| giovannivisentini | 2:0648c1561eb2 | 23 | if (status != NFC_SUCCESS) { //initialization failed |
| giovannivisentini | 1:6d202b62ed68 | 24 | delete mInstance; |
| giovannivisentini | 1:6d202b62ed68 | 25 | error( |
| giovannivisentini | 1:6d202b62ed68 | 26 | "Failed to init X_NUCLEO_NFC01A1 expansion board!\r\nError:0x%X\r\n", |
| giovannivisentini | 1:6d202b62ed68 | 27 | status); |
| giovannivisentini | 1:6d202b62ed68 | 28 | } //if init |
| giovannivisentini | 1:6d202b62ed68 | 29 | } //if instance !=NULL |
| giovannivisentini | 1:6d202b62ed68 | 30 | } //if instance |
| giovannivisentini | 1:6d202b62ed68 | 31 | return mInstance; |
| giovannivisentini | 1:6d202b62ed68 | 32 | } |
