stm32: Support optional lwIP mDNS responder.

This commit is contained in:
Damien George 2019-06-05 16:14:09 +10:00
parent 49388e339e
commit 9e4b3681fd
2 changed files with 12 additions and 0 deletions

View File

@ -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

View File

@ -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;
}
}