uniqueCPUID

Fork of uniqueCPUID by Joseph Ellsworth

Committer:
gastonfeng
Date:
Tue Oct 23 15:50:34 2018 +0800
Revision:
4:af0e9aaee2ed
Parent:
3:8ebd7b354018
json file

Who changed what in which revision?

UserRevisionLine numberNew contents of line
joeata2wh 0:b9461291f915 1 #include "mbed.h"
joeata2wh 0:b9461291f915 2 #include "uniqueCPUID.h"
joeata2wh 0:b9461291f915 3
joeata2wh 2:08766dc8051a 4 /*
joeata2wh 2:08766dc8051a 5 By Joseph Ellsworth CTO of A2WH
joeata2wh 2:08766dc8051a 6 Take a look at A2WH.com Producing Water from Air using Solar Energy
joeata2wh 2:08766dc8051a 7 March-2016 License: https://developer.mbed.org/handbook/MIT-Licence
joeata2wh 2:08766dc8051a 8 Please contact us http://a2wh.com for help with custom design projects.
joeata2wh 2:08766dc8051a 9 */
joeata2wh 0:b9461291f915 10
joeata2wh 0:b9461291f915 11 void getUniqueIDAsStr(char *destStr)
joeata2wh 0:b9461291f915 12 {
joeata2wh 0:b9461291f915 13 unsigned long *Unique = uniqueSerialAddr;
gastonfeng 3:8ebd7b354018 14 sprintf(destStr, "%08luX%08luX%08luX\000", Unique[0], Unique[1], Unique[2]);
joeata2wh 0:b9461291f915 15 }
joeata2wh 0:b9461291f915 16
joeata2wh 0:b9461291f915 17
joeata2wh 0:b9461291f915 18 void printUniqueId(Serial pc) {
joeata2wh 0:b9461291f915 19 unsigned long *Unique = uniqueSerialAddr;
joeata2wh 0:b9461291f915 20 printf("Simple Serial# %08luX %08luX %08luX\n", Unique[0], Unique[1], Unique[2]);
gastonfeng 3:8ebd7b354018 21 }
gastonfeng 3:8ebd7b354018 22
gastonfeng 3:8ebd7b354018 23 std::string getUniqueIDAsString(){
gastonfeng 3:8ebd7b354018 24 char buf[32];
gastonfeng 3:8ebd7b354018 25 unsigned long *Unique = uniqueSerialAddr;
gastonfeng 3:8ebd7b354018 26 sprintf(buf, "%0X%0X%0X\000", Unique[0], Unique[1], Unique[2]);
gastonfeng 3:8ebd7b354018 27 return buf;
joeata2wh 0:b9461291f915 28 }