![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Modularizando o src
Dependencies: EALib EthernetInterface_vz mbed-rtos mbed
Fork of header_main_colinas_V0-20-09-14 by
Diff: utils.cpp
- Revision:
- 48:195c97f12e8e
- Parent:
- 46:a670f187a704
- Child:
- 50:d9b6577a70f5
diff -r 3983efe3aeba -r 195c97f12e8e utils.cpp --- a/utils.cpp Tue Oct 07 18:43:44 2014 +0000 +++ b/utils.cpp Mon Oct 20 16:13:10 2014 +0000 @@ -1,6 +1,8 @@ #include "utils.h" #include "prompt.h" +EthernetInterface eth; + void reverse( char str[], int length ){ int start = 0; int end = length -1; @@ -42,11 +44,12 @@ led3 = led4 = 0; } -int __init_eth__( EthernetInterface * eth ){ +int __init_eth__(){ static bool initialized = false; char buff_ip[ 16 ]; char buff_msk[ 16 ]; char buff_gtw[ 16 ]; + wdt.kick(); pc.printf("\n\r"); FILE *fp = fopen( "/qspi/myip.txt", "r"); if( fp == NULL ){ @@ -112,11 +115,17 @@ buff_gtw[ 15 ] = 0; if( !initialized ){ - eth->init( buff_ip, buff_msk, buff_gtw ); - //eth->init( __MY_IP__, __MY_MSK__, __MY_GTW__ ); + eth.init( buff_ip, buff_msk, buff_gtw ); initialized = true; + return eth.connect(); } - return eth->connect(); + + if( !eth.disconnect() ){ + return eth.connect(); + } + else{ + return eth.connect(); + } } Call_Box * __find_CB__( Vector * v_cb, int ext ){