UUID read and print

Dependencies:   mbed

Committer:
sam_grove
Date:
Tue Apr 21 23:57:34 2015 +0000
Revision:
9:3cbea866b809
Parent:
8:a9f1c2722cd9
Get all 1289 bits

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 9:3cbea866b809 7 unsigned int UUID_LOC_WORD2 = 0x40048058;
sam_grove 9:3cbea866b809 8 unsigned int UUID_LOC_WORD3 = 0x40048054;
sam_grove 7:b66c459fd169 9
sam_grove 7:b66c459fd169 10 // Fetch word 0
sam_grove 7:b66c459fd169 11 uint32_t word0 = *(uint32_t *)UUID_LOC_WORD0;
sam_grove 7:b66c459fd169 12
sam_grove 7:b66c459fd169 13 // Fetch word 1
sam_grove 7:b66c459fd169 14 // we only want bottom 16 bits of word1 (MAC bits 32-47)
sam_grove 7:b66c459fd169 15 // and bit 9 forced to 1, bit 8 forced to 0
sam_grove 7:b66c459fd169 16 // Locally administered MAC, reduced conflicts
sam_grove 7:b66c459fd169 17 // http://en.wikipedia.org/wiki/MAC_address
sam_grove 7:b66c459fd169 18 uint32_t word1 = *(uint32_t *)UUID_LOC_WORD1;
sam_grove 7:b66c459fd169 19 //word1 |= 0x00000200;
sam_grove 7:b66c459fd169 20 //word1 &= 0x0000FEFF;
sam_grove 0:496297783a79 21
sam_grove 9:3cbea866b809 22 uint32_t word2 = *(uint32_t *)UUID_LOC_WORD2;
sam_grove 9:3cbea866b809 23 uint32_t word3 = *(uint32_t *)UUID_LOC_WORD3;
sam_grove 9:3cbea866b809 24
sam_grove 7:b66c459fd169 25 //printf("%4x%08x", word1, word0); // Device id must be in lower case
sam_grove 9:3cbea866b809 26 printf("%08x%08x%08x%08x", word3, word2, word1, word0); // Device id must be in lower case
sam_grove 7:b66c459fd169 27
sam_grove 7:b66c459fd169 28 while(1);
sam_grove 0:496297783a79 29 }
sam_grove 0:496297783a79 30