UUID read and print

Dependencies:   mbed

Revision:
7:b66c459fd169
Parent:
6:3deacf18cc07
Child:
8:a9f1c2722cd9
--- a/main.cpp	Thu Nov 20 00:08:45 2014 +0000
+++ b/main.cpp	Tue Apr 21 23:52:25 2015 +0000
@@ -8,20 +8,26 @@
 #error haha
 #endif
 
-int main() {
-    uint32_t UUID_LOC = 0x40048054; // K64F address of UUID data
-    uint32_t result[4] = {0};
-    uint32_t i = 3; //comment here
-        
-    for (; i>=0; --i) {
-        result[i] = *(uint32_t *)UUID_LOC;
-        printf("REG:%08x\tVAL:%08x\n\r", UUID_LOC, result[i]);
-        UUID_LOC += 4;
-    }
+int main()
+{
+    unsigned int UUID_LOC_WORD0 = 0x40048060;
+    unsigned int UUID_LOC_WORD1 = 0x4004805C;
+
+    // Fetch word 0
+    uint32_t word0 = *(uint32_t *)UUID_LOC_WORD0;
+
+    // Fetch word 1
+    // we only want bottom 16 bits of word1 (MAC bits 32-47)
+    // and bit 9 forced to 1, bit 8 forced to 0
+    // Locally administered MAC, reduced conflicts
+    // http://en.wikipedia.org/wiki/MAC_address
+    uint32_t word1 = *(uint32_t *)UUID_LOC_WORD1;
+    //word1 |= 0x00000200;
+    //word1 &= 0x0000FEFF;
     
-    error("exit\r\n");
-    return *result;
+    //printf("%4x%08x", word1, word0);   // Device id must be in lower case
+    printf("%08x%08x", word1, word0);   // Device id must be in lower case
+    
+    while(1);
 }
 
-
-//hadeerp derp derp thingy
\ No newline at end of file