Skip to content

Commit 8196366

Browse files
committed
initial
1 parent 827eaeb commit 8196366

File tree

1 file changed

+11
-3
lines changed
  • ports/raspberrypi/common-hal/wifi

1 file changed

+11
-3
lines changed

ports/raspberrypi/common-hal/wifi/Radio.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,11 +359,11 @@ void common_hal_wifi_radio_stop_dhcp_client(wifi_radio_obj_t *self) {
359359
}
360360

361361
void common_hal_wifi_radio_start_dhcp_server(wifi_radio_obj_t *self) {
362-
mp_raise_NotImplementedError(NULL);
362+
dhcp_stop(NETIF_AP);
363363
}
364364

365365
void common_hal_wifi_radio_stop_dhcp_server(wifi_radio_obj_t *self) {
366-
mp_raise_NotImplementedError(NULL);
366+
dhcp_stop(NETIF_AP);
367367
}
368368

369369
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) {
@@ -380,7 +380,15 @@ void common_hal_wifi_radio_set_ipv4_address(wifi_radio_obj_t *self, mp_obj_t ipv
380380
}
381381

382382
void common_hal_wifi_radio_set_ipv4_address_ap(wifi_radio_obj_t *self, mp_obj_t ipv4, mp_obj_t netmask, mp_obj_t gateway) {
383-
mp_raise_NotImplementedError(NULL);
383+
common_hal_wifi_radio_stop_dhcp_server(self);
384+
385+
ip4_addr_t ipv4_addr, netmask_addr, gateway_addr;
386+
ipaddress_ipaddress_to_lwip(ipv4, &ipv4_addr);
387+
ipaddress_ipaddress_to_lwip(netmask, &netmask_addr);
388+
ipaddress_ipaddress_to_lwip(gateway, &gateway_addr);
389+
netif_set_addr(NETIF_AP, &ipv4_addr, &netmask_addr, &gateway_addr);
390+
391+
common_hal_wifi_radio_start_dhcp_server(self);
384392
}
385393

386394
volatile bool ping_received;

0 commit comments

Comments
 (0)