Commit 52a78e69 authored by Damien George's avatar Damien George
Browse files

drivers/cyw43: Fix cyw43_deinit so it can be called many times in a row.



This makes sure deinit() can be called on the interface many times without
error, and that the state of the driver is fully reset.

Fixes issue #7493.
Signed-off-by: default avatarDamien George <damien@micropython.org>
parent 6f19b9c0
......@@ -102,28 +102,25 @@ void cyw43_init(cyw43_t *self) {
}
void cyw43_deinit(cyw43_t *self) {
if (cyw43_poll == NULL) {
return;
}
CYW_ENTER
cyw43_ll_bus_sleep(&self->cyw43_ll, true);
cyw43_delay_ms(2);
// Stop the TCP/IP network interfaces.
cyw43_tcpip_deinit(self, 0);
cyw43_tcpip_deinit(self, 1);
self->itf_state = 0;
// Disable async polling
// Turn off the SDIO bus.
#if USE_SDIOIT
sdio_enable_irq(false);
cyw43_poll = NULL;
#ifdef pyb_pin_WL_RFSW_VDD
// Turn the RF-switch off
mp_hal_pin_low(pyb_pin_WL_RFSW_VDD);
#endif
// Power down the WL chip and the SDIO bus
mp_hal_pin_low(pyb_pin_WL_REG_ON);
sdio_deinit();
// Power off the WLAN chip and make sure all state is reset.
cyw43_init(self);
CYW_EXIT
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment