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?[]
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).