Use cyw43_delay_ms() in cyw43_spi_reset() instead of sleep_ms() (#2431)

Since cyw43_spi_reset() may be executed from an async context, we
should use cyw43_delay_ms() instead of sleep_ms(). This is particularly
a problem when using the async_context_threadsafe_background backend,
because sleep_ms() will assert in an ISR.
This commit is contained in:
Michael Brase 2025-05-08 09:26:08 -06:00 committed by GitHub
parent 799225d550
commit 792f55628e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -359,9 +359,9 @@ void cyw43_spi_gpio_setup(void) {
// Reset wifi chip
void cyw43_spi_reset(void) {
gpio_put(CYW43_PIN_WL_REG_ON, false); // off
sleep_ms(20);
cyw43_delay_ms(20);
gpio_put(CYW43_PIN_WL_REG_ON, true); // on
sleep_ms(250);
cyw43_delay_ms(250);
// Setup IRQ (24) - also used for DO, DI
gpio_init(CYW43_PIN_WL_HOST_WAKE);