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.
Dependencies: EthernetInterface IAP mbed-rtos mbed
Fork of TCPSocket_HelloWorld by
Diff: main.cpp
- Revision:
- 18:f9b7d08b5217
- Parent:
- 17:0d74817db362
diff -r 0d74817db362 -r f9b7d08b5217 main.cpp
--- a/main.cpp Thu Apr 23 02:01:38 2015 +0000
+++ b/main.cpp Tue May 12 07:29:44 2015 +0000
@@ -1,10 +1,14 @@
#include "mbed.h"
#include "EthernetInterface.h"
+#include "IAP.h"
+
int main() {
+ printf("-------- Arch Pro Ethernet -----------\n");
EthernetInterface eth;
eth.init(); //Use DHCP
eth.connect();
+ printf("MAC Address is %s\n", eth.getMACAddress());
printf("IP Address is %s\n", eth.getIPAddress());
TCPSocketConnection sock;
@@ -30,13 +34,18 @@
while(1) {}
}
-// override the default weak function to provide a specific mac address
-extern "C" void mbed_mac_address(char *mac)
-{
- mac[0] = 0x01;
- mac[1] = 0x23;
- mac[2] = 0x45;
- mac[3] = 0x67;
- mac[4] = 0x89;
- mac[5] = 0xAB;
+extern "C" void mbed_mac_address(char *mac) {
+ IAP iap;
+
+ int *serial_number_array = iap.read_serial(); // 4 int
+ char *ptr = (char *)serial_number_array;
+
+ mac[0] = ptr[0];
+ mac[1] = ptr[1];
+ mac[2] = ptr[2];
+ mac[3] = ptr[3];
+ mac[4] = ptr[4];
+ mac[5] = ptr[5];
};
+
+
