![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
vhgr
Dependencies: EthernetInterface mbed-rtos mbed
Fork of sisk_project by
Revision 2:b656e974fad2, committed 2017-02-07
- Comitter:
- grzemich
- Date:
- Tue Feb 07 23:44:25 2017 +0000
- Parent:
- 1:65cfd74a3ae5
- Commit message:
- cgfsrffb
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 65cfd74a3ae5 -r b656e974fad2 main.cpp --- a/main.cpp Fri Dec 09 07:14:15 2016 +0000 +++ b/main.cpp Tue Feb 07 23:44:25 2017 +0000 @@ -2,11 +2,26 @@ #include "EthernetInterface.h" #include "fsl_phy.h" +Serial pc(USBTX, USBRX); + + bool connection_status; phy_speed_t speed; phy_duplex_t duplex; int phyAddr = 0; +char a; + void Menu(){ + pc.printf("\n\rParametry transmisji\n\r"); + pc.printf("\n\rTyp polaczenia"); + pc.printf("\n\rq - full-duplex"); + pc.printf("\n\rw - half-duplex\n"); + pc.printf("\n\rPredkosc"); + pc.printf("\n\re - 10 Mbps"); + pc.printf("\n\rr - 100 Mbps\n\r"); + + } + int main() { EthernetInterface eth; @@ -14,22 +29,52 @@ eth.connect(); while(1) { - PHY_GetLinkStatus(ENET, phyAddr, &connection_status); - PHY_GetSpeedDuplex(ENET, phyAddr, &speed, &duplex); + Menu(); + a=pc.getc(); + switch(a) + { + case 'q': + {//to do + printf("Ustawiono full-duplex\n"); + break;} + + case 'w': + {//to do + printf("Ustawiono half-duplex\n"); + break;} + + + case 'e': + { //to do + printf("Ustawiono prędkosc 10 Mbps\n"); + printf("Full duplex\n"); + break;} + + case 'r': + { //to do + printf("Ustawiono prędkosc 100 Mbps\n"); + break;} + + default: + {pc.printf("\n\n\rerror!!!!!!!!\n\n\r"); + break;} +} + // PHY_GetLinkStatus(ENET, phyAddr, &connection_status); + // PHY_GetSpeedDuplex(ENET, phyAddr, &speed, &duplex); if(connection_status){ - printf("Cable is connected\n"); + printf("\n\rCable is connected\n"); if(duplex) - printf("Full duplex\n"); + printf("\n\rFull duplex\n"); else - printf("Half duplex\n"); + printf("\n\rHalf duplex\n"); if(speed) - printf("100 Mbit per second\n"); + printf("\n\r100 Mbit per second\n"); else - printf("10 Mbit per second\n"); + printf("\n\r10 Mbit per second\n"); } else printf("Cable is disconnected\n"); - wait(5); + wait(0.2); } } \ No newline at end of file