FANDOM


If you plan on using the tcpip thread, then the following is an example initialization sequence for lwIP:

#include "lwip/tcpip.h"  
   
 struct netif my_netif;  
   
 err_t my_ip_init(struct ip_addr *ipaddr,  
                  struct ip_addr *netmask,  
                  struct ip_addr *gw,  
                  err_t (* init)(struct netif *netif),  
                  err_t (* input)(struct pbuf *p, struct netif *netif)) {  
     
    // Start the TCP/IP thread & init stuff  
    tcpip_init(NULL, NULL);  
    // WARNING: This must only be run after the OS has been started.  
    // Typically this is the case, however, if not, you must place this  
    // in a post-OS initialization  
    return netifapi_netif_add(&my_netif, ipaddr, netmask, gw, NULL, init, input);  
}

Not using a static IP? Edit

This example assumes static IP, but the final netif_set_up could be replace by dhcp_start or autoip_start (see Network interfaces management for more information).

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.