![](/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
eth.cpp@132:05cd37f7e007, 2015-09-01 (annotated)
- Committer:
- klauss
- Date:
- Tue Sep 01 17:21:11 2015 +0000
- Revision:
- 132:05cd37f7e007
- Parent:
- 125:8ff4dc96ad58
Substitui??o de; send_msg -> vz_printf; debug_msg -> vz_debug
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
klauss | 122:480c44b0e205 | 1 | #include "eth.h" |
klauss | 74:81c47fff88a5 | 2 | |
klauss | 74:81c47fff88a5 | 3 | EthernetInterface eth; |
klauss | 74:81c47fff88a5 | 4 | |
klauss | 124:c1b6c893e1c3 | 5 | int __init_eth__ ( void ) |
klauss | 124:c1b6c893e1c3 | 6 | { |
klauss | 124:c1b6c893e1c3 | 7 | static bool initialized = false; |
klauss | 132:05cd37f7e007 | 8 | char buffer_header_ip [ 16 ] = ""; |
klauss | 132:05cd37f7e007 | 9 | char buffer_header_mask [ 16 ] = ""; |
klauss | 132:05cd37f7e007 | 10 | char buffer_header_gateway [ 16 ] = ""; |
klauss | 124:c1b6c893e1c3 | 11 | if( debug_uart3 ) pc.printf("\n\r"); |
klauss | 125:8ff4dc96ad58 | 12 | |
klauss | 132:05cd37f7e007 | 13 | cm -> get_header_ip ( buffer_header_ip ); |
klauss | 132:05cd37f7e007 | 14 | cm -> get_net_mask ( buffer_header_mask ); |
klauss | 132:05cd37f7e007 | 15 | cm -> get_gateway ( buffer_header_gateway ); |
klauss | 124:c1b6c893e1c3 | 16 | |
klauss | 124:c1b6c893e1c3 | 17 | if( !initialized ){ |
klauss | 132:05cd37f7e007 | 18 | eth.init( buffer_header_ip, buffer_header_mask, buffer_header_gateway ); |
klauss | 124:c1b6c893e1c3 | 19 | initialized = true; |
klauss | 124:c1b6c893e1c3 | 20 | return eth.connect(); |
klauss | 124:c1b6c893e1c3 | 21 | } |
klauss | 124:c1b6c893e1c3 | 22 | if( !eth.disconnect() ){ |
klauss | 124:c1b6c893e1c3 | 23 | return eth.connect(); |
klauss | 124:c1b6c893e1c3 | 24 | } |
klauss | 124:c1b6c893e1c3 | 25 | else{ |
klauss | 124:c1b6c893e1c3 | 26 | return eth.connect(); |
klauss | 124:c1b6c893e1c3 | 27 | } |
klauss | 124:c1b6c893e1c3 | 28 | } |
klauss | 124:c1b6c893e1c3 | 29 | |
klauss | 124:c1b6c893e1c3 | 30 | void __reconnect ( void ) |
klauss | 124:c1b6c893e1c3 | 31 | { |
klauss | 124:c1b6c893e1c3 | 32 | eth.disconnect (); |
klauss | 124:c1b6c893e1c3 | 33 | __init_eth__ (); |
klauss | 74:81c47fff88a5 | 34 | } |