Modularizando o src

Dependencies:   EALib EthernetInterface_vz mbed-rtos mbed

Fork of header_main_colinas_V0-20-09-14 by VZTECH

eth.cpp

Committer:
klauss
Date:
2015-11-24
Revision:
137:32dd35a6dbc9
Parent:
132:05cd37f7e007

File content as of revision 137:32dd35a6dbc9:

#include "eth.h"

EthernetInterface eth;

int __init_eth__ ( void )
{    
    static bool initialized = false;
    char buffer_header_ip [ 16 ] = "";
    char buffer_header_mask [ 16 ] = "";
    char buffer_header_gateway [ 16 ] = "";
    if( debug_uart3 ) pc.printf("\n\r");
    
    cm -> get_header_ip ( buffer_header_ip ); 
    cm -> get_net_mask ( buffer_header_mask );
    cm -> get_gateway ( buffer_header_gateway );
    
    if( !initialized ){
        eth.init( buffer_header_ip, buffer_header_mask, buffer_header_gateway );
        initialized = true;
        return eth.connect();
    }
    if( !eth.disconnect() ){
        return eth.connect();
    }
    else{
        return eth.connect();
    }
}

void __reconnect ( void )
{
    eth.disconnect ();
    __init_eth__ ();
}