#include "mbed.h"
Serial pc(USBTX, USBRX);
Ethernet eth;
extern "C" void mbed_mac_address(char * mac);
int main() {
pc.baud(460800);
char buf[0x600];
mbed_mac_address(buf);
printf("MAC: %02X:%02X:%02X:%02X:%02X:%02X\n",
buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
printf("Ethernet test\n");
while(1) {
int size = eth.receive();
printf("size: %d\n", size);
if(size > 0) {
eth.read(buf, size);
printf("Destination: %02X:%02X:%02X:%02X:%02X:%02X\n",
buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
printf("Source: %02X:%02X:%02X:%02X:%02X:%02X\n",
buf[6], buf[7], buf[8], buf[9], buf[10], buf[11]);
}
wait(1);
}
}