NFC
NFC.on()
Turn NFC on, optionally with a callback function.
// PROTOTYPE
int on(nfc_event_callback_t cb=nullptr);
The callback function has this prototype:
void nfcCallback(nfc_event_type_t type, nfc_event_t* event, void* context);
typeThe type of event (described below)eventThe internal event structure (not currently used)contextAn optional context pointer set when the callback is registered (not currently used).
The event types are:
NFC_EVENT_FIELD_ONNFC tag has detected external NFC field and was selected by an NFC polling device.NFC_EVENT_FIELD_OFFExternal NFC field has been removed.NFC_EVENT_READNFC polling device has read all tag data.
NFC events may occur at interrupt service time. You should not, for example:
- Allocate or free memory (
malloc,free,new,delete,strdup, etc.). - Call Particle functions like
Particle.publish() - Call
delay() - Call
Serial.print(),Log.info(), etc.