vhgr
Dependencies: EthernetInterface mbed-rtos mbed
Fork of sisk_project by
Diff: main.cpp
- Revision:
- 1:65cfd74a3ae5
- Parent:
- 0:7a4b0e7660ad
- Child:
- 2:b656e974fad2
diff -r 7a4b0e7660ad -r 65cfd74a3ae5 main.cpp --- a/main.cpp Fri Dec 02 07:48:20 2016 +0000 +++ b/main.cpp Fri Dec 09 07:14:15 2016 +0000 @@ -1,5 +1,11 @@ #include "mbed.h" #include "EthernetInterface.h" +#include "fsl_phy.h" + +bool connection_status; +phy_speed_t speed; +phy_duplex_t duplex; +int phyAddr = 0; int main() { @@ -8,13 +14,15 @@ eth.connect(); while(1) { - if((int)phy_link_status()){ + PHY_GetLinkStatus(ENET, phyAddr, &connection_status); + PHY_GetSpeedDuplex(ENET, phyAddr, &speed, &duplex); + if(connection_status){ printf("Cable is connected\n"); - if((int)phy_get_duplex()) + if(duplex) printf("Full duplex\n"); else printf("Half duplex\n"); - if((int)phy_get_speed()) + if(speed) printf("100 Mbit per second\n"); else printf("10 Mbit per second\n"); @@ -22,10 +30,6 @@ else printf("Cable is disconnected\n"); - - //printf("Connection status %d\n", (int)phy_link_status()); - //printf("Duplex status %d\n", (int)phy_get_duplex()); - //printf("Speed status %d\n", (int)phy_get_speed()); wait(5); } } \ No newline at end of file