d-a-v / W5500lwIP

W5100, W5500 and ENC28J60 for esp8266 and lwIP (or any other uC using lwIP)
43 stars 11 forks source link

How to set static ip? #13

Closed darkautism closed 4 years ago

darkautism commented 4 years ago

I have a W5500 module and i wanna emulate a mini router. But i did not know how to set static ip in w5500. I notice old discussion tells we can eth.config(ip, mask, ip, ip); but with no luck.

src\main.cpp: In function 'void setup()':
src\main.cpp:25:7: error: 'using Wiznet5500lwIP = class LwipEthernet<Wiznet5500>' has no member named 'config'
   eth.config(ip, mask, ip, ip);

It seems only ESP8266WiFiSTAClass class have config method.

I wrote a sample begin but with no luck, what i missed?

    _netif.ip_addr = ip;
    _netif.gw = gw;
    _netif.netmask = mask;
    _netif.hwaddr_len = sizeof _macAddress;
    memcpy(_netif.hwaddr, _macAddress, sizeof _macAddress);
    netif_add(&_netif, ip, mask, gw, this, netif_init_s, ethernet_input);
    netif_set_up(&_netif);

Thanks for the amazing work btw!

d-a-v commented 4 years ago

Did you try to use https://github.com/esp8266/Arduino/pull/6680 instead ?

darkautism commented 4 years ago

It's worked! Thanks you!