ceri clatworthy
/
MAC_Address_SET
Very short program to SET the MAC Address of MBED,
Revision 0:02ad3aa4b420, committed 2012-03-01
- Comitter:
- ceri
- Date:
- Thu Mar 01 15:01:27 2012 +0000
- Commit message:
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 02ad3aa4b420 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Mar 01 15:01:27 2012 +0000 @@ -0,0 +1,56 @@ +#include "mbed.h" + +extern "C" void mbed_mac_address(char *s) +{ + char mac[6]; + mac[0] = 0x00; + mac[1] = 0x02; + mac[2] = 0xf7; + mac[3] = 0xf0; + mac[4] = 0x46; + mac[5] = 0x4b; + + memcpy(s, mac, 6); +} + + +// the one on my desk ........ 00 02 f7 f0 55 5e +// the one on the fireplace .. 00 02 f7 f0 46 4b + +// 00:02:f7:f0:46:4b .. from tweet program ? + +// -> http://mbed.org/forum/mbed/topic/972/?page=1#comment-10318 + +// Going to write the MAC address from one of my MBED's to annother MBED. + +DigitalOut myled(LED1); +Serial pc(USBTX, USBRX); // tx, rx pc.baud(921600); + +int main() +{ + uint64_t uid = 0; + char mmac[6]; + char mac[6]; + + pc.baud(921600); + + pc.printf("Trying to overwrite MAC Address ..\r\n"); + + mbed_mac_address(mmac); + uid = mmac[0] << 40 | mmac[1] << 32 | + mmac[2] << 24 | mmac[3] << 16 | + mmac[4] << 8 | mmac[5] << 0; + + pc.printf ("Here it is .. %02x %02x %02x %02x %02x %02x .. \r\n", mmac[0], mmac[1], mmac[2], mmac[3], mmac[4], mmac[5]); + + while (1) + { + myled = 1; + wait(0.2); + myled = 0; + wait(0.2); + } +} + + +
diff -r 000000000000 -r 02ad3aa4b420 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Mar 01 15:01:27 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/4c0c40fd0593