Enables PSRAM

Supports #1983
Supports #1946
Supports #1815

Could support esphome/feature-requests#2369
This commit is contained in:
Edward Firmo
2024-04-05 00:54:51 +02:00
parent 0e6853f3bf
commit 140cbdd409
3 changed files with 47 additions and 23 deletions

View File

@@ -1,7 +1,8 @@
# __init__.py
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.core import coroutine_with_priority
from esphome.components.esp32 import add_idf_sdkconfig_option, get_esp32_variant
from esphome.core import CORE, coroutine_with_priority
CODEOWNERS = ["@edwardtfn"]
@@ -14,5 +15,17 @@ CONFIG_SCHEMA = cv.All(
@coroutine_with_priority(1.0)
async def to_code(config):
if CORE.using_arduino:
cg.add_build_flag("-DCONFIG_D0WD_PSRAM_CLK_IO=5")
cg.add_build_flag("-DCONFIG_D0WD_PSRAM_CS_IO=18")
if CORE.using_esp_idf:
add_idf_sdkconfig_option("CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST", True)
add_idf_sdkconfig_option("CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY", True)
add_idf_sdkconfig_option("CONFIG_ESP32_REV_MIN_3", True)
add_idf_sdkconfig_option("CONFIG_D0WD_PSRAM_CLK_IO", 5)
add_idf_sdkconfig_option("CONFIG_D0WD_PSRAM_CS_IO", 18)
cg.add_define("USE_NSPANEL_HA_BLUEPRINT")
cg.add_global(nspanel_ha_blueprint_ns.using)