Browse Source

stm32: Support optional lwIP mDNS responder.

pull/4838/head
Damien George 6 years ago
parent
commit
9e4b3681fd
  1. 4
      ports/stm32/main.c
  2. 8
      ports/stm32/modnetwork.c

4
ports/stm32/main.c

@ -39,6 +39,7 @@
#if MICROPY_PY_LWIP
#include "lwip/init.h"
#include "lwip/apps/mdns.h"
#include "drivers/cyw43/cyw43.h"
#endif
@ -479,6 +480,9 @@ void stm32_main(uint32_t reset_mode) {
// because the system timeout list (next_timeout) is only ever reset by BSS clearing.
// So for now we only init the lwIP stack once on power-up.
lwip_init();
#if LWIP_MDNS_RESPONDER
mdns_resp_init();
#endif
systick_enable_dispatch(SYSTICK_DISPATCH_LWIP, mod_network_lwip_poll_wrapper);
#endif

8
ports/stm32/modnetwork.c

@ -44,6 +44,7 @@
#include "lwip/timeouts.h"
#include "lwip/dns.h"
#include "lwip/dhcp.h"
#include "lwip/apps/mdns.h"
#include "extmod/network_cyw43.h"
#include "drivers/cyw43/cyw43.h"
@ -188,6 +189,10 @@ mp_obj_t mod_network_nic_ifconfig(struct netif *netif, size_t n_args, const mp_o
mp_hal_delay_ms(100);
}
#if LWIP_MDNS_RESPONDER
mdns_resp_netif_settings_changed(netif);
#endif
return mp_const_none;
} else {
// Release and stop any existing DHCP
@ -202,6 +207,9 @@ mp_obj_t mod_network_nic_ifconfig(struct netif *netif, size_t n_args, const mp_o
ip_addr_t dns;
netutils_parse_ipv4_addr(items[3], (uint8_t*)&dns, NETUTILS_BIG);
dns_setserver(0, &dns);
#if LWIP_MDNS_RESPONDER
mdns_resp_netif_settings_changed(netif);
#endif
return mp_const_none;
}
}

Loading…
Cancel
Save