M2M im2ag M2PGI
Dependencies: mbed X_NUCLEO_NFC01A1 NDefLib
Diff: main.cpp
- Revision:
- 7:536aa5009d53
- Parent:
- 6:67e0ae676619
- Child:
- 8:ccf083f26f3a
--- a/main.cpp Tue Mar 22 12:55:52 2016 +0000
+++ b/main.cpp Tue Mar 22 14:10:56 2016 +0000
@@ -7,7 +7,7 @@
#include "NDefLib/RecordType/RecordURI.h"
Serial pc(SERIAL_TX, SERIAL_RX);
DigitalOut myled(LED1);
-InterruptIn interrupt(GP0);
+InterruptIn interrupt(D12);
/**
* Write a Ndef URI message linking to st.com site.
*/
@@ -27,12 +27,12 @@
//use default board pinout
I2C i2cChannel(X_NUCLEO_NFC01A1::DEFAULT_SDA_PIN,X_NUCLEO_NFC01A1::DEFAULT_SDL_PIN);
- X_NUCLEO_NFC01A1 *nfcNucleo = X_NUCLEO_NFC01A1::Instance(i2cChannel,NULL,
+ X_NUCLEO_NFCM *nfcNucleo = X_NUCLEO_NFC01A1::Instance(i2cChannel,NULL,
X_NUCLEO_NFC01A1::DEFAULT_GPO_PIN,X_NUCLEO_NFC01A1::DEFAULT_RF_DISABLE_PIN,
X_NUCLEO_NFC01A1::DEFAULT_LED1_PIN,X_NUCLEO_NFC01A1::DEFAULT_LED2_PIN,
X_NUCLEO_NFC01A1::DEFAULT_LED3_PIN);
- nfcNucleo->getLed1()=0;
-
+ nfcNucleo->getLed1()=0;
+ nfcNucleo->getM24SR().ManageI2CGPO(I2C_ANSWER_READY);
//retrieve the NdefLib interface
NDefLib::NDefNfcTag& tag =nfcNucleo->getM24SR().getNDefTag();
@@ -41,7 +41,7 @@
//open the i2c session with the nfc chip
if(tag.openSession()){
printf("Session opened\n");
- interrupt.fall(&pressed);
+ interrupt.fall(&tagDetect);
nfcNucleo->getLed1()=1;
