Skip to content

Commit 792f556

Browse files
authored
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.
1 parent 799225d commit 792f556

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/rp2_common/pico_cyw43_driver/cyw43_bus_pio_spi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,9 @@ void cyw43_spi_gpio_setup(void) {
359359
// Reset wifi chip
360360
void cyw43_spi_reset(void) {
361361
gpio_put(CYW43_PIN_WL_REG_ON, false); // off
362-
sleep_ms(20);
362+
cyw43_delay_ms(20);
363363
gpio_put(CYW43_PIN_WL_REG_ON, true); // on
364-
sleep_ms(250);
364+
cyw43_delay_ms(250);
365365

366366
// Setup IRQ (24) - also used for DO, DI
367367
gpio_init(CYW43_PIN_WL_HOST_WAKE);

0 commit comments

Comments
 (0)