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.
main.cpp
00001 #include "mbed.h" 00002 #include "IAP.h" 00003 00004 DigitalOut led(LED1); 00005 00006 char *readUUID(void) 00007 { 00008 static char buf[64] = {0}; 00009 IAP iap; 00010 int32_t *block = iap.read_serial(); 00011 uint32_t serial_number[5] = {0}; 00012 00013 memset(buf, 0, sizeof(buf)); 00014 serial_number[0] = *(block); 00015 serial_number[1] = *(block+1); 00016 // we only want bottom 16 bits of word1 (MAC bits 32-47) 00017 // and bit 9 forced to 1, bit 8 forced to 0 00018 // Locally administered MAC, reduced conflicts 00019 // http://en.wikipedia.org/wiki/MAC_address 00020 serial_number[0] |= 0x00000002; 00021 serial_number[0] &= 0x0000FFFE; 00022 00023 snprintf(buf, 16, "%4X%08X", serial_number[0], serial_number[1]); 00024 00025 return buf; 00026 } 00027 00028 int main(void) 00029 { 00030 printf("%s\n", readUUID()); 00031 00032 while(1) { 00033 led = !led; 00034 wait(0.5f); 00035 } 00036 }
Generated on Fri Jul 15 2022 23:04:37 by
