picow: Implement stop_station

Weirdly we have to stop the AP too (which we never started),
or cyw43_tcpip_link_status still reports that STA is connected.
As long as AP mode isn't implemented, this doesn't matter and
we can just do it.
This commit is contained in:
Jeff Epler 2022-10-17 19:14:20 -05:00
parent 508c80da8d
commit 3b7feccd9b
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE

View File

@ -158,6 +158,13 @@ void common_hal_wifi_radio_start_station(wifi_radio_obj_t *self) {
}
void common_hal_wifi_radio_stop_station(wifi_radio_obj_t *self) {
cyw43_wifi_leave(&cyw43_state, CYW43_ITF_STA);
// This is wrong, but without this call the state of ITF_STA is still
// reported as CYW43_LINK_JOIN (by wifi_link_status) and CYW43_LINK_UP
// (by tcpip_link_status). Until AP support is added, we can ignore the
// problem.
cyw43_wifi_leave(&cyw43_state, CYW43_ITF_AP);
bindings_cyw43_wifi_enforce_pm();
}
void common_hal_wifi_radio_start_ap(wifi_radio_obj_t *self, uint8_t *ssid, size_t ssid_len, uint8_t *password, size_t password_len, uint8_t channel, uint8_t authmode, uint8_t max_connections) {