allow LoRa on SPI/HSPI (elecrow)

This commit is contained in:
mverch67 2025-03-26 22:47:02 +01:00 committed by Thomas Göttgens
parent 8f20bb19ba
commit dce1c78a66
2 changed files with 13 additions and 3 deletions

View File

@ -17,8 +17,8 @@
#include <SPI.h> #include <SPI.h>
#ifdef SDCARD_USE_SPI1 #ifdef SDCARD_USE_SPI1
SPIClass SPI1(HSPI); SPIClass SPI_HSPI(HSPI);
#define SDHandler SPI1 #define SDHandler SPI_HSPI
#else #else
#define SDHandler SPI #define SDHandler SPI
#endif #endif

View File

@ -137,6 +137,10 @@ void setupNicheGraphics();
#include "nicheGraphics.h" #include "nicheGraphics.h"
#endif #endif
#if defined(HW_SPI1_DEVICE) && defined(ELECROW)
SPIClass SPI1(HSPI);
#endif
using namespace concurrency; using namespace concurrency;
volatile static const char slipstreamTZString[] = {USERPREFS_TZ_STRING}; volatile static const char slipstreamTZString[] = {USERPREFS_TZ_STRING};
@ -789,10 +793,16 @@ void setup()
#elif !defined(ARCH_ESP32) // ARCH_RP2040 #elif !defined(ARCH_ESP32) // ARCH_RP2040
SPI.begin(); SPI.begin();
#else #else
// ESP32 // ESP32
#if defined(HW_SPI1_DEVICE) && defined(ELECROW)
SPI1.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS);
LOG_DEBUG("SPI1.begin(SCK=%d, MISO=%d, MOSI=%d, NSS=%d)", LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS);
SPI1.setFrequency(4000000);
#else
SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS); SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS);
LOG_DEBUG("SPI.begin(SCK=%d, MISO=%d, MOSI=%d, NSS=%d)", LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS); LOG_DEBUG("SPI.begin(SCK=%d, MISO=%d, MOSI=%d, NSS=%d)", LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS);
SPI.setFrequency(4000000); SPI.setFrequency(4000000);
#endif
#endif #endif
// Initialize the screen first so we can show the logo while we start up everything else. // Initialize the screen first so we can show the logo while we start up everything else.