Merge pull request #7088 from jepler/picow-static-ip

pico w: implement static configuration methods in wifi.Radio
This commit is contained in:
Dan Halbert 2022-10-19 22:41:31 -04:00 committed by GitHub
commit 4e007328e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -268,19 +268,30 @@ mp_obj_t common_hal_wifi_radio_get_ipv4_dns(wifi_radio_obj_t *self) {
}
void common_hal_wifi_radio_set_ipv4_dns(wifi_radio_obj_t *self, mp_obj_t ipv4_dns_addr) {
mp_raise_NotImplementedError(NULL);
ip4_addr_t addr;
ipaddress_ipaddress_to_lwip(ipv4_dns_addr, &addr);
dns_setserver(0, &addr);
}
void common_hal_wifi_radio_start_dhcp_client(wifi_radio_obj_t *self) {
mp_raise_NotImplementedError(NULL);
dhcp_start(NETIF_STA);
}
void common_hal_wifi_radio_stop_dhcp_client(wifi_radio_obj_t *self) {
mp_raise_NotImplementedError(NULL);
dhcp_stop(NETIF_STA);
}
void common_hal_wifi_radio_set_ipv4_address(wifi_radio_obj_t *self, mp_obj_t ipv4, mp_obj_t netmask, mp_obj_t gateway, mp_obj_t ipv4_dns) {
mp_raise_NotImplementedError(NULL);
common_hal_wifi_radio_stop_dhcp_client(self);
ip4_addr_t ipv4_addr, netmask_addr, gateway_addr;
ipaddress_ipaddress_to_lwip(ipv4, &ipv4_addr);
ipaddress_ipaddress_to_lwip(netmask, &netmask_addr);
ipaddress_ipaddress_to_lwip(gateway, &gateway_addr);
netif_set_addr(NETIF_STA, &ipv4_addr, &netmask_addr, &gateway_addr);
if (ipv4_dns != MP_OBJ_NULL) {
common_hal_wifi_radio_set_ipv4_dns(self, ipv4_dns);
}
}
volatile bool ping_received;