vhgr

Dependencies:   EthernetInterface mbed-rtos mbed

Fork of sisk_project by Szymon Guza

Committer:
guzbi
Date:
Fri Dec 02 07:48:20 2016 +0000
Revision:
0:7a4b0e7660ad
Child:
1:65cfd74a3ae5
Projekt ethernet

Who changed what in which revision?

UserRevisionLine numberNew contents of line
guzbi 0:7a4b0e7660ad 1 #include "mbed.h"
guzbi 0:7a4b0e7660ad 2 #include "EthernetInterface.h"
guzbi 0:7a4b0e7660ad 3
guzbi 0:7a4b0e7660ad 4 int main() {
guzbi 0:7a4b0e7660ad 5
guzbi 0:7a4b0e7660ad 6 EthernetInterface eth;
guzbi 0:7a4b0e7660ad 7 eth.init(); //Use DHCP
guzbi 0:7a4b0e7660ad 8 eth.connect();
guzbi 0:7a4b0e7660ad 9
guzbi 0:7a4b0e7660ad 10 while(1) {
guzbi 0:7a4b0e7660ad 11 if((int)phy_link_status()){
guzbi 0:7a4b0e7660ad 12 printf("Cable is connected\n");
guzbi 0:7a4b0e7660ad 13 if((int)phy_get_duplex())
guzbi 0:7a4b0e7660ad 14 printf("Full duplex\n");
guzbi 0:7a4b0e7660ad 15 else
guzbi 0:7a4b0e7660ad 16 printf("Half duplex\n");
guzbi 0:7a4b0e7660ad 17 if((int)phy_get_speed())
guzbi 0:7a4b0e7660ad 18 printf("100 Mbit per second\n");
guzbi 0:7a4b0e7660ad 19 else
guzbi 0:7a4b0e7660ad 20 printf("10 Mbit per second\n");
guzbi 0:7a4b0e7660ad 21 }
guzbi 0:7a4b0e7660ad 22 else
guzbi 0:7a4b0e7660ad 23 printf("Cable is disconnected\n");
guzbi 0:7a4b0e7660ad 24
guzbi 0:7a4b0e7660ad 25
guzbi 0:7a4b0e7660ad 26 //printf("Connection status %d\n", (int)phy_link_status());
guzbi 0:7a4b0e7660ad 27 //printf("Duplex status %d\n", (int)phy_get_duplex());
guzbi 0:7a4b0e7660ad 28 //printf("Speed status %d\n", (int)phy_get_speed());
guzbi 0:7a4b0e7660ad 29 wait(5);
guzbi 0:7a4b0e7660ad 30 }
guzbi 0:7a4b0e7660ad 31 }