Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of SX1276GenericLib by
Diff: Arduino-mbed-APIs/arduino-d21.cpp
- Revision:
- 78:9d2cc07d9525
- Parent:
- 77:7f227a4dffe6
- Child:
- 84:3428e25c7157
--- a/Arduino-mbed-APIs/arduino-d21.cpp Mon Jul 31 16:11:17 2017 +0200 +++ b/Arduino-mbed-APIs/arduino-d21.cpp Wed Aug 02 10:34:14 2017 +0200 @@ -19,6 +19,32 @@ * __SAMD21G18A__ is Genuino Zero-Board (compatible with the LoRa board) */ +int +CPUID(uint8_t *buf, int maxSize, uint32_t xorval) +{ + int f1 = 0x55d5f559; // D21 128-bit UUID, first 32 bit. + int f2 = 0x55d5f515; // D21 128-bit UUID, next 96 bit. + + if (maxSize >= 16 ) { + int cnt = 0; + int fa = f1 ^ xorval; + uint32_t *first = (uint32_t *)fa; + uint8_t *dst = (uint8_t *)first; + for (int i = 0; i < sizeof(uint32_t); i++) + *buf++ = *dst++; + cnt += 4; + int fb = f2 ^ xorval; + uint32_t *next = (uint32_t *)fb; + dst = (uint8_t *)next; + for (int i = 0; i < sizeof(uint32_t)*3; i++) + *buf++ = *dst++; + cnt += 12; + return cnt; + } + + return 0; +} + /* * see tcc.h is automatically included from: * Arduino15/packages/arduino/tools/CMSIS-Atmel/1.1.0/CMSIS/