uniqueCPUID

Fork of uniqueCPUID by Joseph Ellsworth

uniqueCPUID.cpp

Committer:
gastonfeng
Date:
2018-10-23
Revision:
4:af0e9aaee2ed
Parent:
3:8ebd7b354018

File content as of revision 4:af0e9aaee2ed:

#include "mbed.h"
#include "uniqueCPUID.h"

/*
  By Joseph Ellsworth CTO of A2WH
  Take a look at A2WH.com Producing Water from Air using Solar Energy
  March-2016 License: https://developer.mbed.org/handbook/MIT-Licence 
  Please contact us http://a2wh.com for help with custom design projects.
*/

void getUniqueIDAsStr(char *destStr)
{
    unsigned long *Unique = uniqueSerialAddr;
    sprintf(destStr, "%08luX%08luX%08luX\000", Unique[0], Unique[1], Unique[2]);
}


void printUniqueId(Serial pc) {
    unsigned long *Unique = uniqueSerialAddr;
    printf("Simple Serial# %08luX %08luX %08luX\n", Unique[0], Unique[1], Unique[2]);
}

std::string getUniqueIDAsString(){
    char buf[32];
    unsigned long *Unique = uniqueSerialAddr;
    sprintf(buf, "%0X%0X%0X\000", Unique[0], Unique[1], Unique[2]);
    return buf;
}