Initial debug component support for rp2040 (#5056)

This commit is contained in:
Jimmy Hedman 2023-07-05 00:28:12 +02:00 committed by GitHub
parent 45c72f1f22
commit fc3d558d47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -38,7 +38,6 @@ CONFIG_SCHEMA = cv.All(
),
}
).extend(cv.polling_component_schema("60s")),
cv.only_on(["esp32", "esp8266"]),
)

View File

@ -22,8 +22,12 @@
#endif // USE_ESP32
#ifdef USE_ARDUINO
#ifdef USE_RP2040
#include <Arduino.h>
#else
#include <Esp.h>
#endif
#endif
namespace esphome {
namespace debug {
@ -35,6 +39,8 @@ static uint32_t get_free_heap() {
return ESP.getFreeHeap(); // NOLINT(readability-static-accessed-through-instance)
#elif defined(USE_ESP32)
return heap_caps_get_free_size(MALLOC_CAP_INTERNAL);
#elif defined(USE_RP2040)
return rp2040.getFreeHeap();
#endif
}
@ -65,7 +71,7 @@ void DebugComponent::dump_config() {
this->free_heap_ = get_free_heap();
ESP_LOGD(TAG, "Free Heap Size: %" PRIu32 " bytes", this->free_heap_);
#ifdef USE_ARDUINO
#if defined(USE_ARDUINO) && !defined(USE_RP2040)
const char *flash_mode;
switch (ESP.getFlashChipMode()) { // NOLINT(readability-static-accessed-through-instance)
case FM_QIO:
@ -274,6 +280,11 @@ void DebugComponent::dump_config() {
reset_reason = ESP.getResetReason().c_str();
#endif
#ifdef USE_RP2040
ESP_LOGD(TAG, "CPU Frequency: %u", rp2040.f_cpu());
device_info += "CPU Frequency: " + to_string(rp2040.f_cpu());
#endif // USE_RP2040
#ifdef USE_TEXT_SENSOR
if (this->device_info_ != nullptr) {
if (device_info.length() > 255)