diff --git a/components/driver/periph_ctrl.c b/components/driver/periph_ctrl.c index 5f30c148e7..a5802f36a1 100644 --- a/components/driver/periph_ctrl.c +++ b/components/driver/periph_ctrl.c @@ -65,11 +65,15 @@ IRAM_ATTR void wifi_bt_common_module_disable(void) void wifi_module_enable(void) { + portENTER_CRITICAL_SAFE(&periph_spinlock); periph_ll_wifi_module_enable_clk_clear_rst(); + portEXIT_CRITICAL_SAFE(&periph_spinlock); } void wifi_module_disable(void) { + portENTER_CRITICAL_SAFE(&periph_spinlock); periph_ll_wifi_module_disable_clk_set_rst(); + portEXIT_CRITICAL_SAFE(&periph_spinlock); } #endif // CONFIG_ESP32_WIFI_ENABLED