fix SPI1 instances (#10983)
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user