Example program for the X-NUCLEO-NFC04A1
Dependencies: BSP libNDEF ST25DV
source/x_nucleo_nfc04.h@3:c0d41c99e7ec, 2019-11-14 (annotated)
- Committer:
- DiegoOstuni
- Date:
- Thu Nov 14 14:06:31 2019 +0000
- Revision:
- 3:c0d41c99e7ec
- Parent:
- 0:3f1a69fc394e
Update readme
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DiegoOstuni | 0:3f1a69fc394e | 1 | #ifndef _X_NUCLEO_NFC04_H_ |
DiegoOstuni | 0:3f1a69fc394e | 2 | #define _X_NUCLEO_NFC04_H_ |
DiegoOstuni | 0:3f1a69fc394e | 3 | #include "BSP/x_nucleo_nfc04a1_nfctag.h" |
DiegoOstuni | 0:3f1a69fc394e | 4 | #include "libNDEF/NDEFcommon.h" |
DiegoOstuni | 0:3f1a69fc394e | 5 | #include "libNDEF/tagtype5_wrapper.h" |
DiegoOstuni | 0:3f1a69fc394e | 6 | #include "libNDEF/lib_NDEF_URI.h" |
DiegoOstuni | 0:3f1a69fc394e | 7 | #include "libNDEF/lib_NDEF_AAR.h" |
DiegoOstuni | 0:3f1a69fc394e | 8 | #include "libNDEF/lib_NDEF_Bluetooth.h" |
DiegoOstuni | 0:3f1a69fc394e | 9 | #include "libNDEF/lib_NDEF_Email.h" |
DiegoOstuni | 0:3f1a69fc394e | 10 | #include "libNDEF/lib_NDEF_Handover.h" |
DiegoOstuni | 0:3f1a69fc394e | 11 | #include "libNDEF/lib_NDEF_Geo.h" |
DiegoOstuni | 0:3f1a69fc394e | 12 | #include "libNDEF/lib_NDEF_MyApp.h" |
DiegoOstuni | 0:3f1a69fc394e | 13 | #include "libNDEF/lib_NDEF_SMS.h" |
DiegoOstuni | 0:3f1a69fc394e | 14 | #include "libNDEF/lib_NDEF_Text.h" |
DiegoOstuni | 0:3f1a69fc394e | 15 | #include "libNDEF/lib_NDEF_Vcard.h" |
DiegoOstuni | 0:3f1a69fc394e | 16 | #include "libNDEF/lib_NDEF_Wifi.h" |
DiegoOstuni | 0:3f1a69fc394e | 17 | |
DiegoOstuni | 0:3f1a69fc394e | 18 | //#include "ST25DV/st25dv.h" |
DiegoOstuni | 0:3f1a69fc394e | 19 | //#include "x_nucleo_nfc04a1.h" |
DiegoOstuni | 0:3f1a69fc394e | 20 | #include "mbed.h" |
DiegoOstuni | 0:3f1a69fc394e | 21 | #include "PinNames.h" |
DiegoOstuni | 0:3f1a69fc394e | 22 | #include "st25dv.h" |
DiegoOstuni | 0:3f1a69fc394e | 23 | |
DiegoOstuni | 0:3f1a69fc394e | 24 | #include <string> |
DiegoOstuni | 0:3f1a69fc394e | 25 | |
DiegoOstuni | 0:3f1a69fc394e | 26 | using namespace std; |
DiegoOstuni | 0:3f1a69fc394e | 27 | |
DiegoOstuni | 0:3f1a69fc394e | 28 | |
DiegoOstuni | 0:3f1a69fc394e | 29 | |
DiegoOstuni | 0:3f1a69fc394e | 30 | /* Class of the NFC04A1 |
DiegoOstuni | 0:3f1a69fc394e | 31 | * |
DiegoOstuni | 0:3f1a69fc394e | 32 | * begin: It initializes the device in order to start the communication with it |
DiegoOstuni | 0:3f1a69fc394e | 33 | * writeURI: Method that implements the write of an URI through I2C communication |
DiegoOstuni | 0:3f1a69fc394e | 34 | * readURI: Reading of an URI coming from an NFC tag |
DiegoOstuni | 0:3f1a69fc394e | 35 | * writeWiFi: Write the WiFi in the NFC tag |
DiegoOstuni | 0:3f1a69fc394e | 36 | * readWiFi: Read the WiFi coming from another device that writes on the NFC tag |
DiegoOstuni | 0:3f1a69fc394e | 37 | * ledON: It lights one of the three LED based on input PIN |
DiegoOstuni | 0:3f1a69fc394e | 38 | * ledOFF: It lights off one of the three LED based on input PIN |
DiegoOstuni | 0:3f1a69fc394e | 39 | * |
DiegoOstuni | 0:3f1a69fc394e | 40 | */ |
DiegoOstuni | 0:3f1a69fc394e | 41 | class X_Nucleo_NFC04 { |
DiegoOstuni | 0:3f1a69fc394e | 42 | public: |
DiegoOstuni | 0:3f1a69fc394e | 43 | X_Nucleo_NFC04(I2C* i2cChannel, DigitalOut* led_1, DigitalOut* led_2, DigitalOut* led_3, DigitalOut* LPD, DigitalIn* MISO); |
DiegoOstuni | 0:3f1a69fc394e | 44 | int begin(I2C* mi2cChannel, DigitalOut * mLPD); |
DiegoOstuni | 0:3f1a69fc394e | 45 | void ledOn(DigitalOut* led); |
DiegoOstuni | 0:3f1a69fc394e | 46 | void ledOff(DigitalOut* led); |
DiegoOstuni | 0:3f1a69fc394e | 47 | int writeURI(string protocol, string uri, string info, I2C* mi2cChannel); |
DiegoOstuni | 0:3f1a69fc394e | 48 | uint16_t writeWiFi(string NetworkSSID, Ndef_Wifi_Authentication_t AuthenticationType, Ndef_Wifi_Encryption_t EncryptionType, string NetworkKey, I2C* mi2cChannel ); |
DiegoOstuni | 0:3f1a69fc394e | 49 | string readURI( I2C* mi2cChannel); |
DiegoOstuni | 0:3f1a69fc394e | 50 | private: |
DiegoOstuni | 0:3f1a69fc394e | 51 | DigitalOut *mled_1; |
DiegoOstuni | 0:3f1a69fc394e | 52 | DigitalOut *mled_2; |
DiegoOstuni | 0:3f1a69fc394e | 53 | DigitalOut *mled_3; |
DiegoOstuni | 0:3f1a69fc394e | 54 | DigitalOut *mLPD; |
DiegoOstuni | 0:3f1a69fc394e | 55 | DigitalIn *mMISO; |
DiegoOstuni | 0:3f1a69fc394e | 56 | I2C *mi2cChannel; |
DiegoOstuni | 0:3f1a69fc394e | 57 | |
DiegoOstuni | 0:3f1a69fc394e | 58 | }; |
DiegoOstuni | 0:3f1a69fc394e | 59 | |
DiegoOstuni | 0:3f1a69fc394e | 60 | extern X_Nucleo_NFC04 X_Nucleo_Nfc04; |
DiegoOstuni | 0:3f1a69fc394e | 61 | |
DiegoOstuni | 0:3f1a69fc394e | 62 | #endif |