7 #include <esp_heap_caps.h> 8 #include <esp_idf_version.h> 13 static const char *
const TAG =
"psram";
15 void PsramComponent::dump_config() {
18 bool available = heap_caps_get_free_size(MALLOC_CAP_SPIRAM) > 0;
20 ESP_LOGCONFIG(TAG,
"PSRAM:");
21 ESP_LOGCONFIG(TAG,
" Available: %s", YESNO(available));
22 #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 1, 0) 24 const size_t psram_total_size_bytes = heap_caps_get_total_size(MALLOC_CAP_SPIRAM);
25 const float psram_total_size_kb = psram_total_size_bytes / 1024.0f;
27 if (abs(std::round(psram_total_size_kb) - psram_total_size_kb) < 0.05f) {
28 ESP_LOGCONFIG(TAG,
" Size: %.0f KB", psram_total_size_kb);
30 ESP_LOGCONFIG(TAG,
" Size: %zu bytes", psram_total_size_bytes);
Implementation of SPI Controller mode.