UUID read and print

Dependencies:   mbed

Committer:
sam_grove
Date:
Tue Apr 21 23:52:57 2015 +0000
Revision:
8:a9f1c2722cd9
Parent:
7:b66c459fd169
Child:
9:3cbea866b809
Remove gorp...

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sam_grove 0:496297783a79 1 #include "mbed.h"
sam_grove 0:496297783a79 2
sam_grove 7:b66c459fd169 3 int main()
sam_grove 7:b66c459fd169 4 {
sam_grove 7:b66c459fd169 5 unsigned int UUID_LOC_WORD0 = 0x40048060;
sam_grove 7:b66c459fd169 6 unsigned int UUID_LOC_WORD1 = 0x4004805C;
sam_grove 7:b66c459fd169 7
sam_grove 7:b66c459fd169 8 // Fetch word 0
sam_grove 7:b66c459fd169 9 uint32_t word0 = *(uint32_t *)UUID_LOC_WORD0;
sam_grove 7:b66c459fd169 10
sam_grove 7:b66c459fd169 11 // Fetch word 1
sam_grove 7:b66c459fd169 12 // we only want bottom 16 bits of word1 (MAC bits 32-47)
sam_grove 7:b66c459fd169 13 // and bit 9 forced to 1, bit 8 forced to 0
sam_grove 7:b66c459fd169 14 // Locally administered MAC, reduced conflicts
sam_grove 7:b66c459fd169 15 // http://en.wikipedia.org/wiki/MAC_address
sam_grove 7:b66c459fd169 16 uint32_t word1 = *(uint32_t *)UUID_LOC_WORD1;
sam_grove 7:b66c459fd169 17 //word1 |= 0x00000200;
sam_grove 7:b66c459fd169 18 //word1 &= 0x0000FEFF;
sam_grove 0:496297783a79 19
sam_grove 7:b66c459fd169 20 //printf("%4x%08x", word1, word0); // Device id must be in lower case
sam_grove 7:b66c459fd169 21 printf("%08x%08x", word1, word0); // Device id must be in lower case
sam_grove 7:b66c459fd169 22
sam_grove 7:b66c459fd169 23 while(1);
sam_grove 0:496297783a79 24 }
sam_grove 0:496297783a79 25