I’ve recently started a project where I wanted to use NFC for a two way communication between a phone and device. For this reason I changed the Espruino NFC API to expose low level hardware access in JS. To prevent conflicts with Nordic's driver I completely removed support for NRF.nfcRaw and NRF.nfcURL. My branch instead features:
//Enable NFC (returns tag header, 10 bytes)
>NRF.nfcStart();
=new ArrayBuffer([95, 42, 58, 199, 216, 35, 65, 189, 7, 3])
//Disable NFC
NRF.nfcStop();
//Register callback to call with incoming data
NRF.on('NFCrx', function(data) { ... }
//Send response
NRF.nfcSend(new Uint8Array([0x01, 0x02, 0x03, 0x04, ...]);
//Send ACK
NRF.nfcSend(0xA);
//Send NACK
NRF.nfcSend(0x0);
//No response, wait for next command
NRF.nfcSend();
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I’ve recently started a project where I wanted to use NFC for a two way communication between a phone and device. For this reason I changed the Espruino NFC API to expose low level hardware access in JS. To prevent conflicts with Nordic's driver I completely removed support for NRF.nfcRaw and NRF.nfcURL. My branch instead features:
Below is a usage example that "implements" NRF.nfcURL("http://espruino.com"):
I hope my extensions are of use for the projects discussed above.
https://github.com/drandreas/Espruino/releases