File tree Expand file tree Collapse file tree 4 files changed +35
-0
lines changed
libraries/RFduinoNonBLE/examples/DeviceInfo Expand file tree Collapse file tree 4 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 11CHANGELOG
22
3+ v 1.6
4+ - Added getDeviceId() to return the unique id for each device
5+ (see DeviceInfo sketch)
6+
37v 1.5.1
48 - Added support for OSX (contributed by nitsky)
59 - RFDLoader now supports 32-bit and 64-bit osx snow leopard through mavericks
Original file line number Diff line number Diff line change 1+ void setup () {
2+ Serial.begin (57600 );
3+
4+ Serial.println (" The device id is:" );
5+ uint64_t id = getDeviceId ();
6+ Serial.println (getDeviceIdLow (), HEX);
7+ Serial.println (getDeviceIdHigh (), HEX);
8+ }
9+
10+ void loop () {
11+ }
Original file line number Diff line number Diff line change @@ -260,6 +260,21 @@ uint8_t UART0_RX()
260260 return uc_data;
261261}
262262
263+ uint32_t getDeviceIdLow ()
264+ {
265+ return NRF_FICR->DEVICEID [0 ];
266+ }
267+
268+ uint32_t getDeviceIdHigh ()
269+ {
270+ return NRF_FICR->DEVICEID [1 ];
271+ }
272+
273+ uint64_t getDeviceId ()
274+ {
275+ return ((uint64_t )getDeviceIdHigh () << 32 ) | getDeviceIdLow ();
276+ }
277+
263278#ifdef __cplusplus
264279}
265280#endif
Original file line number Diff line number Diff line change @@ -166,6 +166,11 @@ uint8_t UART0_RX();
166166
167167#include "Memory.h"
168168
169+ // unique id for each unit
170+ uint32_t getDeviceIdLow ();
171+ uint32_t getDeviceIdHigh ();
172+ uint64_t getDeviceId ();
173+
169174#ifdef __cplusplus
170175}
171176#endif
You can’t perform that action at this time.
0 commit comments