fix SPI1 instances (#10983)

This commit is contained in:
Manuel
2026-07-10 15:00:32 -05:00
committed by GitHub
co-authored by GitHub
parent 8abae90838
commit f52e2ea8ef
2 changed files with 12 additions and 0 deletions
+8
View File
@@ -196,8 +196,16 @@ void setupNicheGraphics();
#endif
#if defined(HW_SPI1_DEVICE) && defined(ARCH_ESP32)
#if defined(HAS_SDCARD) && defined(SDCARD_USE_SPI1)
// Reuse FSCommon's SPI_HSPI instance to avoid double-initializing SPI2_HOST in arduino-esp32 3.x.
// Two SPIClass(HSPI) objects on the same bus cause the second spi_bus_initialize() to return
// ESP_ERR_INVALID_STATE, leaving the LoRa device handle invalid and blocking SPI transfers.
extern SPIClass SPI_HSPI;
SPIClass &SPI1 = SPI_HSPI;
#else
SPIClass SPI1(HSPI);
#endif
#endif
using namespace concurrency;
+4
View File
@@ -337,8 +337,12 @@ LoRaRadioType radioType = NO_RADIO;
extern RadioLibHal *RadioLibHAL;
#if defined(HW_SPI1_DEVICE) && defined(ARCH_ESP32)
#if defined(HAS_SDCARD) && defined(SDCARD_USE_SPI1)
extern SPIClass &SPI1; // alias for SPI_HSPI; both on SPI2_HOST
#else
extern SPIClass SPI1;
#endif
#endif
std::unique_ptr<RadioInterface> initLoRa()
{